AmberFDSimulation
- class AmberFD.AmberFD.AmberFDSimulation(topology, system, integrator, platform=None, platformProperties=None, state=None, FDProperties=None)
This is a subsitute to openmm.simulation objects and enables the use of AmberFD polarization.
To use it, create a simulation just like you normally would with OpenMM, but instead call AmberFDSimulation. If a system is provided that was not created using the AmberFD forcefield, then this will initialize using openmm.simulation instead. All of the same members that belong to openmm.simulation are also available, such as minimizeEnergy() and step(). Some of these members have additional options that are otherwise unavailable with vanilla openmm.simulation. These options are available regardless if an AmberFD force field is used or not.
- __init__(topology, system, integrator, platform=None, platformProperties=None, state=None, FDProperties=None)
Create a Simulation.
- Parameters
topology (Topology) – A Topology describing the the system to simulate
system (System or XML file name) – The OpenMM System object to simulate (or the name of an XML file with a serialized System)
integrator (Integrator or XML file name) – The OpenMM Integrator to use for simulating the System (or the name of an XML file with a serialized System)
platform (Platform=None) – If not None, the OpenMM Platform to use. When using AmberFD, only the CPU platform is available.
platformProperties (map=None) – If not None, a set of platform-specific properties to pass to the Context’s constructor. NOT IMPLIMENTED IN AmberFD
state (XML file name=None) – The name of an XML file containing a serialized State. If not None, the information stored in state will be transferred to the generated Simulation object. NOT YET IMPLIMENTED IN AmberFD
Methods
__init__
(topology, system, integrator[, ...])Create a Simulation.
loadCheckpoint
(file)Load a checkpoint file that was created with saveCheckpoint().
loadState
(file)Load a State file that was created with saveState().
minimizeEnergy
([tolerance, maxIterations, ...])Minimize the energy of the system w.r.t.
runForClockTime
(time[, checkpointFile, ...])Advance the simulation by integrating time steps until a fixed amount of clock time has elapsed.
saveCheckpoint
(file)Save a checkpoint of the simulation to a file.
saveState
(file)Save the current state of the simulation to a file.
step
(steps)Advance the simulation by integrating a specified number of time steps.
- minimizeEnergy(tolerance=Quantity(value=10, unit=kilojoule / nanometer * mole), maxIterations=500, PDBOutFile=None, output_interval=1, excludeResidueNames=None)
Minimize the energy of the system w.r.t. the molecular coordinates.
- Parameters
tolerance (force) – This specifies how precisely the energy minimum must be located. Minimization is halted once themaximum value of all force components reaches this tolerance.
maxIterations (int) – The maximum number of iterations to perform. If this is 0, minimization is continued until the results converge without regard to how many iterations it takes.
PDBOutFile (string) – .pdb file to print minimized coordinates to as the minimization procedes.
output_interval (int) – Number of steps in between minimization to print coordinates to PDBOutFile
excludeResidueNames (iterable) – A list of residue names to exclude in PDBOutFile. For example, one may want to exclude all waters and ions from KCl, so (‘HOH’, ‘CL’, ‘K’) would be used
- loadCheckpoint(file)
Load a checkpoint file that was created with saveCheckpoint().
- Parameters
file (string or file) – a File-like object to load the checkpoint from, or alternatively a filename
- loadState(file)
Load a State file that was created with saveState().
- Parameters
file (string or file) – a File-like object to load the state from, or alternatively a filename
- runForClockTime(time, checkpointFile=None, stateFile=None, checkpointInterval=None)
Advance the simulation by integrating time steps until a fixed amount of clock time has elapsed.
This is useful when you have a limited amount of computer time available, and want to run the longest simulation possible in that time. This method will continue taking time steps until the specified clock time has elapsed, then return. It also can automatically write out a checkpoint and/or state file before returning, so you can later resume the simulation. Another option allows it to write checkpoints or states at regular intervals, so you can resume even if the simulation is interrupted before the time limit is reached.
- Parameters
time (time) – the amount of time to run for. If no units are specified, it is assumed to be a number of hours.
checkpointFile (string or file=None) – if specified, a checkpoint file will be written at the end of the simulation (and optionally at regular intervals before then) by passing this to saveCheckpoint().
stateFile (string or file=None) – if specified, a state file will be written at the end of the simulation (and optionally at regular intervals before then) by passing this to saveState().
checkpointInterval (time=None) – if specified, checkpoints and/or states will be written at regular intervals during the simulation, in addition to writing a final version at the end. If no units are specified, this is assumed to be in hours.
- saveCheckpoint(file)
Save a checkpoint of the simulation to a file.
The output is a binary file that contains a complete representation of the current state of the Simulation. It includes both publicly visible data such as the particle positions and velocities, and also internal data such as the states of random number generators. Reloading the checkpoint will put the Simulation back into precisely the same state it had before, so it can be exactly continued.
A checkpoint file is highly specific to the Simulation it was created from. It can only be loaded into another Simulation that has an identical System, uses the same Platform and OpenMM version, and is running on identical hardware. If you need a more portable way to resume simulations, consider using saveState() instead.
- Parameters
file (string or file) – a File-like object to write the checkpoint to, or alternatively a filename
- saveState(file)
Save the current state of the simulation to a file.
The output is an XML file containing a serialized State object. It includes all publicly visible data, including positions, velocities, and parameters. Reloading the State will put the Simulation back into approximately the same state it had before.
Unlike saveCheckpoint(), this does not store internal data such as the states of random number generators. Therefore, you should not expect the following trajectory to be identical to what would have been produced with the original Simulation. On the other hand, this means it is portable across different Platforms or hardware.
- Parameters
file (string or file) – a File-like object to write the state to, or alternatively a filename
- step(steps)
Advance the simulation by integrating a specified number of time steps.