Skip to content

Commit

Permalink
Merge pull request #121 from nlesc-nano/solv
Browse files Browse the repository at this point in the history
MAINT: Skip the pKa computation instead of raising for non-negative systems
  • Loading branch information
BvB93 authored Mar 11, 2022
2 parents 488b608 + a0621e8 commit 69c0149
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions nanoCAT/ligand_solvation.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
"""

from __future__ import annotations

import os
import math
import logging
Expand Down Expand Up @@ -130,7 +132,10 @@ def start_crs_jobs(mol_list: Iterable[Molecule],
# Calculate the COSMO surface
mol_conj = _protonate_mol(mol)
coskf = get_surface_charge(mol, job=j1, s=s1)
coskf_conj = get_surface_charge(mol_conj, job=j1, s=s1)
if mol_conj is not None:
coskf_conj = get_surface_charge(mol_conj, job=j1, s=s1)
else:
coskf_conj = None

# Perform the actual COSMO-RS calculation
lst = get_solv(mol, solvent_list, coskf, job=j2, s=s2)
Expand Down Expand Up @@ -174,13 +179,13 @@ def get_solvent_list(solvent_list: Optional[Sequence[str]] = None) -> Sequence[s
return solvent_list


def _protonate_mol(mol: Molecule) -> Molecule:
def _protonate_mol(mol: Molecule) -> Molecule | None:
mol_cp = mol.copy()

i = mol.index(mol.properties.dummies)
anchor = mol_cp[i]
if anchor.properties.charge != -1:
raise NotImplementedError("Non-anionic anchors are not supported")
return None

anchor.properties.charge = 0
return add_Hs(mol_cp, forcefield="uff")
Expand Down

0 comments on commit 69c0149

Please sign in to comment.