gromacs/gro format#
Aliases#
gro, gromacs/gro
Implementation: GromacsGroFormat
Overview#
GROMACS .gro structure or trajectory file.
GROMACS is a versatile package for molecular dynamics simulations.
GRO stores atom names, Cartesian coordinates, an optional velocity block, and a periodic box. dpdata reads one or more concatenated frames and can write either a selected frame or the complete trajectory.
Quick examples#
The examples use the preferred alias gromacs/gro; any alias listed above is equivalent.
import dpdata
# Geometry-only data
system = dpdata.System("input_file", fmt="gromacs/gro")
# Write geometry-only data
system.to("gromacs/gro", "output_path")
Conversions#
Convert from this format to System#
- dpdata.System(file_name, format_atom_name=True, fmt: Literal['gro'] = None, **kwargs) dpdata.system.System
- dpdata.System(file_name, format_atom_name=True, fmt: Literal['gromacs/gro'] = None, **kwargs) dpdata.system.System
- dpdata.System.from_gro(file_name, format_atom_name=True, **kwargs) dpdata.system.System
- dpdata.System.from_gromacs_gro(file_name, format_atom_name=True, **kwargs) dpdata.system.System
Load gromacs .gro file.
- Parameters:
- file_namestr
The input file name
- format_atom_namebool
Whether to format the atom name
- **kwargsdict
Additional format arguments accepted for API compatibility.
- Returns:
- System
converted system
Convert from System to this format#
- dpdata.System.to(fmt: Literal['gro'], file_name: 'FileType | None' = None, frame_idx=-1, **kwargs)
- dpdata.System.to(fmt: Literal['gromacs/gro'], file_name: 'FileType | None' = None, frame_idx=-1, **kwargs)
- dpdata.System.to_gro(file_name: 'FileType | None' = None, frame_idx=-1, **kwargs)
- dpdata.System.to_gromacs_gro(file_name: 'FileType | None' = None, frame_idx=-1, **kwargs)
Dump the system in gromacs .gro format.
- Parameters:
- file_namestr or None
The output file name. If None, return the file content as a string
- frame_idxint
The index of the frame to dump
- **kwargsdict
Additional writer options described below.
- Other Parameters:
- resnamestr, default=”MOL”
Residue name written for every atom.
- shiftint, default=0
Offset added to the one-based atom serial numbers.
Convert from LabeledSystem to this format#
- dpdata.LabeledSystem.to(fmt: Literal['gro'], file_name: 'FileType | None' = None, frame_idx=-1, **kwargs)
- dpdata.LabeledSystem.to(fmt: Literal['gromacs/gro'], file_name: 'FileType | None' = None, frame_idx=-1, **kwargs)
- dpdata.LabeledSystem.to_gro(file_name: 'FileType | None' = None, frame_idx=-1, **kwargs)
- dpdata.LabeledSystem.to_gromacs_gro(file_name: 'FileType | None' = None, frame_idx=-1, **kwargs)
Dump the system in gromacs .gro format.
- Parameters:
- file_namestr or None
The output file name. If None, return the file content as a string
- frame_idxint
The index of the frame to dump
- **kwargsdict
Additional writer options described below.
- Other Parameters:
- resnamestr, default=”MOL”
Residue name written for every atom.
- shiftint, default=0
Offset added to the one-based atom serial numbers.