# Class PdbReader

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

All Implemented Interfaces:
  `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 invalid input: '&' 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
Description
`protected int[]`
`biomtChainAtomCounts`
`protected int`
`fileAtomIndex`
`protected boolean`
`gromacsWideFormat`
`protected String`
`pdbID`

### Fields inherited from class AtomSetCollectionReader

`addedData, addedDataKey, addVibrations, allow_a_len_1, allowPDBFilter, ANGSTROMS_PER_BOHR, applySymmetryToBonds, asc, baseAtomIndex, baseBondIndex, binaryDoc, bsFilter, bsModels, calculationType, CELL_TYPE_CONVENTIONAL, CELL_TYPE_PRIMITIVE, CELL_TYPE_SUPER, cellSlop, centroidPacked, checkNearAtoms, continuing, debugging, desiredModelNumber, desiredSpaceGroupIndex, desiredVibrationNumber, doApplySymmetry, doCentralize, doCentroidUnitCell, doCheckUnitCell, doConvertToFractional, doPackUnitCell, doProcessLines, doReadMolecularOrbitals, dssr, fileName, fileOffset, filePath, fileScaling, fillRange, filter, filterAllHetero, filterCased, filteredPrecision, filterHetero, floatifyJavaDouble, forcePacked, getHeader, haveAtomFilter, haveModel, havePartialChargeFilter, htParams, ignoreFileSpaceGroupName, ignoreFileSymmetryOperators, ignoreFileUnitCell, ignoreStructure, iHaveFractionalCoordinates, iHaveSymmetryOperators, iHaveUnitCell, is2D, isBinary, isConcatenated, isDSSP1, isFinalized, isMolecular, isPrimitive, isSequential, isSUPERCELL, isTrajectory, latticeCells, latticeScaling, latticeType, line, lowPrecision, lstNCS, matUnitCellOrientation, merging, modDim, modelNumber, ms, mustFinalizeModelSet, next, noHydrogens, noMinimize, noPack, optimize2D, out, paramsCentroid, paramsLattice, precision, prevline, primitiveToCrystal, ptLine, ptSupercell, reader, readerName, requiresBSFilter, reverseModels, rotateHexCell, sgName, slabXY, stateScriptVersionInt, strSupercell, symmetry, templateAtomCount, thisBiomolecule, trajectorySteps, ucItems, unitCellOffset, unitCellParams, useAltNames, useFileModelNumbers, validation, vibrationNumber, vibsFractional, vwr`

## Constructor Summary

Constructors
Constructor
Description
`PdbReader()`

## Method Summary

Modifier and Type
Method
Description
`protected boolean`
`checkLine()`
`protected void`
`checkRemark()`
`protected 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.
`protected boolean`
`filterPDBAtom(Atom atom, int iAtom)`
`protected void`
`finalizeReaderPDB()`
`protected void`
`finalizeSubclassReader()`
`protected static float`
`fixRadius(float r)`
`protected void`
`initializeReader()`
`protected void`
`model(int modelNumber, String name)`
`protected Atom`
`processAtom(Atom atom, String name, char altID, String group3, int chainID, int seqNo, char insCode, boolean isHetero, String sym)`
`protected void`
`processAtom2(Atom atom, int serial, float x, float y, float z, int charge)`
`protected void`
`setAdditionalAtomParameters(Atom atom)`
adaptable via subclassing

### Methods inherited from class AtomSetCollectionReader

`addAtomXYZSymName, addExplicitLatticeVector, addJmolScript, addMoreUnitCellInfo, addSites, addSiteScript, appendLoadNote, applySymmetryAndSetTrajectory, applySymTrajASCR, checkAndRemoveFilterKey, 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, fixDoubleA, fixFloatA, fixFloatPt, forceSymmetry, fractionalizeCoordinates, getElementSymbol, getFilter, getFilterWithCase, getFortranFormatLengths, getInterface, getPackingRangeValue, getStrings, getSymmetry, getTokens, getTokensFloat, initializeSymmetry, initializeSymmetryOptions, initializeTrajectoryFile, isLastModel, newAtomSet, parseFloat, parseFloatRange, parseFloatStr, parseInt, parseIntAt, parseIntRange, parseIntStr, parsePrecision, 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, setPrecision, setSpaceGroupName, setSymmetryOperator, setTransform, setUnitCell, setUnitCellItem, setup, setupASCR, warnSkippingOperation`

### Methods inherited from class Object

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

## Field Details

### gromacsWideFormat

protected boolean gromacsWideFormat

### biomtChainAtomCounts

protected int[] biomtChainAtomCounts

### fileAtomIndex

protected int fileAtomIndex

### pdbID

protected String pdbID

## Constructor Details

### PdbReader

public PdbReader()

## Method Details

### initializeReader

protected void initializeReader() throws Exception

Overrides:
  `initializeReader` in class `AtomSetCollectionReader`
Throws:
  `Exception`

### checkLine

protected boolean checkLine() throws Exception

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

### checkRemark

protected void checkRemark()

### finalizeSubclassReader

protected void finalizeSubclassReader() throws Exception

Overrides:
  `finalizeSubclassReader` in class `AtomSetCollectionReader`
Throws:
  `Exception`

### finalizeReaderPDB

protected void finalizeReaderPDB() throws Exception

Throws:
  `Exception`

### processAtom

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

### processAtom2

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

### filterPDBAtom

protected boolean filterPDBAtom(Atom atom, int iAtom)

### setAdditionalAtomParameters

protected void setAdditionalAtomParameters(Atom atom)
adaptable via subclassing

Parameters:
  `atom` -

### deduceElementSymbol

protected 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

### model

protected void model(int modelNumber, String name)

### fixRadius

protected static float fixRadius(float r)