rdkit.Geometry.rdGeometry module — The RDKit 2025.09.6 documentation

# rdkit.Geometry.rdGeometry module

Module containing geometry objects like points, grids, etc

rdkit.Geometry.rdGeometry.ComputeDihedralAngle((Point3D)pt1, (Point3D)pt2, (Point3D)pt3, (Point3D)pt4) → float :

  calculates the dihedral angle determined by four Point3D objects

  C++ signature :

    double ComputeDihedralAngle(RDGeom::Point3D,RDGeom::Point3D,RDGeom::Point3D,RDGeom::Point3D)

rdkit.Geometry.rdGeometry.ComputeGridCentroid((UniformGrid3D_)grid, (Point3D)pt, (float)windowRadius) → tuple :

  Compute the grid point at the center of sphere around a Point3D

  C++ signature :

    boost::python::tuple ComputeGridCentroid(RDGeom::UniformGrid3D,RDGeom::Point3D,double)

rdkit.Geometry.rdGeometry.ComputeSignedDihedralAngle((Point3D)pt1, (Point3D)pt2, (Point3D)pt3, (Point3D)pt4) → float :

  calculates the signed dihedral angle determined by four Point3D objects

  C++ signature :

    double ComputeSignedDihedralAngle(RDGeom::Point3D,RDGeom::Point3D,RDGeom::Point3D,RDGeom::Point3D)

rdkit.Geometry.rdGeometry.FindGridTerminalPoints((UniformGrid3D_)grid, (float)windowRadius, (float)inclusionFraction) → tuple :

  Find a grid’s terminal points (defined in the subshape algorithm).

  C++ signature :

    boost::python::tuple FindGridTerminalPoints(RDGeom::UniformGrid3D,double,double)

class rdkit.Geometry.rdGeometry.Point2D((object)self) → None :

  Bases: `instance`

  A class to represent a two-dimensional point

  Default Constructor

  > C++ signature :

  >   void __init__(_object*)

  __init__( (object)self, (float)xv, (float)yv) -> None :

  > C++ signature :

  >   void __init__(_object*,double,double)

  __init__( (object)self, (Point3D)other) -> None :

    construct from a Point3D (ignoring the z component)

    C++ signature :

      void __init__(_object*,RDGeom::Point3D)

  AngleTo((Point2D)self, (Point2D)other) → float :

    determines the angle between a vector to this point (between 0 and PI)

    C++ signature :

      double AngleTo(RDGeom::Point2D {lvalue},RDGeom::Point2D)

  DirectionVector((Point2D)self, (Point2D)other) → Point2D :

    return a normalized direction vector from this point to another

    C++ signature :

      RDGeom::Point2D DirectionVector(RDGeom::Point2D {lvalue},RDGeom::Point2D)

  DotProduct((Point2D)self, (Point2D)other) → float :

    Dot product with another point

    C++ signature :

      double DotProduct(RDGeom::Point2D {lvalue},RDGeom::Point2D)

  Length((Point2D)self) → float :

    Length of the vector

    C++ signature :

      double Length(RDGeom::Point2D {lvalue})

  LengthSq((Point2D)self) → float :

    Square of the length

    C++ signature :

      double LengthSq(RDGeom::Point2D {lvalue})

  Normalize((Point2D)self) → None :

    Normalize the vector (using L2 norm)

    C++ signature :

      void Normalize(RDGeom::Point2D {lvalue})

  SignedAngleTo((Point2D)self, (Point2D)other) → float :

    determines the signed angle between a vector to this point (between 0 and 2*PI)

    C++ signature :

      double SignedAngleTo(RDGeom::Point2D {lvalue},RDGeom::Point2D)

  property x

    None( (rdkit.Geometry.rdGeometry.Point2D)arg1) -> float:

    C++ signature :

      double {lvalue} None(RDGeom::Point2D {lvalue})

  property y

    None( (rdkit.Geometry.rdGeometry.Point2D)arg1) -> float:

    C++ signature :

      double {lvalue} None(RDGeom::Point2D {lvalue})

class rdkit.Geometry.rdGeometry.Point3D((object)self) → None :

  Bases: `instance`

  A class to represent a three-dimensional point The x, y, and z coordinates can be read and written using either attributes (i.e. pt.x = 4) or indexing (i.e. pt[0] = 4).

  Default Constructor

  > C++ signature :

  >   void __init__(_object*)

  __init__( (object)self, (float)xv, (float)yv, (float)zv) -> None :

  > C++ signature :

  >   void __init__(_object*,double,double,double)

  AngleTo((Point3D)self, (Point3D)other) → float :

    determines the angle between a vector to this point (between 0 and PI)

    C++ signature :

      double AngleTo(RDGeom::Point3D {lvalue},RDGeom::Point3D)

  CrossProduct((Point3D)self, (Point3D)other) → Point3D :

    Get the cross product between two points

    C++ signature :

      RDGeom::Point3D CrossProduct(RDGeom::Point3D {lvalue},RDGeom::Point3D)

  DirectionVector((Point3D)self, (Point3D)other) → Point3D :

    return a normalized direction vector from this point to another

    C++ signature :

      RDGeom::Point3D DirectionVector(RDGeom::Point3D {lvalue},RDGeom::Point3D)

  Distance((Point3D)self, (Point3D)pt2) → float :

    Distance from this point to another point

    C++ signature :

      double Distance(RDGeom::Point3D,RDGeom::Point3D)

  DotProduct((Point3D)self, (Point3D)other) → float :

    Dot product with another point

    C++ signature :

      double DotProduct(RDGeom::Point3D {lvalue},RDGeom::Point3D)

  Length((Point3D)self) → float :

    Length of the vector

    C++ signature :

      double Length(RDGeom::Point3D {lvalue})

  LengthSq((Point3D)self) → float :

    Square of the length

    C++ signature :

      double LengthSq(RDGeom::Point3D {lvalue})

  Normalize((Point3D)self) → None :

    Normalize the vector (using L2 norm)

    C++ signature :

      void Normalize(RDGeom::Point3D {lvalue})

  SignedAngleTo((Point3D)self, (Point3D)other) → float :

    determines the signed angle between a vector to this point (between 0 and 2*PI)

    C++ signature :

      double SignedAngleTo(RDGeom::Point3D {lvalue},RDGeom::Point3D)

  property x

    None( (rdkit.Geometry.rdGeometry.Point3D)arg1) -> float:

    C++ signature :

      double {lvalue} None(RDGeom::Point3D {lvalue})

  property y

    None( (rdkit.Geometry.rdGeometry.Point3D)arg1) -> float:

    C++ signature :

      double {lvalue} None(RDGeom::Point3D {lvalue})

  property z

    None( (rdkit.Geometry.rdGeometry.Point3D)arg1) -> float:

    C++ signature :

      double {lvalue} None(RDGeom::Point3D {lvalue})

class rdkit.Geometry.rdGeometry.PointND((object)self, (int)dim) → None :

  Bases: `instance`

  A class to represent an N-dimensional point

  C++ signature :

    void __init__(_object*,unsigned int)

  AngleTo((PointND)self, (PointND)other) → float :

    determines the angle between a vector to this point (between 0 and PI)

    C++ signature :

      double AngleTo(RDGeom::PointND {lvalue},RDGeom::PointND)

  DirectionVector((PointND)self, (PointND)other) → PointND :

    return a normalized direction vector from this point to another

    C++ signature :

      RDGeom::PointND DirectionVector(RDGeom::PointND {lvalue},RDGeom::PointND)

  Distance((Point3D)self, (Point3D)pt2) → float :

    Distance from this point to another point

    C++ signature :

      double Distance(RDGeom::Point3D,RDGeom::Point3D)

  DotProduct((PointND)self, (PointND)other) → float :

    Dot product with another point

    C++ signature :

      double DotProduct(RDGeom::PointND {lvalue},RDGeom::PointND)

  Length((PointND)self) → float :

    Length of the vector

    C++ signature :

      double Length(RDGeom::PointND {lvalue})

  LengthSq((PointND)self) → float :

    Square of the length

    C++ signature :

      double LengthSq(RDGeom::PointND {lvalue})

  Normalize((PointND)self) → None :

    Normalize the vector (using L2 norm)

    C++ signature :

      void Normalize(RDGeom::PointND {lvalue})

rdkit.Geometry.rdGeometry.ProtrudeDistance((UniformGrid3D_)grid1, (UniformGrid3D_)grid2) → float :

  Compute the protrude distance between two grid objects

  C++ signature :

    double ProtrudeDistance(RDGeom::UniformGrid3D,RDGeom::UniformGrid3D)

rdkit.Geometry.rdGeometry.TanimotoDistance((UniformGrid3D_)grid1, (UniformGrid3D_)grid2) → float :

  Compute the tanimoto distance between two grid objects

  C++ signature :

    double TanimotoDistance(RDGeom::UniformGrid3D,RDGeom::UniformGrid3D)

rdkit.Geometry.rdGeometry.TverskyIndex((UniformGrid3D_)grid1, (UniformGrid3D_)grid2, (float)alpha, (float)beta) → float :

  Compute the tversky index between two grid objects

  C++ signature :

    double TverskyIndex(RDGeom::UniformGrid3D,RDGeom::UniformGrid3D,double,double)

rdkit.Geometry.rdGeometry.UniformGrid3D((float)dimX, (float)dimY, (float)dimZ[, (float)spacing=0.5[, (rdkit.DataStructs.cDataStructs.DiscreteValueType)valType=rdkit.DataStructs.cDataStructs.DiscreteValueType.TWOBITVALUE[, (Point3D)offSet=None]]]) → UniformGrid3D_ :

  Faking the constructor

  C++ signature :

    RDGeom::UniformGrid3D* UniformGrid3D(double,double,double [,double=0.5 [,RDKit::DiscreteValueVect::DiscreteValueType=rdkit.DataStructs.cDataStructs.DiscreteValueType.TWOBITVALUE [,RDGeom::Point3D const*=None]]])

class rdkit.Geometry.rdGeometry.UniformGrid3D_((object)self, (str)pkl) → None :

  Bases: `instance`

  Class to represent a uniform three-dimensional cubic grid. Each grid point can store a poisitive integer value. For the sake of efficiency these value can either be binary, fit in 2, 4, 8 or 16 bits

  pickle constructor

  C++ signature :

    void __init__(_object*,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

  CompareParams((UniformGrid3D_)self, (UniformGrid3D_)other) → bool :

    Compare the parameters between two grid object

    C++ signature :

      bool CompareParams(RDGeom::UniformGrid3D {lvalue},RDGeom::UniformGrid3D)

  GetGridIndex((UniformGrid3D_)self, (int)xi, (int)yi, (int)zi) → int :

    Get the index to the grid point with the three integer indices provided

    C++ signature :

      int GetGridIndex(RDGeom::UniformGrid3D {lvalue},unsigned int,unsigned int,unsigned int)

  GetGridIndices((UniformGrid3D_)self, (int)idx) → tuple :

    Returns the integer indices of the grid index provided.

    C++ signature :

      boost::python::tuple GetGridIndices(RDGeom::UniformGrid3D,unsigned int)

  GetGridPointIndex((UniformGrid3D_)self, (Point3D)point) → int :

    Get the index to the grid point closest to the specified point

    C++ signature :

      int GetGridPointIndex(RDGeom::UniformGrid3D {lvalue},RDGeom::Point3D)

  GetGridPointLoc((UniformGrid3D_)self, (int)pointId) → Point3D :

    Get the location of the specified grid point

    C++ signature :

      RDGeom::Point3D GetGridPointLoc(RDGeom::UniformGrid3D {lvalue},unsigned int)

  GetNumX((UniformGrid3D_)self) → int :

    Get the number of grid points along x-axis

    C++ signature :

      unsigned int GetNumX(RDGeom::UniformGrid3D {lvalue})

  GetNumY((UniformGrid3D_)self) → int :

    Get the number of grid points along y-axis

    C++ signature :

      unsigned int GetNumY(RDGeom::UniformGrid3D {lvalue})

  GetNumZ((UniformGrid3D_)self) → int :

    Get the number of grid points along z-axis

    C++ signature :

      unsigned int GetNumZ(RDGeom::UniformGrid3D {lvalue})

  GetOccupancyVect((UniformGrid3D_)self) → rdkit.DataStructs.cDataStructs.DiscreteValueVect :

    Get the occupancy vector for the grid

    C++ signature :

      RDKit::DiscreteValueVect const* GetOccupancyVect(RDGeom::UniformGrid3D {lvalue})

  GetOffset((UniformGrid3D_)self) → Point3D :

    Get the location of the center of the grid

    C++ signature :

      RDGeom::Point3D GetOffset(RDGeom::UniformGrid3D {lvalue})

  GetSize((UniformGrid3D_)self) → int :

    Get the size of the grid (number of grid points)

    C++ signature :

      unsigned int GetSize(RDGeom::UniformGrid3D {lvalue})

  GetSpacing((UniformGrid3D_)self) → float :

    Get the grid spacing

    C++ signature :

      double GetSpacing(RDGeom::UniformGrid3D {lvalue})

  GetVal((UniformGrid3D_)self, (int)id) → int :

    Get the value at the specified grid point

    C++ signature :

      int GetVal(RDGeom::UniformGrid3D,unsigned int)

  GetValPoint((UniformGrid3D_)self, (Point3D)pt) → int :

    Get the value at the closest grid point

    C++ signature :

      int GetValPoint(RDGeom::UniformGrid3D,RDGeom::Point3D)

  SetSphereOccupancy((UniformGrid3D_)self, (Point3D)center, (float)radius, (float)stepSize[, (int)maxLayers=-1[, (bool)ignoreOutOfBound=True]]) → None :
    Set the occupancy on the grid for a sphere or specified radius

      and multiple layers around this sphere, with decreasing values of

    occupancy

    C++ signature :

      void SetSphereOccupancy(RDGeom::UniformGrid3D {lvalue},RDGeom::Point3D,double,double [,int=-1 [,bool=True]])

  SetVal((UniformGrid3D_)self, (int)id, (int)val) → None :

    Set the value at the specified grid point

    C++ signature :

      void SetVal(RDGeom::UniformGrid3D {lvalue},unsigned int,unsigned int)

  SetValPoint((UniformGrid3D_)self, (Point3D)pt, (int)val) → None :

    Set the value at grid point closest to the specified point

    C++ signature :

      void SetValPoint(RDGeom::UniformGrid3D {lvalue},RDGeom::Point3D,unsigned int)

class rdkit.Geometry.rdGeometry.UniformRealValueGrid3D((object)arg1, (str)arg2) → None :

  Bases: `instance`

  Class to represent a uniform three-dimensional cubic grid. Each grid point can store a floating point value.

  Pickle constructor

  > C++ signature :

  >   void __init__(_object*,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)

  __init__( (object)arg1) -> None :

    Default constructor

    C++ signature :

      void __init__(_object*)

  __init__( (object)arg1, (UniformRealValueGrid3D)arg2) -> None :

    Copy constructor

    C++ signature :

      void __init__(_object*,RDGeom::UniformRealValueGrid3D)

  __init__( (rdkit.Chem.rdMolDescriptors.AtomPairsParameters)arg1, (float)dimX, (float)dimY, (float)dimZ [, (float)spacing=0.5 [, (Point3D)offSet=None]]) -> object :

    Constructor

    C++ signature :

      void* __init__(boost::python::api::object,double,double,double [,double=0.5 [,RDGeom::Point3D const*=None]])

  CompareGrids((UniformRealValueGrid3D)arg1, (UniformRealValueGrid3D)arg2) → bool :

    Compare the parameters and values between two grid objects.

    C++ signature :

      bool CompareGrids(RDGeom::UniformRealValueGrid3D {lvalue},RDGeom::UniformRealValueGrid3D)

  CompareParams((UniformRealValueGrid3D)arg1, (UniformRealValueGrid3D)arg2) → bool :

    Compare the parameters between two grid object.

    C++ signature :

      bool CompareParams(RDGeom::UniformRealValueGrid3D {lvalue},RDGeom::UniformRealValueGrid3D)

  CompareVectors((UniformRealValueGrid3D)arg1, (UniformRealValueGrid3D)arg2) → bool :

    Compare the vector values between two grid objects.

    C++ signature :

      bool CompareVectors(RDGeom::UniformRealValueGrid3D {lvalue},RDGeom::UniformRealValueGrid3D)

  GetGridIndex((UniformRealValueGrid3D)arg1, (int)arg2, (int)arg3, (int)arg4) → int :

    Get the index to the grid point with the three integer indices provided

    C++ signature :

      int GetGridIndex(RDGeom::UniformRealValueGrid3D {lvalue},unsigned int,unsigned int,unsigned int)

  GetGridIndices((UniformRealValueGrid3D)arg1, (int)arg2) → tuple :

    Returns the integer indices of the grid index provided.

    C++ signature :

      boost::python::tuple GetGridIndices(RDGeom::UniformRealValueGrid3D,unsigned int)

  GetGridPointIndex((UniformRealValueGrid3D)arg1, (Point3D)arg2) → int :

    Get the index to the grid point closest to the specified point

    C++ signature :

      int GetGridPointIndex(RDGeom::UniformRealValueGrid3D {lvalue},RDGeom::Point3D)

  GetGridPointLoc((UniformRealValueGrid3D)arg1, (int)arg2) → Point3D :

    Get the location of the specified grid point

    C++ signature :

      RDGeom::Point3D GetGridPointLoc(RDGeom::UniformRealValueGrid3D {lvalue},unsigned int)

  GetNumX((UniformRealValueGrid3D)arg1) → int :

    Get the number of grid points along x-axis

    C++ signature :

      unsigned int GetNumX(RDGeom::UniformRealValueGrid3D {lvalue})

  GetNumY((UniformRealValueGrid3D)arg1) → int :

    Get the number of grid points along y-axis

    C++ signature :

      unsigned int GetNumY(RDGeom::UniformRealValueGrid3D {lvalue})

  GetNumZ((UniformRealValueGrid3D)arg1) → int :

    Get the number of grid points along z-axis

    C++ signature :

      unsigned int GetNumZ(RDGeom::UniformRealValueGrid3D {lvalue})

  GetOccupancyVect((UniformRealValueGrid3D)arg1) → rdkit.DataStructs.cDataStructs.RealValueVect :

    Get the occupancy vector for the grid

    C++ signature :

      RDKit::RealValueVect const* GetOccupancyVect(RDGeom::UniformRealValueGrid3D {lvalue})

  GetOffset((UniformRealValueGrid3D)arg1) → Point3D :

    Get the location of the center of the grid

    C++ signature :

      RDGeom::Point3D GetOffset(RDGeom::UniformRealValueGrid3D {lvalue})

  GetSize((UniformRealValueGrid3D)arg1) → int :

    Get the size of the grid (number of grid points)

    C++ signature :

      unsigned int GetSize(RDGeom::UniformRealValueGrid3D {lvalue})

  GetSpacing((UniformRealValueGrid3D)arg1) → float :

    Get the grid spacing

    C++ signature :

      double GetSpacing(RDGeom::UniformRealValueGrid3D {lvalue})

  GetVal((UniformRealValueGrid3D)arg1, (int)arg2) → float :

    Get the value at the specified grid point

    C++ signature :

      double GetVal(RDGeom::UniformRealValueGrid3D,unsigned int)

  GetValPoint((UniformRealValueGrid3D)arg1, (Point3D)arg2) → float :

    Get the value at the closest grid point

    C++ signature :

      double GetValPoint(RDGeom::UniformRealValueGrid3D,RDGeom::Point3D)

  SetVal((UniformRealValueGrid3D)arg1, (int)arg2, (float)arg3) → None :

    Set the value at the specified grid point

    C++ signature :

      void SetVal(RDGeom::UniformRealValueGrid3D {lvalue},unsigned int,double)

  SetValPoint((UniformRealValueGrid3D)arg1, (Point3D)arg2, (float)arg3) → None :

    Set the value at grid point closest to the specified point

    C++ signature :

      void SetValPoint(RDGeom::UniformRealValueGrid3D {lvalue},RDGeom::Point3D,double)

rdkit.Geometry.rdGeometry.WriteGridToFile((UniformGrid3D_)grid, (str)filename) → None :

  Write the grid to a grid file

  C++ signature :

    void WriteGridToFile(RDGeom::UniformGrid3D,std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)