io#

Utility to load and save simulation data.

Load#

load_box(filename, frame=-1, top=None)[source]#

Loads initial configuration using the file loader from MDTraj.

Parameters:
  • filename – String providing the location of the file to load.

  • frame – Frame of the trajectory to read data from.

  • top – Topology file, necessary if the file does not contain sufficient information to generate the system topology.

Returns:

Tuple of jnp arrays of box, coordinates, mass, and species.

Save#

save_gro(positions, box, velocities=None, group='SOL', species='CG', fractional=False, time=0.0, filename=None)[source]#

Writes a box of particles to the gro file format [1].

Parameters:
Return type:

str

Returns:

Returns the content of the gro file as string.

References

save_traj(times, positions, box, velocities=None, dynamic_box=False, group='SOL', species='CG', fractional=False, filename=None)[source]#

Writes a trajectory to the gro file format using save_gro().

Parameters:
  • times (Union[Array, ndarray, bool, number, bool, int, float, complex]) – (T,) array of corresponding times.

  • positions (Union[Array, ndarray, bool, number, bool, int, float, complex]) – (T, N, 3) array of particle positions.

  • box (Union[Array, ndarray, bool, number, bool, int, float, complex]) – Scalar or array describing the box. If dynamic_box=True, a time dependent box size (T, ...) can be given. Currently, does not support off-diagonal box entries.

  • velocities (Union[Array, ndarray, bool, number, bool, int, float, complex]) – (N, 3) array of velocities. If not given, the velocities are set to zero.

  • dynamic_box (bool) – Set to True if the box is time-dependent.

  • species (Union[str, List]) – Either a string for a single species or a list with one species type per atom.

  • group (Union[str, List]) – Either a string if all atoms belong to the same group or a list with one group per atom.

  • fractional (bool) – Whether particle coordinates are fractional. Transforms fractional coordinates.

  • filename (PathLike) – Save the generated string to a file.

Notes

It is inefficient to save trajectories in ASCII format. Consider reformatting the saved trajectory to a more efficient format, e.g. via:

gmx trjconv -f trajectory.gro -o <new-trajectory>.<trr/xtc>
Return type:

None