Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add more element valence #169

Merged
merged 7 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions propka/energy.py
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,12 @@ def check_coo_arg_exception(group_coo, group_arg, version):
[closest_coo_atom, dist, closest_arg_atom] = get_smallest_distance(
atoms_coo, atoms_arg
)
if closest_coo_atom is None:
_LOGGER.warning(f"COO interaction atoms missing for {group_coo}")
continue
if closest_arg_atom is None:
_LOGGER.warning(f"ARG interaction atoms missing for {group_arg}")
continue
speleo3 marked this conversation as resolved.
Show resolved Hide resolved
[dpka_max, cutoff] = version.get_hydrogen_bond_parameters(
closest_coo_atom, closest_arg_atom
)
Expand Down
32 changes: 26 additions & 6 deletions propka/protonate.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,24 @@ def __init__(self, verbose=False):
"""
self.verbose = verbose
self.valence_electrons = {
'H': 1, 'He': 2, 'Li': 1, 'Be': 2, 'B': 3, 'C': 4, 'N': 5,
'O': 6, 'F': 7, 'Ne': 8, 'Na': 1, 'Mg': 2, 'Al': 3, 'Si': 4,
'P': 5, 'S': 6, 'Cl': 7, 'Ar': 8, 'K': 1, 'Ca': 2, 'Sc': 2,
'Ti': 2, 'V': 2, 'Cr': 1, 'Mn': 2, 'Fe': 2, 'Co': 2, 'Ni': 2,
'Cu': 1, 'Zn': 2, 'Ga': 3, 'Ge': 4, 'As': 5, 'Se': 6, 'Br': 7,
'Kr': 8, 'I': 7}
"H": 1, "He": 2, "Li": 1, "Be": 2, "B": 3, "C": 4, "N": 5,
"O": 6, "F": 7, "Ne": 8, "Na": 1, "Mg": 2, "Al": 3, "Si": 4,
"P": 5, "S": 6, "Cl": 7, "Ar": 8, "K": 1, "Ca": 2, "Sc": 2,
"Ti": 2, "V": 2, "Cr": 1, "Mn": 2, "Fe": 2, "Co": 2, "Ni": 2,
"Cu": 1, "Zn": 2, "Ga": 3, "Ge": 4, "As": 5, "Se": 6, "Br": 7,
"Kr": 8, "Rb": 1, "Sr": 2, "Y": 2, "Zr": 2, "Nb": 1, "Mo": 1,
"Tc": 2, "Ru": 1, "Rh": 1, "Pd": 8, "Ag": 1, "Cd": 2, "In": 3,
"Sn": 4, "Sb": 5, "Te": 6, "I": 7, "Xe": 8, "Cs": 1, "Ba": 2,
"La": 2, "Ce": 2, "Pr": 2, "Nd": 2, "Pm": 2, "Sm": 2, "Eu": 2,
"Gd": 2, "Tb": 2, "Dy": 2, "Ho": 2, "Er": 2, "Tm": 2, "Yb": 2,
"Lu": 2, "Hf": 2, "Ta": 2, "W": 2, "Re": 2, "Os": 2, "Ir": 2,
"Pt": 1, "Au": 1, "Hg": 2, "Tl": 3, "Pb": 4, "Bi": 5, "Po": 6,
"At": 7, "Rn": 8, "Fr": 1, "Ra": 2, "Ac": 2, "Th": 2, "Pa": 2,
"U": 2, "Np": 2, "Pu": 2, "Am": 2, "Cm": 2, "Bk": 2, "Cf": 2,
"Es": 2, "Fm": 2, "Md": 2, "No": 2, "Lr": 3, "Rf": 2, "Db": 2,
"Sg": 2, "Bh": 2, "Hs": 2, "Mt": 2, "Ds": 2, "Rg": 2, "Cn": 2,
"Nh": 3, "Fl": 4, "Mc": 5, "Lv": 6, "Ts": 7, "Og": 8, "Uue": 1
}
# TODO - consider putting charges in a configuration file
self.standard_charges = {
'ARG-NH1': 1.0, 'ASP-OD2': -1.0, 'GLU-OE2': -1.0, 'HIS-ND1': 1.0,
Expand Down Expand Up @@ -137,6 +149,10 @@ def set_number_of_protons_to_add(self, atom):
_LOGGER.debug('Setting number of protons to add for %s', atom)
atom.number_of_protons_to_add = 8
_LOGGER.debug(" 8")
if atom.element not in self.valence_electrons:
_LOGGER.warning(f'Unknown valence electron \
for element {atom.element}')
speleo3 marked this conversation as resolved.
Show resolved Hide resolved
self.valence_electrons[atom.element] = 4
speleo3 marked this conversation as resolved.
Show resolved Hide resolved
atom.number_of_protons_to_add -= self.valence_electrons[atom.element]
_LOGGER.debug('Valence electrons: {0:>4d}'.format(
-self.valence_electrons[atom.element]))
Expand Down Expand Up @@ -165,6 +181,10 @@ def set_steric_number_and_lone_pairs(self, atom):
_LOGGER.debug('='*10)
_LOGGER.debug('Setting steric number and lone pairs for %s', atom)
atom.steric_number = 0
if atom.element not in self.valence_electrons:
self.valence_electrons[atom.element] = 4
speleo3 marked this conversation as resolved.
Show resolved Hide resolved
_LOGGER.warning(f"Not found valence for \
element {atom.element}, use 4")
_LOGGER.debug('{0:>65s}: {1:>4d}'.format(
'Valence electrons', self.valence_electrons[atom.element]))
atom.steric_number += self.valence_electrons[atom.element]
Expand Down
Loading