nanover.openmm.simulation module
- class nanover.openmm.simulation.OpenMMSimulation(name: str | None = None)
Bases:
object
A wrapper for OpenMM simulations to run inside the OmniRunner.
The following attributes can be configured after construction: -
frame_interval
: Number of simulation steps to advance between frames. -include_velocities
: Include particle velocities in frames. -include_forces
: Include particle forces in frames. -platform_name
: Name of OpenMM platform to use when loading the system from XML.- advance_by_one_step()
Advance the simulation to the next point a frame should be reported, and send that frame.
- advance_by_seconds(dt: float)
Advance playback time by some seconds, and advance the simulation to the next frame output.
- Parameters:
dt – Time to advance playback by in seconds (ignored)
- advance_to_next_report()
Step the simulation to the next point a frame should be reported, and send that frame.
- determine_pbcs()
Determine whether the simulation uses periodic boundary conditions and if it does, retrieve the periodic box vectors in nanometers.
- frame_interval
Number of simulation steps to advance between frames.
- classmethod from_simulation(simulation: Simulation, *, name: str | None = None)
Construct this from an existing OpenMM simulation.
- Parameters:
simulation – An existing OpenMM Simulation
name – An optional name for the simulation instead of default
- classmethod from_xml_path(path: PathLike[str], *, name: str | None = None)
Construct this from an existing NanoVer OpenMM XML file at a given path.
- Parameters:
path – Path of the NanoVer OpenMM XML file
name – An optional name for the simulation instead of filename
- include_forces
Include particle forces in frames.
- include_velocities
Include particle velocities in frames.
- load()
Load and set up the simulation if it isn’t done already.
- make_regular_frame(positions: ndarray | None = None)
Make a NanoVer FrameData corresponding to the current state of the simulation.
- Parameters:
positions – Optionally provided particle positions to save fetching them again.
- make_topology_frame()
Make a NanoVer FrameData corresponding to the current particle positions and topology of the simulation.
- pbc_vectors: ndarray | None
Array of vectors defining the periodic box used by the simulation (if PBCs are employed).
- platform_name: str | None
Name of OpenMM platform to use at the time the system is loaded from XML.
- reset(app_server: AppServer)
Reset the simulation to its initial conditions, reset IMD interactions, and reset frame stream to begin with topology and continue.
- Parameters:
app_server – The app server hosting the frame publisher and imd state
- use_pbc_wrapping: bool | None
Provide atom positions wrapped according to PBC such that each molecule has a center of mass within the primary periodic box.