Skip to content

Commit ac0323f

Browse files
Disable the barostat during FIRE minimization (#773)
* Disable the barostat during FIRE minimization * Disable pressure instead of barostat frequency * Update openmmtools/integrators.py Co-authored-by: Mike Henry <11765982+mikemhenry@users.noreply.github.com> --------- Co-authored-by: Mike Henry <11765982+mikemhenry@users.noreply.github.com>
1 parent 5cdd135 commit ac0323f

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

openmmtools/multistate/multistatesampler.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,12 @@ def _minimize_replica(self, replica_id, tolerance, max_iterations):
13601360
# Retrieve thermodynamic and sampler states.
13611361
thermodynamic_state_id = self._replica_thermodynamic_states[replica_id]
13621362
thermodynamic_state = self._thermodynamic_states[thermodynamic_state_id]
1363+
1364+
# Temporarily disable the barostat during minimization.
1365+
# Otherwise, the minimizer will modify the box
1366+
# vectors and may cause instabilities.
1367+
pressure = thermodynamic_state.pressure
1368+
thermodynamic_state.pressure = None
13631369
sampler_state = self._sampler_states[replica_id]
13641370

13651371
# Use the FIRE minimizer
@@ -1397,6 +1403,9 @@ def _minimize_replica(self, replica_id, tolerance, max_iterations):
13971403

13981404
# Get the minimized positions.
13991405
sampler_state.update_from_context(context)
1406+
1407+
# Restore the barostat
1408+
thermodynamic_state.pressure = pressure
14001409

14011410
# Compute the final energy of the system for logging.
14021411
final_energy = thermodynamic_state.reduced_potential(sampler_state)

0 commit comments

Comments
 (0)