Class StereoTool


  • public class StereoTool
    extends Object
    Methods to determine or check the stereo class of a set of atoms. Some of these methods were adapted from Jmol's smiles search package.
    Author:
    maclean
    Source code:
    main
    Belongs to CDK module:
    standard
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  StereoTool.SquarePlanarShape
      The shape that four atoms take in a plane.
      static class  StereoTool.StereoClass
      Currently unused, but intended for the StereoTool to indicate what it 'means' by an assignment of some atoms to a class.
      static class  StereoTool.TetrahedralSign
      The handedness of a tetrahedron, in terms of the point-plane distance of three of the corners, compared to the fourth.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      static double MAX_AXIS_ANGLE
      The maximum angle in radians for two lines to be 'diaxial'.
      static double MIN_COLINEAR_NORMAL
      The maximum tolerance for the normal calculated during colinearity.
      static double PLANE_TOLERANCE  
    • Constructor Summary

      Constructors 
      Constructor Description
      StereoTool()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static boolean allCoplanar​(javax.vecmath.Vector3d planeNormal, javax.vecmath.Point3d pointInPlane, javax.vecmath.Point3d... points)
      Check that all the points in the list are coplanar (in the same plane) as the plane defined by the planeNormal and the pointInPlane.
      static StereoTool.TetrahedralSign getHandedness​(IAtom baseAtomA, IAtom baseAtomB, IAtom baseAtomC, IAtom apexAtom)
      Gets the tetrahedral handedness of four atoms - three of which form the 'base' of the tetrahedron, and the other the apex.
      static javax.vecmath.Vector3d getNormal​(javax.vecmath.Point3d ptA, javax.vecmath.Point3d ptB, javax.vecmath.Point3d ptC)
      Given three points (A, B, C), makes the vectors A-B and A-C, and makes the cross product of these two vectors; this has the effect of making a third vector at right angles to AB and AC.
      static StereoTool.SquarePlanarShape getSquarePlanarShape​(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD)
      Given four atoms (assumed to be in the same plane), returns the arrangement of those atoms in that plane.
      static ITetrahedralChirality.Stereo getStereo​(IAtom atom1, IAtom atom2, IAtom atom3, IAtom atom4)
      Take four atoms, and return Stereo.CLOCKWISE or Stereo.ANTI_CLOCKWISE.
      static boolean isColinear​(javax.vecmath.Point3d ptA, javax.vecmath.Point3d ptB, javax.vecmath.Point3d ptC)
      Checks the three supplied points to see if they fall on the same line.
      static boolean isOctahedral​(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD, IAtom atomE, IAtom atomF, IAtom atomG)
      Checks these 7 atoms to see if they are at the points of an octahedron.
      static boolean isSquarePlanar​(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD)
      Checks these four atoms for square planarity.
      static boolean isTrigonalBipyramidal​(IAtom atomA, IAtom atomB, IAtom atomC, IAtom atomD, IAtom atomE, IAtom atomF)
      Checks these 6 atoms to see if they form a trigonal-bipyramidal shape.
      static double signedDistanceToPlane​(javax.vecmath.Vector3d planeNormal, javax.vecmath.Point3d pointInPlane, javax.vecmath.Point3d point)
      Given a normalized normal for a plane, any point in that plane, and a point, will return the distance between the plane and that point.
    • Field Detail

      • MAX_AXIS_ANGLE

        public static final double MAX_AXIS_ANGLE
        The maximum angle in radians for two lines to be 'diaxial'. Where 0.95 is about 172 degrees.
        See Also:
        Constant Field Values
      • MIN_COLINEAR_NORMAL

        public static final double MIN_COLINEAR_NORMAL
        The maximum tolerance for the normal calculated during colinearity.
        See Also:
        Constant Field Values
    • Constructor Detail

      • StereoTool

        public StereoTool()
    • Method Detail

      • isSquarePlanar

        public static boolean isSquarePlanar​(IAtom atomA,
                                             IAtom atomB,
                                             IAtom atomC,
                                             IAtom atomD)
        Checks these four atoms for square planarity.
        Parameters:
        atomA - an atom in the plane
        atomB - an atom in the plane
        atomC - an atom in the plane
        atomD - an atom in the plane
        Returns:
        true if all the atoms are in the same plane
      • getSquarePlanarShape

        public static StereoTool.SquarePlanarShape getSquarePlanarShape​(IAtom atomA,
                                                                        IAtom atomB,
                                                                        IAtom atomC,
                                                                        IAtom atomD)

        Given four atoms (assumed to be in the same plane), returns the arrangement of those atoms in that plane.

        The 'shapes' returned represent arrangements that look a little like the characters 'U', '4', and 'Z'.

        Parameters:
        atomA - an atom in the plane
        atomB - an atom in the plane
        atomC - an atom in the plane
        atomD - an atom in the plane
        Returns:
        the shape (U/4/Z)
      • allCoplanar

        public static boolean allCoplanar​(javax.vecmath.Vector3d planeNormal,
                                          javax.vecmath.Point3d pointInPlane,
                                          javax.vecmath.Point3d... points)
        Check that all the points in the list are coplanar (in the same plane) as the plane defined by the planeNormal and the pointInPlane.
        Parameters:
        planeNormal - the normal to the plane
        pointInPlane - any point know to be in the plane
        points - an array of points to test
        Returns:
        false if any of the points is not in the plane
      • isOctahedral

        public static boolean isOctahedral​(IAtom atomA,
                                           IAtom atomB,
                                           IAtom atomC,
                                           IAtom atomD,
                                           IAtom atomE,
                                           IAtom atomF,
                                           IAtom atomG)
        Checks these 7 atoms to see if they are at the points of an octahedron.
        Parameters:
        atomA - one of the axial atoms
        atomB - the central atom
        atomC - one of the equatorial atoms
        atomD - one of the equatorial atoms
        atomE - one of the equatorial atoms
        atomF - one of the equatorial atoms
        atomG - the other axial atom
        Returns:
        true if the geometry is octahedral
      • isTrigonalBipyramidal

        public static boolean isTrigonalBipyramidal​(IAtom atomA,
                                                    IAtom atomB,
                                                    IAtom atomC,
                                                    IAtom atomD,
                                                    IAtom atomE,
                                                    IAtom atomF)
        Checks these 6 atoms to see if they form a trigonal-bipyramidal shape.
        Parameters:
        atomA - one of the axial atoms
        atomB - the central atom
        atomC - one of the equatorial atoms
        atomD - one of the equatorial atoms
        atomE - one of the equatorial atoms
        atomF - the other axial atom
        Returns:
        true if the geometry is trigonal-bipyramidal
      • getStereo

        public static ITetrahedralChirality.Stereo getStereo​(IAtom atom1,
                                                             IAtom atom2,
                                                             IAtom atom3,
                                                             IAtom atom4)
        Take four atoms, and return Stereo.CLOCKWISE or Stereo.ANTI_CLOCKWISE. The first atom is the one pointing towards the observer.
        Parameters:
        atom1 - the atom pointing towards the observer
        atom2 - the second atom (points away)
        atom3 - the third atom (points away)
        atom4 - the fourth atom (points away)
        Returns:
        clockwise or anticlockwise
      • getHandedness

        public static StereoTool.TetrahedralSign getHandedness​(IAtom baseAtomA,
                                                               IAtom baseAtomB,
                                                               IAtom baseAtomC,
                                                               IAtom apexAtom)
        Gets the tetrahedral handedness of four atoms - three of which form the 'base' of the tetrahedron, and the other the apex. Note that it assumes a right-handed coordinate system, and that the points {A,B,C} are in a counter-clockwise order in the plane they share.
        Parameters:
        baseAtomA - the first atom in the base of the tetrahedron
        baseAtomB - the second atom in the base of the tetrahedron
        baseAtomC - the third atom in the base of the tetrahedron
        apexAtom - the atom in the point of the tetrahedron
        Returns:
        the sign of the tetrahedron
      • isColinear

        public static boolean isColinear​(javax.vecmath.Point3d ptA,
                                         javax.vecmath.Point3d ptB,
                                         javax.vecmath.Point3d ptC)
        Checks the three supplied points to see if they fall on the same line. It does this by finding the normal to an arbitrary pair of lines between the points (in fact, A-B and A-C) and checking that its length is 0.
        Parameters:
        ptA -
        ptB -
        ptC -
        Returns:
        true if the tree points are on a straight line
      • signedDistanceToPlane

        public static double signedDistanceToPlane​(javax.vecmath.Vector3d planeNormal,
                                                   javax.vecmath.Point3d pointInPlane,
                                                   javax.vecmath.Point3d point)
        Given a normalized normal for a plane, any point in that plane, and a point, will return the distance between the plane and that point.
        Parameters:
        planeNormal - the normalized plane normal
        pointInPlane - an arbitrary point in that plane
        point - the point to measure
        Returns:
        the signed distance to the plane
      • getNormal

        public static javax.vecmath.Vector3d getNormal​(javax.vecmath.Point3d ptA,
                                                       javax.vecmath.Point3d ptB,
                                                       javax.vecmath.Point3d ptC)

        Given three points (A, B, C), makes the vectors A-B and A-C, and makes the cross product of these two vectors; this has the effect of making a third vector at right angles to AB and AC.

        NOTE : the returned normal is normalized; that is, it has been divided by its length.

        Parameters:
        ptA - the 'middle' point
        ptB - one of the end points
        ptC - one of the end points
        Returns:
        the vector at right angles to AB and AC