ExplicitMoleculeComponent#

class gufe.components.explicitmoleculecomponent.ExplicitMoleculeComponent(rdkit: rdkit.Chem.rdchem.Mol, name: str = '')#

Base class for explicit molecules.

This provides basic serialization and conversion to different representations. Specific file formats, such as SDF for small molecules or PDB for proteins, should be implemented in subclasses.

Methods

from_json

Generate an instance from JSON keyed chain representation.

from_rdkit

Create a Component, copying from an RDKit Mol

to_json

Generate a JSON keyed chain representation.

to_rdkit

Return an RDKit copied representation of this molecule

Attributes

name

smiles

total_charge

Net formal charge for the Component, if defined.

classmethod from_json(json_str)#

Generate an instance from JSON keyed chain representation.

Can provide either a filepath/filelike as file, or JSON content via content.

Parameters:
  • file – A filepath or filelike object to read JSON data from.

  • content – A string to read JSON data from.

See also

to_json

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

Create a Component, copying from an RDKit Mol

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

Generate a JSON keyed chain representation.

This will be writen to the filepath or filelike object if passed.

Parameters:

file – A filepath or filelike object to write the JSON to.

Returns:

A minimal JSON representation of the object if file is None; else None.

Return type:

str

See also

from_json

to_rdkit() rdkit.Chem.rdchem.Mol#

Return an RDKit copied representation of this molecule

property total_charge#

Net formal charge for the Component, if defined.