xnn.ffnn.common.typing.to_rdkit#
- xnn.ffnn.common.typing.to_rdkit(structure=None, *, positions=None, atomic_numbers=None, bonds=None, charge=0, smiles=None)[source]#
Build an RDKit molecule with explicit hydrogens from a structure.
Accepts, in order of preference: an RDKit
Mol(returned as is, after adding explicit hydrogens if it has implicit ones); a SMILES string; anase.Atoms; a dict with"pos"/"atomic_numbers"; orpositions+atomic_numbersarrays. For geometric input the connectivity and bond orders are perceived with RDKit’sDetermineBonds(the xyz2mol algorithm); ifbondsare given only the bond orders are determined, keeping that connectivity.- Parameters:
structure (object, optional) – See above.
positions (array_like, optional) – Cartesian coordinates
(N, 3)in Angstrom.atomic_numbers (array_like, optional) – Atomic numbers
(N,).bonds (sequence of (int, int), optional) – Known connectivity; bond orders are then perceived, not connectivity.
charge (int, optional) – Total charge of the structure (needed to perceive bond orders).
smiles (str, optional) – A SMILES string (hydrogens are added explicitly).
- Returns:
A sanitized molecule whose atom order matches the input order (for SMILES input, the RDKit order with hydrogens appended).
- Return type:
rdkit.Chem.Mol