Skip to content

Commit

Permalink
add warning when mod not found
Browse files Browse the repository at this point in the history
  • Loading branch information
csbrasnett committed Oct 20, 2023
1 parent 0459973 commit 1ff951d
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions vermouth/processors/annotate_mut_mod.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,10 +210,12 @@ def annotate_modifications(molecule, modifications, mutations):
(mutations, 'mutation', molecule.force_field.blocks)]

residue_graph = make_residue_graph(molecule)
for res_idx in residue_graph:
for mutmod, key, library in associations:
for resspec, mod in mutmod:
for mutmod, key, library in associations:
for resspec, mod in mutmod:
mod_found = False
for res_idx in residue_graph:
if residue_matches(resspec, residue_graph, res_idx):
mod_found = True
if mod != 'none' and mod not in library:
raise NameError('{} is not known as a {} for '
'force field {}'
Expand All @@ -223,7 +225,11 @@ def annotate_modifications(molecule, modifications, mutations):
_format_resname(res), key, mod)
for node_idx in res['graph']:
molecule.nodes[node_idx][key] = molecule.nodes[node_idx].get(key, []) + [mod]

if mod_found == False:
LOGGER.warning('{} with resid {} not found. '
'No modification made.'
''.format(resspec['resname'], resspec['resid']))


class AnnotateMutMod(Processor):
"""
Expand Down

0 comments on commit 1ff951d

Please sign in to comment.