SimpleUnitCell
Date: 2019-10-22

org.jmol.util

## Class SimpleUnitCell

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

- Direct Known Subclasses:
    UnitCell

      public class SimpleUnitCell
      extends java.lang.Object

  general-purpose simple unit cell for calculations and as a super-class of unitcell, which is only part of Symmetry allows one-dimensional (polymer) and two-dimensional (slab) periodicity

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected float` | `a`
    `protected double` | `a_`
    `protected float` | `alpha`
    `protected float` | `b`
    `protected double` | `b_`
    `protected float` | `beta`
    `protected float` | `c`
    `protected double` | `c_`
    `protected double` | `cA_`
    `protected double` | `cB_`
    `protected double` | `cosAlpha`
    `protected double` | `cosBeta`
    `protected double` | `cosGamma`
    `protected int` | `dimension`
    `private javajs.util.P3` | `fractionalOrigin`
    `protected float` | `gamma`
    `static int` | `INFO_A`
    `static int` | `INFO_ALPHA`
    `static int` | `INFO_B`
    `static int` | `INFO_BETA`
    `static int` | `INFO_C`
    `static int` | `INFO_DIMENSIONS`
    `static int` | `INFO_GAMMA`
    `javajs.util.M4` | `matrixCartesianToFractional`
    `protected javajs.util.M4` | `matrixCtoFNoOffset`
    `javajs.util.M4` | `matrixFractionalToCartesian`
    `protected javajs.util.M4` | `matrixFtoCNoOffset`
    `private int` | `na`
    `private int` | `nb`
    `private int` | `nc`
    `protected double` | `sinAlpha`
    `protected double` | `sinBeta`
    `protected double` | `sinGamma`
    `static float` | `SLOP`
    `private static float` | `SLOP1`
    `protected static float` | `toRadians`
    `protected float[]` | `unitCellParams`
    `double` | `volume`

  - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `SimpleUnitCell()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `static java.lang.String` | `escapeMultiplier(javajs.util.T3 pt)` Generally the multiplier is just {ijk ijk scale}, but when we have 1iiijjjkkk 1iiijjjkkk scale, floats lose kkk due to Java float precision issues so we use P4 {1iiijjjkkk 1iiijjjkkk scale, 1kkkkkk}
    `static float` | `getCellWeight(javajs.util.P3 pt)` calculate weighting of 1 (interior), 0.5 (face), 0.25 (edge), or 0.125 (vertex)
    `javajs.util.T3` | `getFractionalOrigin()`
    `float` | `getInfo(int infoType)`
    `static javajs.util.T3[]` | `getReciprocal(javajs.util.T3[] abc, javajs.util.T3[] ret, float scale)`
    `float[]` | `getUnitCellAsArray(boolean vectorsOnly)`
    `float[]` | `getUnitCellParams()`
    `static void` | `ijkToPoint3f(int nnn, javajs.util.P3 cell, int offset, int kcode)` Expanded cell notation: 111 - 1000 --> center 5,5,5; range 0 to 9 or -5 to +4 1000000 - 1999999 --> center 50,50,50; range 0 to 99 or -50 to +49 1000000000 - 1999999999 --> center 500, 500, 500; range 0 to 999 or -500 to +499
    `protected void` | `init(float[] params)`
    `boolean` | `isPolymer()`
    `boolean` | `isSlab()`
    `boolean` | `isSupercell()`
    `static boolean` | `isValid(float[] parameters)`
    `static SimpleUnitCell` | `newA(float[] params)`
    `private void` | `setABC(javajs.util.V3 va, javajs.util.V3 vb, javajs.util.V3 vc)`
    `private void` | `setCellParams()`
    `static void` | `setMinMaxLatticeParameters(int dimension, javajs.util.P3i minXYZ, javajs.util.P3i maxXYZ, int kcode)`
    `static javajs.util.T3[]` | `setOabc(java.lang.String abcabg, float[] params, javajs.util.T3[] ucnew)` set cell vectors by string
    `private void` | `setParamsFromMatrix()`
    `void` | `toCartesian(javajs.util.T3 pt, boolean ignoreOffset)`
    `void` | `toFractional(javajs.util.T3 pt, boolean ignoreOffset)`
    `void` | `toFractionalM(javajs.util.M4 m)`
    `javajs.util.P3` | `toSupercell(javajs.util.P3 fpt)` convenience return only after changing fpt

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

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

- - ### Field Detail

    - #### unitCellParams

          protected float[] unitCellParams

    - #### matrixCartesianToFractional

          public javajs.util.M4 matrixCartesianToFractional

    - #### matrixFractionalToCartesian

          public javajs.util.M4 matrixFractionalToCartesian

    - #### volume

          public double volume

    - #### toRadians

          protected static final float toRadians

      See Also:
        Constant Field Values

    - #### na

          private int na

    - #### nb

          private int nb

    - #### nc

          private int nc

    - #### a

          protected float a

    - #### b

          protected float b

    - #### c

          protected float c

    - #### alpha

          protected float alpha

    - #### beta

          protected float beta

    - #### gamma

          protected float gamma

    - #### cosAlpha

          protected double cosAlpha

    - #### sinAlpha

          protected double sinAlpha

    - #### cosBeta

          protected double cosBeta

    - #### sinBeta

          protected double sinBeta

    - #### cosGamma

          protected double cosGamma

    - #### sinGamma

          protected double sinGamma

    - #### cA_

          protected double cA_

    - #### cB_

          protected double cB_

    - #### a_

          protected double a_

    - #### b_

          protected double b_

    - #### c_

          protected double c_

    - #### dimension

          protected int dimension

    - #### fractionalOrigin

          private javajs.util.P3 fractionalOrigin

    - #### matrixCtoFNoOffset

          protected javajs.util.M4 matrixCtoFNoOffset

    - #### matrixFtoCNoOffset

          protected javajs.util.M4 matrixFtoCNoOffset

    - #### INFO_DIMENSIONS

          public static final int INFO_DIMENSIONS

      See Also:
        Constant Field Values

    - #### INFO_GAMMA

          public static final int INFO_GAMMA

      See Also:
        Constant Field Values

    - #### INFO_BETA

          public static final int INFO_BETA

      See Also:
        Constant Field Values

    - #### INFO_ALPHA

          public static final int INFO_ALPHA

      See Also:
        Constant Field Values

    - #### INFO_C

          public static final int INFO_C

      See Also:
        Constant Field Values

    - #### INFO_B

          public static final int INFO_B

      See Also:
        Constant Field Values

    - #### INFO_A

          public static final int INFO_A

      See Also:
        Constant Field Values

    - #### SLOP

          public static final float SLOP

      See Also:
        Constant Field Values

    - #### SLOP1

          private static final float SLOP1

      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### SimpleUnitCell

          protected SimpleUnitCell()

  - ### Method Detail

    - #### isSupercell

          public boolean isSupercell()

    - #### isValid

          public static boolean isValid(float[] parameters)

    - #### newA

          public static SimpleUnitCell newA(float[] params)

      Parameters:
        `params` - len = 6 [a b c alpha beta gamma] or len = 15 [-1 0 0 0 0 0 va vb vc] or len = 22 [a b c alpha beta gamma m00 m01 .. m33] and/or len = 25 [...................... na nb nc]
      Returns:
        a simple unit cell

    - #### init

          protected void init(float[] params)

    - #### setParamsFromMatrix

          private void setParamsFromMatrix()

    - #### setABC

          private void setABC(javajs.util.V3 va,
                              javajs.util.V3 vb,
                              javajs.util.V3 vc)

    - #### setCellParams

          private void setCellParams()

    - #### getFractionalOrigin

          public javajs.util.T3 getFractionalOrigin()

    - #### toSupercell

          public javajs.util.P3 toSupercell(javajs.util.P3 fpt)

      convenience return only after changing fpt
      Parameters:
        `fpt` -
      Returns:
        adjusted fpt

    - #### toCartesian

          public final void toCartesian(javajs.util.T3 pt,
                                        boolean ignoreOffset)

    - #### toFractionalM

          public void toFractionalM(javajs.util.M4 m)

    - #### toFractional

          public final void toFractional(javajs.util.T3 pt,
                                         boolean ignoreOffset)

    - #### isPolymer

          public boolean isPolymer()

    - #### isSlab

          public boolean isSlab()

    - #### getUnitCellParams

          public final float[] getUnitCellParams()

    - #### getUnitCellAsArray

          public final float[] getUnitCellAsArray(boolean vectorsOnly)

    - #### getInfo

          public final float getInfo(int infoType)

    - #### ijkToPoint3f

          public static void ijkToPoint3f(int nnn,
                                          javajs.util.P3 cell,
                                          int offset,
                                          int kcode)

      Expanded cell notation: 111 - 1000 --> center 5,5,5; range 0 to 9 or -5 to +4 1000000 - 1999999 --> center 50,50,50; range 0 to 99 or -50 to +49 1000000000 - 1999999999 --> center 500, 500, 500; range 0 to 999 or -500 to +499
      Parameters:
        `nnn` -
        `cell` -
        `offset` - 0 or 1 typically; < 0 means "apply no offset"
        `kcode` - Generally the multiplier is just {ijk ijk scale}, but when we have 1iiijjjkkk 1iiijjjkkk scale, floats lose kkk due to Java float precision issues so we use P4 {1iiijjjkkk 1iiijjjkkk scale, 1kkkkkk}. Here, our offset -- initially 0 or 1 from the uccage renderer, but later -500 or -499 -- tells us which code we are looking at, the first one or the second one.

    - #### escapeMultiplier

          public static java.lang.String escapeMultiplier(javajs.util.T3 pt)

      Generally the multiplier is just {ijk ijk scale}, but when we have 1iiijjjkkk 1iiijjjkkk scale, floats lose kkk due to Java float precision issues so we use P4 {1iiijjjkkk 1iiijjjkkk scale, 1kkkkkk}
      Parameters:
        `pt` -
      Returns:
        String representation for state

    - #### getCellWeight

          public static float getCellWeight(javajs.util.P3 pt)

      calculate weighting of 1 (interior), 0.5 (face), 0.25 (edge), or 0.125 (vertex)
      Parameters:
        `pt` - // * @param tolerance fractional allowance to consider this on an edge
      Returns:
        weighting

    - #### getReciprocal

          public static javajs.util.T3[] getReciprocal(javajs.util.T3[] abc,
                                                       javajs.util.T3[] ret,
                                                       float scale)

    - #### setOabc

          public static javajs.util.T3[] setOabc(java.lang.String abcabg,
                                                 float[] params,
                                                 javajs.util.T3[] ucnew)

      set cell vectors by string
      Parameters:
        `abcabg` - "a=...,b=...,c=...,alpha=...,beta=..., gamma=..." or null
        `params` - to use if not null
        `ucnew` - to create and return; null if only to set params
      Returns:
        T3[4] origin, a, b c

    - #### setMinMaxLatticeParameters

          public static void setMinMaxLatticeParameters(int dimension,
                                                        javajs.util.P3i minXYZ,
                                                        javajs.util.P3i maxXYZ,
                                                        int kcode)