Package org.jmol.util
Class SimpleUnitCell
java.lang.Object
org.jmol.util.SimpleUnitCell
- Direct Known Subclasses:
UnitCell
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
FieldsModifier and TypeFieldDescriptionprotected float
protected double
protected float
protected float
protected double
protected float
protected float
protected double
protected double
protected double
protected double
protected double
protected double
protected int
protected float
static final String
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
protected M4
protected M4
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final int
static final String
protected double
protected double
protected double
protected float
initial value is set in subclass UnitCellstatic final float
static final float
static final float
allowance for rounding in [0,1)protected static final double
protected float[]
double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addVectors
(float[] params) protected static boolean
approx0
(float f) static String
escapeMultiplier
(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 void
fillParams
(V3 va, V3 vb, V3 vc, float[] p) static int
getCellRange
(T3 fset, P3[] cellRange) static int
getDimensionFromParams
(float[] params) Get the fractional origin for the UccageRenderer.final float
getInfo
(int infoType) float
static T3[]
getReciprocal
(T3[] abc, T3[] ret, float scale) Generate the reciprocal unit cell, scaled as desiredfinal float[]
getUnitCellAsArray
(boolean vectorsOnly) final float[]
static void
ijkToPoint3f
(int nnn, 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 for example, a 3x3x3 block of 27 cells: {444 666 1} or {1494949 1515151 1} or {1499499499 1501501501 1}protected void
init
(float[] params) static boolean
isHexagonal
(float[] params) boolean
static boolean
isRhombohedral
(float[] params) boolean
isSlab()
boolean
static boolean
isValid
(float[] parameters) static SimpleUnitCell
newA
(float[] params) static float[]
newParams
(float[] params, float slop) static P4
Convert user's {3 2 1} to {1500500500, 1503502501, 0 or 1, 1500501}static T3[]
set cell vectors by string.static T3[]
setAbcFromParams
(float[] params, T3[] ucnew) static void
setMinMaxLatticeParameters
(int dimension, P3i minXYZ, P3i maxXYZ, int kcode) void
setPrecision
(float slop) final void
toCartesian
(T3 pt, boolean ignoreOffset) final void
toFractional
(T3 pt, boolean ignoreOffset) void
toFractionalM
(M4 m) toString()
toSupercell
(P3 fpt) convenience return only after changing fptvoid
twelfthify
(P3 pt) int
twelfthsOf
(float f) void
unitizeDim
(int dimension, T3 pt) Used for just about everything; via UnitCell including SpaceGroup.getSiteMultiplicity, Symmetry.getInvariantSymops, Symmetry.removeDuplicates, Symmetry.unitize, Symmetry.toUnitCell, SymmetryDesc.getTransform.static void
unitizeDimRnd
(int dimension, T3 pt, float slop) Only used for getting equivalent points and checking for duplicates.static float
unitizeX
(float x, float slop) static float
unitizeXRnd
(float x, float slop) Slightly higher precision -- only used for cmdAssignSpaceGroup checking for duplicates
-
Field Details
-
PARAM_STD
public static final int PARAM_STD- See Also:
-
PARAM_VAX
public static final int PARAM_VAX- See Also:
-
PARAM_VBX
public static final int PARAM_VBX- See Also:
-
PARAM_VCX
public static final int PARAM_VCX- See Also:
-
PARAM_VCZ
public static final int PARAM_VCZ- See Also:
-
PARAM_OXYZ
public static final int PARAM_OXYZ- See Also:
-
PARAM_M4
public static final int PARAM_M4- See Also:
-
PARAM_M33
public static final int PARAM_M33- See Also:
-
PARAM_SUPERCELL
public static final int PARAM_SUPERCELL- See Also:
-
PARAM_SCALE
public static final int PARAM_SCALE- See Also:
-
PARAM_SLOP
public static final int PARAM_SLOP- See Also:
-
PARAM_COUNT
public static final int PARAM_COUNT- See Also:
-
INFO_IS_RHOMBOHEDRAL
public static final int INFO_IS_RHOMBOHEDRAL- See Also:
-
INFO_IS_HEXAGONAL
public static final int INFO_IS_HEXAGONAL- See Also:
-
INFO_DIMENSIONS
public static final int INFO_DIMENSIONS- See Also:
-
INFO_GAMMA
public static final int INFO_GAMMA- See Also:
-
INFO_BETA
public static final int INFO_BETA- See Also:
-
INFO_ALPHA
public static final int INFO_ALPHA- See Also:
-
INFO_C
public static final int INFO_C- See Also:
-
INFO_B
public static final int INFO_B- See Also:
-
INFO_A
public static final int INFO_A- See Also:
-
HEX_TO_RHOMB
- See Also:
-
RHOMB_TO_HEX
- See Also:
-
toRadians
protected static final double toRadians- See Also:
-
SLOPSP
public static final float SLOPSPallowance for rounding in [0,1)- See Also:
-
SLOPDP
public static final float SLOPDP- See Also:
-
SLOP_PARAMS
public static final float SLOP_PARAMS- See Also:
-
unitCellParams
protected float[] unitCellParams -
slop
protected float slopinitial value is set in subclass UnitCell -
matrixCartesianToFractional
-
matrixFractionalToCartesian
-
matrixCtoFNoOffset
-
matrixFtoCNoOffset
-
volume
public double volume -
dimension
protected int dimension -
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_
-
-
Constructor Details
-
SimpleUnitCell
protected SimpleUnitCell()
-
-
Method Details
-
getPrecision
public float getPrecision() -
setPrecision
public void setPrecision(float slop) -
isSupercell
public boolean isSupercell() -
isValid
public static boolean isValid(float[] parameters) -
newA
- 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 and/or len = 27 [..................................... slop] // precision- Returns:
- a simple unit cell
-
getDimensionFromParams
public static int getDimensionFromParams(float[] params) -
init
protected void init(float[] params) -
newParams
public static float[] newParams(float[] params, float slop) -
addVectors
public static void addVectors(float[] params) -
fillParams
-
getFractionalOrigin
Get the fractional origin for the UccageRenderer. NOTE: This is NOT a copy- Returns:
- fractionalOrigin
-
toSupercell
convenience return only after changing fpt- Parameters:
fpt
-- Returns:
- adjusted fpt
-
toCartesian
-
toFractionalM
-
toFractional
-
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) -
getReciprocal
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
-
setAbc
set cell vectors by string. Does not set origin.- 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] ucnew as [origin, a, b, c], with origin unchanged or {0 0 0}
-
setAbcFromParams
-
unitizeDim
Used for just about everything; via UnitCell including SpaceGroup.getSiteMultiplicity, Symmetry.getInvariantSymops, Symmetry.removeDuplicates, Symmetry.unitize, Symmetry.toUnitCell, SymmetryDesc.getTransform. Low precision here unless SET HIGHPRECISION TRUE has been issued.- Parameters:
dimension
-pt
-
-
unitizeDimRnd
Only used for getting equivalent points and checking for duplicates. Presumption here is that two points should not be close together regardless of lattice distances.- Parameters:
dimension
-pt
-slop
-
-
unitizeX
public static float unitizeX(float x, float slop) -
unitizeXRnd
public static float unitizeXRnd(float x, float slop) Slightly higher precision -- only used for cmdAssignSpaceGroup checking for duplicates- Parameters:
x
-slop
-- Returns:
- rounded value +/-slop
-
twelfthsOf
public int twelfthsOf(float f) -
twelfthify
-
ijkToPoint3f
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 for example, a 3x3x3 block of 27 cells: {444 666 1} or {1494949 1515151 1} or {1499499499 1501501501 1}- 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
-
ptToIJK
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
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
-
setMinMaxLatticeParameters
- 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.
-
isHexagonal
public static boolean isHexagonal(float[] params) - Parameters:
params
-- Returns:
- true if approximately hexagonal
-
isRhombohedral
public static boolean isRhombohedral(float[] params) - Parameters:
params
-- Returns:
- true if approximately rhombohedral
-
approx0
protected static boolean approx0(float f) - Parameters:
f
-- Returns:
- true or false
-
getCellRange
-
toString
-