mofbuilder.io.XyzReader#
- class mofbuilder.io.XyzReader(comm=None, ostream=None, filepath=None)[source]#
Bases:
objectReader for XYZ molecular coordinate files.
Handles loading of XYZ files with MPI-aware output and optional structure recentering.
- 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 info/logging.
- Type:
OutputStream
- filepath#
Path to the input .xyz file.
- Type:
Optional[str]
- data#
Atom information as parsed and processed.
- Type:
Optional[np.ndarray]
- _debug#
Enables debug output if True.
- Type:
bool
- read_xyz()[source]#
Read, parse, and (optionally recenter) XYZ file into array format.
- Parameters:
filepath (str | Path | None)
recenter (bool)
com_type (str | None)
residue_name (str)
residue_number (int)
- Return type:
None
- read_xyz(filepath=None, recenter=False, com_type=None, residue_name='MOL', residue_number=1)[source]#
Reads atom and coordinate information from an XYZ file, storing structure in a NumPy array.
Optionally recenters structure coordinates to a specified atom type or whole molecule center of mass.
- Parameters:
filepath (Optional[str or Path]) – Path to the .xyz file. If not supplied, uses instance filepath.
recenter (bool) – If True, recenter coordinates to center-of-mass. Defaults to False.
com_type (Optional[str]) – If specified, use only atoms of this type for COM calculation.
residue_name (str) – Residue name assignment for all atoms. Defaults to ‘MOL’.
residue_number (int) – Residue number for all atoms. Defaults to 1.
- Returns:
None
- Raises:
FileNotFoundError – If the specified file path does not exist.
- Return type:
None
Note
Assigns atom_type, atom_label (e.g., “C1”, “O2”), atom_number (1-based), residue_name, residue_number, x, y, z, spin (1.0), charge (from file or 0.0), and note (from file or empty) for each atom.
Array output shape is (num_atoms, 11).