pestifer.psfutil.psfatom module¶
Defines the PSFAtom and PSFAtomList classes for handling atoms in PSF topology files.
These classes are used to represent individual atoms and collections of atoms in a PSF file.
The PSFAtom class represents a single atom, while the PSFAtomList class is a collection of such atoms.
These classes provide methods for parsing atom lines and managing atom properties.
- class pestifer.psfutil.psfatom.PSFAtom(*args, serial: int, resid: ResID, segname: str, resname: str, atomname: str, atomtype: str, charge: float, atomicwt: float, segtype: str, ligands: list[PSFAtom] = <factory>, is_root: bool = False)[source]¶
Bases:
BaseObjA class representing an atom in a PSF topology file. An atom is defined by its serial number, chain ID, residue sequence number, insertion code, residue name, atom name, type, charge, atomic weight, and segment type. The class provides methods for parsing atom lines, checking if the atom is a hydrogen atom, adding ligands, and checking if the atom is part of a peptide bond.
- add_ligand(other: PSFAtom)[source]¶
Add a ligand to the atom’s list of ligands.
- Parameters:
other (PSFAtom) – The ligand atom to add.
- isH()[source]¶
Check if the atom is a hydrogen atom. Returns True if the atom’s type is ‘H’, otherwise False.
- is_pep(other: PSFAtom)[source]¶
Check if the atom is part of a peptide bond with another atom. A peptide bond is defined as a bond between a carbon atom (C) and a nitrogen atom (NH1).
- Parameters:
other (PSFAtom) – The other atom to check for a peptide bond.
- model_config = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': False}¶
Configuration for
pydantic.BaseModel.
- class pestifer.psfutil.psfatom.PSFAtomList(initlist: Iterable[T] = ())[source]¶
Bases:
BaseObjList[PSFAtom]A class representing a list of
PSFAtomobjects. This class inherits fromPSFTopoElementListand provides methods for managing a collection of atoms in a PSF topology file.- apply_exclusion_logics(exclusion_logics: list[str] = []) int[source]¶
Apply exclusion logic expressions to filter the atom list. This method filters the atom list based on a list of exclusion logic expressions. Atoms that match any of the expressions are removed from the list.
- apply_inclusion_logics(inclusion_logics: list[str] = []) int[source]¶
Apply inclusion logic expressions to filter the atom list. This method filters the atom list based on a list of inclusion logic expressions. Atoms that match any of the expressions are retained in the list.
- describe() str[source]¶
Abstract method to describe the contents of the BaseObjList. Subclasses should implement this method to provide a meaningful description.
- graph()[source]¶
Create a
networkx.Graphrepresentation of the atom list, where atoms are nodes and bonds are edges. This method constructs a networkx graph where each atom is a node and edges are created between atoms and their ligands.- Returns:
A networkx graph representing the atom list, with atoms as nodes and bonds as edges
- Return type: