openff.toolkit.utils.toolkits.ToolkitWrapper

class openff.toolkit.utils.toolkits.ToolkitWrapper[source]

Toolkit wrapper base class.

Warning

This API is experimental and subject to change.

__init__(*args, **kwargs)

Methods

__init__(*args, **kwargs)

from_file(file_path, file_format[, ...])

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

from_file_obj(file_obj, file_format[, ...])

Return an openff.toolkit.topology.Molecule from a file-like object (an object with a ".read()" method using this toolkit.

is_available()

Check whether the corresponding toolkit can be imported

requires_toolkit()

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

Instructions on how to install the wrapped toolkit.

toolkit_name

Return the name of the toolkit wrapped by this class as a str

toolkit_version

Return the version of the wrapped toolkit as a str

property toolkit_name

Return the name of the toolkit wrapped by this class as a str

Warning

This API is experimental and subject to change.

Returns
toolkit_namestr

The name of the wrapped toolkit

property toolkit_installation_instructions

Instructions on how to install the wrapped toolkit.

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.

classmethod is_available()[source]

Check whether the corresponding toolkit can be imported

Returns
is_installedbool

True if corresponding toolkit is installed, False otherwise.

property toolkit_version

Return the version of the wrapped toolkit as a str

Warning

This API is experimental and subject to change.

Returns
toolkit_versionstr

The version of the wrapped toolkit

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

Return an openff.toolkit.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 any molecules contain undefined stereochemistry.

_clsclass

Molecule constructor

Returns
——-
moleculesMolecule or list of Molecules

a list of Molecule objects is returned.

from_file_obj(file_obj, file_format, allow_undefined_stereo=False, _cls=None)[source]

Return an openff.toolkit.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 any molecules contain undefined stereochemistry. If false, the function skips loading the molecule.

_clsclass

Molecule constructor

Returns
moleculesMolecule or list of Molecules

a list of Molecule objects is returned.