mofbuilder.io.GroReader#

class mofbuilder.io.GroReader(comm=None, ostream=None, filepath=None)[source]#

Bases: object

Reader for GROMACS .gro coordinate files.

Handles loading of GRO files with optional MPI-aware parallel output support and recentering of structure to center of mass.

Parameters:
  • comm (Any | None)

  • ostream (veloxchem.outputstream.OutputStream | None)

  • filepath (str | Path | None)

comm#

MPI communicator.

Type:

Any

rank#

MPI process rank.

Type:

int

nodes#

Number of MPI processes.

Type:

int

ostream#

Output stream for printing/logging.

Type:

OutputStream

filepath#

Path to the .gro coordinate file.

Type:

Optional[str]

data#

Loaded atom data after parsing.

Type:

Optional[np.ndarray]

_debug#

Enables debug output if True.

Type:

bool

read_gro(filepath, recenter, com_type)[source]#

Read, parse, (optionally recenter) GRO file.

Parameters:
  • filepath (str | Path | None)

  • recenter (bool)

  • com_type (str | None)

Return type:

None

read_gro(filepath=None, recenter=False, com_type=None)[source]#

Reads a GRO file and parses atomic coordinates.

Optionally recenters the structure so the center of mass (or specified atom type) is at the origin.

Parameters:
  • filepath (Optional[str or Path]) – Path to the .gro file. If provided, overrides the current filepath.

  • recenter (bool) – Whether to recenter coordinates at the center of mass (default False).

  • com_type (Optional[str]) – If recentering, type of atom to use for COM; if None, use all atoms.

Raises:

AssertionError – If the file does not exist.

Return type:

None