openforcefield.utils.toolkits.OpenEyeToolkitWrapper

class openforcefield.utils.toolkits.OpenEyeToolkitWrapper[source]

OpenEye toolkit wrapper

Warning

This API is experimental and subject to change.

Attributes
toolkit_file_read_formats

List of file formats that this toolkit can read.

toolkit_file_write_formats

List of file formats that this toolkit can write.

toolkit_installation_instructions

classmethod(function) -> method

toolkit_name

The name of the toolkit wrapped by this class.

Methods

compute_partial_charges(self, molecule[, …])

Compute partial charges with OpenEye quacpac

compute_partial_charges_am1bcc(self, molecule)

Compute AM1BCC partial charges with OpenEye quacpac

compute_wiberg_bond_orders(self, molecule[, …])

Update and store list of bond orders this molecule.

find_smarts_matches(self, molecule, smarts)

Find all SMARTS matches for the specified molecule, using the specified aromaticity model.

from_file(self, file_path, file_format[, …])

Return an openforcefield.topology.Molecule from a file using this toolkit.

from_file_obj(self, file_obj, file_format[, …])

Return an openforcefield.topology.Molecule from a file-like object (an object with a “.read()” method using this toolkit.

from_object(self, object[, …])

If given an OEMol (or OEMol-derived object), this function will load it into an openforcefield.topology.molecule Otherwise, it will return False.

from_openeye(oemol[, allow_undefined_stereo])

Create a Molecule from an OpenEye molecule.

from_smiles(self, smiles[, …])

Create a Molecule from a SMILES string using the OpenEye toolkit.

generate_conformers(self, molecule[, …])

Generate molecule conformers using OpenEye Omega.

is_available([oetools])

Check if the given OpenEye toolkit components are available.

requires_toolkit()

to_file(self, molecule, file_path, file_format)

Writes an OpenFF Molecule to a file-like object

to_file_obj(self, molecule, file_obj, …)

Writes an OpenFF Molecule to a file-like object

to_openeye(molecule[, aromaticity_model])

Create an OpenEye molecule using the specified aromaticity model

to_smiles(molecule)

Uses the OpenEye toolkit to convert a Molecule into a SMILES string.

__init__(self, /, *args, **kwargs)

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(self, /, \*args, \*\*kwargs)

Initialize self.

compute_partial_charges(self, molecule[, …])

Compute partial charges with OpenEye quacpac

compute_partial_charges_am1bcc(self, molecule)

Compute AM1BCC partial charges with OpenEye quacpac

compute_wiberg_bond_orders(self, molecule[, …])

Update and store list of bond orders this molecule.

find_smarts_matches(self, molecule, smarts)

Find all SMARTS matches for the specified molecule, using the specified aromaticity model.

from_file(self, file_path, file_format[, …])

Return an openforcefield.topology.Molecule from a file using this toolkit.

from_file_obj(self, file_obj, file_format[, …])

Return an openforcefield.topology.Molecule from a file-like object (an object with a “.read()” method using this toolkit.

from_object(self, object[, …])

If given an OEMol (or OEMol-derived object), this function will load it into an openforcefield.topology.molecule Otherwise, it will return False.

from_openeye(oemol[, allow_undefined_stereo])

Create a Molecule from an OpenEye molecule.

from_smiles(self, smiles[, …])

Create a Molecule from a SMILES string using the OpenEye toolkit.

generate_conformers(self, molecule[, …])

Generate molecule conformers using OpenEye Omega.

is_available([oetools])

Check if the given OpenEye toolkit components are available.

requires_toolkit()

to_file(self, molecule, file_path, file_format)

Writes an OpenFF Molecule to a file-like object

to_file_obj(self, molecule, file_obj, …)

Writes an OpenFF Molecule to a file-like object

to_openeye(molecule[, aromaticity_model])

Create an OpenEye molecule using the specified aromaticity model

to_smiles(molecule)

Uses the OpenEye toolkit to convert a Molecule into a SMILES string.

Attributes

toolkit_file_read_formats

List of file formats that this toolkit can read.

toolkit_file_write_formats

List of file formats that this toolkit can write.

toolkit_installation_instructions

classmethod(function) -> method

toolkit_name

The name of the toolkit wrapped by this class.

static is_available(oetools=('oechem', 'oequacpac', 'oeiupac', 'oeomega'))[source]

Check if the given OpenEye toolkit components are available.

If the OpenEye toolkit is not installed or no license is found for at least one the given toolkits , False is returned.

Parameters
oetoolsstr or iterable of strings, optional, default=(‘oechem’, ‘oequacpac’, ‘oeiupac’, ‘oeomega’)

Set of tools to check by their Python module name. Defaults to the complete set of tools supported by this function. Also accepts a single tool to check as a string instead of an iterable of length 1.

Returns
all_installedbool

True if all tools in oetools are installed and licensed, False otherwise

from_object(self, object, allow_undefined_stereo=False)[source]

If given an OEMol (or OEMol-derived object), this function will load it into an openforcefield.topology.molecule Otherwise, it will return False.

Parameters
objectA molecule-like object

An object to by type-checked.

allow_undefined_stereobool, default=False

Whether to accept molecules with undefined stereocenters. If False, an exception will be raised if a molecule with undefined stereochemistry is passed into this function.

Returns
Molecule

An openforcefield.topology.molecule Molecule.

Raises
NotImplementedError

If the object could not be converted into a Molecule.

from_file(self, file_path, file_format, allow_undefined_stereo=False)[source]

Return an openforcefield.topology.Molecule from a file using this toolkit.

Parameters
file_pathstr

The file to read the molecule from

file_formatstr

Format specifier, usually file suffix (eg. ‘MOL2’, ‘SMI’) Note that not all toolkits support all formats. Check ToolkitWrapper.toolkit_file_read_formats for details.

allow_undefined_stereobool, default=False

If false, raises an exception if oemol contains undefined stereochemistry.

Returns
moleculesList[Molecule]

The list of Molecule objects in the file.

Raises
GAFFAtomTypeWarning

If the loaded mol2 file possibly uses GAFF atom types, which are not supported.

Examples

Load a mol2 file into an OpenFF Molecule object.

>>> from openforcefield.utils import get_data_file_path
>>> mol2_file_path = get_data_file_path('molecules/cyclohexane.mol2')
>>> toolkit = OpenEyeToolkitWrapper()
>>> molecule = toolkit.from_file(mol2_file_path, file_format='mol2')
from_file_obj(self, file_obj, file_format, allow_undefined_stereo=False)[source]

Return an openforcefield.topology.Molecule from a file-like object (an object with a “.read()” method using this toolkit.

Parameters
file_objfile-like object

The file-like object to read the molecule from

file_formatstr

Format specifier, usually file suffix (eg. ‘MOL2’, ‘SMI’) Note that not all toolkits support all formats. Check ToolkitWrapper.toolkit_file_read_formats for details.

allow_undefined_stereobool, default=False

If false, raises an exception if oemol contains undefined stereochemistry.

Returns
moleculesList[Molecule]

The list of Molecule objects in the file object.

Raises
GAFFAtomTypeWarning

If the loaded mol2 file possibly uses GAFF atom types, which are not supported.

to_file_obj(self, molecule, file_obj, file_format)[source]

Writes an OpenFF Molecule to a file-like object

Parameters
moleculean OpenFF Molecule

The molecule to write

file_obj

The file-like object to write to

file_format

The format for writing the molecule data

to_file(self, molecule, file_path, file_format)[source]

Writes an OpenFF Molecule to a file-like object

Parameters
moleculean OpenFF Molecule

The molecule to write

file_path

The file path to write to.

file_format

The format for writing the molecule data

static from_openeye(oemol, allow_undefined_stereo=False)[source]

Create a Molecule from an OpenEye molecule. If the OpenEye molecule has implicit hydrogens, this function will make them explicit.

Warning

This API is experimental and subject to change.

Parameters
oemolopeneye.oechem.OEMol

An OpenEye molecule

allow_undefined_stereobool, default=False

If false, raises an exception if oemol contains undefined stereochemistry.

Returns
moleculeopenforcefield.topology.Molecule

An openforcefield molecule

Examples

Create a Molecule from an OpenEye OEMol

>>> from openeye import oechem
>>> from openforcefield.tests.utils import get_data_file_path
>>> ifs = oechem.oemolistream(get_data_file_path('systems/monomers/ethanol.mol2'))
>>> oemols = list(ifs.GetOEGraphMols())
>>> toolkit_wrapper = OpenEyeToolkitWrapper()
>>> molecule = toolkit_wrapper.from_openeye(oemols[0])
static to_openeye(molecule, aromaticity_model='OEAroModel_MDL')[source]

Create an OpenEye molecule using the specified aromaticity model

Warning

This API is experimental and subject to change.

Parameters
moleculeopenforcefield.topology.molecule.Molecule object

The molecule to convert to an OEMol

aromaticity_modelstr, optional, default=DEFAULT_AROMATICITY_MODEL

The aromaticity model to use

Returns
oemolopeneye.oechem.OEMol

An OpenEye molecule

Examples

Create an OpenEye molecule from a Molecule

>>> from openforcefield.topology import Molecule
>>> toolkit_wrapper = OpenEyeToolkitWrapper()
>>> molecule = Molecule.from_smiles('CC')
>>> oemol = toolkit_wrapper.to_openeye(molecule)
static to_smiles(molecule)[source]

Uses the OpenEye toolkit to convert a Molecule into a SMILES string.

Parameters
moleculeAn openforcefield.topology.Molecule

The molecule to convert into a SMILES.

Returns
smilesstr

The SMILES of the input molecule.

from_smiles(self, smiles, hydrogens_are_explicit=False, allow_undefined_stereo=False)[source]

Create a Molecule from a SMILES string using the OpenEye toolkit.

Warning

This API is experimental and subject to change.

Parameters
smilesstr

The SMILES string to turn into a molecule

hydrogens_are_explicitbool, default = False

If False, OE will perform hydrogen addition using OEAddExplicitHydrogens

allow_undefined_stereobool, default=False

Whether to accept SMILES with undefined stereochemistry. If False, an exception will be raised if a SMILES with undefined stereochemistry is passed into this function.

Returns
moleculeopenforcefield.topology.Molecule

An openforcefield-style molecule.

generate_conformers(self, molecule, n_conformers=1, clear_existing=True)[source]

Generate molecule conformers using OpenEye Omega.

Warning

This API is experimental and subject to change.

moleculea Molecule

The molecule to generate conformers for.

n_conformersint, default=1

The maximum number of conformers to generate.

clear_existingbool, default=True

Whether to overwrite existing conformers for the molecule

compute_partial_charges(self, molecule, quantum_chemical_method='AM1-BCC', partial_charge_method='None')[source]

Compute partial charges with OpenEye quacpac

Warning

This API is experimental and subject to change.

Parameters
moleculeMolecule

Molecule for which partial charges are to be computed

charge_modelstr, optional, default=None

The charge model to use. One of [‘noop’, ‘mmff’, ‘mmff94’, ‘am1bcc’, ‘am1bccnosymspt’, ‘amber’, ‘amberff94’, ‘am1bccelf10’] If None, ‘am1bcc’ will be used.

Returns
chargesnumpy.array of shape (natoms) of type float

The partial charges

compute_partial_charges_am1bcc(self, molecule)[source]

Compute AM1BCC partial charges with OpenEye quacpac

Warning

This API is experimental and subject to change.

Parameters
moleculeMolecule

Molecule for which partial charges are to be computed

Returns
chargesnumpy.array of shape (natoms) of type float

The partial charges

compute_wiberg_bond_orders(self, molecule, charge_model=None)[source]

Update and store list of bond orders this molecule. Can be used for initialization of bondorders list, or for updating bond orders in the list.

Warning

This API is experimental and subject to change.

Parameters
moleculeopenforcefield.topology.molecule Molecule

The molecule to assign wiberg bond orders to

charge_modelstr, optional, default=None

The charge model to use. One of [‘am1’, ‘pm3’]. If None, ‘am1’ will be used.

find_smarts_matches(self, molecule, smarts, aromaticity_model='OEAroModel_MDL')[source]

Find all SMARTS matches for the specified molecule, using the specified aromaticity model.

Warning

This API is experimental and subject to change.

Parameters
moleculeopenforcefield.topology.Molecule

The molecule for which all specified SMARTS matches are to be located

smartsstr

SMARTS string with optional SMIRKS-style atom tagging

aromaticity_modelstr, optional, default=’OEAroModel_MDL’

Aromaticity model to use during matching

.. note :: Currently, the only supported ``aromaticity_model`` is ``OEAroModel_MDL``
property toolkit_file_read_formats

List of file formats that this toolkit can read.

property toolkit_file_write_formats

List of file formats that this toolkit can write.

property toolkit_installation_instructions

classmethod(function) -> method

Convert a function to be a class method.

A class method receives the class as implicit first argument, just like an instance method receives the instance. To declare a class method, use this idiom:

class C:

@classmethod def f(cls, arg1, arg2, …):

It can be called either on the class (e.g. C.f()) or on an instance (e.g. C().f()). The instance is ignored except for its class. If a class method is called for a derived class, the derived class object is passed as the implied first argument.

Class methods are different than C++ or Java static methods. If you want those, see the staticmethod builtin.

property toolkit_name

The name of the toolkit wrapped by this class.