narupatools.ase.openmm.converter

Conversion functions between OpenMM objects and ASE objects.

Functions

openmm_simulation_to_ase_atoms

Generate an ASE atoms representation of the OpenMM simulation.

openmm_simulation_to_ase_molecular_dynamics

Convert an OpenMM simulation to an ASE simulation.

narupatools.ase.openmm.converter.openmm_simulation_to_ase_atoms(simulation: openmm.app.simulation.Simulation, /)ase.atoms.Atoms

Generate an ASE atoms representation of the OpenMM simulation.

The Atoms object will have a OpenMMCalculator which calculates the forces and energy based on the simulation.

Parameters

simulation – OpenMM simulation to convert to Atoms.

Returns

ASE atoms object, with positions and chemical symbols read from the current state of the OpenMM simulation.

narupatools.ase.openmm.converter.openmm_simulation_to_ase_molecular_dynamics(simulation: openmm.app.simulation.Simulation)ase.md.md.MolecularDynamics

Convert an OpenMM simulation to an ASE simulation.

This both converts the system itself to an ASE atoms object and converts the simulation to an ASE Langevin integrator. The timestep and temperature are read from the OpenMM simulation’s integrator. If the temperature is not present, a default of 300 kelvin is used. If the OpenMM integrator is Langevin, then the friction is also copied. If no friction is present, a default friction of 10 ps^{-1} is used.

The ASE atoms object has a calculator which will call the original underlying simulation to calculate forces.

Constraints in the OpenMM simulation are not converted, and a warning will be issued if they are present.

Parameters

simulation – An OpenMM simulation object.

Returns

An ASE MolecularDynamics object representing the same system.