rdkit.Chem.rdMolChemicalFeatures module — The RDKit 2025.09.6 documentation

# rdkit.Chem.rdMolChemicalFeatures module

Module containing from chemical feature and functions to generate the

rdkit.Chem.rdMolChemicalFeatures.BuildFeatureFactory((str)fileName) → MolChemicalFeatureFactory :

  Construct a feature factory given a feature definition in a file

  C++ signature :

    RDKit::MolChemicalFeatureFactory* BuildFeatureFactory(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

rdkit.Chem.rdMolChemicalFeatures.BuildFeatureFactoryFromString((str)fdefString) → MolChemicalFeatureFactory :

  Construct a feature factory given a feature definition block

  C++ signature :

    RDKit::MolChemicalFeatureFactory* BuildFeatureFactoryFromString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

rdkit.Chem.rdMolChemicalFeatures.GetAtomMatch((object)featMatch[, (int)maxAts=1024]) → object :
  Returns an empty list if any of the features passed in share an atom.

    Otherwise a list of lists of atom indices is returned.

  C++ signature :

    boost::python::api::object GetAtomMatch(boost::python::api::object [,int=1024])

class rdkit.Chem.rdMolChemicalFeatures.MolChemicalFeature

  Bases: `instance`

  Class to represent a chemical feature. These chemical features may or may not have been derived from molecule object; i.e. it is possible to have a chemical feature that was created just from its type and location.

  Raises an exception This class cannot be instantiated from Python

  ClearCache((MolChemicalFeature)self) → None :

    Clears the cache used to store position information.

    C++ signature :

      void ClearCache(RDKit::MolChemicalFeature {lvalue})

  GetActiveConformer((MolChemicalFeature)self) → int :

    Gets the conformer to use.

    C++ signature :

      int GetActiveConformer(RDKit::MolChemicalFeature {lvalue})

  GetAtomIds((MolChemicalFeature)self) → object :

    Get the IDs of the atoms that participate in the feature

    C++ signature :

      _object* GetAtomIds(RDKit::MolChemicalFeature)

  GetFactory((MolChemicalFeature)self) → MolChemicalFeatureFactory :

    Get the factory used to generate this feature

    C++ signature :

      RDKit::MolChemicalFeatureFactory const* GetFactory(RDKit::MolChemicalFeature {lvalue})

  GetFamily((MolChemicalFeature)self) → str :

    Get the family to which the feature belongs; donor, acceptor, etc.

    C++ signature :

      std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > GetFamily(RDKit::MolChemicalFeature {lvalue})

  GetId((MolChemicalFeature)self) → int :

    Returns the identifier of the feature

    C++ signature :

      int GetId(RDKit::MolChemicalFeature {lvalue})

  GetMol((MolChemicalFeature)self) → rdkit.Chem.rdchem.Mol :

    Get the molecule used to derive the features

    C++ signature :

      RDKit::ROMol const* GetMol(RDKit::MolChemicalFeature {lvalue})

  GetPos((MolChemicalFeature)self, (int)confId) → rdkit.Geometry.rdGeometry.Point3D :

    Get the location of the chemical feature

    > C++ signature :

    >   RDGeom::Point3D GetPos(RDKit::MolChemicalFeature {lvalue},int)

    GetPos( (MolChemicalFeature)self) -> rdkit.Geometry.rdGeometry.Point3D :

      Get the location of the default chemical feature (first position)

      C++ signature :

        RDGeom::Point3D GetPos(RDKit::MolChemicalFeature {lvalue})

  GetType((MolChemicalFeature)self) → str :

    Get the specific type for the feature

    C++ signature :

      std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > GetType(RDKit::MolChemicalFeature {lvalue})

  SetActiveConformer((MolChemicalFeature)self, (int)confId) → None :

    Sets the conformer to use (must be associated with a molecule).

    C++ signature :

      void SetActiveConformer(RDKit::MolChemicalFeature {lvalue},int)

class rdkit.Chem.rdMolChemicalFeatures.MolChemicalFeatureFactory

  Bases: `instance`

  Class to featurize a molecule

  Raises an exception This class cannot be instantiated from Python

  GetFeatureDefs((MolChemicalFeatureFactory)self) → dict :

    Get a dictionary with SMARTS definitions for each feature type

    C++ signature :

      boost::python::dict GetFeatureDefs(RDKit::MolChemicalFeatureFactory)

  GetFeatureFamilies((MolChemicalFeatureFactory)self) → tuple :

    Get a tuple of feature types

    C++ signature :

      boost::python::tuple GetFeatureFamilies(RDKit::MolChemicalFeatureFactory)

  GetMolFeature((MolChemicalFeatureFactory)self, (rdkit.Chem.rdchem.Mol)mol, (int)idx[, (str)includeOnly=''[, (bool)recompute=True[, (int)confId=-1]]]) → MolChemicalFeature :

    returns a particular feature (by index)

    C++ signature :

      boost::shared_ptr<RDKit::MolChemicalFeature> GetMolFeature(RDKit::MolChemicalFeatureFactory,RDKit::ROMol,int [,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >=’’ [,bool=True [,int=-1]]])

  GetNumFeatureDefs((MolChemicalFeatureFactory)self) → int :

    Get the number of feature definitions

    C++ signature :

      int GetNumFeatureDefs(RDKit::MolChemicalFeatureFactory {lvalue})

  GetNumMolFeatures((MolChemicalFeatureFactory)self, (rdkit.Chem.rdchem.Mol)mol[, (str)includeOnly='']) → int :

    Get the number of features the molecule has

    C++ signature :

      int GetNumMolFeatures(RDKit::MolChemicalFeatureFactory,RDKit::ROMol [,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >=’’])