esraMath
Class Fit

java.lang.Object
  extended byesraMath.Fit

public class Fit
extends java.lang.Object

Purpose: The Fit class
Description:
The Fit class provides routines for fitting.

Since:
0.1
Version:
0.3, September 2005
Author:
Mika Kastenholz, Vincent Kraeutler

Field Summary
(package private) static int DIM
           
static double[] origin
           
 
Constructor Summary
Fit()
           
 
Method Summary
static double[][] alignPrincipalAxes(double[][] coords, double[] weights)
          TODO test Align the principal axes of a set of mass points with the coordinate system.
static double[][] fit(double[][] coords, double[][] refCoords, double[] weights)
          A fit of coords to refCoords (weighted by weights).
static double[][] fit(double[][] coords, int[] coordSpecs, double[][] refCoords, int[] refCoordSpecs, double[] weights)
          A fit of coords to refCoords (weighted by weights).
static double[][] iterativeRotationalFit(double[][] pos, double[][] refPos, double[] weights)
          DEPRECATED use rotationalFit() instead.
static double[][] rotation(double[][] pos, double[][] refPos)
           SEE A.D.
static double[][] rotationalFit(double[][] pos, double[][] refPos)
          The atoms of the simulation system are rotated about the origin such that the (weighted) rmsd is minimized.
static double[][] rotationalFit(double[][] pos, double[][] refPos, double[] weights)
          SEE A.D.
static double[][] rotationMatrix(double[][] coords, double[][] refCoords)
           
static double[][] rotationMatrixMcLachlan(double[][] pos, double[][] refPos)
          SEE A.D.
static double[][] shiftCoG(double[][] coordinates, double[] where, double[] weights)
          Shift the center of geometry of a set of 3D-coordinates and massses to some point in 3D-space.
static double[][] translationalFit(double[][] coords, double[][] refCoords, double[] weights)
          Shift the center of geometry of a set of 3D-coordinates to the center of geometry of another set of 3D-coords, both weighted by the same weights.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DIM

static final int DIM
See Also:
Constant Field Values

origin

public static final double[] origin
Constructor Detail

Fit

public Fit()
Method Detail

fit

public static double[][] fit(double[][] coords,
                             double[][] refCoords,
                             double[] weights)
A fit of coords to refCoords (weighted by weights). This uses a quaterion-based parametrization, which involves no need to consider special cases (e.g. co-planar coordinates).

Parameters:
coords - the coordinates to be fitted
refCoords - the reference coordinates
weights - the weights used in the fitting
Returns:
the fitted coordinates

fit

public static double[][] fit(double[][] coords,
                             int[] coordSpecs,
                             double[][] refCoords,
                             int[] refCoordSpecs,
                             double[] weights)
A fit of coords to refCoords (weighted by weights). this is a generalization of fit(double[][], double[][], double[]) that allows you to superimpose selected parts of structures containing different numbers of coordinates.

Parameters:
coords - the coordinates to be fitted
refCoords - the reference coordinates
weights - the weights used in the fitting
Returns:
the fitted coordinates
See Also:
fit(double[][], double[][], double[])

shiftCoG

public static double[][] shiftCoG(double[][] coordinates,
                                  double[] where,
                                  double[] weights)
Shift the center of geometry of a set of 3D-coordinates and massses to some point in 3D-space.

Parameters:
coordinates - the coordinates to be shifted
where - where to shift the coordinates
weights - the weights associated with the coordinates
Returns:
the shifted coordinates

translationalFit

public static double[][] translationalFit(double[][] coords,
                                          double[][] refCoords,
                                          double[] weights)
Shift the center of geometry of a set of 3D-coordinates to the center of geometry of another set of 3D-coords, both weighted by the same weights.

Parameters:
coords - the coordinates to be shifted
refCoords - the target coordinates
weights - the weights
Returns:
the shifted coords

rotation

public static double[][] rotation(double[][] pos,
                                  double[][] refPos)

SEE A.D. KEARSLEY, ACTA. CRYST. A45 (1989) 208-210.

describes a rotation about the origin such that the rmsd(pos, refPos) is minimized. the block(operator, 0, 0, 3, 3) contains the rotation matrix, while operator[3] contains the rotation eigenvalues. scaled by the number of considered coordinates (i.e. 3 * pos.length or 3 * BLA.sum(weights) for weighted fits) the square root of the smallest scaled eigenvalue (i.e. operator[3][3]) is the rmsd.

Parameters:
pos - the positions to be fitted
refPos - the (weighted) reference positions
Returns:
the matrix[4][4] operator

rotationMatrix

public static double[][] rotationMatrix(double[][] coords,
                                        double[][] refCoords)
Parameters:
coords -
refCoords -
Returns:
the rotation matrix part of the rotation operator
See Also:
rotation(double[][], double[][])

rotationalFit

public static double[][] rotationalFit(double[][] pos,
                                       double[][] refPos)
The atoms of the simulation system are rotated about the origin such that the (weighted) rmsd is minimized.

Parameters:
pos - the positions to be fitted
refPos - the reference positions
Returns:
the fitted positions

rotationalFit

public static double[][] rotationalFit(double[][] pos,
                                       double[][] refPos,
                                       double[] weights)
SEE A.D. KEARSLEY, ACTA. CRYST. A45 (1989) 208-210. The atoms of the simulation system are rotated about the origin based on a rotationmatrix calculated via a unit quaternion.

Parameters:
pos - the positions to be fitted
refPos - the reference positions
weights - the weights used in the fitting
Returns:
the fitted positions

rotationMatrixMcLachlan

public static double[][] rotationMatrixMcLachlan(double[][] pos,
                                                 double[][] refPos)
SEE A.D. MCLACHLAN, J. MOL. BIOL. 128 (1979) 49. DEPRECATED use rotationMatrix() instead. it's both faster and doesn't suffer from numerical instabilities. describes a rotation about the origin such that the rmsd(pos, refPos) is minimized.

Parameters:
pos - the positions to be fitted
refPos - the (weighted) reference positions
Returns:
the rotation matrix

iterativeRotationalFit

public static double[][] iterativeRotationalFit(double[][] pos,
                                                double[][] refPos,
                                                double[] weights)
DEPRECATED use rotationalFit() instead. it's both faster and doesn't suffer from numerical instabilities. SEE A.D. MCLACHLAN, ACTA. CRYST. A38 (1982) 871-873. The atoms of the simulation system are rotated about the origin such that the (weighted) rmsd is minimized.

Parameters:
pos - the positions to be fitted
refPos - the reference positions
weights - the weights used in the fitting
Returns:
the fitted positions

alignPrincipalAxes

public static double[][] alignPrincipalAxes(double[][] coords,
                                            double[] weights)
TODO test Align the principal axes of a set of mass points with the coordinate system.

Parameters:
coords - the coordinates to be shifted
weights - the weights associated with the coordinates
Returns:
the aligned coordinates