MathExt
Date: 2019-10-22

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 and Description
    --- | ---
    `private ScriptEval` | `e`
    `private JmolPatternMatcher` | `pm`
    `private java.util.Random` | `rand`
    `private Viewer` | `vwr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MathExt()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private 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` | `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)`
    `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 haveBitSet)`
    `private boolean` | `evaluateTensor(ScriptMathProcessor mp, SV[] args)`
    `private boolean` | `evaluateUnitCell(ScriptMathProcessor mp, SV[] args, boolean isSelector)`
    `private boolean` | `evaluateUserFunction(ScriptMathProcessor mp, java.lang.String name, SV[] args, int tok, boolean isSelector)`
    `private boolean` | `evaluateWithin(ScriptMathProcessor mp, SV[] args)`
    `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, java.lang.String surfaceId)`
    `private java.lang.Object` | `getHelixData(javajs.util.BS bs, int tokType)`
    `java.lang.Object` | `getMinMax(java.lang.Object floatOrSVArray, int tok)`
    `private java.lang.Object` | `getMinMaxPoint(java.lang.Object pointOrSVArray, int tok)` calculates the statistical value for x, y, and z independently
    `private java.lang.Object` | `getMinMaxQuaternion(javajs.util.Lst<SV> svData, int tok)`
    `private JmolPatternMatcher` | `getPatternMatcher()`
    `private javajs.util.Lst<SV>` | `getSublist(javajs.util.Lst<SV> listIn, javajs.util.Lst<SV> formatList)` [ {...},{...}...
    `MathExt` | `init(java.lang.Object se)`
    `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)`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### vwr

          private Viewer vwr

    - #### e

          private ScriptEval e

    - #### rand

          private java.util.Random rand

    - #### pm

          private JmolPatternMatcher pm

  - ### Constructor Detail

    - #### MathExt

          public MathExt()

  - ### 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`

    - #### evaluateSpacegroup

          private boolean evaluateSpacegroup(ScriptMathProcessor mp,
                                             SV[] args)

    - #### 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(javajs.util.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 javajs.util.BS getAtomsNearSurface(float distance,
                                                     java.lang.String surfaceId)

    - #### getAtomsNearPts

          private javajs.util.BS getAtomsNearPts(float distance,
                                                 javajs.util.T3[] points,
                                                 javajs.util.BS bsInclude)

    - #### 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 javajs.util.BS setContactBitSets(javajs.util.BS bsA,
                                                  javajs.util.BS bsB,
                                                  boolean localOnly,
                                                  float distance,
                                                  RadiusData rd,
                                                  boolean warnMultiModel)