rgpycrumbs.geom.fragments

Core fragment detection algorithms for molecular systems.

Provides geometric (scaled covalent radii) and bond-order (GFN2-xTB) based fragment detection, plus distance-based fragment merging.

Added in version 0.0.6.

Attributes

Classes

StrEnum

Backport for Python 3.10.

DetectionMethod

Available detection methodologies.

Functions

find_fragments_geometric(→ tuple[int, numpy.ndarray])

Detect molecular fragments using scaled covalent radii.

find_fragments_bond_order(→ tuple[int, numpy.ndarray, ...)

Analyze connectivity via the Wiberg Bond Order (WBO) matrix.

build_graph_and_find_components(→ tuple[int, ...)

Identify connected components using direct CSR sparse matrix construction.

merge_fragments_by_distance(→ tuple[int, numpy.ndarray])

Merges fragments with geometric centers closer than the specified distance.

Module Contents

class rgpycrumbs.geom.fragments.StrEnum[source]

Bases: str, enum.Enum

Backport for Python 3.10.

rgpycrumbs.geom.fragments.tbliteinterface[source]
class rgpycrumbs.geom.fragments.DetectionMethod[source]

Bases: enum.StrEnum

Available detection methodologies.

Added in version 0.0.6.

GEOMETRIC = 'geometric'[source]
BOND_ORDER = 'bond-order'[source]
rgpycrumbs.geom.fragments.DEFAULT_BOND_MULTIPLIER = 1.2[source]
rgpycrumbs.geom.fragments.DEFAULT_BOND_ORDER_THRESHOLD = 0.8[source]
rgpycrumbs.geom.fragments.find_fragments_geometric(atoms: ase.atoms.Atoms, bond_multiplier: float, radius_type: str = 'natural') tuple[int, numpy.ndarray][source]

Detect molecular fragments using scaled covalent radii.

Added in version 0.0.6.

rgpycrumbs.geom.fragments.find_fragments_bond_order(atoms: ase.atoms.Atoms, threshold: float, charge: int, multiplicity: int, method: str = 'GFN2-xTB') tuple[int, numpy.ndarray, numpy.ndarray, numpy.ndarray][source]

Analyze connectivity via the Wiberg Bond Order (WBO) matrix. Calculate electronic structure using the specified xTB level.

Added in version 0.0.6.

rgpycrumbs.geom.fragments.build_graph_and_find_components(num_atoms: int, row_indices: numpy.ndarray | list[int], col_indices: numpy.ndarray | list[int]) tuple[int, numpy.ndarray][source]

Identify connected components using direct CSR sparse matrix construction.

Added in version 0.0.6.

This function avoids Python list overhead by passing interaction indices directly to the SciPy sparse engine.

rgpycrumbs.geom.fragments.merge_fragments_by_distance(atoms: ase.atoms.Atoms, n_components: int, labels: numpy.ndarray, min_dist: float) tuple[int, numpy.ndarray][source]

Merges fragments with geometric centers closer than the specified distance.

Added in version 0.0.6.