readers module

Full Documentation for hippynn.molecular_dynamics.readers module. Click here for a summary page.

Read outputs from LAMMPS, Gromacs.

This module is only available if the MDAnalysis package is installed.

extract_trajectory_data(topology, trajectory, start=0, stop=None, stride=1, type_correction_dict=None, guess_masses=True, mda_universe_kwargs={})[source]

Extracts trajectory data using MDAnalysis.

E.g., for Gromacs: extract_trajectory_data(topology=”output.gro”, trajectory=”output.trr”) E.g., for LAMMPS: extract_trajectory_data(topology=”system.data”, trajectory=”output.lammpstrj”)

Parameters:
  • topology (str) – Path to topology file (e.g., ‘init.data’, ‘md.gro’).

  • trajectory (str) – Path to trajectory file (e.g., ‘traj.lammpstrj’, ‘md.trr’).

  • start (int) – Starting frame index (inclusive). Default is 0.

  • stop (int) – Ending frame index (exclusive). If None, reads until the end.

  • stride (int) – Step size between frames. Default is 1.

  • type_correction_dict (dict(str, int)) – If types inferred from files are not atomic numbers or symbols, pass {force_field_type: atomic_number} to correct this. The keys’ types must Default is None.

  • guess_masses (bool) – If true, will try to infer masses based on types. Default is True.

  • mda_universe_kwargs (dict) – Keywords to feed to MDAnalysis.Universe. Default is {}.

Returns:

Dictionary with keys: - positions: ndarray (n_frames, n_atoms, 3) - velocities: ndarray or None (n_frames, n_atoms, 3) - forces: ndarray or None (n_frames, n_atoms, 3) - cells: ndarray (n_frames, 3, 3) - masses: ndarray or None (n_atoms,) - species: ndarray (n_atoms,) - mol_ids: ndarray (n_atoms,)

Return type:

dict

get_types(universe)[source]