Package org.jmol.util
Class SimpleUnitCell
- java.lang.Object
-
- org.jmol.util.SimpleUnitCell
-
- Direct Known Subclasses:
UnitCell
public class SimpleUnitCell extends java.lang.Objectgeneral-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 Description protected floataprotected doublea_protected floatalphaprotected floatbprotected doubleb_protected floatbetaprotected floatcprotected doublec_protected doublecA_protected doublecB_protected doublecosAlphaprotected doublecosBetaprotected doublecosGammaprotected intdimensionprivate javajs.util.P3fractionalOriginprotected floatgammastatic intINFO_Astatic intINFO_ALPHAstatic intINFO_Bstatic intINFO_BETAstatic intINFO_Cstatic intINFO_DIMENSIONSstatic intINFO_GAMMAjavajs.util.M4matrixCartesianToFractionalprotected javajs.util.M4matrixCtoFNoOffsetjavajs.util.M4matrixFractionalToCartesianprotected javajs.util.M4matrixFtoCNoOffsetprivate intnaprivate intnbprivate intncstatic intPARAM_COUNTstatic intPARAM_M4static intPARAM_SCALEstatic intPARAM_STDstatic intPARAM_SUPERCELLstatic intPARAM_VABCprotected doublesinAlphaprotected doublesinBetaprotected doublesinGammastatic floatSLOPprivate static floatSLOP1private static floatSLOP2allowance for rounding in [0,1)protected static floattoRadiansprotected float[]unitCellParamsdoublevolume
-
Constructor Summary
Constructors Modifier Constructor Description protectedSimpleUnitCell()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidaddVectors(float[] params)static booleancheckPeriodic(javajs.util.P3 pt)check atom position for range [0, 1) allowing for roundingstatic booleancheckUnitCell(SymmetryInterface uc, javajs.util.P3 cell, javajs.util.P3 ptTemp)static java.lang.StringescapeMultiplier(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 floatgetCellWeight(javajs.util.P3 pt)calculate weighting of 1 (interior), 0.5 (face), 0.25 (edge), or 0.125 (vertex)javajs.util.T3getFractionalOrigin()floatgetInfo(int infoType)static javajs.util.T3[]getReciprocal(javajs.util.T3[] abc, javajs.util.T3[] ret, float scale)Generate the reciprocal unit cell, scaled as desiredfloat[]getUnitCellAsArray(boolean vectorsOnly)float[]getUnitCellParams()static voidijkToPoint3f(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 +499protected voidinit(float[] params)booleanisPolymer()booleanisSlab()booleanisSupercell()static booleanisValid(float[] parameters)static SimpleUnitCellnewA(float[] params)static floatnormalizeXRnd(float x)static javajs.util.P4ptToIJK(javajs.util.T3 pt, int scale)Convert user's {3 2 1} to {1500500500, 1503502501, 0 or 1, 1500501}private voidsetABC(javajs.util.V3 va, javajs.util.V3 vb, javajs.util.V3 vc)private voidsetCellParams()static voidsetMinMaxLatticeParameters(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 stringprivate voidsetParamsFromMatrix()voidtoCartesian(javajs.util.T3 pt, boolean ignoreOffset)voidtoFractional(javajs.util.T3 pt, boolean ignoreOffset)voidtoFractionalM(javajs.util.M4 m)java.lang.StringtoString()javajs.util.P3toSupercell(javajs.util.P3 fpt)convenience return only after changing fptstatic voidunitizeDim(int dimension, javajs.util.T3 pt)static voidunitizeDimRnd(int dimension, javajs.util.T3 pt)static floatunitizeX(float x)static floatunitizeXRnd(float x)
-
-
-
Field Detail
-
PARAM_STD
public static final int PARAM_STD
- See Also:
- Constant Field Values
-
PARAM_VABC
public static final int PARAM_VABC
- See Also:
- Constant Field Values
-
PARAM_M4
public static final int PARAM_M4
- See Also:
- Constant Field Values
-
PARAM_SUPERCELL
public static final int PARAM_SUPERCELL
- See Also:
- Constant Field Values
-
PARAM_SCALE
public static final int PARAM_SCALE
- See Also:
- Constant Field Values
-
PARAM_COUNT
public static final int PARAM_COUNT
- See Also:
- Constant Field Values
-
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
-
SLOP2
private static final float SLOP2
allowance for rounding in [0,1)- See Also:
- Constant Field Values
-
-
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] len = 6 [a b -1 alpha beta gamma] // slab len = 6 [a -1 -1 alpha beta gamma] // polymer or len = 15 [-1 -1 -1 -1 -1 -1 va[3] vb[3] vc[3]] // vectors only or len = 15 [a -1 -1 -1 -1 -1 va[3] vb[3] vc[3]] // polymer, vectors only or len = 15 [a b -1 -1 -1 -1 va[3] vb[3] vc[3]] // slab, vectors only or len = 22 [a b c alpha beta gamma m00 m01 .. m33] // matrix included and/or len = 25 [...................... na nb nc] // supercell and/or len = 26 [...................... na nb nc scale] // scaled supercell- Returns:
- a simple unit cell
-
init
protected void init(float[] params)
-
addVectors
public static void addVectors(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.
-
ptToIJK
public static javajs.util.P4 ptToIJK(javajs.util.T3 pt, int scale)Convert user's {3 2 1} to {1500500500, 1503502501, 0 or 1, 1500501}- Parameters:
pt-scale- 1 for block of unit cells; 0 for one large supercell- Returns:
- converted P4
-
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)Generate the reciprocal unit cell, scaled as desired- Parameters:
abc- [a,b,c] or [o,a,b,c]ret-scale- 0 for 2pi, teneral reciprocal lattice- Returns:
- oabc
-
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 nullparams- to use if not nullucnew- 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)- Parameters:
dimension-minXYZ-maxXYZ-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.
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
unitizeDim
public static void unitizeDim(int dimension, javajs.util.T3 pt)
-
unitizeDimRnd
public static void unitizeDimRnd(int dimension, javajs.util.T3 pt)
-
unitizeX
public static float unitizeX(float x)
-
unitizeXRnd
public static float unitizeXRnd(float x)
-
normalizeXRnd
public static float normalizeXRnd(float x)
-
checkPeriodic
public static boolean checkPeriodic(javajs.util.P3 pt)
check atom position for range [0, 1) allowing for rounding- Parameters:
pt-- Returns:
- true if in [0, 1)
-
checkUnitCell
public static boolean checkUnitCell(SymmetryInterface uc, javajs.util.P3 cell, javajs.util.P3 ptTemp)
-
-