Package ffx.crystal

Class SymOp

java.lang.Object
ffx.crystal.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:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    final int[]
    Replicates position for the given symmetry operator (LxMxN).
    final double[][]
    The rotation matrix in fractional coordinates.
    final double[]
    The translation vector in fractional coordinates.
    static final double[]
    Constant Tr_0_0_0={ZERO, ZERO, ZERO}
    static final double[][]
    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.
  • Method Summary

    Modifier and Type
    Method
    Description
    append(SymOp symOp)
    Return the combined SymOp that is equivalent to first applying this SymOp and then the argument.
    static void
    applyCartesianSymOp(double[] xyz, double[] mate, SymOp symOp)
    Apply a cartesian symmetry operator to an array of coordinates.
    static void
    applyCartesianSymOp(double[] xyz, double[] mate, SymOp symOp, boolean[] mask)
    Apply a cartesian symmetry operator to an array of coordinates.
    static void
    applyCartesianSymRot(double[] xyz, double[] mate, SymOp symOp)
    Apply a Cartesian symmetry rotation to an array of Cartesian coordinates.
    static void
    applyCartesianSymRot(double[] xyz, double[] mate, SymOp symOp, boolean[] mask)
    Apply a Cartesian symmetry rotation to an array of Cartesian coordinates.
    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.
    static void
    applyFracSymOp(double[] xyz, double[] mate, SymOp symOp)
    Apply a fractional symmetry operator to one set of coordinates.
    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.
    static void
    applySymRot(HKL hkl, HKL mate, SymOp symOp)
    Apply a symmetry operator to one HKL.
    static void
    applyTransSymRot(HKL hkl, HKL mate, SymOp symOp)
    Apply a transpose rotation symmetry operator to one HKL.
    double[][]
    Return the SymOp as a 4x4 matrix.
    static String
    Print a Sym Op matrix as a continued line string.
    static SymOp
    combineSymOps(SymOp symOp1, SymOp symOp2)
    Return the combined SymOp that is equivalent to first applying symOp1 and then SymOp2.
    static SymOp
    Invert a symmetry operator.
    static SymOp
    Create a SymOp from an input String.
    prepend(SymOp symOp)
    Return the combined SymOp that is equivalent to first applying the argument and then this SymOp.
    static SymOp
    randomSymOpFactory(double scalar)
    Generate a random Cartesian Symmetry Operator.
    static SymOp
    randomSymOpFactory(double[] tr)
    Generate a random Cartesian Symmetry Operator.
    double
    symPhaseShift(double[] hkl)
    symPhaseShift
    double
    symPhaseShift
    Print the symmetry operator with double precision.
    toXYZString

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • 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 Details

    • 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 Details

    • 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, the method returns immediately.
      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.
    • asMatrixString

      public static String asMatrixString(SymOp symOp)
      Print a Sym Op matrix as a continued line string.
      Parameters:
      symOp - Symmetry operation to print.
      Returns:
      Continued line string.
    • 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.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • 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.