Package org.jmol.scriptext
Class MathExt
java.lang.Object
org.jmol.scriptext.MathExt
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate javajs.util.Lst<SV>
addAllLists
(javajs.util.Lst<SV> list, javajs.util.Lst<SV> l) boolean
evaluate
(ScriptMathProcessor mp, T op, SV[] args, int tok) private boolean
evaluateArray
(ScriptMathProcessor mp, SV[] args, boolean isSelector) private boolean
evaluateBin
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateCache
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateColor
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateCompare
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateConnected
(ScriptMathProcessor mp, SV[] args, int tok, int intValue) private boolean
evaluateContact
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateData
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateDotDist
(ScriptMathProcessor mp, SV[] args, int tok, int op) x = y.distance({atoms}) the average distance from elements of y to the CENTER of {atoms} x = {atomset1}.distance.min({atomset2}, asAtomSet) If asAtomSet is true, returns the closest atom in atomset1 to any atom of atomset2; if false or omitted, returns an array listing the distance of each atom in atomset1 to the closest atom in atomset2.private boolean
evaluateFind
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateFormat
(ScriptMathProcessor mp, int intValue, SV[] args, boolean isLabel) private boolean
evaluateGetProperty
(ScriptMathProcessor mp, SV[] args, int tok0, boolean isAtomProperty) _ by itself, not as a function, is shorthand for getProperty("auxiliaryInfo") $ print _.keys boundbox group3Counts group3Lists modelLoadNote models properties someModelsHaveFractionalCoordinates someModelsHaveSymmetry someModelsHaveUnitcells symmetryRange _m by itself, not as a function, is shorthand for getProperty("auxiliaryInfo.models")[_currentFrame] $ print format("json",_m.unitCellParams) [ 0.0,0.0,0.0,0.0,0.0,0.0,0.0,-2.1660376,-2.1660376,0.0,-2.1660376, 2.1660376,-4.10273,0.0,0.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN ] {atomset}._ by itself delivers a subset array of auxiliaryInfo.models for all models in {atomset} $ print {*}._..1..aflowInfo (first model's aflowInfo) _(key) prepends "auxiliaryInfo.models", delivering a modelCount-length array of information $ print _("aflowInfo[SELECT auid WHERE H__eV___VASP_ < 0]") {atomset}._(key) selects for model Auxiliary info related to models of the specified atoms {atomset}.getProperty(key) defaults to atomInfo, but also allows key to start with "bondInfo" Examples: print _("aflowInfo[select sg where volume_cell > 70]") print {model>10}._("aflowInfo[select sg where volume_cell > 70]")private boolean
evaluateHelix
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateIn
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateInChI
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateList
(ScriptMathProcessor mp, int tok, SV[] args) private boolean
evaluateLoad
(ScriptMathProcessor mp, SV[] args, boolean isFile) private boolean
evaluateMath
(ScriptMathProcessor mp, SV[] args, int tok) private boolean
evaluateMeasure
(ScriptMathProcessor mp, SV[] args, int tok) private boolean
evaluateModulation
(ScriptMathProcessor mp, SV[] args) private boolean
evaluatePlane
(ScriptMathProcessor mp, SV[] args, int tok) plane() or intersection()private boolean
evaluatePoint
(ScriptMathProcessor mp, SV[] args) private boolean
evaluatePointGroup
(ScriptMathProcessor mp, SV[] args, boolean isAtomProperty) private boolean
evaluatePrompt
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateQuaternion
(ScriptMathProcessor mp, SV[] args, int tok) private boolean
evaluateRandom
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateReplace
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateRowCol
(ScriptMathProcessor mp, SV[] args, int tok) private boolean
evaluateScript
(ScriptMathProcessor mp, SV[] args, int tok) private boolean
evaluateSort
(ScriptMathProcessor mp, SV[] args, int tok) sort() or sort(n) or count() or count("xxxx")private boolean
evaluateSpacegroup
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateString
(ScriptMathProcessor mp, int tok, SV[] args) private boolean
evaluateSubstructure
(ScriptMathProcessor mp, SV[] args, int tok, boolean isSelector) private boolean
evaluateSymop
(ScriptMathProcessor mp, SV[] args, boolean isProperty) private boolean
evaluateTensor
(ScriptMathProcessor mp, SV[] args) private boolean
evaluateUnitCell
(ScriptMathProcessor mp, SV[] args, boolean isSelector) private boolean
evaluateUserFunction
(ScriptMathProcessor mp, String name, SV[] args, int tok, boolean isSelector) private boolean
evaluateWithin
(ScriptMathProcessor mp, SV[] args, boolean isAtomProperty) private boolean
evaluateWrite
(ScriptMathProcessor mp, SV[] args) private javajs.util.BS
getAtomsNearPts
(float distance, javajs.util.T3[] points, javajs.util.BS bsInclude) private javajs.util.BS
getAtomsNearSurface
(float distance, String surfaceId) private Object
getHelixData
(javajs.util.BS bs, int tokType) private Object
getMinMaxPoint
(Object pointOrSVArray, int tok) calculates the statistical value for x, y, and z independentlyprivate Object
getMinMaxQuaternion
(javajs.util.Lst<SV> svData, int tok) private JmolPatternMatcher
private javajs.util.Lst<SV>
getSublist
(javajs.util.Lst<SV> listIn, javajs.util.Lst<SV> formatList) [ {...},{...}...private T
opTokenFor
(int tok) javajs.util.BS
setContactBitSets
(javajs.util.BS bsA, javajs.util.BS bsB, boolean localOnly, float distance, RadiusData rd, boolean warnMultiModel)
-
Field Details
-
nan
-
vwr
-
e
-
t0
private static long t0 -
rand
-
pm
-
-
Constructor Details
-
MathExt
public MathExt()
-
-
Method Details
-
init
-
evaluate
- Throws:
ScriptException
-
evaluateSpacegroup
-
evaluatePointGroup
private boolean evaluatePointGroup(ScriptMathProcessor mp, SV[] args, boolean isAtomProperty) throws ScriptException - Throws:
ScriptException
-
evaluateUnitCell
private boolean evaluateUnitCell(ScriptMathProcessor mp, SV[] args, boolean isSelector) throws ScriptException - Throws:
ScriptException
-
evaluateArray
private boolean evaluateArray(ScriptMathProcessor mp, SV[] args, boolean isSelector) throws ScriptException - Throws:
ScriptException
-
evaluateBin
- Throws:
ScriptException
-
evaluateCache
-
evaluateColor
-
evaluateCompare
- Throws:
ScriptException
-
evaluateConnected
private boolean evaluateConnected(ScriptMathProcessor mp, SV[] args, int tok, int intValue) throws ScriptException - Throws:
ScriptException
-
evaluateContact
-
evaluateData
-
evaluateDotDist
private boolean evaluateDotDist(ScriptMathProcessor mp, SV[] args, int tok, int op) throws ScriptException x = y.distance({atoms}) the average distance from elements of y to the CENTER of {atoms} x = {atomset1}.distance.min({atomset2}, asAtomSet) If asAtomSet is true, returns the closest atom in atomset1 to any atom of atomset2; if false or omitted, returns an array listing the distance of each atom in atomset1 to the closest atom in atomset2. This array can be used to assign properties to atomset1: {1.1}.property_d = {1.1}.distance.min({2.1}); color {1.1} property_d. x = {atomset1}.distance.min({point}, asAtomSet) If asAtomSet is true, returns the atom in atomset1 closest to the specified point;if false or omitted, returns the closest distance to the specified point from any atom in atomset1. x = {atomset1}.distance.min({atomset2}).min returns the shortest distance from any atom in atomset1 to any atom in atomset2. x = {atomset1}.distance.max({atomset2}, asAtomSet) If asAtomSet is true, returns the furthest atom in atomset1 to any atom of atomset2; if false or omitted, returns an array listing the distance of each atom in atomset1 to the furthest atom in atomset2. x = {atomset1}.distance.max({point}, asAtomSet) If asAtomSet is true, returns the atom in atomset1 furthest from the specified point;if false or omitted, returns the furthest distance to the specified point from any atom in atomset1. x = {atomset1}.distance.max({atomset2}).max returns the furthest distance from any atom in atomset1 to any atom in atomset2. x = {atomset1}.distance.all({atomset2}) returns an array or array of arrays of values- Parameters:
mp
-args
-tok
-op
- optional .min .max for distance- Returns:
- true if successful
- Throws:
ScriptException
-
evaluateHelix
- Throws:
ScriptException
-
getHelixData
-
evaluateInChI
- Throws:
ScriptException
-
evaluateFind
- Throws:
ScriptException
-
evaluateGetProperty
private boolean evaluateGetProperty(ScriptMathProcessor mp, SV[] args, int tok0, boolean isAtomProperty) throws ScriptException _ by itself, not as a function, is shorthand for getProperty("auxiliaryInfo") $ print _.keys boundbox group3Counts group3Lists modelLoadNote models properties someModelsHaveFractionalCoordinates someModelsHaveSymmetry someModelsHaveUnitcells symmetryRange _m by itself, not as a function, is shorthand for getProperty("auxiliaryInfo.models")[_currentFrame] $ print format("json",_m.unitCellParams) [ 0.0,0.0,0.0,0.0,0.0,0.0,0.0,-2.1660376,-2.1660376,0.0,-2.1660376, 2.1660376,-4.10273,0.0,0.0,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN,NaN ] {atomset}._ by itself delivers a subset array of auxiliaryInfo.models for all models in {atomset} $ print {*}._..1..aflowInfo (first model's aflowInfo) _(key) prepends "auxiliaryInfo.models", delivering a modelCount-length array of information $ print _("aflowInfo[SELECT auid WHERE H__eV___VASP_ < 0]") {atomset}._(key) selects for model Auxiliary info related to models of the specified atoms {atomset}.getProperty(key) defaults to atomInfo, but also allows key to start with "bondInfo" Examples: print _("aflowInfo[select sg where volume_cell > 70]") print {model>10}._("aflowInfo[select sg where volume_cell > 70]")- Parameters:
mp
-args
-tok0
-isAtomProperty
-- Returns:
- true if no syntax problems
- Throws:
ScriptException
-
evaluateFormat
private boolean evaluateFormat(ScriptMathProcessor mp, int intValue, SV[] args, boolean isLabel) throws ScriptException - Throws:
ScriptException
-
getSublist
[ {...},{...}... ] ==> [[...],[...]]- Parameters:
listIn
-formatList
-- Returns:
- sublist
-
evaluateList
- Throws:
ScriptException
-
addAllLists
-
evaluateLoad
private boolean evaluateLoad(ScriptMathProcessor mp, SV[] args, boolean isFile) throws ScriptException - Throws:
ScriptException
-
evaluateMath
-
evaluateMeasure
- Throws:
ScriptException
-
evaluateModulation
- Throws:
ScriptException
-
evaluatePlane
plane() or intersection()- Parameters:
mp
-args
-tok
-- Returns:
- true
- Throws:
ScriptException
-
evaluatePoint
-
evaluatePrompt
-
evaluateQuaternion
private boolean evaluateQuaternion(ScriptMathProcessor mp, SV[] args, int tok) throws ScriptException - Throws:
ScriptException
-
evaluateRandom
-
evaluateRowCol
- Throws:
ScriptException
-
evaluateIn
- Throws:
ScriptException
-
evaluateReplace
- Throws:
ScriptException
-
evaluateScript
- Throws:
ScriptException
-
evaluateSort
sort() or sort(n) or count() or count("xxxx")- Parameters:
mp
-args
-tok
-- Returns:
- true if no error
- Throws:
ScriptException
-
evaluateString
- Throws:
ScriptException
-
evaluateSubstructure
private boolean evaluateSubstructure(ScriptMathProcessor mp, SV[] args, int tok, boolean isSelector) throws ScriptException - Throws:
ScriptException
-
evaluateSymop
private boolean evaluateSymop(ScriptMathProcessor mp, SV[] args, boolean isProperty) throws ScriptException - Throws:
ScriptException
-
evaluateTensor
- Throws:
ScriptException
-
evaluateUserFunction
private boolean evaluateUserFunction(ScriptMathProcessor mp, String name, SV[] args, int tok, boolean isSelector) throws ScriptException - Throws:
ScriptException
-
evaluateWithin
private boolean evaluateWithin(ScriptMathProcessor mp, SV[] args, boolean isAtomProperty) throws ScriptException - Throws:
ScriptException
-
evaluateWrite
- Throws:
ScriptException
-
getAtomsNearSurface
-
getAtomsNearPts
private javajs.util.BS getAtomsNearPts(float distance, javajs.util.T3[] points, javajs.util.BS bsInclude) -
getMinMax
-
getMinMaxPoint
calculates the statistical value for x, y, and z independently- Parameters:
pointOrSVArray
-tok
-- Returns:
- Point3f or nan
-
getMinMaxQuaternion
-
getPatternMatcher
-
opTokenFor
-
setContactBitSets
public javajs.util.BS setContactBitSets(javajs.util.BS bsA, javajs.util.BS bsB, boolean localOnly, float distance, RadiusData rd, boolean warnMultiModel)
-