nanover.omni.openmm module

class nanover.omni.openmm.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.

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: List[List[float]] | ndarray[Any, dtype[float32 | float64]] | 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.

platform_name: str | None

Name of OpenMM platform to use at the time the system is loaded from XML.

reset(app_server: NanoverImdApplication)

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