Package org.jmol.scriptext
Class MathExt
- java.lang.Object
-
- org.jmol.scriptext.MathExt
-
public class MathExt extends java.lang.Object
-
-
Field Summary
Fields Modifier and Type Field Description private ScriptEvaleprivate JmolPatternMatcherpmprivate java.util.Randomrandprivate Viewervwr
-
Constructor Summary
Constructors Constructor Description MathExt()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private javajs.util.Lst<SV>addAllLists(javajs.util.Lst<SV> list, javajs.util.Lst<SV> l)booleanevaluate(ScriptMathProcessor mp, T op, SV[] args, int tok)private booleanevaluateArray(ScriptMathProcessor mp, SV[] args, boolean isSelector)private booleanevaluateBin(ScriptMathProcessor mp, SV[] args)private booleanevaluateCache(ScriptMathProcessor mp, SV[] args)private booleanevaluateColor(ScriptMathProcessor mp, SV[] args)private booleanevaluateCompare(ScriptMathProcessor mp, SV[] args)private booleanevaluateConnected(ScriptMathProcessor mp, SV[] args, int tok, int intValue)private booleanevaluateContact(ScriptMathProcessor mp, SV[] args)private booleanevaluateData(ScriptMathProcessor mp, SV[] args)private booleanevaluateDotDist(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 booleanevaluateFind(ScriptMathProcessor mp, SV[] args)private booleanevaluateFormat(ScriptMathProcessor mp, int intValue, SV[] args, boolean isLabel)private booleanevaluateGetProperty(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 booleanevaluateHelix(ScriptMathProcessor mp, SV[] args)private booleanevaluateIn(ScriptMathProcessor mp, SV[] args)private booleanevaluateList(ScriptMathProcessor mp, int tok, SV[] args)private booleanevaluateLoad(ScriptMathProcessor mp, SV[] args, boolean isFile)private booleanevaluateMath(ScriptMathProcessor mp, SV[] args, int tok)private booleanevaluateMeasure(ScriptMathProcessor mp, SV[] args, int tok)private booleanevaluateModulation(ScriptMathProcessor mp, SV[] args)private booleanevaluatePlane(ScriptMathProcessor mp, SV[] args, int tok)plane() or intersection()private booleanevaluatePoint(ScriptMathProcessor mp, SV[] args)private booleanevaluatePointGroup(ScriptMathProcessor mp, SV[] args)private booleanevaluatePrompt(ScriptMathProcessor mp, SV[] args)private booleanevaluateQuaternion(ScriptMathProcessor mp, SV[] args, int tok)private booleanevaluateRandom(ScriptMathProcessor mp, SV[] args)private booleanevaluateReplace(ScriptMathProcessor mp, SV[] args)private booleanevaluateRowCol(ScriptMathProcessor mp, SV[] args, int tok)private booleanevaluateScript(ScriptMathProcessor mp, SV[] args, int tok)private booleanevaluateSort(ScriptMathProcessor mp, SV[] args, int tok)sort() or sort(n) or count() or count("xxxx")private booleanevaluateString(ScriptMathProcessor mp, int tok, SV[] args)private booleanevaluateSubstructure(ScriptMathProcessor mp, SV[] args, int tok, boolean isSelector)private booleanevaluateSymop(ScriptMathProcessor mp, SV[] args, boolean haveBitSet)private booleanevaluateTensor(ScriptMathProcessor mp, SV[] args)private booleanevaluateUnitCell(ScriptMathProcessor mp, SV[] args, boolean isSelector)private booleanevaluateUserFunction(ScriptMathProcessor mp, java.lang.String name, SV[] args, int tok, boolean isSelector)private booleanevaluateWithin(ScriptMathProcessor mp, SV[] args)private booleanevaluateWrite(ScriptMathProcessor mp, SV[] args)private BSgetAtomsNearPts(float distance, javajs.util.T3[] points, BS bsInclude)private BSgetAtomsNearSurface(float distance, java.lang.String surfaceId)private java.lang.ObjectgetHelixData(BS bs, int tokType)java.lang.ObjectgetMinMax(java.lang.Object floatOrSVArray, int tok)private java.lang.ObjectgetMinMaxPoint(java.lang.Object pointOrSVArray, int tok)calculates the statistical value for x, y, and z independentlyprivate java.lang.ObjectgetMinMaxQuaternion(javajs.util.Lst<SV> svData, int tok)private JmolPatternMatchergetPatternMatcher()private javajs.util.Lst<SV>getSublist(javajs.util.Lst<SV> listIn, javajs.util.Lst<SV> formatList)[ {...},{...}...MathExtinit(java.lang.Object se)private TopTokenFor(int tok)BSsetContactBitSets(BS bsA, BS bsB, boolean localOnly, float distance, RadiusData rd, boolean warnMultiModel)
-
-
-
Field Detail
-
vwr
private Viewer vwr
-
e
private ScriptEval e
-
rand
private java.util.Random rand
-
pm
private JmolPatternMatcher pm
-
-
Method Detail
-
init
public MathExt init(java.lang.Object se)
-
evaluate
public boolean evaluate(ScriptMathProcessor mp, T op, SV[] args, int tok) throws ScriptException
- Throws:
ScriptException
-
evaluatePointGroup
private boolean evaluatePointGroup(ScriptMathProcessor mp, SV[] args)
-
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
private boolean evaluateBin(ScriptMathProcessor mp, SV[] args) throws ScriptException
- Throws:
ScriptException
-
evaluateCache
private boolean evaluateCache(ScriptMathProcessor mp, SV[] args)
-
evaluateColor
private boolean evaluateColor(ScriptMathProcessor mp, SV[] args)
-
evaluateCompare
private boolean evaluateCompare(ScriptMathProcessor mp, SV[] args) throws ScriptException
- Throws:
ScriptException
-
evaluateConnected
private boolean evaluateConnected(ScriptMathProcessor mp, SV[] args, int tok, int intValue) throws ScriptException
- Throws:
ScriptException
-
evaluateContact
private boolean evaluateContact(ScriptMathProcessor mp, SV[] args)
-
evaluateData
private boolean evaluateData(ScriptMathProcessor mp, SV[] args)
-
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
private boolean evaluateHelix(ScriptMathProcessor mp, SV[] args) throws ScriptException
- Throws:
ScriptException
-
getHelixData
private java.lang.Object getHelixData(BS bs, int tokType)
-
evaluateFind
private boolean evaluateFind(ScriptMathProcessor mp, SV[] args) throws ScriptException
- 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
private javajs.util.Lst<SV> getSublist(javajs.util.Lst<SV> listIn, javajs.util.Lst<SV> formatList)
[ {...},{...}... ] ==> [[...],[...]]- Parameters:
listIn-formatList-- Returns:
- sublist
-
evaluateList
private boolean evaluateList(ScriptMathProcessor mp, int tok, SV[] args) throws ScriptException
- Throws:
ScriptException
-
addAllLists
private javajs.util.Lst<SV> addAllLists(javajs.util.Lst<SV> list, javajs.util.Lst<SV> l)
-
evaluateLoad
private boolean evaluateLoad(ScriptMathProcessor mp, SV[] args, boolean isFile) throws ScriptException
- Throws:
ScriptException
-
evaluateMath
private boolean evaluateMath(ScriptMathProcessor mp, SV[] args, int tok)
-
evaluateMeasure
private boolean evaluateMeasure(ScriptMathProcessor mp, SV[] args, int tok) throws ScriptException
- Throws:
ScriptException
-
evaluateModulation
private boolean evaluateModulation(ScriptMathProcessor mp, SV[] args) throws ScriptException
- Throws:
ScriptException
-
evaluatePlane
private boolean evaluatePlane(ScriptMathProcessor mp, SV[] args, int tok) throws ScriptException
plane() or intersection()- Parameters:
mp-args-tok-- Returns:
- true
- Throws:
ScriptException
-
evaluatePoint
private boolean evaluatePoint(ScriptMathProcessor mp, SV[] args)
-
evaluatePrompt
private boolean evaluatePrompt(ScriptMathProcessor mp, SV[] args)
-
evaluateQuaternion
private boolean evaluateQuaternion(ScriptMathProcessor mp, SV[] args, int tok) throws ScriptException
- Throws:
ScriptException
-
evaluateRandom
private boolean evaluateRandom(ScriptMathProcessor mp, SV[] args)
-
evaluateRowCol
private boolean evaluateRowCol(ScriptMathProcessor mp, SV[] args, int tok) throws ScriptException
- Throws:
ScriptException
-
evaluateIn
private boolean evaluateIn(ScriptMathProcessor mp, SV[] args) throws ScriptException
- Throws:
ScriptException
-
evaluateReplace
private boolean evaluateReplace(ScriptMathProcessor mp, SV[] args) throws ScriptException
- Throws:
ScriptException
-
evaluateScript
private boolean evaluateScript(ScriptMathProcessor mp, SV[] args, int tok) throws ScriptException
- Throws:
ScriptException
-
evaluateSort
private boolean evaluateSort(ScriptMathProcessor mp, SV[] args, int tok) throws ScriptException
sort() or sort(n) or count() or count("xxxx")- Parameters:
mp-args-tok-- Returns:
- true if no error
- Throws:
ScriptException
-
evaluateString
private boolean evaluateString(ScriptMathProcessor mp, int tok, SV[] args) throws ScriptException
- 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 haveBitSet) throws ScriptException
- Throws:
ScriptException
-
evaluateTensor
private boolean evaluateTensor(ScriptMathProcessor mp, SV[] args) throws ScriptException
- Throws:
ScriptException
-
evaluateUserFunction
private boolean evaluateUserFunction(ScriptMathProcessor mp, java.lang.String name, SV[] args, int tok, boolean isSelector) throws ScriptException
- Throws:
ScriptException
-
evaluateWithin
private boolean evaluateWithin(ScriptMathProcessor mp, SV[] args) throws ScriptException
- Throws:
ScriptException
-
evaluateWrite
private boolean evaluateWrite(ScriptMathProcessor mp, SV[] args) throws ScriptException
- Throws:
ScriptException
-
getAtomsNearSurface
private BS getAtomsNearSurface(float distance, java.lang.String surfaceId)
-
getMinMax
public java.lang.Object getMinMax(java.lang.Object floatOrSVArray, int tok)
-
getMinMaxPoint
private java.lang.Object getMinMaxPoint(java.lang.Object pointOrSVArray, int tok)calculates the statistical value for x, y, and z independently- Parameters:
pointOrSVArray-tok-- Returns:
- Point3f or "NaN"
-
getMinMaxQuaternion
private java.lang.Object getMinMaxQuaternion(javajs.util.Lst<SV> svData, int tok)
-
getPatternMatcher
private JmolPatternMatcher getPatternMatcher()
-
opTokenFor
private T opTokenFor(int tok)
-
setContactBitSets
public BS setContactBitSets(BS bsA, BS bsB, boolean localOnly, float distance, RadiusData rd, boolean warnMultiModel)
-
-