Utilities

Overview

Details

msibi.utils.conversion.gsd_from_files(topology_file: str, traj_file: str, output: str = 'output.gsd')

Convert a topology and trajectory pair to a GSD file after validation.

This function first validates the inputs using _mda_check. If all requirements are satisfied, the data is converted into HOOMD’s GSD format using gsd_from_universe.

Note

If requirements for loading files into MDAnalysis are not met, diagnostic information is printed instead of writing a file.

Examples:

from msibi.utils.conversion import gsd_from_files

gsd_from_files(topology_file="lammps.data", traj_file="lammps.dump", output="output.gsd")
Parameters:
  • topology_file (str) – Path to topology file (PSF, GRO, LAMMPSDATA, etc.).

  • traj_file (str) – Path to trajectory file (DCD, XTC, TRR, LAMMPSDUMP etc.).

  • output (str, optional, default = output.gsd) – Name of the output GSD file.

msibi.utils.conversion.gsd_from_universe(universe: Universe, output: str = 'output.gsd')

Convert an MDAnalysis Universe into a GSD trajectory.

Extracts particle, bonding, angular, dihedral, and improper information from the given Universe and writes each frame to a GSD file compatible with HOOMD-blue.

Note

Particle types are inferred from atom.type. Bond, angle, dihedral and improper types are deduplicated and stored as HOOMD-Blue style type lists with associated type IDs. Each frame of the Universe trajectory is written to the GSD file.

Examples:

import MDAnalysis as mda
from msibi.utils.conversion import gsd_from_universe

u = mda.Universe("topology.tpr", "trajectory.xtc")
gsd_from_universe(u, output="output.gsd")
Parameters:
  • universe (MDAnalysis.Universe) – Universe containing the system’s topology and trajectory.

  • output (str, optional) – Name of the output GSD file (default is ‘output.gsd’).

Modules