Topology

class mdcraft.core.Topology(filename: str | Path, *, format: str = None, **kwargs)[source]

Bases: object

Simulation topology.

A topology defines the structure, interactions, and parameters required to describe the simulation system. Information includes topological objects, such as atoms, residues, segments, chains, and molecules, and their force field properties, such as masses, charges, bonds, angles, dihedrals, and improper dihedrals.

The topology hierarchy is organized as follows:

  • Atoms are the basic building blocks.

  • Residues are groups of atoms that form a chemically distinct unit within a larger structure, like an amino acid in a protein or a monomer in a polymer.

  • Segments are groups of residues that represent a structural or functional subregion within a molecule, like a loop region in a protein or a block of monomers in a copolymer. Oftentimes, there is no distinction between segments and chains.

  • Chains are sequences of connected residues that form a single, continuous strand in a molecule, like a polypeptide chain in a protein or a full polymer chain.

  • Molecules are groups of atoms that are chemically bonded to each other, and can range from small (e.g., water) to very large macromolecules (e.g., proteins, DNA, and polymers).

Parameters:
filenamestr or pathlib.Path

Path to the topology file.

formatstr, keyword-only, optional

Format of the topology file. If not specified, the format is determined from the file extension.

**kwargsdict

Additional keyword arguments to pass to the topology reader.

Methods

property dimensions: ndarray[float64] | None

Simulation box dimensions (or lattice parameters). If None, the dimensions are not available in the topology.

Reference units: \(\mathrm{nm}\) for lengths and degrees (\(^\circ\)) for angles.

property n_atoms: int

Number of atoms.