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

correct atomlist selection in apply_modifications.py #400

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
10 changes: 7 additions & 3 deletions polyply/src/apply_modifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,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)

Expand All @@ -114,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)
Expand Down
4 changes: 2 additions & 2 deletions polyply/src/generate_templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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)
Expand All @@ -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:
Expand Down
Loading