ModelLoader
Date: 2019-10-22

org.jmol.modelset

## Class ModelLoader

- java.lang.Object
- - org.jmol.modelset.ModelLoader

-     public final class ModelLoader
      extends java.lang.Object

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private int` | `adapterModelCount`
    `private int` | `adapterTrajectoryCount`
    `private boolean` | `appendNew`
    `int` | `baseAtomIndex`
    `int` | `baseGroupIndex`
    `private int` | `baseModelCount`
    `int` | `baseModelIndex`
    `private int` | `baseTrajectoryCount`
    `private Chain[]` | `chainOf`
    `private Chain` | `currentChain`
    `private int` | `currentChainID`
    `private java.lang.String` | `currentGroup3`
    `private char` | `currentGroupInsertionCode`
    `private int` | `currentGroupSequenceNumber`
    `private static int` | `defaultGroupCount`
    `private boolean` | `doAddHydrogens`
    `private boolean` | `doMinimize`
    `private java.lang.String` | `fileHeader`
    `private int[]` | `firstAtomIndexes`
    `int[][]` | `group3Counts`
    `java.lang.String[]` | `group3Lists`
    `private java.lang.String[]` | `group3Of`
    `private int` | `groupCount`
    `Group[]` | `groups`
    `private java.util.Map<java.lang.Object,Atom>` | `htAtomMap`
    `private java.util.Map<java.lang.String,java.lang.String>` | `htGroup1`
    `private int` | `iChain`
    `private int` | `iModel`
    `private boolean` | `is2D`
    `private boolean` | `isMutate`
    `private boolean` | `isNewChain`
    `private boolean` | `isPyMOLsession`
    `boolean` | `isTrajectory`
    `private BioResolver` | `jbr`
    `private java.lang.String` | `jmolData`
    `private Group[]` | `mergeGroups`
    `private boolean` | `merging`
    `private Model` | `model`
    `private ModelSet` | `modelSet0`
    `private boolean` | `modulationOn`
    `private javajs.util.P3` | `modulationTUV`
    `ModelSet` | `ms`
    `private boolean` | `noAutoBond`
    `private Group` | `nullGroup`
    `private int[]` | `seqcodes`
    `private boolean` | `someModelsAreModulated`
    `private boolean` | `someModelsHaveUnitcells`
    `int[]` | `specialAtomIndexes`
    `javajs.util.BS` | `structuresDefinedInFile`
    `private javajs.util.Lst<Bond>` | `vStereo`
    `private Viewer` | `vwr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `ModelLoader(Viewer vwr, java.lang.String modelSetName, javajs.util.SB loadScript, java.lang.Object asc, ModelSet modelSet0, javajs.util.BS bsNew)`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private void` | `addAtom(boolean isPDB, javajs.util.BS atomSymmetry, int atomSite, java.lang.Object atomUid, int atomicAndIsotopeNumber, java.lang.String atomName, int formalCharge, float partialCharge, javajs.util.Lst<java.lang.Object> tensors, float occupancy, float bfactor, javajs.util.P3 xyz, boolean isHetero, int atomSerial, int atomSeqID, java.lang.String group3, javajs.util.V3 vib, char alternateLocationID, float radius)`
    `private void` | `addGroup(Chain chain, Group group)`
    `private void` | `addJmolDataProperties(Model m, java.util.Map<java.lang.String,float[]> jmolDataProperties)`
    `private void` | `applyStereochemistry()`
    `private Bond` | `bondAtoms(java.lang.Object atomUid1, java.lang.Object atomUid2, short order)`
    `private void` | `checkNewGroup(JmolAdapter adapter, int chainID, java.lang.String group3, int groupSequenceNumber, char groupInsertionCode, boolean addH, boolean isLegacyHAddition)`
    `private void` | `countGroup(int modelIndex, java.lang.String code, java.lang.String group3)`
    `static java.lang.String` | `createAtomDataSet(Viewer vwr, ModelSet modelSet, int tokType, java.lang.Object asc, javajs.util.BS bsSelected)`
    `private void` | `createModelSet(JmolAdapter adapter, java.lang.Object asc, javajs.util.BS bsNew)`
    `private void` | `distinguishAndPropagateGroup(int groupIndex, Chain chain, java.lang.String group3, int seqcode, int firstAtomIndex, int lastAtomIndex)`
    `private void` | `finalizeGroupBuild()`
    `private void` | `finalizeModels(int baseModelCount)` Model numbers are considerably more complicated in Jmol 11.
    `private void` | `finalizeShapes()`
    `private void` | `findElementsPresent()`
    `private void` | `freeze()`
    `int` | `getAtomCount()`
    `private javajs.util.BS` | `getBranch2dZ(int atomIndex, int atomIndexNot, javajs.util.BS bs0, javajs.util.BS bsBranch, javajs.util.V3 v, javajs.util.V3 v0, javajs.util.V3 v1)`
    `int` | `getFirstAtomIndex(int iGroup)`
    `java.lang.String` | `getGroup3(int iGroup)`
    `private Chain` | `getOrAllocateChain(Model model, int chainID)`
    `private int` | `getPdbCharge(java.lang.String group3, java.lang.String name)` Adjust known N and O atom formal charges.
    `private void` | `initializeAtomBondModelCounts(int nAtoms)`
    `private void` | `initializeBonding()`
    `private void` | `initializeInfo(java.lang.String name, java.util.Map<java.lang.String,java.lang.Object> info)`
    `private void` | `initializeUnitCellAndSymmetry()`
    `private void` | `iterateOverAllNewAtoms(JmolAdapter adapter, java.lang.Object asc)`
    `private void` | `iterateOverAllNewBonds(JmolAdapter adapter, java.lang.Object asc)`
    `private void` | `iterateOverAllNewModels(JmolAdapter adapter, java.lang.Object asc)`
    `private void` | `mergeGroups()`
    `private void` | `mergeTrajAndVib(ModelSet oldSet, ModelSet newSet)`
    `private Trajectory` | `newTrajectory(ModelSet ms, javajs.util.Lst<javajs.util.P3[]> steps)`
    `private void` | `set2dZ(int iatom1, int iatom2)`
    `private static void` | `setAtom2dZ(Atom atomRef, Atom atom2, javajs.util.V3 v, javajs.util.V3 v0, javajs.util.V3 v1)` set the z based on a cos relationship to the y axis.
    `private void` | `setAtomProperties()`
    `private static void` | `setBranch2dZ(Atom atom, javajs.util.BS bs, javajs.util.BS bsToTest, javajs.util.V3 v, javajs.util.V3 v0, javajs.util.V3 v1)`
    `private void` | `setDefaultRendering(int maxAtoms)`
    `private void` | `setModelNameNumberProperties(int modelIndex, int trajectoryBaseIndex, java.lang.String modelName, int modelNumber, java.util.Properties modelProperties, java.util.Map<java.lang.String,java.lang.Object> modelAuxiliaryInfo, java.lang.String jmolData)`
    `void` | `undeleteAtom(int iAtom)` called from org.jmol.modelsetbio.resolver when adding hydrogens.

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

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

- - ### Field Detail

    - #### vwr

          private Viewer vwr

    - #### ms

          public ModelSet ms

    - #### modelSet0

          private ModelSet modelSet0

    - #### merging

          private boolean merging

    - #### appendNew

          private boolean appendNew

    - #### jmolData

          private java.lang.String jmolData

    - #### group3Lists

          public java.lang.String[] group3Lists

    - #### group3Counts

          public int[][] group3Counts

    - #### specialAtomIndexes

          public int[] specialAtomIndexes

    - #### someModelsHaveUnitcells

          private boolean someModelsHaveUnitcells

    - #### someModelsAreModulated

          private boolean someModelsAreModulated

    - #### is2D

          private boolean is2D

    - #### isMutate

          private boolean isMutate

    - #### isTrajectory

          public boolean isTrajectory

    - #### isPyMOLsession

          private boolean isPyMOLsession

    - #### doMinimize

          private boolean doMinimize

    - #### doAddHydrogens

          private boolean doAddHydrogens

    - #### fileHeader

          private java.lang.String fileHeader

    - #### jbr

          private BioResolver jbr

    - #### groups

          public Group[] groups

    - #### groupCount

          private int groupCount

    - #### modulationTUV

          private javajs.util.P3 modulationTUV

    - #### htAtomMap

          private final java.util.Map<java.lang.Object,Atom> htAtomMap

    - #### defaultGroupCount

          private static final int defaultGroupCount

      See Also:
        Constant Field Values

    - #### chainOf

          private Chain[] chainOf

    - #### group3Of

          private java.lang.String[] group3Of

    - #### seqcodes

          private int[] seqcodes

    - #### firstAtomIndexes

          private int[] firstAtomIndexes

    - #### iModel

          private int iModel

    - #### model

          private Model model

    - #### currentChainID

          private int currentChainID

    - #### isNewChain

          private boolean isNewChain

    - #### currentChain

          private Chain currentChain

    - #### currentGroupSequenceNumber

          private int currentGroupSequenceNumber

    - #### currentGroupInsertionCode

          private char currentGroupInsertionCode

    - #### currentGroup3

          private java.lang.String currentGroup3

    - #### nullGroup

          private Group nullGroup

    - #### baseModelIndex

          public int baseModelIndex

    - #### baseModelCount

          private int baseModelCount

    - #### baseAtomIndex

          public int baseAtomIndex

    - #### baseGroupIndex

          public int baseGroupIndex

    - #### baseTrajectoryCount

          private int baseTrajectoryCount

    - #### adapterModelCount

          private int adapterModelCount

    - #### adapterTrajectoryCount

          private int adapterTrajectoryCount

    - #### noAutoBond

          private boolean noAutoBond

    - #### modulationOn

          private boolean modulationOn

    - #### htGroup1

          private java.util.Map<java.lang.String,java.lang.String> htGroup1

    - #### mergeGroups

          private Group[] mergeGroups

    - #### iChain

          private int iChain

    - #### vStereo

          private javajs.util.Lst<Bond> vStereo

    - #### structuresDefinedInFile

          public javajs.util.BS structuresDefinedInFile

  - ### Constructor Detail

    - #### ModelLoader

          public ModelLoader(Viewer vwr,
                             java.lang.String modelSetName,
                             javajs.util.SB loadScript,
                             java.lang.Object asc,
                             ModelSet modelSet0,
                             javajs.util.BS bsNew)

  - ### Method Detail

    - #### initializeInfo

          private void initializeInfo(java.lang.String name,
                                      java.util.Map<java.lang.String,java.lang.Object> info)

    - #### newTrajectory

          private Trajectory newTrajectory(ModelSet ms,
                                           javajs.util.Lst<javajs.util.P3[]> steps)

    - #### getGroup3

          public java.lang.String getGroup3(int iGroup)

    - #### getFirstAtomIndex

          public int getFirstAtomIndex(int iGroup)

    - #### getAtomCount

          public int getAtomCount()

    - #### createModelSet

          private void createModelSet(JmolAdapter adapter,
                                      java.lang.Object asc,
                                      javajs.util.BS bsNew)

    - #### mergeTrajAndVib

          private void mergeTrajAndVib(ModelSet oldSet,
                                       ModelSet newSet)

    - #### setDefaultRendering

          private void setDefaultRendering(int maxAtoms)

    - #### setAtomProperties

          private void setAtomProperties()

    - #### initializeAtomBondModelCounts

          private void initializeAtomBondModelCounts(int nAtoms)

    - #### mergeGroups

          private void mergeGroups()

    - #### iterateOverAllNewModels

          private void iterateOverAllNewModels(JmolAdapter adapter,
                                               java.lang.Object asc)

    - #### setModelNameNumberProperties

          private void setModelNameNumberProperties(int modelIndex,
                                                    int trajectoryBaseIndex,
                                                    java.lang.String modelName,
                                                    int modelNumber,
                                                    java.util.Properties modelProperties,
                                                    java.util.Map<java.lang.String,java.lang.Object> modelAuxiliaryInfo,
                                                    java.lang.String jmolData)

    - #### finalizeModels

          private void finalizeModels(int baseModelCount)

      Model numbers are considerably more complicated in Jmol 11. int modelNumber The adapter gives us a modelNumber, but that is not necessarily what the user accesses. If a single files is loaded this is: a) single file context: 1) the sequential number of the model in the file , or 2) if a PDB file and "MODEL" record is present, that model number b) multifile context: always 1000000 * (fileIndex + 1) + (modelIndexInFile + 1) int fileIndex The 0-based reference to the file containing this model. Used when doing "_modelnumber3.2" in a multifile context int modelFileNumber An integer coding both the file and the model: file * 1000000 + modelInFile (1-based) Used all over the place. Note that if there is only one file, then modelFileNumber < 1000000. String modelNumberDotted A number the user can use "1.3" String modelNumberForAtomLabel Either the dotted number or the PDB MODEL number, if there is only one file
      Parameters:
        `baseModelCount` -

    - #### iterateOverAllNewAtoms

          private void iterateOverAllNewAtoms(JmolAdapter adapter,
                                              java.lang.Object asc)

    - #### addJmolDataProperties

          private void addJmolDataProperties(Model m,
                                             java.util.Map<java.lang.String,float[]> jmolDataProperties)

    - #### getPdbCharge

          private int getPdbCharge(java.lang.String group3,
                                   java.lang.String name)

      Adjust known N and O atom formal charges. Note that this does not take care of ligands.
      Parameters:
        `group3` -
        `name` -
      Returns:
        0, 1, or -1

    - #### addAtom

          private void addAtom(boolean isPDB,
                               javajs.util.BS atomSymmetry,
                               int atomSite,
                               java.lang.Object atomUid,
                               int atomicAndIsotopeNumber,
                               java.lang.String atomName,
                               int formalCharge,
                               float partialCharge,
                               javajs.util.Lst<java.lang.Object> tensors,
                               float occupancy,
                               float bfactor,
                               javajs.util.P3 xyz,
                               boolean isHetero,
                               int atomSerial,
                               int atomSeqID,
                               java.lang.String group3,
                               javajs.util.V3 vib,
                               char alternateLocationID,
                               float radius)

    - #### checkNewGroup

          private void checkNewGroup(JmolAdapter adapter,
                                     int chainID,
                                     java.lang.String group3,
                                     int groupSequenceNumber,
                                     char groupInsertionCode,
                                     boolean addH,
                                     boolean isLegacyHAddition)

    - #### getOrAllocateChain

          private Chain getOrAllocateChain(Model model,
                                           int chainID)

    - #### iterateOverAllNewBonds

          private void iterateOverAllNewBonds(JmolAdapter adapter,
                                              java.lang.Object asc)

    - #### bondAtoms

          private Bond bondAtoms(java.lang.Object atomUid1,
                                 java.lang.Object atomUid2,
                                 short order)

    - #### initializeUnitCellAndSymmetry

          private void initializeUnitCellAndSymmetry()

    - #### initializeBonding

          private void initializeBonding()

    - #### finalizeGroupBuild

          private void finalizeGroupBuild()

    - #### distinguishAndPropagateGroup

          private void distinguishAndPropagateGroup(int groupIndex,
                                                    Chain chain,
                                                    java.lang.String group3,
                                                    int seqcode,
                                                    int firstAtomIndex,
                                                    int lastAtomIndex)

    - #### addGroup

          private void addGroup(Chain chain,
                                Group group)

    - #### countGroup

          private void countGroup(int modelIndex,
                                  java.lang.String code,
                                  java.lang.String group3)

    - #### freeze

          private void freeze()

    - #### findElementsPresent

          private void findElementsPresent()

    - #### applyStereochemistry

          private void applyStereochemistry()

    - #### set2dZ

          private void set2dZ(int iatom1,
                              int iatom2)

    - #### getBranch2dZ

          private javajs.util.BS getBranch2dZ(int atomIndex,
                                              int atomIndexNot,
                                              javajs.util.BS bs0,
                                              javajs.util.BS bsBranch,
                                              javajs.util.V3 v,
                                              javajs.util.V3 v0,
                                              javajs.util.V3 v1)

      Parameters:
        `atomIndex` -
        `atomIndexNot` -
        `bs0` -
        `bsBranch` -
        `v` -
        `v0` -
        `v1` -
      Returns:
        atom bitset

    - #### setBranch2dZ

          private static void setBranch2dZ(Atom atom,
                                           javajs.util.BS bs,
                                           javajs.util.BS bsToTest,
                                           javajs.util.V3 v,
                                           javajs.util.V3 v0,
                                           javajs.util.V3 v1)

    - #### setAtom2dZ

          private static void setAtom2dZ(Atom atomRef,
                                         Atom atom2,
                                         javajs.util.V3 v,
                                         javajs.util.V3 v0,
                                         javajs.util.V3 v1)

      set the z based on a cos relationship to the y axis. Specifically, theta = acos(v.dot.v0) z = 0.8 * sin(4 theta) so: theta 4 theta y 0 0 x pi/2 2 pi -y pi 4 pi -x pi/2 2 pi y -1/4 -pi/4 x +1/4 pi/4 -y -1/4 3pi/4 -x +1/4 -pi/4
      Parameters:
        `atomRef` -
        `atom2` -
        `v` -
        `v0` -
        `v1` -

    - #### finalizeShapes

          private void finalizeShapes()

    - #### undeleteAtom

          public void undeleteAtom(int iAtom)

      called from org.jmol.modelsetbio.resolver when adding hydrogens.
      Parameters:
        `iAtom` -

    - #### createAtomDataSet

          public static java.lang.String createAtomDataSet(Viewer vwr,
                                                           ModelSet modelSet,
                                                           int tokType,
                                                           java.lang.Object asc,
                                                           javajs.util.BS bsSelected)