edu.sdsc.sirius.util
Class StructureMath

java.lang.Object
  extended byedu.sdsc.sirius.util.StructureMath

public class StructureMath
extends java.lang.Object

This class contains all the math necessary to transform atomic coordinates and drive rotation and translation when building structures

Author:
Oleksandr V. Buzko

Constructor Summary
StructureMath()
           
 
Method Summary
static void checkHydrogens(Atom atom, StructureViewer viewer, float pH, boolean batch)
           
static void checkHydrogens(Structure structure, StructureViewer viewer, float pH)
          This method runs through the structure and adds hydrogens where necessary, based on tabulated element valencies.
static Location getBondLocation(Bond bond)
          Returns a location of the bond, with the lookAt vector pointed along the bond and the up vector being orthogonal to the plane of the bond and one of the atoms the third vector is computed automatically The position is at the heavy atom
static double[] getFromOriginMatrix(Atom root)
           
static double[] getFromOriginMatrix(double[] coordinates)
           
static double[] getLinearRotationMatrix(double angle, double[] axis)
           
static double[] getLinearTranslationMatrix(double[] vector)
           
static double[] getPointOnVector(double[] eye, double[] vector, double distance)
          Get coordinates of a point on a vector that originates from a given point
static double getRMSD(Structure structure1, Structure structure2)
           
static java.util.Vector getRotatedAtoms(StructureMap map, Bond bond, Atom atom)
           
static double[][] getRotationMatrix(double[] vector1, double[] vector2)
           
static double[][] getRotationMatrix(double angle, double[] axis)
           
static double[] getToOriginMatrix(Atom root)
           
static double[] getToOriginMatrix(double[] coordinates)
           
static boolean inRing(Atom root, int size)
          This method determines whether a given Atom is in a ring system of the specified size
static double rmsd(java.util.Vector atoms1, java.util.Vector atoms2)
           
static void rotateCoordinates(double[] axis, double[] root, double angle, java.util.Vector coordinates)
           
static void rotateStructure(double[] axis, Atom root, double angle, java.util.Vector atoms)
          Note that the argument is in degrees, and they get converted into radians
static void superimpose(Structure structure1, java.util.Vector atoms1, Structure structure2, java.util.Vector atoms2)
          This method performs RMSD minimization structure superposition.
static void transformAtomSet(Location start, Location target, java.util.Vector atoms)
           
static void transformCoordinates(double[] input, double[] matrix)
           
static void transformCoordinates(double[] input, double[][] matrix)
          This method returns the new x,y,z coordinates for a point given the corresponding rotation matrix
static double[] transformPoint(Location start, Location target, double[] point)
           
static void transformStructure(Location start, Location target, Structure structure)
           
static void transformVector(Location start, Location target, double[] vector, double[] out)
           
static java.util.Vector transformVectors(double[] start, double[] target, java.util.Vector vectors)
           
static void updateBondOrders(Structure structure)
          This method checks whether the structure is a protein or DNA and assigns correct bond orders in case they have not been assigned.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StructureMath

public StructureMath()
Method Detail

transformStructure

public static final void transformStructure(Location start,
                                            Location target,
                                            Structure structure)

transformPoint

public static final double[] transformPoint(Location start,
                                            Location target,
                                            double[] point)

transformAtomSet

public static final void transformAtomSet(Location start,
                                          Location target,
                                          java.util.Vector atoms)

transformVector

public static final void transformVector(Location start,
                                         Location target,
                                         double[] vector,
                                         double[] out)

transformVectors

public static final java.util.Vector transformVectors(double[] start,
                                                      double[] target,
                                                      java.util.Vector vectors)

transformCoordinates

public static final void transformCoordinates(double[] input,
                                              double[][] matrix)
This method returns the new x,y,z coordinates for a point given the corresponding rotation matrix

Parameters:
input -
matrix -
Returns:

transformCoordinates

public static final void transformCoordinates(double[] input,
                                              double[] matrix)

getPointOnVector

public static final double[] getPointOnVector(double[] eye,
                                              double[] vector,
                                              double distance)
Get coordinates of a point on a vector that originates from a given point

Parameters:
eye - - point fromm where the vector starts
vector - - vector in question
distance -
Returns:

getBondLocation

public static final Location getBondLocation(Bond bond)
Returns a location of the bond, with the lookAt vector pointed along the bond and the up vector being orthogonal to the plane of the bond and one of the atoms the third vector is computed automatically The position is at the heavy atom

Parameters:
bond -
Returns:

getRotationMatrix

public static final double[][] getRotationMatrix(double[] vector1,
                                                 double[] vector2)

getRotationMatrix

public static final double[][] getRotationMatrix(double angle,
                                                 double[] axis)

getLinearRotationMatrix

public static final double[] getLinearRotationMatrix(double angle,
                                                     double[] axis)

getLinearTranslationMatrix

public static final double[] getLinearTranslationMatrix(double[] vector)

rotateStructure

public static final void rotateStructure(double[] axis,
                                         Atom root,
                                         double angle,
                                         java.util.Vector atoms)
Note that the argument is in degrees, and they get converted into radians

Parameters:
axis -
root -
angle -
atoms -

rotateCoordinates

public static final void rotateCoordinates(double[] axis,
                                           double[] root,
                                           double angle,
                                           java.util.Vector coordinates)

getToOriginMatrix

public static final double[] getToOriginMatrix(Atom root)

getToOriginMatrix

public static final double[] getToOriginMatrix(double[] coordinates)

getFromOriginMatrix

public static final double[] getFromOriginMatrix(Atom root)

getFromOriginMatrix

public static final double[] getFromOriginMatrix(double[] coordinates)

checkHydrogens

public static void checkHydrogens(Structure structure,
                                  StructureViewer viewer,
                                  float pH)
This method runs through the structure and adds hydrogens where necessary, based on tabulated element valencies. Things like incorrect bond orders are ignored, so it's the user's responsibility (for now) to take care of the correct bond orders. If the number of hydrogens is too great, the number is reduced to the valency and geometry is recalculated

Parameters:
structure -

checkHydrogens

public static void checkHydrogens(Atom atom,
                                  StructureViewer viewer,
                                  float pH,
                                  boolean batch)

inRing

public static boolean inRing(Atom root,
                             int size)
This method determines whether a given Atom is in a ring system of the specified size

Returns:

getRotatedAtoms

public static java.util.Vector getRotatedAtoms(StructureMap map,
                                               Bond bond,
                                               Atom atom)

updateBondOrders

public static void updateBondOrders(Structure structure)
This method checks whether the structure is a protein or DNA and assigns correct bond orders in case they have not been assigned.

Parameters:
structure -

getRMSD

public static double getRMSD(Structure structure1,
                             Structure structure2)

superimpose

public static void superimpose(Structure structure1,
                               java.util.Vector atoms1,
                               Structure structure2,
                               java.util.Vector atoms2)
This method performs RMSD minimization structure superposition. Two vectors of equal sizes contain Atoms that need to be compared and used to search orientation space.

Parameters:
structure1 -
atoms1 -
structure2 -
atoms2 -

rmsd

public static double rmsd(java.util.Vector atoms1,
                          java.util.Vector atoms2)