Skip to content
Merged
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
16 changes: 16 additions & 0 deletions src/somd2/runner/_repex.py
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,22 @@ def _create_dynamics(
):
from openmm.unit import angstrom

# Get the positions from the context.
positions = (
dynamics.context()
.getState(getPositions=True)
.getPositions(asNumpy=True)
) / angstrom

# The positions array also contains the ghost water atoms that
# were added during the GCMC setup. We need to make sure that
# we copy these over to the perturbed positions array.
diff = len(positions) - len(perturbed_positions)
if diff != 0:
perturbed_positions = _np.concatenate(
[perturbed_positions, positions[-diff:]]
)

dynamics.context().setPeriodicBoxVectors(*perturbed_box * angstrom)
dynamics.context().setPositions(perturbed_positions * angstrom)

Expand Down