org.jmol.adapter.smarter
Class AtomSetCollectionReader

java.lang.Object
  extended by org.jmol.adapter.smarter.AtomSetCollectionReader
Direct Known Subclasses:
AimsReader, AlchemyReader, AmpacReader, BasisFunctionReader, CastepReader, CifReader, CrystalReader, CubeReader, FoldingXyzReader, ForceFieldReader, GaussianWfnReader, GhemicalMMReader, GromacsReader, HyperChemReader, JmeReader, MdCrdReader, MolReader, MopacReader, NWChemReader, PdbReader, ShelxReader, SpartanInputReader, SpartanReader, Wien2kReader, XmlReader, XyzReader

public abstract class AtomSetCollectionReader
extends Object


Field Summary
protected  boolean addVibrations
           
static float ANGSTROMS_PER_BOHR
           
 boolean applySymmetryToBonds
           
protected  AtomSetCollection atomSetCollection
           
protected  BitSet bsFilter
           
protected  BitSet bsModels
           
 String calculationType
           
 boolean continuing
           
protected  int desiredModelNumber
           
private  int desiredSpaceGroupIndex
           
 int desiredVibrationNumber
           
protected  boolean doApplySymmetry
           
protected  boolean doCheckUnitCell
           
private  boolean doConvertToFractional
           
private  boolean doPackUnitCell
           
 boolean doProcessLines
           
private  boolean doSetOrientation
           
private  boolean fileCoordinatesAreFractional
           
(package private)  String fileName
           
private  Point3f fileOffset
           
private  Point3f fileScaling
           
protected  String filter
           
private  boolean filterAltLoc
           
private  boolean filterAtomType
           
private  boolean filterChain
           
private  boolean filterGroup3
           
private  int[] firstLastStep
           
protected  boolean getHeader
           
private  boolean haveAtomFilter
           
 boolean haveModel
           
protected  boolean havePartialChargeFilter
           
 Hashtable htParams
           
protected  boolean ignoreFileSpaceGroupName
           
protected  boolean ignoreFileSymmetryOperators
           
protected  boolean ignoreFileUnitCell
           
private  boolean iHaveFractionalCoordinates
           
 boolean iHaveSymmetryOperators
           
 boolean iHaveUnitCell
           
protected  boolean isSequential
           
protected  boolean isTrajectory
           
private  int lastModelNumber
           
 int[] latticeCells
           
 String line
           
private  Matrix3f matrixRotate
           
protected  Matrix3f matUnitCellOrientation
           
private  boolean merging
           
 int modelNumber
           
protected  int[] next
           
private  int nMatrixElements
           
protected  float[] notionalUnitCell
           
protected  OutputStream os
           
private  String previousScript
           
private  String previousSpaceGroup
           
private  float[] previousUnitCell
           
 String prevline
           
protected  long ptLine
           
protected  BufferedReader reader
           
protected  String readerName
           
 boolean readMolecularOrbitals
           
private  String siteScript
           
protected  String spaceGroup
           
protected  SymmetryInterface symmetry
           
private  float symmetryRange
           
protected  int templateAtomCount
           
private  Point3f unitCellOffset
           
protected  int vibrationNumber
           
protected  JmolViewer viewer
           
 
Constructor Summary
AtomSetCollectionReader()
           
 
Method Summary
protected  void addJmolScript(String script)
           
 void addPrimitiveLatticeVector(int i, float[] xyz, int i0)
           
protected  void addSites(Hashtable htSites)
           
protected  void addSiteScript(String script)
           
 void applySymmetryAndSetTrajectory()
           
 boolean checkFilter(String key)
           
 boolean checkLastModel()
          sets continuing and doProcessLines
protected  boolean checkLine()
           
 void checkLineForScript()
           
protected  void checkLineForScript(String line)
           
private  boolean checkUnitCell(int n)
           
 void clearLatticeParameters()
           
protected  int cloneLastAtomSet(int atomCount)
           
protected  void discardLines(int nLines)
           
protected  void discardLinesUntilBlank()
           
protected  String discardLinesUntilContains(String containsMatch)
           
protected  String discardLinesUntilContains(String s1, String s2)
           
protected  String discardLinesUntilNonBlank()
           
protected  String discardLinesUntilStartsWith(String startsWith)
           
 boolean doGetModel(int modelNumber)
           
 boolean doGetVibration(int vibrationNumber)
           
protected  void fillDataBlock(String[][] data)
          fills an array with a pre-defined number of lines of token data, skipping blank lines in the process
protected  void fillDataBlock(String[][] data, int col0, int colWidth)
          fills an array with a predefined number of lines of data that is arranged in fixed FORTRAN-like column format
protected  void fillFloatArray(float[] temp, String line0, int width)
          fills a float array with string data from a file
protected  void fillFrequencyData(int iAtom0, int atomCount, int modelAtomCount, boolean[] ignore, boolean isWide, int col0, int colWidth, int[] atomIndexes)
          Extracts a block of frequency data from a file.
protected  boolean filterAtom(Atom atom, int iAtom)
           
private  boolean filterReject(String notCode, String code)
           
protected  void finalizeReader()
           
private  Object finish()
           
static String getElementSymbol(int elementNumber)
           
protected static ArrayList getFortranFormatLengths(String s)
          get all integers after letters negative entries are spaces (1Xn)
protected static String[] getStrings(String sinfo, int nFields, int width)
           
protected  SymmetryInterface getSymmetry()
           
protected  String[] getTokens()
           
static String[] getTokens(String s)
           
protected static String[] getTokens(String s, int iStart)
           
protected static void getTokensFloat(String s, float[] f, int n)
           
private  void initialize()
           
private  void initializeCartesianToFractional()
           
protected  void initializeReader()
           
protected  void initializeSymmetry()
           
 boolean isLastModel(int modelNumber)
          after reading a model, Q: Is this the last model?
protected  void newAtomSet(String name)
           
protected  float parseFloat()
           
 float parseFloat(String s)
           
protected  float parseFloat(String s, int iStart, int iEnd)
           
protected  int parseInt()
           
 int parseInt(String s)
           
protected  int parseInt(String s, int iStart)
           
protected  int parseInt(String s, int iStart, int iEnd)
           
protected  void parseStringInfestedFloatArray(String s, float[] data)
           
protected  String parseToken()
           
protected  String parseToken(String s)
           
protected  String parseToken(String s, int iStart, int iEnd)
           
protected  String parseTokenNext(String s)
           
protected static String parseTrimmed(String s, int iStart)
           
protected static String parseTrimmed(String s, int iStart, int iEnd)
           
 void readAtomSetCollectionFromDOM(Object DOMNode)
           
(package private)  Object readData()
           
protected  Object readData(Object DOMNode)
           
 String readLine()
           
protected  void set2D()
           
 void setAtomCoord(Atom atom)
           
 void setAtomCoord(Atom atom, float x, float y, float z)
           
private  void setError(Throwable e)
           
protected  void setFilter(String filter0)
           
 void setFractionalCoordinates(boolean TF)
           
 void setMOData(Hashtable moData)
           
 void setSpaceGroupName(String name)
           
 void setSymmetryOperator(String xyz)
           
 void setTransform(float x1, float y1, float z1, float x2, float y2, float z2, float x3, float y3, float z3)
           
 void setUnitCell(float a, float b, float c, float alpha, float beta, float gamma)
           
 void setUnitCellItem(int i, float x)
           
(package private)  void setup(String fileName, Hashtable htParams, BufferedReader reader)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ANGSTROMS_PER_BOHR

public static final float ANGSTROMS_PER_BOHR
See Also:
Constant Field Values

atomSetCollection

protected AtomSetCollection atomSetCollection

reader

protected BufferedReader reader

readerName

protected String readerName

htParams

public Hashtable htParams

line

public String line

prevline

public String prevline

next

protected int[] next

ptLine

protected long ptLine

latticeCells

public int[] latticeCells

doProcessLines

public boolean doProcessLines

iHaveUnitCell

public boolean iHaveUnitCell

iHaveSymmetryOperators

public boolean iHaveSymmetryOperators

doApplySymmetry

protected boolean doApplySymmetry

ignoreFileSymmetryOperators

protected boolean ignoreFileSymmetryOperators

isTrajectory

protected boolean isTrajectory

applySymmetryToBonds

public boolean applySymmetryToBonds

doCheckUnitCell

protected boolean doCheckUnitCell

getHeader

protected boolean getHeader

isSequential

protected boolean isSequential

templateAtomCount

protected int templateAtomCount

modelNumber

public int modelNumber

vibrationNumber

protected int vibrationNumber

desiredVibrationNumber

public int desiredVibrationNumber

bsModels

protected BitSet bsModels

spaceGroup

protected String spaceGroup

havePartialChargeFilter

protected boolean havePartialChargeFilter

calculationType

public String calculationType

iHaveFractionalCoordinates

private boolean iHaveFractionalCoordinates

doPackUnitCell

private boolean doPackUnitCell

doConvertToFractional

private boolean doConvertToFractional

merging

private boolean merging

fileCoordinatesAreFractional

private boolean fileCoordinatesAreFractional

ignoreFileUnitCell

protected boolean ignoreFileUnitCell

ignoreFileSpaceGroupName

protected boolean ignoreFileSpaceGroupName

symmetryRange

private float symmetryRange

notionalUnitCell

protected float[] notionalUnitCell

firstLastStep

private int[] firstLastStep

desiredModelNumber

protected int desiredModelNumber

lastModelNumber

private int lastModelNumber

desiredSpaceGroupIndex

private int desiredSpaceGroupIndex

symmetry

protected SymmetryInterface symmetry

os

protected OutputStream os

fileScaling

private Point3f fileScaling

fileOffset

private Point3f fileOffset

fileName

String fileName

continuing

public boolean continuing

viewer

protected JmolViewer viewer

haveModel

public boolean haveModel

previousSpaceGroup

private String previousSpaceGroup

previousUnitCell

private float[] previousUnitCell

nMatrixElements

private int nMatrixElements

matUnitCellOrientation

protected Matrix3f matUnitCellOrientation

bsFilter

protected BitSet bsFilter

filter

protected String filter

haveAtomFilter

private boolean haveAtomFilter

filterAltLoc

private boolean filterAltLoc

filterGroup3

private boolean filterGroup3

filterChain

private boolean filterChain

filterAtomType

private boolean filterAtomType

doSetOrientation

private boolean doSetOrientation

addVibrations

protected boolean addVibrations

readMolecularOrbitals

public boolean readMolecularOrbitals

matrixRotate

private Matrix3f matrixRotate

unitCellOffset

private Point3f unitCellOffset

previousScript

private String previousScript

siteScript

private String siteScript
Constructor Detail

AtomSetCollectionReader

public AtomSetCollectionReader()
Method Detail

setup

void setup(String fileName,
           Hashtable htParams,
           BufferedReader reader)

readData

Object readData()
          throws Exception
Throws:
Exception

readData

protected Object readData(Object DOMNode)

readAtomSetCollectionFromDOM

public void readAtomSetCollectionFromDOM(Object DOMNode)

initializeReader

protected void initializeReader()
                         throws Exception
Throws:
Exception

checkLine

protected boolean checkLine()
                     throws Exception
Returns:
true if need to read new line
Throws:
Exception

checkLastModel

public boolean checkLastModel()
sets continuing and doProcessLines

Returns:
TRUE if continuing, FALSE if not

isLastModel

public boolean isLastModel(int modelNumber)
after reading a model, Q: Is this the last model?

Parameters:
modelNumber -
Returns:
Yes/No

finalizeReader

protected void finalizeReader()
                       throws Exception
Throws:
Exception

finish

private Object finish()

setError

private void setError(Throwable e)

initialize

private void initialize()

doGetModel

public boolean doGetModel(int modelNumber)

initializeSymmetry

protected void initializeSymmetry()

newAtomSet

protected void newAtomSet(String name)

cloneLastAtomSet

protected int cloneLastAtomSet(int atomCount)
                        throws Exception
Throws:
Exception

setSpaceGroupName

public void setSpaceGroupName(String name)

setSymmetryOperator

public void setSymmetryOperator(String xyz)

initializeCartesianToFractional

private void initializeCartesianToFractional()

clearLatticeParameters

public void clearLatticeParameters()

setUnitCellItem

public void setUnitCellItem(int i,
                            float x)

setUnitCell

public void setUnitCell(float a,
                        float b,
                        float c,
                        float alpha,
                        float beta,
                        float gamma)

addPrimitiveLatticeVector

public void addPrimitiveLatticeVector(int i,
                                      float[] xyz,
                                      int i0)

checkUnitCell

private boolean checkUnitCell(int n)

getSymmetry

protected SymmetryInterface getSymmetry()

setFractionalCoordinates

public void setFractionalCoordinates(boolean TF)

setFilter

protected void setFilter(String filter0)

checkFilter

public boolean checkFilter(String key)

filterAtom

protected boolean filterAtom(Atom atom,
                             int iAtom)
Parameters:
atom -
iAtom -
Returns:
true if we want this atom

filterReject

private boolean filterReject(String notCode,
                             String code)

set2D

protected void set2D()

doGetVibration

public boolean doGetVibration(int vibrationNumber)

setTransform

public void setTransform(float x1,
                         float y1,
                         float z1,
                         float x2,
                         float y2,
                         float z2,
                         float x3,
                         float y3,
                         float z3)

setAtomCoord

public void setAtomCoord(Atom atom,
                         float x,
                         float y,
                         float z)

setAtomCoord

public void setAtomCoord(Atom atom)

addSites

protected void addSites(Hashtable htSites)

applySymmetryAndSetTrajectory

public void applySymmetryAndSetTrajectory()
                                   throws Exception
Throws:
Exception

setMOData

public void setMOData(Hashtable moData)

getElementSymbol

public static String getElementSymbol(int elementNumber)

fillDataBlock

protected void fillDataBlock(String[][] data,
                             int col0,
                             int colWidth)
                      throws Exception
fills an array with a predefined number of lines of data that is arranged in fixed FORTRAN-like column format

Parameters:
data -
col0 -
colWidth -
Throws:
Exception

fillDataBlock

protected void fillDataBlock(String[][] data)
                      throws Exception
fills an array with a pre-defined number of lines of token data, skipping blank lines in the process

Parameters:
data -
Throws:
Exception

fillFloatArray

protected void fillFloatArray(float[] temp,
                              String line0,
                              int width)
                       throws Exception
fills a float array with string data from a file

Parameters:
temp -
line0 - TODO
width - TODO
Throws:
Exception

fillFrequencyData

protected void fillFrequencyData(int iAtom0,
                                 int atomCount,
                                 int modelAtomCount,
                                 boolean[] ignore,
                                 boolean isWide,
                                 int col0,
                                 int colWidth,
                                 int[] atomIndexes)
                          throws Exception
Extracts a block of frequency data from a file. This block may be of two types -- either X Y Z across a row or each of X Y Z on a separate line. Data is presumed to be in fixed FORTRAN-like column format, not space-separated columns.

Parameters:
iAtom0 - the first atom to be assigned a frequency
atomCount - the number of atoms to be assigned
modelAtomCount - the number of atoms in each model
ignore - the frequencies to ignore because the user has selected only certain vibrations to be read or for whatever reason; length serves to set the number of frequencies to be read
isWide - when TRUE, this is a table that has X Y Z for each mode within the same row; when FALSE, this is a table that has X Y Z for each mode on a separate line.
col0 - the column in which data starts
colWidth - the width of the data columns
atomIndexes - an array either null or indicating exactly which atoms get the frequencies (used by CrystalReader)
Throws:
Exception

discardLines

protected void discardLines(int nLines)
                     throws Exception
Throws:
Exception

discardLinesUntilStartsWith

protected String discardLinesUntilStartsWith(String startsWith)
                                      throws Exception
Throws:
Exception

discardLinesUntilContains

protected String discardLinesUntilContains(String containsMatch)
                                    throws Exception
Throws:
Exception

discardLinesUntilContains

protected String discardLinesUntilContains(String s1,
                                           String s2)
                                    throws Exception
Throws:
Exception

discardLinesUntilBlank

protected void discardLinesUntilBlank()
                               throws Exception
Throws:
Exception

discardLinesUntilNonBlank

protected String discardLinesUntilNonBlank()
                                    throws Exception
Throws:
Exception

checkLineForScript

protected void checkLineForScript(String line)

checkLineForScript

public void checkLineForScript()

addJmolScript

protected void addJmolScript(String script)

addSiteScript

protected void addSiteScript(String script)

readLine

public String readLine()
                throws Exception
Throws:
Exception

getStrings

protected static final String[] getStrings(String sinfo,
                                           int nFields,
                                           int width)

parseStringInfestedFloatArray

protected void parseStringInfestedFloatArray(String s,
                                             float[] data)

getTokens

protected String[] getTokens()

getTokensFloat

protected static void getTokensFloat(String s,
                                     float[] f,
                                     int n)

getTokens

public static String[] getTokens(String s)

getTokens

protected static String[] getTokens(String s,
                                    int iStart)

parseFloat

protected float parseFloat()

parseFloat

public float parseFloat(String s)

parseFloat

protected float parseFloat(String s,
                           int iStart,
                           int iEnd)

parseInt

protected int parseInt()

parseInt

public int parseInt(String s)

parseInt

protected int parseInt(String s,
                       int iStart)

parseInt

protected int parseInt(String s,
                       int iStart,
                       int iEnd)

parseToken

protected String parseToken()

parseToken

protected String parseToken(String s)

parseTokenNext

protected String parseTokenNext(String s)

parseToken

protected String parseToken(String s,
                            int iStart,
                            int iEnd)

parseTrimmed

protected static String parseTrimmed(String s,
                                     int iStart)

parseTrimmed

protected static String parseTrimmed(String s,
                                     int iStart,
                                     int iEnd)

getFortranFormatLengths

protected static ArrayList getFortranFormatLengths(String s)
get all integers after letters negative entries are spaces (1Xn)

Parameters:
s -
Returns:
Vector of integers