pestifer.psfutil.psfring module

Defines the Ring class and the ring_check function for detection of pierced rings

class pestifer.psfutil.psfring.PSFRing(idx_list: list[int])[source]

Bases: PSFTopoElement

A class for handling rings in a molecular structure. This class represents a ring defined by a list of atom indices and provides methods to check if a bond pierces the ring. It also provides methods to yield treadmilled versions of the ring and to check for equality with another ring.

Parameters:

idx_list (list) – A list of atom indices that define the ring.

pierced_by(bond, cutoff=3.5, tol=1e-05)[source]

Check if a bond pierces the ring. A bond is considered to pierce the ring if:

  • The center of mass (COM) of the bond is within a specified cutoff distance from the COM of the ring.

  • The COM of the bond is not more than half the distance between the two endpoints of the bond.

  • The ring’s points, when projected onto a plane perpendicular to the bond at the bond’s midpoint, form a closed loop (i.e., the sum of angles around the COM is approximately 2π).

Parameters:
  • bond (PSFBond) – The bond to check for piercing the ring.

  • cutoff (float) – The cutoff distance for considering a bond to pierce the ring.

  • tol (float) – The tolerance for checking if the ring forms a closed loop.

Returns:

A dictionary containing the result of the piercing check. Keys include:

  • pierced: bool

    True if the bond pierces the ring, False otherwise.

  • piercepoint: np.ndarray

    The center of mass of the ring projected onto the plane perpendicular to the bond at the bond’s midpoint, if the bond pierces the ring.

  • error: float

    The error in the closed loop condition, if the bond pierces the ring.

  • reason: str

    A reason for why the bond does not pierce the ring, if applicable.

Return type:

dict

treadmill()[source]

yield the treadmilled versions of the list if atom indices in the ring This method generates all possible rotations of the ring’s atom indices. Each rotation is a new arrangement of the atom indices, simulating the effect of a treadmill.

Yields:

list – A list of all possible rotations of the ring’s atom indices.

class pestifer.psfutil.psfring.RingList(input_obj)[source]

Bases: PSFTopoElementList

A class for handling lists of Ring objects. This class inherits from PSFTopoElementList and provides methods to initialize the list from a networkx graph, ingest coordinates, and check for string representation.

Parameters:

input_obj (nx.Graph or list of Ring)

pestifer.psfutil.psfring.ring_check(psf, pdb, xsc=None, cutoff=10.0, segtypes=['lipid'])[source]

Check for rings in a molecular structure and identify bonds that pierce them. This function reads a PSF file and a PDB file, extracts the coordinates of atoms, and checks for rings in the structure. It identifies bonds that pierce the rings based on a specified cutoff distance and returns a list of specifications for the piercing bonds.

Parameters:
  • psf (str) – Path to the PSF file.

  • pdb (str) – Path to the PDB file.

  • xsc (str or None) – Path to the XSC file. If None, the system is treated as non-periodic (vacuum): a bounding box is derived from the coordinate extents and the minimum-image convention is not applied.

  • cutoff (float) – Cutoff distance in Angstroms for identifying piercing bonds. Default is 10.0.

  • segtypes (list) – List of segment types to include in the analysis. Default is [‘lipid’].