narupa.openmm.converter module

Module providing conversion methods between Narupa and OpenMM.

narupa.openmm.converter.add_openmm_state_to_frame_data(data: narupa.trajectory.frame_data.FrameData, state: pretends.State, include_positions: bool = True) → None

Adds the OpenMM state information to the given FrameData, including positions and periodic box vectors.

Parameters:
  • data – Narupa FrameData to add state information to.
  • state – OpenMM State from which to extract state information.
  • include_positions – If True, the particle positions are read from the state and included in the frame.
narupa.openmm.converter.add_openmm_topology_to_frame_data(data: narupa.trajectory.frame_data.FrameData, topology: pretends.Topology) → None

Adds the OpenMM topology information to the given FrameData, including residue, chain, atomic and bond information.

Parameters:
  • dataFrameData to add topology information to.
  • topology – OpenMM Topology from which to extract information.
narupa.openmm.converter.openmm_to_frame_data(*, state: Optional[pretends.State] = None, topology: Optional[pretends.Topology] = None, include_positions: bool = True) → narupa.trajectory.frame_data.FrameData

Converts the given OpenMM state and topology objects into a Narupa FrameData.

Both fields are optional. For performance reasons, it is best to construct a Narupa FrameData once with topology information, and from then on just update the state, as that will result in less data being transmitted.

Parameters:
  • state – An optional OpenMM State from which to extract state data.
  • topology – An optional OpenMM Topology from which to extract topological information.
  • include_positions – If True, the particle positions are read from the state and included in the frame.
Returns:

A FrameData with the state and topology information provided added to it.