UnitCell
Date: 2019-10-22

org.jmol.symmetry

## Class UnitCell

- java.lang.Object
- - org.jmol.util.SimpleUnitCell
  - - org.jmol.symmetry.UnitCell

- All Implemented Interfaces:
    java.lang.Cloneable

      class UnitCell
      extends SimpleUnitCell
      implements java.lang.Cloneable

  a class private to the org.jmol.symmetry package to be accessed only through the SymmetryInterface API adds vertices and offsets orientation, and a variety of additional calculations that in principle could be put in SimpleUnitCell if desired, but for now are in this optional package.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private boolean` | `allFractionalRelative` this flag TRUE causes an update of matrixCtoFNoOffset each time an offset is changed so that it is updated and the two stay the same; set true only for JmolData, tensors, and isosurfaceMesh it is no longer clear to me exactly why this is necessary, and perhaps it is not for some of these
    `protected javajs.util.P3` | `cartesianOffset`
    `private javajs.util.P3` | `fractionalOffset`
    `javajs.util.Lst<java.lang.String>` | `moreInfo`
    `java.lang.String` | `name`
    `private static double` | `twoP2`
    `protected javajs.util.T3` | `unitCellMultiplier`
    `private static javajs.util.V3[]` | `unitVectors`
    `private javajs.util.P3[]` | `vertices`

    - ### Fields inherited from class org.jmol.util.SimpleUnitCell

      `a, a_, alpha, b, b_, beta, c, c_, cA_, cB_, cosAlpha, cosBeta, cosGamma, dimension, gamma, INFO_A, INFO_ALPHA, INFO_B, INFO_BETA, INFO_C, INFO_DIMENSIONS, INFO_GAMMA, matrixCartesianToFractional, matrixCtoFNoOffset, matrixFractionalToCartesian, matrixFtoCNoOffset, sinAlpha, sinBeta, sinGamma, SLOP, toRadians, unitCellParams, volume`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `private` | `UnitCell()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `checkDistance(javajs.util.P3 f1, javajs.util.P3 f2, float distance, float dx, int iRange, int jRange, int kRange, javajs.util.P3 ptOffset)`
    `static UnitCell` | `cloneUnitCell(UnitCell uc)`
    `(package private) java.lang.String` | `dumpInfo(boolean isFull)`
    `private float` | `fix(float x)`
    `(package private) static UnitCell` | `fromOABC(javajs.util.T3[] oabc, boolean setRelative)` A special constructor for spacially defined unit cells.
    `static UnitCell` | `fromParams(float[] params, boolean setRelative)`
    `(package private) javajs.util.P3[]` | `getCanonicalCopy(float scale, boolean withOffset)`
    `(package private) javajs.util.P3` | `getCartesianOffset()`
    `javajs.util.T3[]` | `getConventionalUnitCell(java.lang.String latticeType, javajs.util.M3 primitiveToCrystal)` return a conventional lattice from a primitive
    `(package private) javajs.util.P3` | `getFractionalOffset()`
    `(package private) java.util.Map<java.lang.String,java.lang.Object>` | `getInfo()`
    `javajs.util.Quat` | `getQuaternionRotation(java.lang.String abc)` Returns a quaternion that will take the standard frame to a view down a particular axis, expressed as its counterparts.
    `java.lang.String` | `getState()`
    `(package private) Tensor` | `getTensor(Viewer vwr, float[] parBorU)`
    `javajs.util.T3` | `getUnitCellMultiplier()`
    `javajs.util.P3[]` | `getUnitCellVectors()`
    `javajs.util.T3[]` | `getV0abc(java.lang.Object def)`
    `(package private) javajs.util.P3[]` | `getVertices()`
    `boolean` | `hasOffset()`
    `(package private) void` | `initOrientation(javajs.util.M3 mat)`
    `private void` | `initUnitcellVertices()`
    `boolean` | `isSameAs(UnitCell uc)`
    `void` | `reset()`
    `private void` | `setCartesianOffset(javajs.util.T3 origin)`
    `(package private) void` | `setOffset(javajs.util.T3 pt)`
    `private static float` | `toFractionalX(float x)`
    `boolean` | `toFromPrimitive(boolean toPrimitive, char type, javajs.util.T3[] uc, javajs.util.M3 primitiveToCrystal)`
    `(package private) void` | `toUnitCell(javajs.util.T3 pt, javajs.util.T3 offset)` when offset is null, use the current cell, otherwise use the original unit cell
    `void` | `unitize(javajs.util.T3 pt)` returns [0,1)

    - ### Methods inherited from class org.jmol.util.SimpleUnitCell

      `escapeMultiplier, getCellWeight, getFractionalOrigin, getInfo, getReciprocal, getUnitCellAsArray, getUnitCellParams, ijkToPoint3f, init, isPolymer, isSlab, isSupercell, isValid, newA, setMinMaxLatticeParameters, setOabc, toCartesian, toFractional, toFractionalM, toSupercell`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### vertices

          private javajs.util.P3[] vertices

    - #### fractionalOffset

          private javajs.util.P3 fractionalOffset

    - #### allFractionalRelative

          private boolean allFractionalRelative

      this flag TRUE causes an update of matrixCtoFNoOffset each time an offset is changed so that it is updated and the two stay the same; set true only for JmolData, tensors, and isosurfaceMesh it is no longer clear to me exactly why this is necessary, and perhaps it is not for some of these

    - #### cartesianOffset

          protected final javajs.util.P3 cartesianOffset

    - #### unitCellMultiplier

          protected javajs.util.T3 unitCellMultiplier

    - #### moreInfo

          public javajs.util.Lst<java.lang.String> moreInfo

    - #### name

          public java.lang.String name

    - #### twoP2

          private static final double twoP2

      See Also:
        Constant Field Values

    - #### unitVectors

          private static final javajs.util.V3[] unitVectors

  - ### Constructor Detail

    - #### UnitCell

          private UnitCell()

  - ### Method Detail

    - #### fromOABC

          static UnitCell fromOABC(javajs.util.T3[] oabc,
                                   boolean setRelative)

      A special constructor for spacially defined unit cells. Not used by readers.
      Parameters:
        `oabc` - [origin, Va, Vb, Vc]
        `setRelative` - a flag only set true for IsosurfaceMesh
      Returns:
        new unit cell

    - #### fromParams

          public static UnitCell fromParams(float[] params,
                                            boolean setRelative)

      Parameters:
        `params` -
        `setRelative` - only set true for JmolData and tensors
      Returns:
        a new unit cell

    - #### initOrientation

          void initOrientation(javajs.util.M3 mat)

    - #### toUnitCell

          final void toUnitCell(javajs.util.T3 pt,
                                javajs.util.T3 offset)

      when offset is null, use the current cell, otherwise use the original unit cell
      Parameters:
        `pt` -
        `offset` -

    - #### unitize

          public void unitize(javajs.util.T3 pt)

      returns [0,1)
      Parameters:
        `pt` -

    - #### reset

          public void reset()

    - #### setOffset

          void setOffset(javajs.util.T3 pt)

    - #### setCartesianOffset

          private void setCartesianOffset(javajs.util.T3 origin)

    - #### getInfo

          java.util.Map<java.lang.String,java.lang.Object> getInfo()

    - #### dumpInfo

          java.lang.String dumpInfo(boolean isFull)

    - #### getVertices

          javajs.util.P3[] getVertices()

    - #### getCartesianOffset

          javajs.util.P3 getCartesianOffset()

    - #### getFractionalOffset

          javajs.util.P3 getFractionalOffset()

    - #### getTensor

          Tensor getTensor(Viewer vwr,
                           float[] parBorU)

    - #### getCanonicalCopy

          javajs.util.P3[] getCanonicalCopy(float scale,
                                            boolean withOffset)

      Parameters:
        `scale` -
        `withOffset` -
      Returns:
        points in Triangulator order

    - #### toFractionalX

          private static float toFractionalX(float x)

    - #### initUnitcellVertices

          private void initUnitcellVertices()

    - #### checkDistance

          public boolean checkDistance(javajs.util.P3 f1,
                                       javajs.util.P3 f2,
                                       float distance,
                                       float dx,
                                       int iRange,
                                       int jRange,
                                       int kRange,
                                       javajs.util.P3 ptOffset)

      Parameters:
        `f1` -
        `f2` -
        `distance` -
        `dx` -
        `iRange` -
        `jRange` -
        `kRange` -
        `ptOffset` - TODO
      Returns:
        TRUE if pt has been set.

    - #### getUnitCellMultiplier

          public javajs.util.T3 getUnitCellMultiplier()

    - #### getUnitCellVectors

          public javajs.util.P3[] getUnitCellVectors()

    - #### fix

          private float fix(float x)

    - #### isSameAs

          public boolean isSameAs(UnitCell uc)

    - #### hasOffset

          public boolean hasOffset()

    - #### getState

          public java.lang.String getState()

    - #### getQuaternionRotation

          public javajs.util.Quat getQuaternionRotation(java.lang.String abc)

      Returns a quaternion that will take the standard frame to a view down a particular axis, expressed as its counterparts.
      Parameters:
        `abc` - ab bc ca
      Returns:
        quaternion

    - #### getV0abc

          public javajs.util.T3[] getV0abc(java.lang.Object def)

      Parameters:
        `def` - String "abc;offset" or M3 or M4 to origin; if String, can be preceded by ! for "reverse of". For example, "!a-b,-5a-5b,-c;7/8,0,1/8" offset is optional, and can be a definition such as "a=3.40,b=4.30,c=5.02,alpha=90,beta=90,gamma=129"
      Returns:
        [origin va vb vc]

    - #### toFromPrimitive

          public boolean toFromPrimitive(boolean toPrimitive,
                                         char type,
                                         javajs.util.T3[] uc,
                                         javajs.util.M3 primitiveToCrystal)

      Parameters:
        `toPrimitive` - or assumed conventional
        `type` - P, R, A, B, C, I(BCC), or F(FCC)
        `uc` - either [origin, va, vb, vc] or just [va, vb, vc]
        `primitiveToCrystal` -
      Returns:
        true if successful

    - #### getConventionalUnitCell

          public javajs.util.T3[] getConventionalUnitCell(java.lang.String latticeType,
                                                          javajs.util.M3 primitiveToCrystal)

      return a conventional lattice from a primitive
      Parameters:
        `latticeType` - "A" "B" "C" "R" etc.
      Returns:
        [origin va vb vc]

    - #### cloneUnitCell

          public static UnitCell cloneUnitCell(UnitCell uc)