molsysmt.topology.get_rigid_fragments#
- molsysmt.topology.get_rigid_fragments(molecular_system, bond_indices=None, chemical_state='reference', structure_indices='all', skip_digestion=False)[source]#
Deriving rigid fragments by cutting explicitly selected covalent bonds.
- Parameters:
molecular_system (molecular system) – Molecular system in any supported form with a complete covalent graph.
bond_indices (int, list, tuple or numpy.ndarray, default=None) – Source bond indices (0-based) to cut. None cuts no bonds. Repeated indices are deduplicated. Dative and ring cuts are rejected.
chemical_state (str, int or None, default='reference') – Chemical state supplying connectivity. ‘structure’ resolves the state assigned to the selected structures; these must agree on one state.
structure_indices (int, list, tuple or numpy.ndarray, default='all') – Structure indices (0-based) used only for chemical-state resolution.
skip_digestion (bool, default=False) – Whether to skip argument digestion. Default is False.
- Returns:
Packed int64 fragment_atom_indices and fragment_offsets, a fragment index for each source atom (atom_fragment_indices), selected source bond_indices and bonded_atom_pairs, and aligned fragment_pairs. Also includes atom_indices, chemical_state_index and connectivity evidence. Fragments and their memberships are sorted by source atom index.
- Return type:
dict
- Raises:
ArgumentError – If a cut is out of range, noncovalent, or does not separate its endpoints.
StructuralInconsistencyError – If complete, valid chemical connectivity is unavailable.
Notes
Rigidity here means connectivity after the supplied cuts. This function does not classify chemically rotatable bonds, impose torsion angles or root a PDBQT tree. Bond orders are not needed for explicit graph cuts. Every selected bond must be a bridge in the original covalent graph; cutting multiple ring edges does not make them eligible torsions. Coordinates and the source chemical state are not modified.
See also
get_covalent_blocksFind connected atom sets after removing atom pairs.
get_ringsPerceive a minimum cycle basis from declared connectivity.
Examples
>>> import molsysmt as msm >>> import pandas as pd >>> from molsysmt.native import Topology >>> topology = Topology(n_atoms=3) >>> topology.bonds = pd.DataFrame({'atom1_index': [0, 1], ... 'atom2_index': [1, 2], 'bond_type': ['covalent', 'covalent']}) >>> topology._chemical_states[0].connectivity_completeness = 'complete' >>> result = msm.topology.get_rigid_fragments(topology, bond_indices=[1]) >>> result['fragment_atom_indices'].tolist(), result['fragment_offsets'].tolist() ([0, 1, 2], [0, 2, 3])
Tutorial with more examples
See Deriving rigid fragments for explicit graph cuts.
Added in version 1.0.0.