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(molecule[, …]) Compute partial charges with OpenEye quacpac
compute_partial_charges_am1bcc(molecule) Compute AM1BCC partial charges with OpenEye quacpac
compute_wiberg_bond_orders(molecule[, …]) Update and store list of bond orders this molecule.
find_smarts_matches(molecule, smarts[, …]) Find all SMARTS matches for the specified molecule, using the specified aromaticity model.
from_file(filename, file_format[, …]) Return an openforcefield.topology.Molecule from a file using this toolkit.
from_file_obj(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(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(smiles[, hydrogens_are_explicit]) Create a Molecule from a SMILES string using the OpenEye toolkit.
generate_conformers(molecule[, …]) Generate molecule conformers using OpenEye Omega.
is_available() Check whether this toolkit wrapper is available for use because the underlying toolkit can be found.
requires_toolkit()
to_file(molecule, outfile, outfile_format) Writes an OpenFF Molecule to a file-like object
to_file_obj(molecule, file_obj, outfile_format) 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.
toolkit_is_available([oetools]) Check if the given OpenEye toolkit components are available.
__init__($self, /, *args, **kwargs)

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

Methods

compute_partial_charges(molecule[, …]) Compute partial charges with OpenEye quacpac
compute_partial_charges_am1bcc(molecule) Compute AM1BCC partial charges with OpenEye quacpac
compute_wiberg_bond_orders(molecule[, …]) Update and store list of bond orders this molecule.
find_smarts_matches(molecule, smarts[, …]) Find all SMARTS matches for the specified molecule, using the specified aromaticity model.
from_file(filename, file_format[, …]) Return an openforcefield.topology.Molecule from a file using this toolkit.
from_file_obj(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(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(smiles[, hydrogens_are_explicit]) Create a Molecule from a SMILES string using the OpenEye toolkit.
generate_conformers(molecule[, …]) Generate molecule conformers using OpenEye Omega.
is_available() Check whether this toolkit wrapper is available for use because the underlying toolkit can be found.
requires_toolkit()
to_file(molecule, outfile, outfile_format) Writes an OpenFF Molecule to a file-like object
to_file_obj(molecule, file_obj, outfile_format) 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.
toolkit_is_available([oetools]) Check if the given OpenEye toolkit components are available.

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 toolkit_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:
oetools : str 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_installed : bool

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

classmethod is_available()[source]

Check whether this toolkit wrapper is available for use because the underlying toolkit can be found.

Note

This method caches the result of any costly checks for file paths or module imports.

Parameters:
is_available : bool

True if toolkit wrapper is available for use, False otherwise

from_object(object)[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:
object : A molecule-like object

An object to by type-checked.

Returns:
Molecule

An openforcefield.topology.molecule Molecule.

Raises:
NotImplementedError

If the object could not be converted into a Molecule.

from_file(filename, file_format, allow_undefined_stereo=False)[source]

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

Parameters:
filename : str

The file to read the molecule from

file_format : str

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_stereo : bool, default=False

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

Returns:
molecules : list of Molecules

a list of Molecule objects is returned.

Raises:
GAFFAtomTypeWarning

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

from_file_obj(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_obj : file-like object

The file-like object to read the molecule from

file_format : str

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_stereo : bool, default=False

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

Returns:
molecules : Molecule or list of Molecules

a list of Molecule objects is

to_file_obj(molecule, file_obj, outfile_format)[source]

Writes an OpenFF Molecule to a file-like object

Parameters:
molecule : an OpenFF Molecule

The molecule to write

file_obj

The file-like object to write to

outfile_format

The format for writing the molecule data

to_file(molecule, outfile, outfile_format)[source]

Writes an OpenFF Molecule to a file-like object

Parameters:
molecule : an OpenFF Molecule

The molecule to write

outfile

The filename to write to

outfile_format

The format for writing the molecule data

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

Create a Molecule from an OpenEye molecule.

Warning

This API is experimental and subject to change.

Parameters:
oemol : openeye.oechem.OEMol

An OpenEye molecule

allow_undefined_stereo : bool, default=False

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

Returns:
molecule : openforcefield.topology.Molecule

An openforcefield molecule

Examples

Create a Molecule from an OpenEye OEMol

>>> from openeye import oechem
>>> from openforcefield.tests.utils import get_data_filename
>>> ifs = oechem.oemolistream(get_data_filename('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

Todo

  • Should the aromaticity model be specified in some other way?

Warning

This API is experimental and subject to change.

Parameters:
molecule : openforcefield.topology.molecule.Molecule object

The molecule to convert to an OEMol

aromaticity_model : str, optional, default=DEFAULT_AROMATICITY_MODEL

The aromaticity model to use

Returns:
oemol : openeye.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:
molecule : An openforcefield.topology.Molecule

The molecule to convert into a SMILES.

Returns:
smiles : str

The SMILES of the input molecule.

from_smiles(smiles, hydrogens_are_explicit=False)[source]

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

Warning

This API is experimental and subject to change.

Parameters:
smiles : str

The SMILES string to turn into a molecule

hydrogens_are_explicit : bool, default = False

If False, OE will perform hydrogen addition using OEAddExplicitHydrogens

Returns:
molecule : openforcefield.topology.Molecule

An openforcefield-style molecule.

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

Generate molecule conformers using OpenEye Omega.

Warning

This API is experimental and subject to change.

Todo

  • which parameters should we expose? (or can we implement a general system with **kwargs?)
  • will the coordinates be returned in the OpenFF Molecule’s own indexing system? Or is there a chance that

they’ll get reindexed when we convert the input into an OEmol?

molecule : a Molecule
The molecule to generate conformers for.
num_conformers : int, default=1
The maximum number of conformers to generate.
clear_existing : bool, default=True
Whether to overwrite existing conformers for the molecule
compute_partial_charges(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.

Todo

  • Should the default be ELF?
  • Can we expose more charge models?
Parameters:
molecule : Molecule

Molecule for which partial charges are to be computed

charge_model : str, 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:
charges : numpy.array of shape (natoms) of type float

The partial charges

compute_partial_charges_am1bcc(molecule)[source]

Compute AM1BCC partial charges with OpenEye quacpac

Warning

This API is experimental and subject to change.

Todo

  • Should the default be ELF?
  • Can we expose more charge models?
Parameters:
molecule : Molecule

Molecule for which partial charges are to be computed

Returns:
charges : numpy.array of shape (natoms) of type float

The partial charges

compute_wiberg_bond_orders(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:
molecule : openforcefield.topology.molecule Molecule

The molecule to assign wiberg bond orders to

charge_model : str, optional, default=None

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

find_smarts_matches(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:
molecule : openforcefield.topology.Molecule

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

smarts : str

SMARTS string with optional SMIRKS-style atom tagging

aromaticity_model : str, optional, default=’OEAroModel_MDL’

Aromaticity model to use during matching

.. note :: Currently, the only supported ``aromaticity_model`` is ``OEAroModel_MDL``
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

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.

toolkit_name

The name of the toolkit wrapped by this class.