Unverified Commit 7c2e5991 authored by Jacob Monroe's avatar Jacob Monroe Committed by GitHub
Browse files

Moved _syncWithDisk in init before adding table of biases to CustomCVForce so...

Moved _syncWithDisk in init before adding table of biases to CustomCVForce so that loaded biases are included in the biasing potential. (#3052)
parent 1e42b8be
...@@ -123,6 +123,7 @@ class Metadynamics(object): ...@@ -123,6 +123,7 @@ class Metadynamics(object):
self._selfBias = np.zeros(tuple(v.gridWidth for v in reversed(variables))) self._selfBias = np.zeros(tuple(v.gridWidth for v in reversed(variables)))
self._totalBias = np.zeros(tuple(v.gridWidth for v in reversed(variables))) self._totalBias = np.zeros(tuple(v.gridWidth for v in reversed(variables)))
self._loadedBiases = {} self._loadedBiases = {}
self._syncWithDisk()
self._deltaT = temperature*(biasFactor-1) self._deltaT = temperature*(biasFactor-1)
varNames = ['cv%d' % i for i in range(len(variables))] varNames = ['cv%d' % i for i in range(len(variables))]
self._force = mm.CustomCVForce('table(%s)' % ', '.join(varNames)) self._force = mm.CustomCVForce('table(%s)' % ', '.join(varNames))
...@@ -146,7 +147,6 @@ class Metadynamics(object): ...@@ -146,7 +147,6 @@ class Metadynamics(object):
freeGroups = set(range(32)) - set(force.getForceGroup() for force in system.getForces()) freeGroups = set(range(32)) - set(force.getForceGroup() for force in system.getForces())
self._force.setForceGroup(max(freeGroups)) self._force.setForceGroup(max(freeGroups))
system.addForce(self._force) system.addForce(self._force)
self._syncWithDisk()
def step(self, simulation, steps): def step(self, simulation, steps):
"""Advance the simulation by integrating a specified number of time steps. """Advance the simulation by integrating a specified number of time steps.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment