# Class UnitCell

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

All Implemented Interfaces:
  `Cloneable`

public class UnitCell extends SimpleUnitCell implements Cloneable
a class pseudoprivate to the org.jmol.symmetry and org.jmol.applet.smarter.FileSymmetry to be accessed generally 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
Description
`String`
`name`

### Fields inherited from class SimpleUnitCell

`a, a_, alpha, b, b_, beta, c, c_, cA_, cB_, cosAlpha, cosBeta, cosGamma, dimension, DIMENSION_TYPE_ALL, dimensionType, gamma, HEX_TO_RHOMB, INFO_A, INFO_ALPHA, INFO_B, INFO_BETA, INFO_C, INFO_DIMENSION_TYPE, INFO_DIMENSIONS, INFO_GAMMA, INFO_IS_HEXAGONAL, INFO_IS_RHOMBOHEDRAL, INFO_VOLUME, matrixCartesianToFractional, matrixCtoFNoOffset, matrixFractionalToCartesian, matrixFtoCNoOffset, PARAM_COUNT, PARAM_M33, PARAM_M4, PARAM_OXYZ, PARAM_SCALE, PARAM_SLOP, PARAM_STD, PARAM_SUPERCELL, PARAM_VAX, PARAM_VBX, PARAM_VCX, PARAM_VCZ, RHOMB_TO_HEX, sinAlpha, sinBeta, sinGamma, slop, SLOP_PARAMS, SLOPDP, SLOPSP, toRadians, unitCellParams, volume`

## Method Summary

Modifier and Type
Method
Description
`void`
`adjustRangeMinMax(T3[] oabc, float packingRange, P3i minXYZ, P3i maxXYZ, P3 rmin, P3 rmax, P3i newMin, P3i newMax)`
`static UnitCell`
`fromOABC(T3[] oabc, boolean setRelative)`
A special constructor for spacially defined unit cells.
`static UnitCell`
`fromParams(float[] params, boolean setRelative, float slop)`
`P3[]`
`getCanonicalCopyTrimmed(P3 frac, float scale)`
`P3`
`getCenter(int periodicity)`
Takes into account subperiodic groups using BoxInfo.unitCubePoints P3.new3(0, 0, 0), // 0 P3.new3(0, 0, 1), // 1 c P3.new3(0, 1, 0), // 2 b P3.new3(0, 1, 1), // 3 bc P3.new3(1, 0, 0), // 4 a P3.new3(1, 0, 1), // 5 ac P3.new3(1, 1, 0), // 6 ab P3.new3(1, 1, 1), // 7 }; abc
`T3[]`
`getConventionalUnitCell(String latticeType, M3 primitiveToCrystal)`
return a conventional lattice from a primitive
`float[][]`
`getF2C()`
`static T3[]`
`getMatrixAndUnitCell(Viewer vwr, SimpleUnitCell uc, Object def, M4 retMatrix)`
`Tensor`
`getTensor(Viewer vwr, float[] parBorU)`
`void`
`setSpinAxisAngle(A4 aa)`
`static void`
`setSymmetryMinMax(P3 c, P3 rmin, P3 rmax)`
`void`
`toCartesianSpin(T3 v)`
`void`
`toFractionalSpin(T3 v)`
`static M4`
`toTrm(String transform, M4 trm)`
`final void`
`toUnitCellRnd(T3 pt, T3 offset)`
when offset is null, use the current cell, otherwise use the original unit cell

### Methods inherited from class SimpleUnitCell

`addVectors, approx0, escapeMultiplier, fillParams, getCellRange, getDimensionFromParams, getFractionalOrigin, getInfo, getInfoStr, getPrecision, getReciprocal, getUnitCellAsArray, getUnitCellParams, ijkToPoint3f, init, isHexagonal, isPolymer, isRhombohedral, isSlab, isSupercell, isValid, newA, newParams, parseCalc, parseCalcFunctions, parseSimpleMath, ptToIJK, setAbc, setAbcFromParams, setMinMaxLatticeParameters, setPrecision, toCartesian, toFractional, toFractionalM, toString, toSupercell, twelfthify, twelfthsOf, unitizeDim, unitizeDimRnd, unitizeX, unitizeXRnd`

### Methods inherited from class Object

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

## Field Details

### name

public String name

## Method Details

### fromOABC

public static UnitCell fromOABC(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, float slop)

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

### getCanonicalCopyTrimmed

public P3[] getCanonicalCopyTrimmed(P3 frac, float scale)

### getConventionalUnitCell

public T3[] getConventionalUnitCell(String latticeType, M3 primitiveToCrystal)
return a conventional lattice from a primitive

Parameters:
  `latticeType` - "A" "B" "C" "R" etc.
  `primitiveToCrystal` -
Returns:
  [origin va vb vc]

### getTensor

public Tensor getTensor(Viewer vwr, float[] parBorU)

### toTrm

public static M4 toTrm(String transform, M4 trm)

### getMatrixAndUnitCell

public static T3[] getMatrixAndUnitCell(Viewer vwr, SimpleUnitCell uc, Object def, M4 retMatrix)

Parameters:
  `vwr` - only needed for reciprocal axis and sqrt(...)
  `uc` - generally this or null
  `def` - String "abc;offset" or M3 or M4 or Object[M4]; 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" also allows for reciprocal lattice a*, b*, c
  `retMatrix` - if a string, return the 4x4 matrix corresponding to this definition; may be null to ignore
Returns:
  [origin va vb vc]

### getF2C

public float[][] getF2C()

### toUnitCellRnd

public final void toUnitCellRnd(T3 pt, T3 offset)
when offset is null, use the current cell, otherwise use the original unit cell

Parameters:
  `pt` -
  `offset` -

### getCenter

public P3 getCenter(int periodicity)
Takes into account subperiodic groups using BoxInfo.unitCubePoints P3.new3(0, 0, 0), // 0 P3.new3(0, 0, 1), // 1 c P3.new3(0, 1, 0), // 2 b P3.new3(0, 1, 1), // 3 bc P3.new3(1, 0, 0), // 4 a P3.new3(1, 0, 1), // 5 ac P3.new3(1, 1, 0), // 6 ab P3.new3(1, 1, 1), // 7 }; abc

Parameters:
  `periodicity` -
Returns:
  center

### setSpinAxisAngle

public void setSpinAxisAngle(A4 aa)

### setSymmetryMinMax

public static void setSymmetryMinMax(P3 c, P3 rmin, P3 rmax)

### adjustRangeMinMax

public void adjustRangeMinMax(T3[] oabc, float packingRange, P3i minXYZ, P3i maxXYZ, P3 rmin, P3 rmax, P3i newMin, P3i newMax)

Parameters:
  `oabc` -
  `packingRange` - in Cartesian angstroms, usually 0.02, or NaN
  `minXYZ` - supercell lattice scaling minimum, may be null
  `maxXYZ` - supercell lattice scaling maximum, ignored if minXYZ is null
  `rmin` - preset minimum of range, or null
  `rmax` - preset maximum of range; ignored if rmin is null
  `newMin` -
  `newMax` -

### toFractionalSpin

public void toFractionalSpin(T3 v)

### toCartesianSpin

public void toCartesianSpin(T3 v)