Skip to content

Commit

Permalink
Merge pull request #236 from jthorton/coords_fix
Browse files Browse the repository at this point in the history
Fixes #235
  • Loading branch information
j-wags committed Sep 17, 2021
2 parents 128d5bd + 64b9959 commit 0d63ac5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
7 changes: 5 additions & 2 deletions src/openmmio.py
Original file line number Diff line number Diff line change
Expand Up @@ -1288,12 +1288,15 @@ def normal_modes(self, shot=0, optimize=True, for_hessian_target=False):

def _update_positions(self, X1, disable_vsite):
"""A convenience method for updating the positions of the simulation context."""
# check if we have units
if isinstance(X1, numpy.ndarray):
X1 = X1 * angstrom

if disable_vsite:
self.simulation.context.setPositions(X1 * angstrom)
self.simulation.context.setPositions(X1)
else:
# Create virtual sites before setting positions
mod = Modeller(self.pdb.topology, X1*angstrom)
mod = Modeller(self.pdb.topology, X1)
mod.addExtraParticles(self.forcefield)
self.simulation.context.setPositions(ResetVirtualSites_fast(mod.getPositions(), self.vsinfo))

Expand Down
2 changes: 1 addition & 1 deletion src/smirnoffio.py
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ def _update_positions(self, X1, disable_vsite):
else:
X1 = (X1 + [Vec3(0.0, 0.0, 0.0)] * n_v_sites) * angstrom

self.simulation.context.setPositions(X1 * angstrom)
self.simulation.context.setPositions(X1)
self.simulation.context.computeVirtualSites()

def interaction_energy(self, fraga, fragb):
Expand Down

0 comments on commit 0d63ac5

Please sign in to comment.