Chemical Data Processing Library Python API - Version 1.4.0
Public Member Functions | Properties | List of all members
CDPL.Math.FKabschAlgorithm Class Reference

Implementation of the Kabsch algorithm [KABA]. More...

+ Inheritance diagram for CDPL.Math.FKabschAlgorithm:

Public Member Functions

None __init__ ()
 Contructs the FKabschAlgorithm instance.
 
None __init__ (FKabschAlgorithm algo)
 Contructs a copy of the FKabschAlgorithm instance algo. More...
 
int getObjectID ()
 Returns the numeric identifier (ID) of the wrapped C++ class instance. More...
 
FKabschAlgorithm assign (FKabschAlgorithm algo)
 Replaces the current state with a copy of the state of the FKabschAlgorithm instance algo. More...
 
FMatrix getTransform ()
 Returns the rigid-body transformation produced by the most recent successful align() call. More...
 
bool align (ConstFMatrixExpression points, ConstFMatrixExpression ref_points, bool do_center=True, int max_svd_iter=0)
 Computes the rigid body transformation that aligns a set of \( N \) \( D \)-dimensional points points with a corresponding set of reference points ref_points at a minimum RMSD. More...
 
bool align (ConstDMatrixExpression points, ConstDMatrixExpression ref_points, bool do_center=True, int max_svd_iter=0)
 Computes the rigid body transformation that aligns a set of \( N \) \( D \)-dimensional points points with a corresponding set of reference points ref_points at a minimum RMSD. More...
 
bool align (ConstFMatrixExpression points, ConstFMatrixExpression ref_points, ConstFVectorExpression weights, bool do_center=True, int max_svd_iter=0)
 Computes the rigid body transformation that aligns a set of \( N \) \( D \)-dimensional points points with a corresponding set of reference points ref_points at a minimum RMSD. More...
 
bool align (ConstDMatrixExpression points, ConstDMatrixExpression ref_points, ConstDVectorExpression weights, bool do_center=True, int max_svd_iter=0)
 Computes the rigid body transformation that aligns a set of \( N \) \( D \)-dimensional points points with a corresponding set of reference points ref_points at a minimum RMSD. More...
 

Properties

 objectID = property(getObjectID)
 
 transform = property(getTransform)
 

Detailed Description

Implementation of the Kabsch algorithm [KABA].

Finds the least Root Mean Square Distance between two sets of \( N \) points in \( D \) dimensions and the rigid transformation (i.e. translation and rotation) to employ in order to bring one set that close to the other.

Note that the points are paired, i.e. it is known which point in one set should be compared to a given point in the other set. It is possible to give weights to the points. Those weights are determined a priori and do not depend on the distances.

The convention is used that points are column vectors of the input matrices.

Constructor & Destructor Documentation

◆ __init__()

None CDPL.Math.FKabschAlgorithm.__init__ ( FKabschAlgorithm  algo)

Contructs a copy of the FKabschAlgorithm instance algo.

Parameters
algoThe FKabschAlgorithm instance to copy.

Member Function Documentation

◆ getObjectID()

int CDPL.Math.FKabschAlgorithm.getObjectID ( )

Returns the numeric identifier (ID) of the wrapped C++ class instance.

Different Python FKabschAlgorithm instances may reference the same underlying C++ class instance. The commonly used Python expression a is not b thus cannot tell reliably whether the two FKabschAlgorithm instances a and b reference different C++ objects. The numeric identifier returned by this method allows to correctly implement such an identity test via the simple expression a.getObjectID() != b.getObjectID().

Returns
The numeric ID of the internally referenced C++ class instance.

◆ assign()

FKabschAlgorithm CDPL.Math.FKabschAlgorithm.assign ( FKabschAlgorithm  algo)

Replaces the current state with a copy of the state of the FKabschAlgorithm instance algo.

Parameters
algoThe FKabschAlgorithm instance to copy.
Returns
self.

◆ getTransform()

FMatrix CDPL.Math.FKabschAlgorithm.getTransform ( )

Returns the rigid-body transformation produced by the most recent successful align() call.

Returns
The (D+1)×(D+1) transformation matrix (homogeneous form).

◆ align() [1/4]

bool CDPL.Math.FKabschAlgorithm.align ( ConstFMatrixExpression  points,
ConstFMatrixExpression  ref_points,
bool   do_center = True,
int   max_svd_iter = 0 
)

Computes the rigid body transformation that aligns a set of \( N \) \( D \)-dimensional points points with a corresponding set of reference points ref_points at a minimum RMSD.

Parameters
pointsA D×N-matrix storing the points to align as column vectors.
ref_pointsA D×N-matrix storing the reference points as column vectors.
do_centerTrue if centering of the data points needs to be performed, and False if not.
max_svd_iterThe maximum number of iterations to perform in the SV-decomposition, or 0 if no limit.
Returns
True if convergence in the internal SV-decomposition has been reached in max_svd_iter iterations, and False otherwise.
Precondition
points.getSize1() == ref_points.getSize1()
points.getSize2() == ref_points.getSize2()
Exceptions
Base.SizeErrorif preconditions got violated.

◆ align() [2/4]

bool CDPL.Math.FKabschAlgorithm.align ( ConstDMatrixExpression  points,
ConstDMatrixExpression  ref_points,
bool   do_center = True,
int   max_svd_iter = 0 
)

Computes the rigid body transformation that aligns a set of \( N \) \( D \)-dimensional points points with a corresponding set of reference points ref_points at a minimum RMSD.

Parameters
pointsA D×N-matrix storing the points to align as column vectors.
ref_pointsA D×N-matrix storing the reference points as column vectors.
do_centerTrue if centering of the data points needs to be performed, and False if not.
max_svd_iterThe maximum number of iterations to perform in the SV-decomposition, or 0 if no limit.
Returns
True if convergence in the internal SV-decomposition has been reached in max_svd_iter iterations, and False otherwise.
Precondition
points.getSize1() == ref_points.getSize1()
points.getSize2() == ref_points.getSize2()
Exceptions
Base.SizeErrorif preconditions got violated.

◆ align() [3/4]

bool CDPL.Math.FKabschAlgorithm.align ( ConstFMatrixExpression  points,
ConstFMatrixExpression  ref_points,
ConstFVectorExpression  weights,
bool   do_center = True,
int   max_svd_iter = 0 
)

Computes the rigid body transformation that aligns a set of \( N \) \( D \)-dimensional points points with a corresponding set of reference points ref_points at a minimum RMSD.

Parameters
pointsA D×N-matrix storing the points to align as column vectors.
ref_pointsA D×N-matrix storing the reference points as column vectors.
weightsA \( N \)-dimensional vector storing the non-negative weights that are assigned to the points.
do_centerTrue if centering of the data points needs to be performed, and False if not.
max_svd_iterThe maximum number of iterations to perform in the SV-decomposition, or 0 if no limit.
Returns
True if convergence in the internal SV-decomposition has been reached in max_svd_iter iterations, and False otherwise.
Precondition
points.getSize1() == ref_points.getSize1()
points.getSize2() == ref_points.getSize2()
weights().getSize() == points.getSize2()
weights()(i) >= 0 && sum(weights) > 0
Exceptions
Base.SizeErroror Base.ValueError if preconditions got violated.

◆ align() [4/4]

bool CDPL.Math.FKabschAlgorithm.align ( ConstDMatrixExpression  points,
ConstDMatrixExpression  ref_points,
ConstDVectorExpression  weights,
bool   do_center = True,
int   max_svd_iter = 0 
)

Computes the rigid body transformation that aligns a set of \( N \) \( D \)-dimensional points points with a corresponding set of reference points ref_points at a minimum RMSD.

Parameters
pointsA D×N-matrix storing the points to align as column vectors.
ref_pointsA D×N-matrix storing the reference points as column vectors.
weightsA \( N \)-dimensional vector storing the non-negative weights that are assigned to the points.
do_centerTrue if centering of the data points needs to be performed, and False if not.
max_svd_iterThe maximum number of iterations to perform in the SV-decomposition, or 0 if no limit.
Returns
True if convergence in the internal SV-decomposition has been reached in max_svd_iter iterations, and False otherwise.
Precondition
points.getSize1() == ref_points.getSize1()
points.getSize2() == ref_points.getSize2()
weights().getSize() == points.getSize2()
weights()(i) >= 0 && sum(weights) > 0
Exceptions
Base.SizeErroror Base.ValueError if preconditions got violated.