org.jmol.adapter.readers.simple
Class MopacReader

java.lang.Object
  extended by org.jmol.adapter.smarter.AtomSetCollectionReader
      extended by org.jmol.adapter.readers.simple.MopacReader

public class MopacReader
extends AtomSetCollectionReader

Reads Mopac 93, 6, 7, 2002, or 2009 output files

Author:
Egon Willighagen

Field Summary
private  int baseAtomIndex
           
private  boolean chargesFound
           
private  boolean haveHeader
           
private  int mopacVersion
           
 
Fields inherited from class org.jmol.adapter.smarter.AtomSetCollectionReader
addVibrations, ANGSTROMS_PER_BOHR, applySymmetryToBonds, atomSetCollection, bsFilter, bsModels, calculationType, continuing, desiredModelNumber, desiredVibrationNumber, doApplySymmetry, doc, doCheckUnitCell, doPackUnitCell, doProcessLines, filter, filterHetero, getHeader, haveModel, havePartialChargeFilter, htParams, ignoreFileSpaceGroupName, ignoreFileSymmetryOperators, ignoreFileUnitCell, iHaveFractionalCoordinates, iHaveSymmetryOperators, iHaveUnitCell, isBinary, isSequential, isTrajectory, latticeCells, line, matUnitCellOrientation, modelNumber, next, notionalUnitCell, os, prevline, ptLine, reader, readerName, readMolecularOrbitals, spaceGroup, stateScriptVersionInt, supercell, symmetry, templateAtomCount, useAltNames, vibrationNumber, viewer
 
Constructor Summary
MopacReader()
           
 
Method Summary
protected  boolean checkLine()
           
protected  void initializeReader()
           
(package private)  void processAtomicCharges()
          Reads the section in MOPAC files with atomic charges.
(package private)  void processCoordinates()
          Reads the section in MOPAC files with cartesian coordinates.
(package private)  void processTotalEnergy()
           
private  void readFrequencies()
          Interprets the Harmonic frequencies section.
 
Methods inherited from class org.jmol.adapter.smarter.AtomSetCollectionReader
addJmolScript, addPrimitiveLatticeVector, addSites, addSiteScript, appendLoadNote, applySymmetryAndSetTrajectory, checkFilter, checkLastModel, checkLineForScript, checkLineForScript, clearUnitCell, cloneLastAtomSet, discardLinesUntilBlank, discardLinesUntilContains, discardLinesUntilContains, discardLinesUntilNonBlank, discardLinesUntilStartsWith, doGetModel, doGetVibration, fillDataBlock, fillDataBlock, fillFloatArray, fillFrequencyData, filterAtom, finalizeReader, getElementSymbol, getFortranFormatLengths, getStrings, getSymmetry, getTokens, getTokens, getTokens, getTokensFloat, initializeSymmetry, isLastModel, newAtomSet, parseFloat, parseFloat, parseFloat, parseInt, parseInt, parseInt, parseInt, parseStringInfestedFloatArray, parseToken, parseToken, parseToken, parseTokenNext, parseTrimmed, parseTrimmed, processBinaryDocument, processXml, read3Vectors, readData, readLine, readLines, set2D, setAtomCoord, setAtomCoord, setFilter, setFractionalCoordinates, setIsPDB, setMOData, setPdb, setSpaceGroupName, setSymmetryOperator, setTransform, setUnitCell, setUnitCellItem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

baseAtomIndex

private int baseAtomIndex

chargesFound

private boolean chargesFound

haveHeader

private boolean haveHeader

mopacVersion

private int mopacVersion
Constructor Detail

MopacReader

public MopacReader()
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

processTotalEnergy

void processTotalEnergy()

processAtomicCharges

void processAtomicCharges()
                    throws java.lang.Exception
Reads the section in MOPAC files with atomic charges. These sections look like:
               NET ATOMIC CHARGES AND DIPOLE CONTRIBUTIONS
 
          ATOM NO.   TYPE          CHARGE        ATOM  ELECTRON DENSITY
            1          C          -0.077432        4.0774
            2          C          -0.111917        4.1119
            3          C           0.092081        3.9079
 
They are expected to be found in the file before the cartesian coordinate section.

Throws:
java.lang.Exception

processCoordinates

void processCoordinates()
                  throws java.lang.Exception
Reads the section in MOPAC files with cartesian coordinates. These sections look like:
           CARTESIAN COORDINATES
 
     NO.       ATOM         X         Y         Z
 
      1         C        0.0000    0.0000    0.0000
      2         C        1.3952    0.0000    0.0000
      3         C        2.0927    1.2078    0.0000
 
In a MOPAC2002 file the columns are different:
          CARTESIAN COORDINATES

 NO.       ATOM           X             Y             Z

  1         H        0.00000000    0.00000000    0.00000000
  2         O        0.95094500    0.00000000    0.00000000
  3         H        1.23995160    0.90598439    0.00000000
 

Throws:
java.lang.Exception

readFrequencies

private void readFrequencies()
                      throws java.lang.Exception
Interprets the Harmonic frequencies section.
     THE LAST 6 VIBRATIONS ARE THE TRANSLATION AND ROTATION MODES
    THE FIRST THREE OF THESE BEING TRANSLATIONS IN X, Y, AND Z, RESPECTIVELY
              NORMAL COORDINATE ANALYSIS
   
       ROOT NO.    1           2           3           4           5           6
   
              370.51248   370.82204   618.03031   647.68700   647.74806   744.32662
     
            1   0.00002     0.00001    -0.00002    -0.05890     0.07204    -0.00002
            2   0.00001    -0.00006    -0.00001     0.01860     0.13517     0.00000
            3   0.00421    -0.11112     0.06838    -0.00002    -0.00003    -0.02449
   
            4   0.00002     0.00001    -0.00002    -0.04779     0.07977    -0.00001
            5  -0.00002     0.00002     0.00001     0.13405    -0.02908     0.00004
            6  -0.10448     0.05212    -0.06842    -0.00005    -0.00002    -0.02447
 

The vectors are added to a clone of the last read AtomSet. Only the Frequencies are set as properties for each of the frequency type AtomSet generated.

Throws:
java.lang.Exception - If an I/O error occurs