From 9b50b82fd78716ba9df4da838061f514293a102b Mon Sep 17 00:00:00 2001 From: Chris Brasnett <35073246+csbrasnett@users.noreply.github.com> Date: Mon, 24 Feb 2025 09:11:33 +0000 Subject: [PATCH 1/3] correct atomlist selection in apply_modifications.py --- polyply/src/apply_modifications.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/polyply/src/apply_modifications.py b/polyply/src/apply_modifications.py index 3d460137..f2eadd4a 100644 --- a/polyply/src/apply_modifications.py +++ b/polyply/src/apply_modifications.py @@ -99,8 +99,7 @@ def apply_mod(meta_molecule, modifications): for i in mod_interactions: for j in molecule.force_field.modifications[desired_mod].interactions[i]: molecule.add_interaction(i, - (anum_dict[j.atoms[0]]-1, - anum_dict[j.atoms[1]]-1), + [anum_dict[k]-1 for k in j.atoms], j.parameters, meta=j.meta) From 05288c5391e454d42c98dff8fea1ffecb3f9ef60 Mon Sep 17 00:00:00 2001 From: Chris Brasnett <35073246+csbrasnett@users.noreply.github.com> Date: Wed, 26 Feb 2025 17:14:43 +0000 Subject: [PATCH 2/3] move resname in gen_templates so can find it --- polyply/src/generate_templates.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/polyply/src/generate_templates.py b/polyply/src/generate_templates.py index 5bd1d69f..fc31b809 100644 --- a/polyply/src/generate_templates.py +++ b/polyply/src/generate_templates.py @@ -109,7 +109,7 @@ def find_interaction_involving(block, current_node, prev_node): linking atom {} and atom {}.''' raise IOError(msg.format(block.nodes[0]["resname"], prev_node, current_node)) -def _expand_inital_coords(block, max_count=50000): +def _expand_inital_coords(block, max_count=1000): """ Given a `graph` generate initial coordinates in three dimensions using the Kamada-Kawai algorithm. @@ -343,6 +343,7 @@ class variable. self.topology.defines) opt_counter = 0 + resname = block.nodes[list(block.nodes)[0]]['resname'] while True: coords = _expand_inital_coords(block) @@ -363,7 +364,6 @@ class variable. break else: opt_counter += 1 - resname = block.nodes[list(block.nodes)[0]]['resname'] if resname in self.volumes: self.volumes[graph_hash] = self.volumes[resname] else: From bd8d67f37aabf79b4569c7b4372a1daf549be2cd Mon Sep 17 00:00:00 2001 From: Chris Brasnett <35073246+csbrasnett@users.noreply.github.com> Date: Thu, 27 Feb 2025 10:03:08 +0000 Subject: [PATCH 3/3] fix resspec parsing so that default protein ones are overwritten if others are given --- polyply/src/apply_modifications.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/polyply/src/apply_modifications.py b/polyply/src/apply_modifications.py index cc723bc4..042ad6f0 100644 --- a/polyply/src/apply_modifications.py +++ b/polyply/src/apply_modifications.py @@ -113,8 +113,13 @@ class ApplyModifications(Processor): """ def __init__(self, meta_molecule, modifications=[]): self.target_mods = _patch_protein_termini(meta_molecule) + default_resspecs = [i[0] for i in self.target_mods] for resspec, val in modifications: - self.target_mods.append((parse_residue_spec(resspec), val)) + parsed_resspec = parse_residue_spec(resspec) + # if the residue being targeted in the additional resspec is already there, remove the first instance + if parsed_resspec in default_resspecs: + del self.target_mods[default_resspecs==parsed_resspec] + self.target_mods.append((parsed_resspec, val)) def run_molecule(self, meta_molecule): apply_mod(meta_molecule, self.target_mods)