PdbReader
Date: 2019-10-22

org.jmol.adapter.readers.pdb

## Class PdbReader

- java.lang.Object
- - org.jmol.adapter.smarter.AtomSetCollectionReader
  - - org.jmol.adapter.readers.pdb.PdbReader

- All Implemented Interfaces:
    javajs.api.GenericLineReader
  Direct Known Subclasses:
    JmolDataReader, P2nReader, PqrReader, PyMOLReader

      public class PdbReader
      extends AtomSetCollectionReader

  PDB file reader.

  http://www.rcsb.org

  Author:
    Miguel, Egon, and Bob (hansonr@stolaf.edu) pqr and gromacs pdb_wide_format added by Bob see http://repo.or.cz/w/gromacs.git/blob/HEAD:/src/gmxlib/pdbio.c line 244 see http://repo.or.cz/w/gromacs.git/blob/HEAD:/src/gmxlib/pdbio.c line 323 TLS Motion Determination: J Painter & E A Merritt (2006) Acta Cryst. D62, 439-450 http://skuld.bmsc.washington.edu/~tlsmd symmetry added by Bob Hanson: setFractionalCoordinates() setSpaceGroupName() setUnitCell() initializeCartesianToFractional(); setUnitCellItem() setAtomCoord() applySymmetryAndSetTrajectory()

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `private static float` | `_8PI2_`
    `private int` | `ac`
    `private boolean` | `applySymmetry`
    `private int` | `atomTypeLen`
    `private int` | `atomTypePt0`
    `protected int[]` | `biomtChainAtomCounts`
    `private java.lang.String` | `compnd`
    `private int` | `configurationPtr`
    `private int` | `conformationIndex`
    `private int[]` | `connectLast`
    `private int` | `connectNextAtomIndex`
    `private int` | `connectNextAtomSet`
    `private float` | `cryst1`
    `private java.util.Map<java.lang.String,java.lang.String>` | `currentCompnd`
    `private java.lang.String` | `currentGroup3`
    `private java.lang.String` | `currentKey`
    `private int` | `currentResno`
    `private float[]` | `dataT`
    `protected int` | `fileAtomIndex`
    `private java.lang.String` | `fileSgName`
    `private boolean` | `getTlsGroups`
    `protected boolean` | `gromacsWideFormat`
    `private boolean` | `haveDoubleBonds`
    `private boolean` | `haveMappedSerials`
    `private java.util.Map<java.lang.String,java.lang.Boolean>` | `htElementsInCurrentGroup`
    `private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>>` | `htFormul`
    `(package private) java.util.Map<java.lang.String,java.lang.String>` | `htGroup1`
    `private java.util.Map<java.lang.String,java.lang.String>` | `htHetero`
    `private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.String>>` | `htMolIds`
    `private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>>` | `htSites`
    `private boolean` | `isbiomol`
    `private boolean` | `isConnectStateBug`
    `private boolean` | `isCourseGrained`
    `private boolean` | `isLegacyModelType`
    `private boolean` | `isMultiModel`
    `private char` | `lastAltLoc`
    `private int` | `lastGroup`
    `private char` | `lastInsertion`
    `private int` | `lastSourceSerial`
    `private int` | `lastTargetSerial`
    `private int` | `lineLength`
    `private static java.lang.String` | `lineOptions`
    `private int` | `maxLength`
    `private int` | `maxSerial`
    `private static int` | `MODE_HEX`
    `private static int` | `MODE_HYBRID36`
    `private static int` | `MODE_PDB`
    `private int` | `nRes`
    `private int` | `nUNK`
    `private javajs.util.SB` | `pdbHeader`
    `private java.lang.String` | `pdbID`
    `private static float` | `RAD_PER_DEG`
    `private boolean` | `resetKey`
    `private javajs.util.SB` | `sb`
    `private javajs.util.SB` | `sbConect`
    `private javajs.util.SB` | `sbIgnored`
    `private javajs.util.SB` | `sbSelected`
    `private javajs.util.SB` | `sbTlsErrors`
    `private int` | `seqMode`
    `private int` | `serial`
    `private int` | `serMode`
    `private int` | `tlsGroupID`
    `private java.util.Map<Atom,float[]>` | `tlsU`
    `private javajs.util.Lst<java.util.Map<java.lang.String,java.lang.Object>>` | `vBiomolecules`
    `private javajs.util.Lst<java.util.Map<java.lang.String,java.lang.String>>` | `vCompnds`
    `private javajs.util.Lst<int[]>` | `vConnect`
    `private javajs.util.Lst<java.util.Map<java.lang.String,java.lang.Object>>` | `vTlsModels`

    - ### 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
    `PdbReader()`

  - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `private void` | `addConnection(int[] is)`
    `private void` | `anisou()`
    `private void` | `atom()`
    `private void` | `checkForResidualBFactors(SymmetryInterface symmetry)`
    `protected boolean` | `checkLine()`
    `private void` | `checkNotPDB()`
    `protected void` | `checkRemark()`
    `private void` | `checkUnitCellParams()`
    `private void` | `compnd(boolean isSource)`
    `private void` | `conect()`
    `private void` | `connectAll(int maxSerial, boolean isConnectStateBug)`
    `private void` | `connectAllBad(int maxSerial)`
    `private void` | `cryst1()`
    `protected java.lang.String` | `deduceElementSymbol(boolean isHetero)` The problem here stems from the fact that developers have not fully understood the PDB specifications -- and that those have changed.
    `private void` | `expdta()`
    `protected boolean` | `filterPDBAtom(Atom atom, int iAtom)`
    `protected void` | `finalizeReaderPDB()`
    `protected void` | `finalizeSubclassReader()` optional reader-specific method run first.
    `private int` | `findAtom(int atom1, int atom2, int chain, int resno, boolean isTrue)`
    `private int` | `findAtomForRange(int atom1, int atom2, int chain, int resno, boolean isLast)`
    `protected static float` | `fixRadius(float r)`
    `private void` | `formul()`
    `private float` | `getFloat(int ich, int cch)`
    `private int` | `getModelNumber()`
    `private int` | `getSeqNo(int i, int j)`
    `private int` | `getSerial(int i, int j)`
    `private void` | `handleTlsMissingModels()` for now, we just ignore TLS details if user has selected a specific model
    `private void` | `header()`
    `private void` | `het()`
    `private void` | `hetnam()`
    `protected void` | `initializeReader()`
    `protected void` | `model(int modelNumber)`
    `protected Atom` | `processAtom(Atom atom, java.lang.String name, char altID, java.lang.String group3, int chainID, int seqNo, char insCode, boolean isHetero, java.lang.String sym)`
    `protected void` | `processAtom2(Atom atom, int serial, float x, float y, float z, int charge)`
    `private java.lang.String` | `readHeader(boolean getLine)`
    `private boolean` | `remark285()`
    `private boolean` | `remark290()`
    `private boolean` | `remark350()`
    `private boolean` | `remarkTls()`
    `private void` | `scale(int n)`
    `private void` | `seqAdv()`
    `protected void` | `setAdditionalAtomParameters(Atom atom)` adaptable via subclassing
    `private void` | `setBiomoleculeAtomCounts()`
    `private void` | `setTlsGroups(int iGroup, int iModel, SymmetryInterface symmetry)` Sets the atom property property_tlsGroup based on TLS group ranges and adds "TLS" key to model's auxiliaryInfo.
    `private void` | `setTlsTensor(Atom atom, java.util.Map<java.lang.String,java.lang.Object> group, SymmetryInterface symmetry)`
    `private void` | `site()`
    `private void` | `structure()`
    `private void` | `title()`
    `private void` | `tlsAddError(java.lang.String error)`

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

    - #### MODE_PDB

          private static final int MODE_PDB

      See Also:
        Constant Field Values

    - #### MODE_HEX

          private static final int MODE_HEX

      See Also:
        Constant Field Values

    - #### MODE_HYBRID36

          private static final int MODE_HYBRID36

      See Also:
        Constant Field Values

    - #### serMode

          private int serMode

    - #### seqMode

          private int seqMode

    - #### serial

          private int serial

    - #### lineLength

          private int lineLength

    - #### pdbHeader

          private javajs.util.SB pdbHeader

    - #### applySymmetry

          private boolean applySymmetry

    - #### getTlsGroups

          private boolean getTlsGroups

    - #### isMultiModel

          private boolean isMultiModel

    - #### haveMappedSerials

          private boolean haveMappedSerials

    - #### isConnectStateBug

          private boolean isConnectStateBug

    - #### isLegacyModelType

          private boolean isLegacyModelType

    - #### gromacsWideFormat

          protected boolean gromacsWideFormat

    - #### htFormul

          private final java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Boolean>> htFormul

    - #### htHetero

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

    - #### htSites

          private java.util.Map<java.lang.String,java.util.Map<java.lang.String,java.lang.Object>> htSites

    - #### htElementsInCurrentGroup

          private java.util.Map<java.lang.String,java.lang.Boolean> htElementsInCurrentGroup

    - #### htMolIds

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

    - #### vCompnds

          private javajs.util.Lst<java.util.Map<java.lang.String,java.lang.String>> vCompnds

    - #### vBiomolecules

          private javajs.util.Lst<java.util.Map<java.lang.String,java.lang.Object>> vBiomolecules

    - #### vTlsModels

          private javajs.util.Lst<java.util.Map<java.lang.String,java.lang.Object>> vTlsModels

    - #### sbTlsErrors

          private javajs.util.SB sbTlsErrors

    - #### biomtChainAtomCounts

          protected int[] biomtChainAtomCounts

    - #### sbIgnored

          private javajs.util.SB sbIgnored

    - #### sbSelected

          private javajs.util.SB sbSelected

    - #### sbConect

          private javajs.util.SB sbConect

    - #### sb

          private javajs.util.SB sb

    - #### ac

          private int ac

    - #### maxSerial

          private int maxSerial

    - #### nUNK

          private int nUNK

    - #### nRes

          private int nRes

    - #### currentCompnd

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

    - #### currentGroup3

          private java.lang.String currentGroup3

    - #### currentKey

          private java.lang.String currentKey

    - #### currentResno

          private int currentResno

    - #### configurationPtr

          private int configurationPtr

    - #### resetKey

          private boolean resetKey

    - #### compnd

          private java.lang.String compnd

    - #### conformationIndex

          private int conformationIndex

    - #### fileAtomIndex

          protected int fileAtomIndex

    - #### lastAltLoc

          private char lastAltLoc

    - #### lastGroup

          private int lastGroup

    - #### lastInsertion

          private char lastInsertion

    - #### lastSourceSerial

          private int lastSourceSerial

    - #### lastTargetSerial

          private int lastTargetSerial

    - #### tlsGroupID

          private int tlsGroupID

    - #### atomTypePt0

          private int atomTypePt0

    - #### atomTypeLen

          private int atomTypeLen

    - #### isCourseGrained

          private boolean isCourseGrained

    - #### isbiomol

          private boolean isbiomol

    - #### lineOptions

          private static final java.lang.String lineOptions

      See Also:
        Constant Field Values

    - #### htGroup1

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

    - #### maxLength

          private int maxLength

    - #### pdbID

          private java.lang.String pdbID

    - #### haveDoubleBonds

          private boolean haveDoubleBonds

    - #### cryst1

          private float cryst1

    - #### fileSgName

          private java.lang.String fileSgName

    - #### dataT

          private final float[] dataT

    - #### RAD_PER_DEG

          private static final float RAD_PER_DEG

      See Also:
        Constant Field Values

    - #### _8PI2_

          private static final float _8PI2_

      See Also:
        Constant Field Values

    - #### tlsU

          private java.util.Map<Atom,float[]> tlsU

    - #### vConnect

          private javajs.util.Lst<int[]> vConnect

    - #### connectNextAtomIndex

          private int connectNextAtomIndex

    - #### connectNextAtomSet

          private int connectNextAtomSet

    - #### connectLast

          private int[] connectLast

  - ### Constructor Detail

    - #### PdbReader

          public PdbReader()

  - ### Method Detail

    - #### initializeReader

          protected void initializeReader()
                                   throws java.lang.Exception

      Overrides:
        `initializeReader` in class `AtomSetCollectionReader`
      Throws:
        `java.lang.Exception`

    - #### checkLine

          protected boolean checkLine()
                               throws java.lang.Exception

      Overrides:
        `checkLine` in class `AtomSetCollectionReader`
      Returns:
        true if need to read new line
      Throws:
        `java.lang.Exception`

    - #### checkRemark

          protected void checkRemark()

    - #### seqAdv

          private void seqAdv()

    - #### readHeader

          private java.lang.String readHeader(boolean getLine)
                                       throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### finalizeSubclassReader

          protected void finalizeSubclassReader()
                                         throws java.lang.Exception

      Description copied from class: `AtomSetCollectionReader`
      optional reader-specific method run first.
      Overrides:
        `finalizeSubclassReader` in class `AtomSetCollectionReader`
      Throws:
        `java.lang.Exception`

    - #### finalizeReaderPDB

          protected void finalizeReaderPDB()
                                    throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### checkUnitCellParams

          private void checkUnitCellParams()

    - #### checkForResidualBFactors

          private void checkForResidualBFactors(SymmetryInterface symmetry)

    - #### header

          private void header()

    - #### title

          private void title()

    - #### compnd

          private void compnd(boolean isSource)

    - #### setBiomoleculeAtomCounts

          private void setBiomoleculeAtomCounts()

    - #### remark350

          private boolean remark350()
                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### remark285

          private boolean remark285()

    - #### remark290

          private boolean remark290()
                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### getSerial

          private int getSerial(int i,
                                int j)

    - #### getSeqNo

          private int getSeqNo(int i,
                               int j)

    - #### processAtom

          protected Atom processAtom(Atom atom,
                                     java.lang.String name,
                                     char altID,
                                     java.lang.String group3,
                                     int chainID,
                                     int seqNo,
                                     char insCode,
                                     boolean isHetero,
                                     java.lang.String sym)

    - #### processAtom2

          protected void processAtom2(Atom atom,
                                      int serial,
                                      float x,
                                      float y,
                                      float z,
                                      int charge)

    - #### atom

          private void atom()

    - #### filterPDBAtom

          protected boolean filterPDBAtom(Atom atom,
                                          int iAtom)

    - #### setAdditionalAtomParameters

          protected void setAdditionalAtomParameters(Atom atom)

      adaptable via subclassing
      Parameters:
        `atom` -

    - #### deduceElementSymbol

          protected java.lang.String deduceElementSymbol(boolean isHetero)

      The problem here stems from the fact that developers have not fully understood the PDB specifications -- and that those have changed. The actual rules are as follows (using 1-based numbering: 1) Chemical symbols may be in columns 77 and 78 for total disambiguity. 2) Only valid chemical symbols should be in columns 13 and 14 These are the first two characters of a four-character field. 3) Four-character atom names for hydrogen necessarily start in column 13, so when that is the case, if the four-letter name starts with "H" then it is hydrogen regardless of what letter comes next. For example, "HG3 " is mercury (and should be in a HETATM record, not an ATOM record, anyway), but "HG33" is hydrogen, presumably. This leave open the ambiguity of a four-letter H name in a heteroatom set where the symbol is really H, not Hg or Ha, or Ho or Hf, etc.
      Parameters:
        `isHetero` -
      Returns:
        an atom symbol

    - #### conect

          private void conect()

    - #### structure

          private void structure()

    - #### getModelNumber

          private int getModelNumber()

    - #### model

          protected void model(int modelNumber)

    - #### checkNotPDB

          private void checkNotPDB()

    - #### cryst1

          private void cryst1()
                       throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### getFloat

          private float getFloat(int ich,
                                 int cch)
                          throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### scale

          private void scale(int n)
                      throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### expdta

          private void expdta()

    - #### formul

          private void formul()

    - #### het

          private void het()

    - #### hetnam

          private void hetnam()

    - #### anisou

          private void anisou()

    - #### site

          private void site()

    - #### remarkTls

          private boolean remarkTls()
                             throws java.lang.Exception

      Throws:
        `java.lang.Exception`

    - #### handleTlsMissingModels

          private void handleTlsMissingModels()

      for now, we just ignore TLS details if user has selected a specific model

    - #### setTlsGroups

          private void setTlsGroups(int iGroup,
                                    int iModel,
                                    SymmetryInterface symmetry)

      Sets the atom property property_tlsGroup based on TLS group ranges and adds "TLS" key to model's auxiliaryInfo.
      Parameters:
        `iGroup` -
        `iModel` -
        `symmetry` -

    - #### findAtomForRange

          private int findAtomForRange(int atom1,
                                       int atom2,
                                       int chain,
                                       int resno,
                                       boolean isLast)

    - #### findAtom

          private int findAtom(int atom1,
                               int atom2,
                               int chain,
                               int resno,
                               boolean isTrue)

    - #### setTlsTensor

          private void setTlsTensor(Atom atom,
                                    java.util.Map<java.lang.String,java.lang.Object> group,
                                    SymmetryInterface symmetry)

    - #### tlsAddError

          private void tlsAddError(java.lang.String error)

    - #### fixRadius

          protected static float fixRadius(float r)

    - #### addConnection

          private void addConnection(int[] is)

    - #### connectAllBad

          private void connectAllBad(int maxSerial)

    - #### connectAll

          private void connectAll(int maxSerial,
                                  boolean isConnectStateBug)