rdkit.Chem.rdShapeAlign module — The RDKit 2025.09.6 documentation

# rdkit.Chem.rdShapeAlign module

rdkit.Chem.rdShapeAlign.AlignMol((rdkit.Chem.rdchem.Mol)ref, (rdkit.Chem.rdchem.Mol)probe[, (int)refConfId=-1[, (int)probeConfId=-1[, (bool)useColors=True[, (float)opt_param=1.0[, (int)max_preiters=10[, (int)max_postiters=30]]]]]]) → tuple :

  Aligns a probe molecule to a reference molecule. The probe is modified.

  > refRDKit.ROMol

  >   Reference molecule

  > probeRDKit.ROMol

  >   Probe molecule

  > refConfIdint, optional

  >   Reference conformer ID (default is -1)

  > probeConfIdint, optional

  >   Probe conformer ID (default is -1)

  > useColorsbool, optional

  >   Whether or not to use colors in the scoring (default is True)

  > opt_paramfloat, optional

  >   Balance of shape and color for optimization. 0 is only color, 0.5 is equal weight, and 1.0 is only shape. Default is 1.0.

  > max_preitersint, optional

  >   In the two phase optimization, the maximum iterations done on all poses.

  > max_postitersint, optional

  >   In the two phase optimization, the maximum iterations during the second phase on only the best poses from the first phase

  > > 2-tuple of doubles

  > >   The results are (shape_score, color_score) The color_score is zero if opt_param is 1.0.

  > C++ signature :

  >   boost::python::tuple AlignMol(RDKit::ROMol,RDKit::ROMol {lvalue} [,int=-1 [,int=-1 [,bool=True [,double=1.0 [,unsigned int=10 [,unsigned int=30]]]]]])

  AlignMol( (rdkit.Chem.rdchem.Mol)ref, (rdkit.Chem.rdchem.Mol)probe, (ShapeInputOptions)refShapeOpts, (ShapeInputOptions)probeShapeOpts [, (int)refConfId=-1 [, (int)probeConfId=-1 [, (float)opt_param=1.0 [, (int)max_preiters=10 [, (int)max_postiters=30]]]]]) -> tuple :

    Aligns a probe molecule to a reference molecule. The probe is modified.

    refRDKit.ROMol

      Reference molecule

    probeRDKit.ROMol

      Probe molecule

    refShapeOptsShapeInputOptions

      Options for constructing the shape for the reference molecule

    probeShapeOptsShapeInputOptions

      Options for constructing the shape for the probe molecule

    refConfIdint, optional

      Reference conformer ID (default is -1)

    probeConfIdint, optional

      Probe conformer ID (default is -1)

    opt_paramfloat, optional

      Balance of shape and color for optimization. 0 is only color, 0.5 is equal weight, and 1.0 is only shape. Default is 1.0.

    max_preitersint, optional

      In the two phase optimization, the maximum iterations done on all poses.

    max_postitersint, optional

      In the two phase optimization, the maximum iterations during the second phase on only the best poses from the first phase

    > 2-tuple of doubles

    >   The results are (shape_score, color_score) The color_score is zero if opt_param is 1.0.

    C++ signature :

      boost::python::tuple AlignMol(RDKit::ROMol,RDKit::ROMol {lvalue},ShapeInputOptions,ShapeInputOptions [,int=-1 [,int=-1 [,double=1.0 [,unsigned int=10 [,unsigned int=30]]]]])

  AlignMol( (ShapeInput)refShape, (rdkit.Chem.rdchem.Mol)probe [, (int)probeConfId=-1 [, (bool)useColors=True [, (float)opt_param=1.0 [, (int)max_preiters=10 [, (int)max_postiters=30 [, (bool)applyRefShift=False]]]]]]) -> tuple :

    Aligns a probe molecule to a reference shape. The probe is modified. Assumes the shapes are both centred on the origin.

    refShapeShapeInput

      Reference shape

    probeRDKit.ROMol

      Probe molecule

    probeConfIdint, optional

      Probe conformer ID (default is -1)

    useColorsbool, optional

      Whether or not to use colors in the scoring (default is True)

    opt_paramfloat, optional

      Balance of shape and color for optimization. 0 is only color, 0.5 is equal weight, and 1.0 is only shape. Default is 1.0.

    max_preitersint, optional

      In the two phase optimization, the maximum iterations done on all poses.

    max_postitersint, optional

      In the two phase optimization, the maximum iterations during the second phase on only the best poses from the first phase

    applyRefShiftbool, optional

      If True, apply the reference shape’s shift translation to the final coordinates.

    > 2-tuple of doubles

    >   The results are (shape_score, color_score) The color_score is zero if opt_param is 1.0.

    C++ signature :

      boost::python::tuple AlignMol(ShapeInput,RDKit::ROMol {lvalue} [,int=-1 [,bool=True [,double=1.0 [,unsigned int=10 [,unsigned int=30 [,bool=False]]]]]])

rdkit.Chem.rdShapeAlign.AlignShapes((ShapeInput)refShape, (ShapeInput)probeShape[, (float)opt_param=1.0[, (int)max_preiters=10[, (int)max_postiters=30]]]) → tuple :

  Aligns a probe shape to a reference shape. The probe is modified.

  Parameters:

    - refShape (ShapeInput) – Reference shape

    - probeShape (ShapeInput) – Probe shape

    - opt_param (float, optional) – Balance of shape and color for optimization. 0 is only color, 0.5 is equal weight, and 1.0 is only shape

    - max_preiters (int, optional) – In the two phase optimization, the maximum iterations done on all poses.

    - max_postiters (int, optional) – In the two phase optimization, the maximum iterations during the second phase on only the best poses from the first phase

  Returns:

    The results are (shape_score, color_score, matrix) The matrix is a 12-float list giving the transformation matrix that overlays the probe onto the reference.

  Return type:

    3-tuple of double, double, list of doubles

  C++ signature :

    boost::python::tuple AlignShapes(ShapeInput,ShapeInput {lvalue} [,double=1.0 [,unsigned int=10 [,unsigned int=30]]])

class rdkit.Chem.rdShapeAlign.FloatVector((object)arg1) → None :

  Bases: `instance`

  C++ signature :

    void __init__(_object*)

  append((FloatVector)arg1, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)arg2) → None :
    C++ signature :

      void append(std::vector<float, std::allocator<float> > {lvalue},boost::python::api::object)

  extend((FloatVector)arg1, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)arg2) → None :
    C++ signature :

      void extend(std::vector<float, std::allocator<float> > {lvalue},boost::python::api::object)

rdkit.Chem.rdShapeAlign.PrepareConformer((rdkit.Chem.rdchem.Mol)mol[, (int)confId=-1[, (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)opts=None]]) → ShapeInput :

  Generates a ShapeInput object for a molecule

  Parameters:

    - mol (RDKit.ROMol) – Reference molecule

    - confId (int, optional) – Conformer ID to use (default is -1)

    - opts (ShapeInputOptions, optional) – Options for Shapeinput

  Return type:

    a ShapeInput for the molecule

  C++ signature :

    ShapeInput* PrepareConformer(RDKit::ROMol [,int=-1 [,boost::python::api::object=None]])

rdkit.Chem.rdShapeAlign.ScoreMol((rdkit.Chem.rdchem.Mol)mol1, (rdkit.Chem.rdchem.Mol)mol2, (ShapeInputOptions)mol1ShapeOpts, (ShapeInputOptions)mol2ShapeOpts[, (int)mol1ConfId=-1[, (int)mol2ConfId=-1]]) → tuple :

  Calculate the scores between a shape and a molecule without moving them.

  > mol1RDKit.ROMol

  >   First molecule

  > mol2RDKit.ROMol

  >   Second molecule

  > mol1ShapeOptions:

  >   Options for constructing the shape for molecule 1

  > mol2ShapeOptions:

  >   Options for constructing the shape for molecule 2

  > mol1ConfIdint, optional

  >   First molecule conformer ID (default is -1)

  > mol2ConfIdint, optional

  >   Second conformer ID (default is -1)

  > > 2-tuple of doubles

  > >   The results are (shape_score, color_score) The color_score is zero if useColors is False for either of the

  > shape options

  > C++ signature :

  >   boost::python::tuple ScoreMol(RDKit::ROMol,RDKit::ROMol {lvalue},ShapeInputOptions,ShapeInputOptions [,int=-1 [,int=-1]])

  ScoreMol( (ShapeInput)shape, (rdkit.Chem.rdchem.Mol)mol, (ShapeInputOptions)molShapeOpts [, (int)molConfId=-1]) -> tuple :

    Calculate the scores between 2 molecules without moving them.

    shapeShapeInput

      Shape

    molRDKit.ROMol

      Molecule

    molShapeOptions:

      Options for constructing the shape for molecule

    molConfIdint, optional

      Molecule conformer ID (default is -1)

    > 2-tuple of doubles

    >   The results are (shape_score, color_score) The color_score is zero if shape.useColors is False

    C++ signature :

      boost::python::tuple ScoreMol(ShapeInput,RDKit::ROMol {lvalue},ShapeInputOptions [,int=-1])

rdkit.Chem.rdShapeAlign.ScoreShape((ShapeInput)shape1, (ShapeInput)shape2[, (bool)useColors=False]) → tuple :

  Calculate the scores between 2 shapes without moving them.

  Parameters:

    - shape1 (ShapeInput) – Shape

    - shape2 (ShapeInput) – Shape

    - useColors (bool) – Whether to use colors for the score or not.

  Returns:

    The results are (shape_score, color_score) The color_score is zero if useColors is False

  Return type:

    2-tuple of doubles

  C++ signature :

    boost::python::tuple ScoreShape(ShapeInput,ShapeInput {lvalue} [,bool=False])

class rdkit.Chem.rdShapeAlign.ShapeInput

  Bases: `instance`

  Raises an exception This class cannot be instantiated from Python

  property alpha_vector

    None( (rdkit.Chem.rdShapeAlign.ShapeInput)arg1) -> rdkit.rdBase._vectd:

    C++ signature :

      std::vector<double, std::allocator<double> > {lvalue} None(ShapeInput {lvalue})

  property atom_type_vector

    None( (rdkit.Chem.rdShapeAlign.ShapeInput)arg1) -> rdkit.rdBase._vectj:

    C++ signature :

      std::vector<unsigned int, std::allocator<unsigned int> > {lvalue} None(ShapeInput {lvalue})

  property coord

    None( (rdkit.Chem.rdShapeAlign.ShapeInput)arg1) -> rdkit.Chem.rdShapeAlign.FloatVector:

    C++ signature :

      std::vector<float, std::allocator<float> > {lvalue} None(ShapeInput {lvalue})

  property inertialRot

    Rotation applied to put the shape into its principal axes frame of reference.

  property shift

    Translation of centre of shape coordinates to origin.

  property sof

    None( (rdkit.Chem.rdShapeAlign.ShapeInput)arg1) -> float:

    C++ signature :

      double {lvalue} None(ShapeInput {lvalue})

  property sov

    None( (rdkit.Chem.rdShapeAlign.ShapeInput)arg1) -> float:

    C++ signature :

      double {lvalue} None(ShapeInput {lvalue})

  property volumeAtomIndexVector

    None( (rdkit.Chem.rdShapeAlign.ShapeInput)arg1) -> rdkit.rdBase._vectj:

    C++ signature :

      std::vector<unsigned int, std::allocator<unsigned int> > {lvalue} None(ShapeInput {lvalue})

class rdkit.Chem.rdShapeAlign.ShapeInputOptions((object)arg1) → None :

  Bases: `instance`

  Shape Input Options

  C++ signature :

    void __init__(_object*)

  property atomRadii

    Non-standard radii to use for the atoms specified by their indices in the molecule. A list of tuples of [int, float].

  property atomSubset

    If not empty, use just these atoms in the molecule to form the ShapeInput object.

  property customFeatures

    Custom features for the shape.

  property dummyRadius

    If using dummy atoms in the alignment, what radius to use for them. Default=2.16 (the radius of Xe).

  property includeDummies

    Whether to use dummy atoms in the alignment. Default=False.

  property normalize

    Whether to normalise the shape by putting intoits inertial frame. Default=True.

  property notColorAtoms

    Any atoms mentioned here by index should not be used in a color feature.

  property useColors

    Whether to use colors (pharmacophore features) in the score. Default=True.

rdkit.Chem.rdShapeAlign.TransformConformer((list)arg1, (list)finalTrans, (list)matrix, (ShapeInput)probeShape, (rdkit.Chem.rdchem.Conformer)probeConformer) → None :

  Assuming that probeShape has been overlaid onto refShape to give the supplied transformation matrix, applies that transformation to the

  > given conformer.

  Parameters:

    - finalTrans (list[float * 3]) – The final translation to apply to conformer.

    - matrix (list[float * 12]) – The transformation matrix

    - probeShape (ShapeInput) – Probe shape

    - probeConformer (Conformer) – Probe conformer

  C++ signature :

    void TransformConformer(boost::python::list,boost::python::list,boost::python::list,ShapeInput,RDKit::Conformer {lvalue})