NAGLOpenEyeToolkitWrapper

class openff.nagl.toolkits.NAGLOpenEyeToolkitWrapper[source]

Bases: NAGLToolkitWrapperBase, OpenEyeToolkitWrapper

Methods

get_atoms_are_in_ring_size

Determine whether each atom in a molecule is in a ring of a given size.

get_best_rmsd

Compute the lowest all-atom RMSD between a reference and target conformer, allowing for symmetry-equivalent atoms to be permuted.

get_bonds_are_in_ring_size

Determine whether each bond in a molecule is in a ring of a given size.

get_molecule_hybridizations

Get the hybridization of each atom in a molecule.

stream_molecules_from_sdf_file

Stream molecules from an SDF file.

stream_molecules_to_file

Stream molecules to an SDF file using a context manager.

to_openeye

Convert an OpenFF Molecule to an OpenEye OEMol with charges stored as SD data.

Attributes

get_atoms_are_in_ring_size(molecule: Molecule, ring_size: int) List[bool][source]

Determine whether each atom in a molecule is in a ring of a given size.

Parameters:
Returns:

in_ring_size (List[bool])

get_best_rmsd(molecule: Molecule, reference_conformer: ndarray | Quantity, target_conformer: ndarray | Quantity) Quantity[source]

Compute the lowest all-atom RMSD between a reference and target conformer, allowing for symmetry-equivalent atoms to be permuted.

Parameters:
  • molecule (openff.toolkit.topology.Molecule) – The molecule to compute the RMSD for

  • reference_conformer (np.ndarray or openff.units.unit.Quantity) – The reference conformer to compare to the target conformer. If a numpy array, it is assumed to be in units of angstrom.

  • target_conformer (np.ndarray or openff.units.unit.Quantity) – The target conformer to compare to the reference conformer. If a numpy array, it is assumed to be in units of angstrom.

Returns:

rmsd (unit.Quantity)

Examples

>>> from openff.units import unit
>>> from openff.toolkit.topology import Molecule
>>> from openff.toolkit.utils.toolkits import OpenEyeToolkitWrapper
>>> toolkit_wrapper = OpenEyeToolkitWrapper()
>>> molecule = Molecule.from_smiles("CCCCO")
>>> molecule.generate_conformers(n_conformers=2)
>>> rmsd = toolkit_wrapper.get_best_rmsd(molecule, molecule.conformers[0], molecule.conformers[1])
>>> print(f"RMSD in angstrom: {rmsd.m_as(unit.angstrom)}")
get_bonds_are_in_ring_size(molecule: Molecule, ring_size: int) List[bool][source]

Determine whether each bond in a molecule is in a ring of a given size.

Parameters:
Returns:

in_ring_size (List[bool]) – Bonds are in the same order as the molecule’s bonds attribute.

get_molecule_hybridizations(molecule: Molecule) List[HybridizationType][source]

Get the hybridization of each atom in a molecule.

Parameters:

molecule (openff.toolkit.topology.Molecule) – The molecule to get the hybridizations of.

Returns:

hybridizations (List[HybridizationType]) – The hybridization of each atom in the molecule.

name = 'openeye'
stream_molecules_from_sdf_file(file: str, as_smiles: bool = False, mapped_smiles: bool = False, include_sdf_data: bool = True, **kwargs)[source]

Stream molecules from an SDF file.

Parameters:
  • file (str) – The path to the SDF file to stream molecules from.

  • as_smiles (bool, default False) – If True, return a SMILES string instead of an OpenFF Molecule

  • mapped_smiles (bool, default False) – If True, return a SMILES string with atom indices as atom map numbers.

  • include_sdf_data (bool, default True) – If True, include the SDF tag data in the output molecules.

Returns:

molecules (Generator[openff.toolkit.topology.Molecule or str])

stream_molecules_to_file(file: str)[source]

Stream molecules to an SDF file using a context manager.

Parameters:

file (str) – The path to the SDF file to stream molecules to.

Examples

>>> from openff.toolkit.topology import Molecule
>>> from openff.toolkit.utils.toolkits import OpenEyeToolkitWrapper
>>> toolkit_wrapper = OpenEyeToolkitWrapper()
>>> molecule1 = Molecule.from_smiles("CCO")
>>> molecule2 = Molecule.from_smiles("CCC")
>>> with toolkit_wrapper.stream_molecules_to_file("molecules.sdf") as writer:
...     writer(molecule1)
...     writer(molecule2)
to_openeye(molecule: Molecule)[source]

Convert an OpenFF Molecule to an OpenEye OEMol with charges stored as SD data.

Parameters:

molecule (openff.toolkit.topology.Molecule) – The molecule to convert

Returns:

oemol (openeye.oechem.OEMol)