rdkit_io#
- irmsd.interfaces.rdkit_io.conf_id_to_iterator(molecule: Mol, conf_id: None | int | list[int]) Generator | List['Mol'][source]#
Iterate over the conformers selected by conf_id (None selects all).
Raises TypeError unless conf_id is None, an int, or a list.
- irmsd.interfaces.rdkit_io.conformer_iterator(molecule: Mol, conf_ids: list[int]) Conformer[source]#
Yield the conformers of molecule listed in conf_ids.
- irmsd.interfaces.rdkit_io.cregen_rdkit(molecules: 'Mol' | Sequence['Mol'], rthr: float = 0.125, ethr: float = 8e-05, bthr: float = 0.01, printlvl: int = 0, ewin: float | None = None) List['Mol'][source]#
CREGEN-style pruning: unique structures by iRMSD, energy and rotational constants.
- Parameters:
molecules (
rdkit.Chem.Molorlistofrdkit.Chem.Mol) – A single Mol must carry more than one conformer.rthr (
float) – iRMSD threshold in Angstrom.ethr (
float) – Energy threshold in Hartree.bthr (
float) – Relative rotational-constant threshold.printlvl (
int) – Verbosity, passed to the backend.ewin (
floatorNone) – Energy window in Hartree above the lowest-energy structure.
- Returns:
Unique structures.
- Return type:
listofrdkit.Chem.Mol- Raises:
TypeError – If the input is not an RDKit Mol or a list of them.
- irmsd.interfaces.rdkit_io.delta_irmsd_list_rdkit(molecules: 'Mol' | Sequence['Mol'], iinversion: int = 0, allcanon: bool = True, printlvl: int = 0) Tuple[np.ndarray, List['Mol']][source]#
iRMSD deltas over an ensemble.
- Parameters:
molecules (
rdkit.Chem.Molorlistofrdkit.Chem.Mol) – A single Mol must carry more than one conformer.iinversion (
int) – Inversion handling: 0 auto, 1 on, 2 off.allcanon – Canonicalization flag and verbosity, passed to the backend.
printlvl – Canonicalization flag and verbosity, passed to the backend.
- Returns:
delta (
np.ndarray) – Seedelta_irmsd_listfor semantics.new_molecules_list (
listofrdkit.Chem.Mol) – Processed structures.
- Raises:
TypeError – If the input is not an RDKit Mol or a list of them.
- irmsd.interfaces.rdkit_io.get_axis_rdkit(molecule, conf_id: None | int | list[int] = None) Tuple[ndarray, ndarray, ndarray] | List[Tuple[ndarray, ndarray, ndarray]][source]#
Principal axes for the selected conformers.
- Parameters:
- Returns:
(rotational constants, average moments, eigenvectors) per conformer.
- Return type:
- Raises:
TypeError – If molecule is not an RDKit Mol.
- irmsd.interfaces.rdkit_io.get_canonical_rdkit(molecule, conf_id: None | int | list[int] = None, wbo: None | ndarray = None, invtype='apsp+', heavy: bool = False) ndarray[source]#
Canonical atom ranks for the selected conformers.
- Parameters:
molecule (
rdkit.Chem.Mol)conf_id (
int,listofint, orNone) – Conformer ID(s); None selects all conformers.wbo (
np.ndarray, optional) – Wiberg bond orders, required forinvtype='cangen'. Shape (n_atoms, n_atoms) to share across conformers, or (n_conf, n_atoms, n_atoms) for one per conformer.invtype (
str) – Invariant type.heavy (
bool) – Rank heavy atoms only.
- Returns:
Shape (n_atoms,) for one conformer, (n_conf, n_atoms) for several.
- Return type:
np.ndarray- Raises:
TypeError – If molecule is not an RDKit Mol.
- irmsd.interfaces.rdkit_io.get_cn_rdkit(molecule, conf_id: None | int | list[int] = None) ndarray[source]#
Coordination numbers for the selected conformers.
- irmsd.interfaces.rdkit_io.get_energy_rdkit(conformer) float | None[source]#
Float of the conformer’s “energy” property, or None if unset.
- irmsd.interfaces.rdkit_io.get_irmsd_rdkit(molecule_ref, molecule_align, conf_id_ref=-1, conf_id_align=-1, iinversion: int = 0) Tuple[float, 'Mol', 'Mol'][source]#
iRMSD between two conformers after permutation and alignment.
- irmsd.interfaces.rdkit_io.get_point_group_rdkit(molecule, conf_id: None | int | list[int] = None, **settings) str | None | List[str | None][source]#
Schoenflies point group for the selected conformers.
- Parameters:
molecule (
rdkit.Chem.Mol)conf_id (
int,listofint, orNone) – Conformer ID(s); None selects all conformers.**settings – Analyzer settings, see
irmsd.get_point_group().
- Returns:
Symbol per conformer; None if the analyzer skipped it.
- Return type:
- Raises:
TypeError – If molecule is not an RDKit Mol.
- irmsd.interfaces.rdkit_io.get_rmsd_rdkit(molecule_ref, molecule_align, conf_id_ref=-1, conf_id_align=-1, mask=None) Tuple[float, 'Mol', np.ndarray][source]#
RMSD between two conformers after alignment, without permutation.
- irmsd.interfaces.rdkit_io.molecule_to_rdkit(molecule: Molecule) Mol[source]#
- irmsd.interfaces.rdkit_io.molecule_to_rdkit(molecules: Sequence[Molecule]) list['Mol']
Convert irmsd Molecule(s) to RDKit Mol(s) carrying atoms and one conformer.
No bonds or properties are transferred. Returns a single Mol if exactly one Molecule results, else a list.
- Raises:
TypeError – If the input is not a Molecule or a list of them.
- irmsd.interfaces.rdkit_io.prune_rdkit(molecules: 'Mol' | Sequence['Mol'], rthr: float, iinversion: int = 0, allcanon: bool = True, printlvl: int = 0, ethr: float | None = None, ewin: float | None = None) List['Mol'][source]#
Prune an ensemble by iRMSD, keeping the first structure of each group.
- Parameters:
molecules (
rdkit.Chem.Molorlistofrdkit.Chem.Mol) – A single Mol must carry more than one conformer.rthr (
float) – iRMSD threshold in Angstrom.iinversion (
int) – Inversion handling: 0 auto, 1 on, 2 off.allcanon – Canonicalization flag and verbosity, passed to the backend.
printlvl – Canonicalization flag and verbosity, passed to the backend.
ewin (
floatorNone) – Energy window in Hartree above the lowest-energy structure.
- Returns:
Retained structures.
- Return type:
listofrdkit.Chem.Mol- Raises:
TypeError – If the input is not an RDKit Mol or a list of them.
- irmsd.interfaces.rdkit_io.rdkit_to_molecule(molecules: Mol, conf_id: int | list[int] | None = None) Molecule | list[Molecule][source]#
- irmsd.interfaces.rdkit_io.rdkit_to_molecule(molecules: Sequence['Mol'], conf_id: int | list[int] | None = None) list[Molecule]
Convert RDKit Mol(s) to irmsd Molecule(s), one per selected conformer.
Mol-level and conformer-level properties are merged into
info; conformer properties win on key clashes.
- irmsd.interfaces.rdkit_io.sorter_irmsd_rdkit(molecules: 'Mol' | Sequence['Mol'], rthr: float = 0.125, iinversion: int = 0, allcanon: bool = True, printlvl: int = 0, ethr: float | None = None, ewin: float | None = None) Tuple[np.ndarray, List['Mol']][source]#
Group an ensemble by iRMSD.
- Parameters:
molecules (
rdkit.Chem.Molorlistofrdkit.Chem.Mol) – A single Mol must carry more than one conformer.rthr (
float) – iRMSD threshold in Angstrom.iinversion (
int) – Inversion handling: 0 auto, 1 on, 2 off.allcanon – Canonicalization flag and verbosity, passed to the backend.
printlvl – Canonicalization flag and verbosity, passed to the backend.
ewin (
floatorNone) – Energy window in Hartree above the lowest-energy structure.
- Returns:
groups (
np.ndarray) – Integer group index per structure.new_molecules_list (
listofrdkit.Chem.Mol) – Sorted structures.
- Raises:
TypeError – If the input is not an RDKit Mol or a list of them.