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

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.

to_sdf() str#

Create a string based on SDF.

See also

from_sdf_string()

create an object from the output of this

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

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

to_openff()#

OpenFF Toolkit representation of this molecule

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

Construct from an OpenFF toolkit Molecule

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

Create a Component, copying from an RDKit Mol

property name: str#
property smiles: str#
to_json()#
to_rdkit() Mol#

Return an RDKit copied representation of this molecule

property total_charge#

Net formal charge for the Component, if defined.