BaseTopologyReader¶
- class mdcraft.io.base.BaseTopologyReader(filename: str | Path, /, *, n_workers: int | None = 1)[source]¶
Bases:
BaseReaderBase class for topology readers.
Subclasses must set values for
the
_FORMATand_EXTENSIONSattributes, which specify the format and standard extension(s) of the topology file, respectively,the
_PARALLELIZABLEattribute, which specifies whether the reader can process a file in parallel,the
_unitsattribute, which specifies the base units (charge, energy, length, mass, temperature, and time) used by the simulation software that generated the trajectory file,the
_reducedattribute, which specifies whether the data is in reduced units,the
dimensions()property, which specifies the simulation box dimensions (or lattice parameters), andthe
n_atoms(),n_bonds(),n_angles(),n_dihedrals(),n_improper_dihedrals(),n_residues(),n_segments(),n_chains(), andn_molecules()properties, which specify the number of atoms, bonds, angles, dihedrals, improper dihedrals, residues, segments, chains, and molecules, respectively,
and implement
the
__repr__()method to provide a string representation of the reader that can be used to recreate it, andthe
open()andclose()methods to handle the opening and closing of the file.
- Parameters:
- filenamestr or pathlib.Path, positional-only
Filename or path to the topology file.
- n_workersint, keyword-only, default:
1 Number of threads to use when reading the file. If
None, the number of available logical threads is used.
Methods
Closes the topology or trajectory file and deletes the handle.
Opens the topology or trajectory file and stores a handle to it.
read_topology