MagresReader
Date: 2019-10-22

org.jmol.adapter.readers.xtal

## Class MagresReader

- java.lang.Object
- - org.jmol.adapter.smarter.AtomSetCollectionReader
  - - org.jmol.adapter.readers.xtal.MagresReader

- All Implemented Interfaces:
    javajs.api.GenericLineReader

      public class MagresReader
      extends AtomSetCollectionReader

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static int` | `BLOCK_ATOMS`
    `private static int` | `BLOCK_CALC`
    `private static int` | `BLOCK_MAGRES`
    `private static int` | `BLOCK_NEW`
    `private static int` | `BLOCK_NONE`
    `private float[]` | `cellParams`
    `private int` | `currentBlock`
    `private javajs.util.SB` | `header`
    `private javajs.util.Lst<Tensor>` | `interactionTensors`
    `private java.util.Map<java.lang.String,java.lang.String>` | `magresUnits`

    - ### Fields inherited from class org.jmol.adapter.smarter.AtomSetCollectionReader

      `addedData, addedDataKey, addVibrations, allowPDBFilter, ANGSTROMS_PER_BOHR, applySymmetryToBonds, asc, baseAtomIndex, binaryDoc, bsFilter, bsModels, calculationType, continuing, debugging, desiredModelNumber, desiredSpaceGroupIndex, desiredVibrationNumber, doApplySymmetry, doCentralize, doCheckUnitCell, doConvertToFractional, doPackUnitCell, doProcessLines, doReadMolecularOrbitals, dssr, fileName, fileOffset, filePath, fileScaling, fillRange, filter, filterHetero, fixJavaFloat, forcePacked, getHeader, haveAtomFilter, haveModel, havePartialChargeFilter, htParams, ignoreFileSpaceGroupName, ignoreFileSymmetryOperators, ignoreFileUnitCell, ignoreStructure, iHaveFractionalCoordinates, iHaveSymmetryOperators, iHaveUnitCell, isBinary, isConcatenated, isDSSP1, isFinalized, isMolecular, isPrimitive, isSequential, isTrajectory, latticeCells, latticeScaling, latticeType, line, lstNCS, matUnitCellOrientation, modDim, modelNumber, ms, mustFinalizeModelSet, next, out, packingError, prevline, primitiveToCrystal, ptLine, ptSupercell, reader, readerName, requiresBSFilter, reverseModels, rotateHexCell, sgName, stateScriptVersionInt, strSupercell, symmetry, templateAtomCount, thisBiomolecule, trajectorySteps, unitCellOffset, unitCellParams, useAltNames, useFileModelNumbers, validation, vibrationNumber, vibsFractional, vwr`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `MagresReader()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private int` | `checkBlock()` looking for tags here.
    `protected boolean` | `checkLine()` Valid blocks include [calculation] [atoms] [magres]; all magres entries must be prefaced with a corresponding unit; Use of < > instead of [ ] is allowed.
    `protected void` | `finalizeSubclassReader()` Set final auxiliary info and symmetry, including "fileHeader", "magresUnits", and "interactionTensors"; note that print getProperty("auxiliaryInfo.models[1].magresUnits") should return a catalog of tensor types.
    `private static java.lang.String` | `getAtomName(java.lang.String name, java.lang.String index)` combine name and index
    `protected void` | `initializeReader()` not sure how to work with symmetry here...
    `private boolean` | `readAtom()` Allowing for BOHR units here; probably unnecessary.
    `private boolean` | `readCellParams()`
    `private boolean` | `readSymmetry()` not doing anything with this -- P1 assumed
    `private boolean` | `readTensor()` Read a tensor line.
    `private boolean` | `setUnits(boolean isMagresBlock)` catalog units
    `private boolean` | `trimLine()` All characters after hash ignored; lines are trimmed.

    - ### Methods inherited from class org.jmol.adapter.smarter.AtomSetCollectionReader

      `addAtomXYZSymName, addExplicitLatticeVector, addJmolScript, addSites, addSiteScript, appendLoadNote, appendUunitCellInfo, applySymmetryAndSetTrajectory, applySymTrajASCR, checkCurrentLineForScript, checkFilterKey, checkLastModel, checkLineForScript, clearUnitCell, cloneLastAtomSet, discardLinesUntilBlank, discardLinesUntilContains, discardLinesUntilContains2, discardLinesUntilNonBlank, discardLinesUntilStartsWith, discardPreviousAtoms, doGetModel, doGetVibration, doPreSymmetry, fill3x3, fillDataBlock, fillDataBlockFixed, fillFloatArray, fillFrequencyData, filterAtom, filterReject, finalizeMOData, finalizeModelSet, finalizeReaderASCR, finalizeSubclassSymmetry, forceSymmetry, fractionalizeCoordinates, getElementSymbol, getFilter, getFortranFormatLengths, getInterface, getNewSymmetry, getStrings, getSymmetry, getTokens, getTokensFloat, initializeSymmetry, initializeSymmetryOptions, initializeTrajectoryFile, isLastModel, newAtomSet, parseFloat, parseFloatRange, parseFloatStr, parseInt, parseIntAt, parseIntRange, parseIntStr, parseToken, parseTokenNext, parseTokenRange, parseTokenStr, processBinaryDocument, processDOM, rd, read3Vectors, readDataObject, readLines, readNextLine, rejectAtomName, RL, set2D, setAtomCoord, setAtomCoordScaled, setAtomCoordTokens, setAtomCoordXYZ, setChainID, setElementAndIsotope, setFilter, setFilterAtomTypeStr, setFractionalCoordinates, setIsPDB, setLoadNote, setModelPDB, setSpaceGroupName, setSymmetryOperator, setTransform, setUnitCell, setUnitCellItem, setup, setupASCR`

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

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

- - ### Field Detail

    - #### BLOCK_NEW

          private static final int BLOCK_NEW

      See Also:
        Constant Field Values

    - #### BLOCK_NONE

          private static final int BLOCK_NONE

      See Also:
        Constant Field Values

    - #### BLOCK_CALC

          private static final int BLOCK_CALC

      See Also:
        Constant Field Values

    - #### BLOCK_ATOMS

          private static final int BLOCK_ATOMS

      See Also:
        Constant Field Values

    - #### BLOCK_MAGRES

          private static final int BLOCK_MAGRES

      See Also:
        Constant Field Values

    - #### currentBlock

          private int currentBlock

    - #### cellParams

          private float[] cellParams

    - #### magresUnits

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

    - #### interactionTensors

          private javajs.util.Lst<Tensor> interactionTensors

    - #### header

          private javajs.util.SB header

  - ### Constructor Detail

    - #### MagresReader

          public MagresReader()

  - ### Method Detail

    - #### initializeReader

          protected void initializeReader()

      not sure how to work with symmetry here...
      Overrides:
        `initializeReader` in class `AtomSetCollectionReader`

    - #### finalizeSubclassReader

          protected void finalizeSubclassReader()
                                         throws java.lang.Exception

      Set final auxiliary info and symmetry, including "fileHeader", "magresUnits", and "interactionTensors"; note that print getProperty("auxiliaryInfo.models[1].magresUnits") should return a catalog of tensor types.
      Overrides:
        `finalizeSubclassReader` in class `AtomSetCollectionReader`
      Throws:
        `java.lang.Exception`

    - #### checkLine

          protected boolean checkLine()
                               throws java.lang.Exception

      Valid blocks include [calculation] [atoms] [magres]; all magres entries must be prefaced with a corresponding unit; Use of < > instead of [ ] is allowed.
      Overrides:
        `checkLine` in class `AtomSetCollectionReader`
      Returns:
        true to read another line (some readers return false because they have over-read a line)
      Throws:
        `java.lang.Exception`

    - #### trimLine

          private boolean trimLine()

      All characters after hash ignored; lines are trimmed.
      Returns:
        true if line has content

    - #### checkBlock

          private int checkBlock()

      looking for tags here.
      Returns:
        currentBlock if not a tag or BLOCK_NEW otherwise

    - #### setUnits

          private boolean setUnits(boolean isMagresBlock)

      catalog units
      Parameters:
        `isMagresBlock` -
      Returns:
        true

    - #### readSymmetry

          private boolean readSymmetry()

      not doing anything with this -- P1 assumed
      Returns:
        true

    - #### readCellParams

          private boolean readCellParams()
                                  throws java.lang.Exception

      Returns:
        true;
      Throws:
        `java.lang.Exception`

    - #### readAtom

          private boolean readAtom()

      Allowing for BOHR units here; probably unnecessary.
      Returns:
        true

    - #### getAtomName

          private static java.lang.String getAtomName(java.lang.String name,
                                                      java.lang.String index)

      combine name and index
      Parameters:
        `name` -
        `index` -
      Returns:
        name_index

    - #### readTensor

          private boolean readTensor()
                              throws java.lang.Exception

      Read a tensor line. Note that a corresponding unit line must have appeared first.
      Returns:
        true;
      Throws:
        `java.lang.Exception`