Skip to content
Merged
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
15 changes: 15 additions & 0 deletions src/somd2/config/_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def __init__(
opencl_platform_index=0,
oversubscription_factor=1,
replica_exchange=False,
randomise_velocities=False,
perturbed_system=None,
gcmc=False,
gcmc_frequency=None,
Expand Down Expand Up @@ -363,6 +364,9 @@ def __init__(
Whether to run replica exchange simulation. Currently this can only be used when
GPU resources are available.

randomise_velocities: bool
Whether to randomise velocities at the start of each replica exchange cycle.

perturbed_system: str
The path to a stream file containing a Sire system for the equilibrated perturbed
end state (lambda = 1). This will be used as the starting conformation all lambda
Expand Down Expand Up @@ -539,6 +543,7 @@ def __init__(
self.opencl_platform_index = opencl_platform_index
self.oversubscription_factor = oversubscription_factor
self.replica_exchange = replica_exchange
self.randomise_velocities = randomise_velocities
self.perturbed_system = perturbed_system
self.gcmc = gcmc
self.gcmc_frequency = gcmc_frequency
Expand Down Expand Up @@ -1645,6 +1650,16 @@ def replica_exchange(self, replica_exchange):
raise ValueError("'replica_exchange' must be of type 'bool'")
self._replica_exchange = replica_exchange

@property
def randomise_velocities(self):
return self._randomise_velocities

@randomise_velocities.setter
def randomise_velocities(self, randomise_velocities):
if not isinstance(randomise_velocities, bool):
raise ValueError("'randomise_velocities' must be of type 'bool'")
self._randomise_velocities = randomise_velocities

@property
def perturbed_system(self):
return self._perturbed_system
Expand Down
3 changes: 2 additions & 1 deletion src/somd2/runner/_repex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1240,7 +1240,8 @@ def _run_block(
_logger.info(f"Running dynamics at {_lam_sym} = {lam:.5f}")

# Draw new velocities from the Maxwell-Boltzmann distribution.
dynamics.randomise_velocities()
if self._config.randomise_velocities:
dynamics.randomise_velocities()

# Run the dynamics.
dynamics.run(
Expand Down
Loading