esraMath
Class Geometry

java.lang.Object
  extended byesraMath.Geometry

public class Geometry
extends java.lang.Object

Author:
vincent

Constructor Summary
Geometry()
           
 
Method Summary
static double angle(double[] aa, double[] bb, double[] cc)
           
static double[] centerOfGeometry(double[][] positions, double[] weights)
          Compute the center of geometry of a set of 3D-coordinates and massses.
static double dihedral(double[] ii, double[] jj, double[] kk, double[] ll)
           The dihedral angle following IUPAC-IUB convention.
static double distance(double[] aa, double[] bb)
           
static double fitAndRmsd(double[][] posA, double[][] posB, double[] weights)
          fit two structures and compute the rmsd.
static double[][] inertiaTensor(double[][] coords, double[] weights)
          Compute the inertia tensor for a set of 3D-coordinates with masses.
static double iupac2math(double iupacDihedral)
          Transform a IUPAC dihedral angle into a dihedral angle following the mathematical standard conventions: a counterclockwise rotation is positive; default ranges go from [0, 2pi]
static double[][] lineRotationMatrix(double[] p, double[] d, double angle)
          Build rotation matrix for (counterclockwise) rotation around an arbitary line, using a point and a direction from that point on the line.
static double rgyr(double[][] positions, double[] masses)
           
static double rmsd(double[][] posA, double[][] posB)
           
static double rmsd(double[][] posA, double[][] posB, double[] weights)
           
static double[][] rotate(double[][] rotMatrix, double[][] coords)
          Rotate point using a supplied rotationmatrix.
static double[][] rotateAndShift(double[][] rotMatrix, double[][] coords)
          Rotate point using a supplied rotationmatrix.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Geometry

public Geometry()
Method Detail

distance

public static double distance(double[] aa,
                              double[] bb)
Parameters:
aa -
bb -
Returns:
the distance between two position vectors aa and bb

angle

public static double angle(double[] aa,
                           double[] bb,
                           double[] cc)
Parameters:
aa - first position
bb - second (center) position
cc - third position
Returns:
the (minimum) angle (radians) formed by three positions aa, bb and cc, with bb being the central point.

dihedral

public static double dihedral(double[] ii,
                              double[] jj,
                              double[] kk,
                              double[] ll)

The dihedral angle following IUPAC-IUB convention.

Biochemistry, 9, (1970) 3471.
http://www.iupac.org/goldbook/T06406.pdf

Parameters:
ii -
jj -
kk -
ll -
Returns:
the dihedral angle formed by four positions ii, jj, kk, ll, in that order.

iupac2math

public static double iupac2math(double iupacDihedral)
Transform a IUPAC dihedral angle into a dihedral angle following the mathematical standard conventions:

Parameters:
iupacDihedral -
Returns:
the new dihedral in the range [0, 2 pi]

centerOfGeometry

public static double[] centerOfGeometry(double[][] positions,
                                        double[] weights)
Compute the center of geometry of a set of 3D-coordinates and massses.

Parameters:
positions - the coordinates
weights - the weights associated with the coordinates
Returns:
the center of mass (3-vector)

rgyr

public static double rgyr(double[][] positions,
                          double[] masses)
Parameters:
positions -
masses -
Returns:
the radius of gyration of the system

rmsd

public static double rmsd(double[][] posA,
                          double[][] posB)
Parameters:
posA - first positions
posB - second positions
Returns:
rmsd

rmsd

public static double rmsd(double[][] posA,
                          double[][] posB,
                          double[] weights)
Parameters:
posA - first positions
posB - second positions
weights - weightings (e.g. masses)
Returns:
rmsd

fitAndRmsd

public static double fitAndRmsd(double[][] posA,
                                double[][] posB,
                                double[] weights)
fit two structures and compute the rmsd. perform a minimal root-mean-square-distance rototranslational fit and return the corresponding RMSD. equivalent to, but should be faster than, first performing a fit and then calculating the rmsd.

Parameters:
posA - first positions
posB - second positions
weights - weightings (e.g. masses)
Returns:
rmsd

inertiaTensor

public static double[][] inertiaTensor(double[][] coords,
                                       double[] weights)
Compute the inertia tensor for a set of 3D-coordinates with masses.

Parameters:
coords - the coordinates used
weights - the weights associated with the coordinates
Returns:
the inertia tensor (3 x 3 matrix)

lineRotationMatrix

public static double[][] lineRotationMatrix(double[] p,
                                            double[] d,
                                            double angle)
Build rotation matrix for (counterclockwise) rotation around an arbitary line, using a point and a direction from that point on the line.

Parameters:
p - point on line (e.g. origin: 0,0,0)
d - line direction (e.g. z-axis: 0 0 1)
angle - rotation angle in radians (e.g. Math.PI = 180 degrees)
Returns:
rotation/translation matrix

rotate

public static double[][] rotate(double[][] rotMatrix,
                                double[][] coords)
Rotate point using a supplied rotationmatrix.

Parameters:
rotMatrix - rotation matrix
coords - the coordinates to rotate
Returns:
rotated coordinates

rotateAndShift

public static double[][] rotateAndShift(double[][] rotMatrix,
                                        double[][] coords)
Rotate point using a supplied rotationmatrix.

Parameters:
rotMatrix - rotation matrix
coords - the coordinates to rotate
Returns:
rotated coordinates