SmallMoleculeComponent#

class openfe.setup.system.SmallMoleculeComponent(rdkit: Mol, name: str = '')#

Bases: ExplicitMoleculeComponent

Component representing a small molecule.

Note

This class is a read-only representation of a molecule, if you want to edit the molecule do this in an appropriate toolkit before creating an instance from this class.

This class supports reading/writing to the .sdf format, which is suited to smaller molecules. Ligands alchemically mutated in a free energy calculation are typically represented with this class.

The name can be explicitly set by the name attribute, or implicitly set based on the tags in the input molecular representation (if supported, as with RDKit). If not explicitly set on creation, the molecule will first look for an OpenFE-specific tag ofe-name, and if that doesn’t exist, for a commonly-used naming tag (e.g., the _Name property for RDKit molecules). If no name is found, the empty string is used.

Parameters:
  • rdkit (rdkit.Chem.rdchem.Mol) – rdkit representation of the molecule

  • name (str, optional) – A human readable tag for this molecule. This name will be used in the hash.

Methods

from_openff

Construct from an OpenFF toolkit Molecule

from_sdf_file

Create SmallMoleculeComponent from SDF file.

from_sdf_string

Create SmallMoleculeComponent from SDF-formatted string.

to_openff

OpenFF Toolkit representation of this molecule

to_sdf

Create a string based on SDF.

classmethod from_json(json_str)#
classmethod from_openff(openff, name: str = '')#

Construct from an OpenFF toolkit Molecule

classmethod from_rdkit(rdkit: Mol, name: str = '')#

Create a Component, copying from an RDKit Mol

classmethod from_sdf_file(filename: str)#

Create SmallMoleculeComponent from SDF file.

Parameters:

filename (str) – name of SDF file

Returns:

the deserialized molecule

Return type:

SmallMoleculeComponent

classmethod from_sdf_string(sdf_str: str)#

Create SmallMoleculeComponent from SDF-formatted string.

Parameters:

sdf_str (str) – input string in SDF format

Returns:

the deserialized molecule

Return type:

SmallMoleculeComponent

property name: str#
property smiles: str#
to_json()#
to_openff()#

OpenFF Toolkit representation of this molecule

to_rdkit() Mol#

Return an RDKit copied representation of this molecule

to_sdf() str#

Create a string based on SDF.

See also

from_sdf_string()

create an object from the output of this

property total_charge#

Net formal charge for the Component, if defined.