org.jmol.adapter.smarter
Class Resolver

java.lang.Object
  extended by org.jmol.adapter.smarter.Resolver

public class Resolver
extends java.lang.Object


Field Summary
private static java.lang.String[] adfContainsRecords
           
private static java.lang.String[] ampacContainsRecords
           
private static java.lang.String[] cifLineStartRecords
           
private static java.lang.String classBase
           
private static java.lang.String CML_NAMESPACE_URI
           
private static java.lang.String[] crystalContainsRecords
           
private static java.lang.String[] csfLineStartRecords
           
private static java.lang.String[] cubeFileStartRecords
           
private static java.lang.String[] dcdFileStartRecords
           
private static java.lang.String[] dgridContainsRecords
           
private static java.lang.String[] dmolContainsRecords
           
private static java.lang.String[] espressoContainsRecords
           
private static java.lang.String[][] fileStartsWithRecords
           
private static java.lang.String[] gamessUKContainsRecords
           
private static java.lang.String[] gamessUSContainsRecords
           
private static java.lang.String[] gaussianContainsRecords
           
private static java.lang.String[] ghemicalMMLineStartRecords
           
private static java.lang.String[] gulpContainsRecords
           
private static java.lang.String[][] headerContainsRecords
           
private static java.lang.String[] hyperChemLineStartRecords
           
private static java.lang.String[] jaguarLineStartRecords
           
private static int LEADER_CHAR_MAX
           
private static java.lang.String[][] lineStartsWithRecords
           
private static java.lang.String[] mdlLineStartRecords
           
private static java.lang.String[] mdTopLineStartRecords
           
private static java.lang.String[] mol2Records
           
private static java.lang.String[] moldenFileStartRecords
           
private static java.lang.String[] mopacContainsRecords
           
private static java.lang.String[] nwchemContainsRecords
           
private static java.lang.String[] p2nLineStartRecords
           
private static java.lang.String[] pdbLineStartRecords
           
private static java.lang.String[] pqrLineStartRecords
           
private static java.lang.String[] psiContainsRecords
           
private static java.lang.String[] qchemContainsRecords
           
private static java.lang.String[] readerSets
           
private static java.lang.String[] shelxLineStartRecords
           
private static java.lang.String[] siestaContainsRecords
           
private static java.lang.String[] spartanBinaryContainsRecords
           
private static java.lang.String[] spartanContainsRecords
           
private static java.lang.String[] spartanSmolLineStartRecords
           
private static int SPECIAL_AIMS
           
private static int SPECIAL_ALCHEMY
           
static int SPECIAL_ARGUS_DOM
           
static int SPECIAL_ARGUS_XML
           
private static int SPECIAL_CASTEP
           
static int SPECIAL_CHEM3D_DOM
           
static int SPECIAL_CHEM3D_XML
           
static int SPECIAL_CML_DOM
           
static int SPECIAL_CML_XML
           
private static int SPECIAL_CRYSTAL
           
private static int SPECIAL_CUBE
           
private static int SPECIAL_FOLDINGXYZ
           
private static int SPECIAL_GENNBO
           
private static int SPECIAL_GROMACS
           
private static int SPECIAL_JME
           
private static int SPECIAL_MOL
           
static int SPECIAL_MOLPRO_DOM
           
static int SPECIAL_MOLPRO_XML
           
private static int SPECIAL_MOPACGRAPHF
           
private static int SPECIAL_ODYSSEY
           
static int SPECIAL_ODYSSEY_DOM
           
static int SPECIAL_ODYSSEY_XML
           
static int SPECIAL_QE_XML
           
static int SPECIAL_VASP_DOM
           
static int SPECIAL_VASP_XML
           
private static int SPECIAL_WIEN
           
static int SPECIAL_XSD_DOM
           
static int SPECIAL_XSD_XML
           
private static int SPECIAL_XYZ
           
static java.lang.String[][] specialTags
           
private static java.lang.String[] sptContainsRecords
           
private static java.lang.String[] uicrcifContainsRecords
           
private static java.lang.String[] vaspOutcarLineStartRecords
           
private static java.lang.String[] webmoFileStartRecords
           
private static java.lang.String[] xmlContainsRecords
           
 
Constructor Summary
Resolver()
           
 
Method Summary
private static boolean checkAims(java.lang.String[] lines)
           
private static boolean checkAlchemy(java.lang.String line)
           
private static boolean checkCastep(java.lang.String[] lines)
           
private static boolean checkCrystal(java.lang.String[] lines)
           
private static boolean checkCube(java.lang.String[] lines)
           
private static boolean checkFoldingXyz(java.lang.String[] lines)
           
private static boolean checkGenNBO(java.lang.String[] lines)
           
private static boolean checkGromacs(java.lang.String[] lines)
           
private static java.lang.String checkHeaderContains(java.lang.String header)
           
private static java.lang.String checkLineStarts(java.lang.String[] lines)
           
private static boolean checkMol(java.lang.String[] lines)
           
private static boolean checkMopacGraphf(java.lang.String[] lines)
           
private static boolean checkOdyssey(java.lang.String[] lines)
           
private static java.lang.String checkSpecial(int nLines, java.lang.String[] lines, boolean isEnd)
           
(package private) static java.lang.StringBuffer checkSpecialData(java.io.InputStream is, java.lang.String[] zipDirectory)
          called by SmarterJmolAdapter to see if we have a Spartan directory and, if so, open it and get all the data into the correct order.
(package private) static java.lang.String[] checkSpecialInZip(java.lang.String[] zipDirectory)
          called by SmarterJmolAdapter to see if we can automatically assign a file from the zip file.
private static java.lang.String checkType(java.lang.String[][] typeTags, java.lang.String type)
           
private static boolean checkWien2k(java.lang.String[] lines)
           
private static boolean checkXyz(java.lang.String[] lines)
           
private static java.lang.String determineAtomSetCollectionReader(java.io.BufferedReader bufferedReader, boolean returnLines)
          the main resolver method.
(package private) static java.lang.Object DOMResolve(java.lang.Object DOMNode, java.util.Map<java.lang.String,java.lang.Object> htParams)
          a largely untested reader of the DOM - where in a browser there is model actually in XML format already present on the page.
(package private) static java.lang.Object getAtomCollectionReader(java.lang.String fullName, java.lang.String type, java.io.BufferedReader bufferedReader, java.util.Map<java.lang.String,java.lang.Object> htParams, int ptFile)
          the main method for reading files.
(package private) static java.lang.String getFileType(java.io.BufferedReader br)
          From SmarterJmolAdapter.getFileTypeName(Object atomSetCollectionOrReader) just return the file type with no exception issues
static java.lang.String getReaderClassBase(java.lang.String type)
           
private static java.lang.String getReaderFromType(java.lang.String type)
           
private static java.lang.String[] getSpartanDirs(java.lang.String outputFileData)
          read the output file from the Spartan directory and decide from that what files need to be read and in what order - usually M0001 or a set of Profiles.
private static java.lang.String[] getSpartanFileList(java.lang.String name, java.lang.String[] dirNums)
          returns the list of files to read for every Spartan spardir.
private static java.lang.String getXmlType(netscape.javascript.JSObject DOMNode)
           
private static java.lang.String getXmlType(java.lang.String header)
           
(package private) static java.lang.String[] specialLoad(java.lang.String name, java.lang.String type)
          Special loading for file directories.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

classBase

private static final java.lang.String classBase
See Also:
Constant Field Values

readerSets

private static final java.lang.String[] readerSets

CML_NAMESPACE_URI

private static final java.lang.String CML_NAMESPACE_URI
See Also:
Constant Field Values

SPECIAL_JME

private static final int SPECIAL_JME
See Also:
Constant Field Values

SPECIAL_MOPACGRAPHF

private static final int SPECIAL_MOPACGRAPHF
See Also:
Constant Field Values

SPECIAL_ODYSSEY

private static final int SPECIAL_ODYSSEY
See Also:
Constant Field Values

SPECIAL_MOL

private static final int SPECIAL_MOL
See Also:
Constant Field Values

SPECIAL_XYZ

private static final int SPECIAL_XYZ
See Also:
Constant Field Values

SPECIAL_FOLDINGXYZ

private static final int SPECIAL_FOLDINGXYZ
See Also:
Constant Field Values

SPECIAL_CUBE

private static final int SPECIAL_CUBE
See Also:
Constant Field Values

SPECIAL_ALCHEMY

private static final int SPECIAL_ALCHEMY
See Also:
Constant Field Values

SPECIAL_WIEN

private static final int SPECIAL_WIEN
See Also:
Constant Field Values

SPECIAL_CASTEP

private static final int SPECIAL_CASTEP
See Also:
Constant Field Values

SPECIAL_AIMS

private static final int SPECIAL_AIMS
See Also:
Constant Field Values

SPECIAL_CRYSTAL

private static final int SPECIAL_CRYSTAL
See Also:
Constant Field Values

SPECIAL_GROMACS

private static final int SPECIAL_GROMACS
See Also:
Constant Field Values

SPECIAL_GENNBO

private static final int SPECIAL_GENNBO
See Also:
Constant Field Values

SPECIAL_ARGUS_XML

public static final int SPECIAL_ARGUS_XML
See Also:
Constant Field Values

SPECIAL_CML_XML

public static final int SPECIAL_CML_XML
See Also:
Constant Field Values

SPECIAL_CHEM3D_XML

public static final int SPECIAL_CHEM3D_XML
See Also:
Constant Field Values

SPECIAL_MOLPRO_XML

public static final int SPECIAL_MOLPRO_XML
See Also:
Constant Field Values

SPECIAL_ODYSSEY_XML

public static final int SPECIAL_ODYSSEY_XML
See Also:
Constant Field Values

SPECIAL_XSD_XML

public static final int SPECIAL_XSD_XML
See Also:
Constant Field Values

SPECIAL_VASP_XML

public static final int SPECIAL_VASP_XML
See Also:
Constant Field Values

SPECIAL_QE_XML

public static final int SPECIAL_QE_XML
See Also:
Constant Field Values

SPECIAL_ARGUS_DOM

public static final int SPECIAL_ARGUS_DOM
See Also:
Constant Field Values

SPECIAL_CML_DOM

public static final int SPECIAL_CML_DOM
See Also:
Constant Field Values

SPECIAL_CHEM3D_DOM

public static final int SPECIAL_CHEM3D_DOM
See Also:
Constant Field Values

SPECIAL_MOLPRO_DOM

public static final int SPECIAL_MOLPRO_DOM
See Also:
Constant Field Values

SPECIAL_ODYSSEY_DOM

public static final int SPECIAL_ODYSSEY_DOM
See Also:
Constant Field Values

SPECIAL_XSD_DOM

public static final int SPECIAL_XSD_DOM
See Also:
Constant Field Values

SPECIAL_VASP_DOM

public static final int SPECIAL_VASP_DOM
See Also:
Constant Field Values

specialTags

public static final java.lang.String[][] specialTags

LEADER_CHAR_MAX

private static final int LEADER_CHAR_MAX
See Also:
Constant Field Values

cubeFileStartRecords

private static final java.lang.String[] cubeFileStartRecords

mol2Records

private static final java.lang.String[] mol2Records

webmoFileStartRecords

private static final java.lang.String[] webmoFileStartRecords

moldenFileStartRecords

private static final java.lang.String[] moldenFileStartRecords

dcdFileStartRecords

private static final java.lang.String[] dcdFileStartRecords

fileStartsWithRecords

private static final java.lang.String[][] fileStartsWithRecords

pqrLineStartRecords

private static final java.lang.String[] pqrLineStartRecords

p2nLineStartRecords

private static final java.lang.String[] p2nLineStartRecords

pdbLineStartRecords

private static final java.lang.String[] pdbLineStartRecords

shelxLineStartRecords

private static final java.lang.String[] shelxLineStartRecords

cifLineStartRecords

private static final java.lang.String[] cifLineStartRecords

ghemicalMMLineStartRecords

private static final java.lang.String[] ghemicalMMLineStartRecords

jaguarLineStartRecords

private static final java.lang.String[] jaguarLineStartRecords

mdlLineStartRecords

private static final java.lang.String[] mdlLineStartRecords

spartanSmolLineStartRecords

private static final java.lang.String[] spartanSmolLineStartRecords

csfLineStartRecords

private static final java.lang.String[] csfLineStartRecords

mdTopLineStartRecords

private static final java.lang.String[] mdTopLineStartRecords

hyperChemLineStartRecords

private static final java.lang.String[] hyperChemLineStartRecords

vaspOutcarLineStartRecords

private static final java.lang.String[] vaspOutcarLineStartRecords

lineStartsWithRecords

private static final java.lang.String[][] lineStartsWithRecords

sptContainsRecords

private static final java.lang.String[] sptContainsRecords

xmlContainsRecords

private static final java.lang.String[] xmlContainsRecords

gaussianContainsRecords

private static final java.lang.String[] gaussianContainsRecords

ampacContainsRecords

private static final java.lang.String[] ampacContainsRecords

mopacContainsRecords

private static final java.lang.String[] mopacContainsRecords

qchemContainsRecords

private static final java.lang.String[] qchemContainsRecords

gamessUKContainsRecords

private static final java.lang.String[] gamessUKContainsRecords

gamessUSContainsRecords

private static final java.lang.String[] gamessUSContainsRecords

spartanBinaryContainsRecords

private static final java.lang.String[] spartanBinaryContainsRecords

spartanContainsRecords

private static final java.lang.String[] spartanContainsRecords

adfContainsRecords

private static final java.lang.String[] adfContainsRecords

dgridContainsRecords

private static final java.lang.String[] dgridContainsRecords

dmolContainsRecords

private static final java.lang.String[] dmolContainsRecords

gulpContainsRecords

private static final java.lang.String[] gulpContainsRecords

psiContainsRecords

private static final java.lang.String[] psiContainsRecords

nwchemContainsRecords

private static final java.lang.String[] nwchemContainsRecords

uicrcifContainsRecords

private static final java.lang.String[] uicrcifContainsRecords

crystalContainsRecords

private static final java.lang.String[] crystalContainsRecords

espressoContainsRecords

private static final java.lang.String[] espressoContainsRecords

siestaContainsRecords

private static final java.lang.String[] siestaContainsRecords

headerContainsRecords

private static final java.lang.String[][] headerContainsRecords
Constructor Detail

Resolver

public Resolver()
Method Detail

getReaderClassBase

public static final java.lang.String getReaderClassBase(java.lang.String type)

getFileType

static java.lang.String getFileType(java.io.BufferedReader br)
From SmarterJmolAdapter.getFileTypeName(Object atomSetCollectionOrReader) just return the file type with no exception issues

Parameters:
br -
Returns:
String file type

specialLoad

static java.lang.String[] specialLoad(java.lang.String name,
                                      java.lang.String type)
Special loading for file directories. This method is called from the FileManager via SmarterJmolAdapter. It's here because Resolver is the place where all distinctions are made. In the case of spt files, no need to load them; here we are just checking for type. In the case of .spardir directories, we need to provide a list of the critical files that need loading and concatenation for the SpartanSmolReader. we return an array for which: [0] file type (class prefix) or null for SPT file [1] header to add for each BEGIN/END block (ignored) [2...] files to load and concatenate

Parameters:
name -
type -
Returns:
array detailing action for this set of files

checkSpecialInZip

static java.lang.String[] checkSpecialInZip(java.lang.String[] zipDirectory)
called by SmarterJmolAdapter to see if we can automatically assign a file from the zip file. If so, return a subfile list for this file. The first element of the list is left empty -- it would be the zipfile name. Assignment can be made if (1) there is only one file in the collection or (2) if the first file is xxxx.spardir/ Note that __MACOS? files are ignored by the ZIP file reader.

Parameters:
zipDirectory -
Returns:
subFileList

checkSpecialData

static java.lang.StringBuffer checkSpecialData(java.io.InputStream is,
                                               java.lang.String[] zipDirectory)
called by SmarterJmolAdapter to see if we have a Spartan directory and, if so, open it and get all the data into the correct order.

Parameters:
is -
zipDirectory -
Returns:
String data for processing

getAtomCollectionReader

static java.lang.Object getAtomCollectionReader(java.lang.String fullName,
                                                java.lang.String type,
                                                java.io.BufferedReader bufferedReader,
                                                java.util.Map<java.lang.String,java.lang.Object> htParams,
                                                int ptFile)
                                         throws java.lang.Exception
the main method for reading files. Called from SmarterJmolAdapter when reading a file, reading a set of files, or reading a ZIP file

Parameters:
fullName -
type -
bufferedReader -
htParams -
ptFile -
Returns:
an AtomSetCollection or a String error
Throws:
java.lang.Exception

DOMResolve

static java.lang.Object DOMResolve(java.lang.Object DOMNode,
                                   java.util.Map<java.lang.String,java.lang.Object> htParams)
                            throws java.lang.Exception
a largely untested reader of the DOM - where in a browser there is model actually in XML format already present on the page. -- Egon Willighagen

Parameters:
DOMNode -
htParams -
Returns:
an AtomSetCollection or a String error
Throws:
java.lang.Exception

getSpartanFileList

private static java.lang.String[] getSpartanFileList(java.lang.String name,
                                                     java.lang.String[] dirNums)
returns the list of files to read for every Spartan spardir. Simple numbers are assumed to be Profiles; others are models.

Parameters:
name -
dirNums -
Returns:
String[] list of files to read given a list of directory names

getSpartanDirs

private static java.lang.String[] getSpartanDirs(java.lang.String outputFileData)
read the output file from the Spartan directory and decide from that what files need to be read and in what order - usually M0001 or a set of Profiles. But Spartan saves the Profiles in alphabetical order, not numerical. So we fix that here.

Parameters:
outputFileData -
Returns:
String[] list of files to read

getXmlType

private static java.lang.String getXmlType(netscape.javascript.JSObject DOMNode)

determineAtomSetCollectionReader

private static java.lang.String determineAtomSetCollectionReader(java.io.BufferedReader bufferedReader,
                                                                 boolean returnLines)
                                                          throws java.lang.Exception
the main resolver method. One of the great advantages of Jmol is that it can smartly determine a file type from its contents. In cases where this is not possible, one can force a file type using a prefix to a filename. For example: load mol2::xxxx.whatever This is only necessary for a few file types, where only numbers are involved -- molecular dynamics coordinate files, for instance (mdcrd). We must do this in a very specific order. DON'T MESS WITH THIS!

Parameters:
bufferedReader -
returnLines -
Returns:
readerName or a few lines, if requested, or null
Throws:
java.lang.Exception

checkHeaderContains

private static java.lang.String checkHeaderContains(java.lang.String header)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

checkLineStarts

private static java.lang.String checkLineStarts(java.lang.String[] lines)

getXmlType

private static java.lang.String getXmlType(java.lang.String header)
                                    throws java.lang.Exception
Throws:
java.lang.Exception

getReaderFromType

private static final java.lang.String getReaderFromType(java.lang.String type)

checkType

private static final java.lang.String checkType(java.lang.String[][] typeTags,
                                                java.lang.String type)

checkSpecial

private static final java.lang.String checkSpecial(int nLines,
                                                   java.lang.String[] lines,
                                                   boolean isEnd)

checkAims

private static boolean checkAims(java.lang.String[] lines)

checkAlchemy

private static boolean checkAlchemy(java.lang.String line)

checkCastep

private static boolean checkCastep(java.lang.String[] lines)

checkCrystal

private static boolean checkCrystal(java.lang.String[] lines)

checkCube

private static boolean checkCube(java.lang.String[] lines)

checkFoldingXyz

private static boolean checkFoldingXyz(java.lang.String[] lines)
Parameters:
lines - First lines of the files.
Returns:
Indicates if the file may be a Folding@Home file.

checkGenNBO

private static boolean checkGenNBO(java.lang.String[] lines)

checkGromacs

private static boolean checkGromacs(java.lang.String[] lines)

checkMol

private static boolean checkMol(java.lang.String[] lines)

checkMopacGraphf

private static boolean checkMopacGraphf(java.lang.String[] lines)
Parameters:
lines - First lines of the files.
Returns:
Indicates if the file is a Mopac GRAPHF output file.

checkOdyssey

private static boolean checkOdyssey(java.lang.String[] lines)

checkWien2k

private static boolean checkWien2k(java.lang.String[] lines)

checkXyz

private static boolean checkXyz(java.lang.String[] lines)