# Class CifReader

java.lang.Object
org.jmol.adapter.smarter.AtomSetCollectionReader
org.jmol.adapter.readers.cif.CifReader

All Implemented Interfaces:
  `GenericLineReader`

Direct Known Subclasses:
  `Cif2Reader, MMCifReader`

public class CifReader extends AtomSetCollectionReader
A true line-free CIF file reader for CIF files. Subclasses of CIF -- mmCIF/PDBx (pre-initialized) and msCIF (initialized here) Note that a file can be a PDB file without being Added nonstandard mCIF (magnetic_ tags) 5/2/2014 note that PRELIM keys can be removed at some later time Added preliminary Spin-Frame "ssg" tags2025.02.07

http://www.iucr.org/iucr-top/cif/ http://www.iucr.org/iucr-top/cif/standard/cifstd5.html

Author:
  Miguel, Egon, and Bob (hansonr@stolaf.edu) symmetry added by Bob Hanson: setSpaceGroupName() setSymmetryOperator() setUnitCellItem() setFractionalCoordinates() setAtomCoord() applySymmetryAndSetTrajectory()

## Field Summary

Fields
Modifier and Type
Field
Description
`protected int`
`ac`
`protected static final String`
`CAT_ATOM_SITE`
`protected static final String`
`CAT_ATOM_SITES`
`protected static final String`
`CAT_ATOM_TYPE`
`protected static final String`
`CAT_CELL`
`protected static final byte`
`EMPTY`
/////////////////////////////////////////////////////////////
`protected char`
`firstChar`
`protected Map<String,String>`
`htGroup1`
`protected boolean`
`iHaveDesiredModel`
`protected boolean`
`isCourseGrained`
`protected boolean`
`isLigand`
`protected boolean`
`isLoop`
`protected boolean`
`isMagCIF`
`protected boolean`
`isMMCIF`
`protected boolean`
`isSpinCIF`
`protected String`
`lastDataSetName`
`protected int`
`maxSerial`
`Map<String,Integer>`
`modelMap`
`protected int`
`nAtoms`
`protected int`
`nAtoms0`
`protected static final byte`
`NONE`
`protected String`
`pdbID`
`protected boolean`
`skipping`
`Lst<String>`
`symops`
`protected String`
`thisDataSetName`
`protected boolean`
`useAuthorChainID`

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

## Method Summary

Modifier and Type
Method
Description
`protected boolean`
`addCifAtom(Atom atom, String id, String componentId, String strChain)`
`protected void`
`addHeader()`
`void`
`applySymmetryAndSetTrajectory()`
`protected boolean`
`checkAllFieldsPresent(String[] keys, int lastKey, boolean critical)`
`protected int`
`checkPDBModelField(int modelField, int currentModelNo)`
`protected boolean`
`checkSubclassSymmetry()`
`void`
`doPreSymmetry(boolean doApplySymmetry)`
`protected int`
`fieldProperty(int col)`
`protected boolean`
`filterCIFAtom(Atom atom, String componentId)`
`protected boolean`
`finalizeSubclass()`
`protected void`
`finalizeSubclassReader()`
`protected void`
`finalizeSubclassSymmetry(boolean haveSymmetry)`
`static String`
`fullTrim(Object s)`
`int`
`getBondOrder(String field)`
`protected GenericCifDataParser`
`getCifDataParser()`
`protected String`
`getFieldString(byte type)`
`protected float`
`getFloatColumnData(int i)`
`void`
`initializeReader()`
`protected void`
`initSubclass()`
`protected boolean`
`isFieldValid()`
`protected boolean`
`isLoopKey()`
`protected boolean`
`isNull(String key)`
`protected void`
`newModel(int modelNo)`
`protected void`
`nextAtomSet()`
`protected float`
`parseCartesianField()`
`protected float`
`parseFloatField()`
`protected int`
`parseIntField()`
`protected void`
`parseLoopParameters(String[] fieldNames)`
sets up arrays and variables for tokenizer.getData() after the first tag of the loop has been checked.
`protected boolean`
`processAtomTypeLoopBlock()`
reads the oxidation number and associates it with an atom name, which can then later be associated with the right atom indirectly.
`protected void`
`processCellParameter()`
unit cell parameters -- two options, so we use MOD 6
`protected void`
`processCitationListBlock()`
`protected void`
`processLoopBlock()`
processes loop_ blocks of interest or skips the data
`protected boolean`
`processSubclassAtom(Atom atom, String assemblyId, String strChain)`
`protected void`
`processSubclassEntry()`
`protected boolean`
`processSubclassLoopBlock()`
`protected void`
`processUnitCellTransformMatrix()`
the PDB transformation matrix cartesian --> fractional key and field have been set already
`int`
`setSymmetryOperator(String xyz)`
`protected void`
`skipLoop(boolean doReport)`
`protected void`
`skipLoopKeyword()`

### Methods inherited from class AtomSetCollectionReader

`addAtomXYZSymName, addExplicitLatticeVector, addJmolScript, addMoreUnitCellInfo, addSites, addSiteScript, appendLoadNote, applySymTrajASCR, checkAndRemoveFilterKey, checkCurrentLineForScript, checkFilterKey, checkLastModel, checkLine, checkLineForScript, clearUnitCell, cloneLastAtomSet, discardLinesUntilBlank, discardLinesUntilContains, discardLinesUntilContains2, discardLinesUntilNonBlank, discardLinesUntilStartsWith, discardPreviousAtoms, doGetModel, doGetVibration, fill3x3, fillDataBlock, fillDataBlockFixed, fillFloatArray, fillFrequencyData, filterAtom, filterReject, finalizeMOData, finalizeModelSet, finalizeReaderASCR, 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, setTransform, setUnitCell, setUnitCellItem, setup, setupASCR, warnSkippingOperation`

### Methods inherited from class Object

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

## Field Details

### useAuthorChainID

protected boolean useAuthorChainID

### thisDataSetName

protected String thisDataSetName

### lastDataSetName

protected String lastDataSetName

### iHaveDesiredModel

protected boolean iHaveDesiredModel

### isMMCIF

protected boolean isMMCIF

### isLigand

protected boolean isLigand

### isMagCIF

protected boolean isMagCIF

### isSpinCIF

protected boolean isSpinCIF

### skipping

protected boolean skipping

### nAtoms

protected int nAtoms

### ac

protected int ac

### isCourseGrained

protected boolean isCourseGrained

### htGroup1

protected Map<String,String> htGroup1

### nAtoms0

protected int nAtoms0

### modelMap

public Map<String,Integer> modelMap

### symops

public Lst<String> symops

### pdbID

protected String pdbID

### CAT_CELL

protected static final String CAT_CELL

See Also:
  - Constant Field Values

### CAT_ATOM_SITES

protected static final String CAT_ATOM_SITES

See Also:
  - Constant Field Values

### maxSerial

protected int maxSerial

### CAT_ATOM_TYPE

protected static final String CAT_ATOM_TYPE

See Also:
  - Constant Field Values

### EMPTY

protected static final byte EMPTY
/////////////////////////////////////////////////////////////

See Also:
  - Constant Field Values

### NONE

protected static final byte NONE

See Also:
  - Constant Field Values

### CAT_ATOM_SITE

protected static final String CAT_ATOM_SITE

See Also:
  - Constant Field Values

### isLoop

protected boolean isLoop

### firstChar

protected char firstChar

## Constructor Details

### CifReader

public CifReader()

## Method Details

### initializeReader

public void initializeReader() throws Exception

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

### initSubclass

protected void initSubclass()

### getCifDataParser

protected GenericCifDataParser getCifDataParser()

### setSymmetryOperator

public int setSymmetryOperator(String xyz)

Overrides:
  `setSymmetryOperator` in class `AtomSetCollectionReader`

### processSubclassEntry

protected void processSubclassEntry() throws Exception

Throws:
  `Exception`

### newModel

protected void newModel(int modelNo) throws Exception

Throws:
  `Exception`

### finalizeSubclassReader

protected void finalizeSubclassReader() throws Exception

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

### addHeader

protected void addHeader()

### finalizeSubclass

protected boolean finalizeSubclass() throws Exception

Throws:
  `Exception`

### doPreSymmetry

public void doPreSymmetry(boolean doApplySymmetry) throws Exception

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

### applySymmetryAndSetTrajectory

public void applySymmetryAndSetTrajectory() throws Exception

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

### finalizeSubclassSymmetry

protected void finalizeSubclassSymmetry(boolean haveSymmetry) throws Exception

Overrides:
  `finalizeSubclassSymmetry` in class `AtomSetCollectionReader`
Parameters:
  `haveSymmetry` -
Throws:
  `Exception`

### nextAtomSet

protected void nextAtomSet()

### processCellParameter

protected void processCellParameter() throws Exception
unit cell parameters -- two options, so we use MOD 6

Throws:
  `Exception`

### processUnitCellTransformMatrix

protected void processUnitCellTransformMatrix() throws Exception
the PDB transformation matrix cartesian --> fractional key and field have been set already

Throws:
  `Exception`

### processLoopBlock

protected void processLoopBlock() throws Exception
processes loop_ blocks of interest or skips the data

Throws:
  `Exception`

### processSubclassLoopBlock

protected boolean processSubclassLoopBlock() throws Exception

Throws:
  `Exception`

### processAtomTypeLoopBlock

protected boolean processAtomTypeLoopBlock() throws Exception
reads the oxidation number and associates it with an atom name, which can then later be associated with the right atom indirectly.

Returns:
  true; for convenience only in switch statements
Throws:
  `Exception`

### fieldProperty

protected int fieldProperty(int col)

### parseCartesianField

protected float parseCartesianField()

### addCifAtom

protected boolean addCifAtom(Atom atom, String id, String componentId, String strChain)

### checkPDBModelField

protected int checkPDBModelField(int modelField, int currentModelNo) throws Exception

Parameters:
  `modelField` -
  `currentModelNo` -
Returns:
  new currentModelNo
Throws:
  `Exception`

### processSubclassAtom

protected boolean processSubclassAtom(Atom atom, String assemblyId, String strChain)

Parameters:
  `atom` -
  `assemblyId` -
  `strChain` -
Returns:
  true if valid atom

### filterCIFAtom

protected boolean filterCIFAtom(Atom atom, String componentId)

### processCitationListBlock

protected void processCitationListBlock() throws Exception

Throws:
  `Exception`

### getBondOrder

public int getBondOrder(String field)

### checkSubclassSymmetry

protected boolean checkSubclassSymmetry()

### checkAllFieldsPresent

protected boolean checkAllFieldsPresent(String[] keys, int lastKey, boolean critical)

### isNull

protected boolean isNull(String key)

### skipLoop

protected void skipLoop(boolean doReport) throws Exception

Throws:
  `Exception`

### fullTrim

public static String fullTrim(Object s)

### isFieldValid

protected boolean isFieldValid()

### parseIntField

protected int parseIntField()

### parseFloatField

protected float parseFloatField()

### parseLoopParameters

protected void parseLoopParameters(String[] fieldNames) throws Exception
sets up arrays and variables for tokenizer.getData() after the first tag of the loop has been checked.

Parameters:
  `fieldNames` -
Throws:
  `Exception`

### getFieldString

protected String getFieldString(byte type)

### skipLoopKeyword

protected void skipLoopKeyword()

### isLoopKey

protected boolean isLoopKey()

### getFloatColumnData

protected float getFloatColumnData(int i)