openforcefield.utils.toolkits.
RDKitToolkitWrapper
[source]¶RDKit toolkit wrapper
Warning
This API is experimental and subject to change.
Attributes: |
|
---|
Methods
find_smarts_matches (molecule, smarts[, …]) |
Find all SMARTS matches for the specified molecule, using the specified aromaticity model. |
from_file (filename, file_format[, …]) |
Create 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 rdchem.Mol (or rdchem.Mol-derived object), this function will load it into an openforcefield.topology.molecule. |
from_rdkit (rdmol[, allow_undefined_stereo]) |
Create a Molecule from an RDKit molecule. |
from_smiles (smiles[, hydrogens_are_explicit]) |
Create a Molecule from a SMILES string using the RDKit toolkit. |
generate_conformers (molecule[, …]) |
Generate molecule conformers using RDKit. |
is_available () |
Check whether toolkit is available for use. |
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_rdkit (molecule[, aromaticity_model]) |
Create an RDKit molecule |
to_smiles (molecule) |
Uses the RDKit toolkit to convert a Molecule into a SMILES string. |
toolkit_is_available () |
Check whether the RDKit toolkit can be imported |
__init__
($self, /, *args, **kwargs)¶Initialize self. See help(type(self)) for accurate signature.
Methods
find_smarts_matches (molecule, smarts[, …]) |
Find all SMARTS matches for the specified molecule, using the specified aromaticity model. |
from_file (filename, file_format[, …]) |
Create 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 rdchem.Mol (or rdchem.Mol-derived object), this function will load it into an openforcefield.topology.molecule. |
from_rdkit (rdmol[, allow_undefined_stereo]) |
Create a Molecule from an RDKit molecule. |
from_smiles (smiles[, hydrogens_are_explicit]) |
Create a Molecule from a SMILES string using the RDKit toolkit. |
generate_conformers (molecule[, …]) |
Generate molecule conformers using RDKit. |
is_available () |
Check whether toolkit is available for use. |
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_rdkit (molecule[, aromaticity_model]) |
Create an RDKit molecule |
to_smiles (molecule) |
Uses the RDKit toolkit to convert a Molecule into a SMILES string. |
toolkit_is_available () |
Check whether the RDKit toolkit can be imported |
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. |
toolkit_is_available
()[source]¶Check whether the RDKit toolkit can be imported
Returns: |
|
---|
is_available
()[source]¶Check whether toolkit is available for use.
Parameters: |
|
---|
from_object
(object)[source]¶If given an rdchem.Mol (or rdchem.Mol-derived object), this function will load it into an openforcefield.topology.molecule. Otherwise, it will return False.
Parameters: |
|
---|---|
Returns: |
|
Raises: |
|
from_file
(filename, file_format, allow_undefined_stereo=False)[source]¶Create an openforcefield.topology.Molecule from a file using this toolkit.
Parameters: |
|
---|---|
Returns: |
|
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.
Warning
This API is experimental and subject to change.
Parameters: |
|
---|---|
Returns: |
|
to_file_obj
(molecule, file_obj, outfile_format)[source]¶Writes an OpenFF Molecule to a file-like object
Parameters: |
|
---|
to_file
(molecule, outfile, outfile_format)[source]¶Writes an OpenFF Molecule to a file-like object
Parameters: |
|
---|
to_smiles
(molecule)[source]¶Uses the RDKit toolkit to convert a Molecule into a SMILES string.
Parameters: |
|
---|---|
Returns: |
|
from_smiles
(smiles, hydrogens_are_explicit=False)[source]¶Create a Molecule from a SMILES string using the RDKit toolkit.
Warning
This API is experimental and subject to change.
Parameters: |
|
---|---|
Returns: |
|
generate_conformers
(molecule, num_conformers=1, clear_existing=True)[source]¶Generate molecule conformers using RDKit.
Warning
This API is experimental and subject to change.
Todo
Molecule
from_rdkit
(rdmol, allow_undefined_stereo=False)[source]¶Create a Molecule from an RDKit molecule.
Requires the RDKit to be installed.
Warning
This API is experimental and subject to change.
Parameters: |
|
---|---|
Returns: |
|
Examples
Create a molecule from an RDKit molecule
>>> from rdkit import Chem
>>> from openforcefield.tests.utils import get_data_filename
>>> rdmol = Chem.MolFromMolFile(get_data_filename('systems/monomers/ethanol.sdf'))
>>> toolkit_wrapper = RDKitToolkitWrapper()
>>> molecule = toolkit_wrapper.from_rdkit(rdmol)
to_rdkit
(molecule, aromaticity_model='OEAroModel_MDL')[source]¶Create an RDKit molecule
Requires the RDKit to be installed.
Warning
This API is experimental and subject to change.
Parameters: |
|
---|---|
Returns: |
|
Examples
Convert a molecule to RDKit
>>> from openforcefield.topology import Molecule
>>> ethanol = Molecule.from_smiles('CCO')
>>> rdmol = ethanol.to_rdkit()
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: |
|
---|
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.