Trajectory Helpers

mlipaudit.utils.trajectory_helpers.create_mdtraj_trajectory_from_simulation_state(simulation_state: SimulationState, topology_path: str | PathLike, cell_lengths: tuple[float, float, float] | None = None, cell_angles: tuple[float, float, float] = (90.0, 90.0, 90.0)) Trajectory

Create an mdtraj trajectory from a simulation state and topology.

This function uses a temporary directory as it temporarily writes to disk in order to save the trajectory as an xyz file. All input values should be in Angstrom units. Note that the resulting trajectory uses nm as units.

Parameters:
  • simulation_state – The state containing the trajectory.

  • topology_path – The path towards the topology file. Typically, a pdb file.

  • cell_lengths – The lengths of the unit cell in Angstrom. Default is None.

  • cell_angles – The angles of the unit cell in degrees. Default is (90, 90, 90).

Returns:

The converted trajectory.

mlipaudit.utils.trajectory_helpers.create_ase_trajectory_from_simulation_state(simulation_state: SimulationState) list[Atoms]

Create an ASE trajectory from the mlip library’s simulation state.

Note that the positions of the simulation state is in Angstrom, as are the positions of the resulting ASE trajectory.

Parameters:

simulation_state – The state containing the trajectory.

Returns:

An ASE trajectory as a list of ase.Atoms.

mlipaudit.utils.trajectory_helpers.create_mdtraj_trajectory_from_positions(positions: ndarray, atom_symbols: list[str]) Trajectory

Load a simulation state into an MDTraj trajectory.

Note that the units will therefore be converted from Angstrom to nm.

Parameters:
  • positions – Atomic positions from a simulation state.

  • atom_symbols – List of atom symbols.

Returns:

MDTraj trajectory.

Return type:

trajectory