diff --git a/vermouth/processors/annotate_mut_mod.py b/vermouth/processors/annotate_mut_mod.py index a5a83442..5ee17d73 100644 --- a/vermouth/processors/annotate_mut_mod.py +++ b/vermouth/processors/annotate_mut_mod.py @@ -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 {}' @@ -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): """