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
private javajs.util.P3
protected float
static final int
static final int
static final int
static final int
static final int
static final int
static final int
javajs.util.M4
protected javajs.util.M4
javajs.util.M4
protected javajs.util.M4
private int
private int
private int
static final int
static final int
static final int
static final int
static final int
static final int
protected double
protected double
protected double
static final float
private static final float
private static final float
allowance for rounding in [0,1)protected static final float
protected float[]
double
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic void
addVectors
(float[] params) boolean
checkPeriodic
(javajs.util.P3 pt) check atom position for range [0, 1) allowing for roundingstatic 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
final float
getInfo
(int infoType) static javajs.util.T3[]
getReciprocal
(javajs.util.T3[] abc, javajs.util.T3[] ret, float scale) Generate the reciprocal unit cell, scaled as desiredfinal float[]
getUnitCellAsArray
(boolean vectorsOnly) final float[]
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 +499protected void
init
(float[] params) boolean
boolean
isSlab()
boolean
static boolean
isValid
(float[] parameters) boolean
isWithinUnitCell
(double a, double b, double c, javajs.util.P3 pt) static SimpleUnitCell
newA
(float[] params) static float
normalizeXRnd
(float x) static javajs.util.P4
ptToIJK
(javajs.util.T3 pt, int scale) Convert user's {3 2 1} to {1500500500, 1503502501, 0 or 1, 1500501}private void
setABC
(javajs.util.V3 va, javajs.util.V3 vb, javajs.util.V3 vc) private void
static void
setMinMaxLatticeParameters
(int dimension, javajs.util.P3i minXYZ, javajs.util.P3i maxXYZ, int kcode) static javajs.util.T3[]
set cell vectors by stringprivate void
final void
toCartesian
(javajs.util.T3 pt, boolean ignoreOffset) final void
toFractional
(javajs.util.T3 pt, boolean ignoreOffset) void
toFractionalM
(javajs.util.M4 m) toString()
javajs.util.P3
toSupercell
(javajs.util.P3 fpt) convenience return only after changing fptstatic void
unitizeDim
(int dimension, javajs.util.T3 pt) static void
unitizeDimRnd
(int dimension, javajs.util.T3 pt) static float
unitizeX
(float x) static float
unitizeXRnd
(float x)
-
Field Details
-
PARAM_STD
public static final int PARAM_STD- See Also:
-
PARAM_VABC
public static final int PARAM_VABC- See Also:
-
PARAM_M4
public static final int PARAM_M4- See Also:
-
PARAM_SUPERCELL
public static final int PARAM_SUPERCELL- See Also:
-
PARAM_SCALE
public static final int PARAM_SCALE- See Also:
-
PARAM_COUNT
public static final int PARAM_COUNT- See Also:
-
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:
-
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:
-
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:
-
SLOP
public static final float SLOP- See Also:
-
SLOP1
private static final float SLOP1- See Also:
-
SLOP2
private static final float SLOP2allowance for rounding in [0,1)- See Also:
-
-
Constructor Details
-
SimpleUnitCell
protected SimpleUnitCell()
-
-
Method Details
-
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- 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) -
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
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
-
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 boolean checkPeriodic(javajs.util.P3 pt) check atom position for range [0, 1) allowing for rounding- Parameters:
pt
-- Returns:
- true if in [0, 1)
-
isWithinUnitCell
public boolean isWithinUnitCell(double a, double b, double c, javajs.util.P3 pt) -
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; invalid input: '<' 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
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
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
-