Package ffx.crystal

Class SymOp


  • public class SymOp
    extends Object
    The SymOp class defines the rotation and translation of a single symmetry operator.
    Since:
    1.0
    Author:
    Michael J. Schnieders
    See Also:
    SpaceGroup
    • Field Summary

      Fields 
      Modifier and Type Field Description
      int[] replicatesVector
      Replicates position for the given symmetry operator (LxMxN).
      double[][] rot
      The rotation matrix in fractional coordinates.
      double[] tr
      The translation vector in fractional coordinates.
      static double[] Tr_0_0_0
      Constant Tr_0_0_0={ZERO, ZERO, ZERO}
      static double[][] ZERO_ROTATION
      Constant ZERO_ROTATION = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}
    • Constructor Summary

      Constructors 
      Constructor Description
      SymOp​(double[][] m)
      The SymOp constructor using a 4x4 matrix.
      SymOp​(double[][] rot, double[] tr)
      The SymOp constructor using a rotation matrix and translation vector.
      SymOp​(double[][] rot, double[] tr, int[] replicatesVector)
      The SymOp constructor using a rotation matrix and translation vector.
    • Field Detail

      • ZERO_ROTATION

        public static final double[][] ZERO_ROTATION
        Constant ZERO_ROTATION = {{1.0, 0.0, 0.0}, {0.0, 1.0, 0.0}, {0.0, 0.0, 1.0}}
      • Tr_0_0_0

        public static final double[] Tr_0_0_0
        Constant Tr_0_0_0={ZERO, ZERO, ZERO}
      • rot

        public final double[][] rot
        The rotation matrix in fractional coordinates.
      • tr

        public final double[] tr
        The translation vector in fractional coordinates.
      • replicatesVector

        public final int[] replicatesVector
        Replicates position for the given symmetry operator (LxMxN).
    • Constructor Detail

      • SymOp

        public SymOp​(double[][] rot,
                     double[] tr)
        The SymOp constructor using a rotation matrix and translation vector.
        Parameters:
        rot - The rotation matrix.
        tr - The translation vector.
      • SymOp

        public SymOp​(double[][] rot,
                     double[] tr,
                     int[] replicatesVector)
        The SymOp constructor using a rotation matrix and translation vector.
        Parameters:
        rot - The rotation matrix.
        tr - The translation vector.
        replicatesVector - Describes symmetry operators location within replicates crystal.
      • SymOp

        public SymOp​(double[][] m)
        The SymOp constructor using a 4x4 matrix.
        Parameters:
        m - The rotation matrix and translation vector as a 4x4 matrix.
    • Method Detail

      • symPhaseShift

        public double symPhaseShift​(double[] hkl)
        symPhaseShift
        Parameters:
        hkl - an array of double.
        Returns:
        a double.
      • symPhaseShift

        public double symPhaseShift​(HKL hkl)
        symPhaseShift
        Parameters:
        hkl - a HKL object.
        Returns:
        a double.
      • asMatrix

        public double[][] asMatrix()
        Return the SymOp as a 4x4 matrix.
        Returns:
        A 4x4 matrix representation of the SymOp.
      • append

        public SymOp append​(SymOp symOp)
        Return the combined SymOp that is equivalent to first applying this SymOp and then the argument. Note: Applied as rotation then translation. X' = S_arg(S_this(X)) X' = S_combined(X)
        Parameters:
        symOp - The SymOp to append to this SymOp.
        Returns:
        The combined SymOp.
      • prepend

        public SymOp prepend​(SymOp symOp)
        Return the combined SymOp that is equivalent to first applying the argument and then this SymOp. Note: Applied as rotation then translation. X' = S_this(S_arg(X)) X' = S_combined(X)
        Parameters:
        symOp - The SymOp to prepend to this Symop.
        Returns:
        The combined SymOp.
      • combineSymOps

        public static SymOp combineSymOps​(SymOp symOp1,
                                          SymOp symOp2)
        Return the combined SymOp that is equivalent to first applying symOp1 and then SymOp2. Note: Applied as rotation then translation. X' = S_2(S_1(X)) X' = S_combined(X)
        Parameters:
        symOp1 - The fist SymOp.
        symOp2 - The second SymOp.
        Returns:
        The combined SymOp.
      • applyCartSymOp

        public static void applyCartSymOp​(int n,
                                          double[] x,
                                          double[] y,
                                          double[] z,
                                          double[] mateX,
                                          double[] mateY,
                                          double[] mateZ,
                                          SymOp symOp)
        Apply a Cartesian symmetry operator to an array of Cartesian coordinates. If the arrays x, y or z are null or not of length n, the method returns immediately. If mateX, mateY or mateZ are null or not of length n, new arrays are allocated.
        Parameters:
        n - Number of atoms.
        x - Input cartesian x-coordinates.
        y - Input cartesian y-coordinates.
        z - Input cartesian z-coordinates.
        mateX - Output cartesian x-coordinates.
        mateY - Output cartesian y-coordinates.
        mateZ - Output cartesian z-coordinates.
        symOp - The cartesian symmetry operator.
      • applyCartesianSymOp

        public static void applyCartesianSymOp​(double[] xyz,
                                               double[] mate,
                                               SymOp symOp)
        Apply a cartesian symmetry operator to an array of coordinates.
        Parameters:
        xyz - Input cartesian coordinates.
        mate - Symmetry mate cartesian coordinates.
        symOp - The cartesian symmetry operator.
      • applyCartesianSymOp

        public static void applyCartesianSymOp​(double[] xyz,
                                               double[] mate,
                                               SymOp symOp,
                                               boolean[] mask)
        Apply a cartesian symmetry operator to an array of coordinates.
        Parameters:
        xyz - Input cartesian coordinates.
        mate - Symmetry mate cartesian coordinates.
        symOp - The cartesian symmetry operator.
        mask - Only apply the SymOp if the per atom mask is true.
      • applyFracSymOp

        public static void applyFracSymOp​(double[] xyz,
                                          double[] mate,
                                          SymOp symOp)
        Apply a fractional symmetry operator to one set of coordinates.
        Parameters:
        xyz - Input fractional coordinates.
        mate - Symmetry mate fractional coordinates.
        symOp - The fractional symmetry operator.
      • applySymOp

        public static void applySymOp​(int h,
                                      int k,
                                      int l,
                                      int[] mate,
                                      SymOp symOp,
                                      int nx,
                                      int ny,
                                      int nz)
        Apply a symmetry operator to one set of coordinates.
        Parameters:
        h - Input coordinates.
        k - Input coordinates.
        l - Input coordinates.
        mate - Symmetry mate coordinates.
        symOp - The symmetry operator.
        nx - number of unit cell translations
        ny - number of unit cell translations
        nz - number of unit cell translations
      • applySymRot

        public static void applySymRot​(HKL hkl,
                                       HKL mate,
                                       SymOp symOp)
        Apply a symmetry operator to one HKL.
        Parameters:
        hkl - Input HKL.
        mate - Symmetry mate HKL.
        symOp - The symmetry operator.
      • applyCartesianSymRot

        public static void applyCartesianSymRot​(double[] xyz,
                                                double[] mate,
                                                SymOp symOp)
        Apply a Cartesian symmetry rotation to an array of Cartesian coordinates. The length of xyz must be divisible by 3 and mate must have the same length.
        Parameters:
        xyz - Input cartesian x, y, z-coordinates.
        mate - Output cartesian x, y, z-coordinates.
        symOp - The fractional symmetry operator.
      • applyCartesianSymRot

        public static void applyCartesianSymRot​(double[] xyz,
                                                double[] mate,
                                                SymOp symOp,
                                                boolean[] mask)
        Apply a Cartesian symmetry rotation to an array of Cartesian coordinates. The length of xyz must be divisible by 3 and mate must have the same length.
        Parameters:
        xyz - Input cartesian x, y, z-coordinates.
        mate - Output cartesian x, y, z-coordinates.
        symOp - The fractional symmetry operator.
        mask - Only apply the SymOp if the per atom mask is true.
      • applyTransSymRot

        public static void applyTransSymRot​(HKL hkl,
                                            HKL mate,
                                            SymOp symOp)
        Apply a transpose rotation symmetry operator to one HKL.
        Parameters:
        hkl - Input HKL.
        mate - Symmetry mate HKL.
        symOp - The symmetry operator.
      • invertSymOp

        public static SymOp invertSymOp​(SymOp symOp)
        Invert a symmetry operator.
        Parameters:
        symOp - Original symmetry operator of which the inverse is desired.
        Returns:
        SymOp The inverse symmetry operator of the one supplied.
      • parse

        public static SymOp parse​(String s)
        Create a SymOp from an input String.
        Parameters:
        s - Input String containing 12 white-space delimited double values.
        Returns:
        The SymOp.
      • randomSymOpFactory

        public static SymOp randomSymOpFactory​(double scalar)
        Generate a random Cartesian Symmetry Operator.
        Parameters:
        scalar - The range of translations will be from -scalar/2 .. scalar/2.
        Returns:
        A Cartesian SymOp with a random rotation and translation.
      • randomSymOpFactory

        public static SymOp randomSymOpFactory​(double[] tr)
        Generate a random Cartesian Symmetry Operator.

        The random rotation matrix is derived from: Arvo, James (1992), "Fast random rotation matrices", in David Kirk, Graphics Gems III, San Diego: Academic Press Professional, pp. 117–120, ISBN 978-0-12-409671-4

        Parameters:
        tr - The translations to apply.
        Returns:
        A Cartesian SymOp with a random rotation and translation.
      • toStringPrecise

        public String toStringPrecise()
        Print the symmetry operator with double precision.
        Returns:
        String of rotation/translation with double precision.
      • toXYZString

        public String toXYZString()
        toXYZString
        Returns:
        a String object.