org.jmol.adapter.smarter
Class Resolver

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

public class Resolver
extends Object


Field Summary
private static String[] adfContainsRecords
           
private static String[] ampacContainsRecords
           
private static String[] cifLineStartRecords
           
private static String classBase
           
private static String CML_NAMESPACE_URI
           
private static String[][] containsRecords
           
private static String[] crystalContainsRecords
           
private static String[] csfLineStartRecords
           
private static String[] cubeFileStartRecords
           
private static String[] dgridContainsRecords
           
private static String[][] fileStartsWithRecords
           
private static String[] gamessUKContainsRecords
           
private static String[] gamessUSContainsRecords
           
private static String[] gaussianContainsRecords
           
private static String[] ghemicalMMLineStartRecords
           
private static String[] hyperChemLineStartRecords
           
private static String[] jaguarLineStartRecords
           
private static int LEADER_CHAR_MAX
           
private static String[][] lineStartsWithRecords
           
private static String[] mdlLineStartRecords
           
private static String[] mdTopLineStartRecords
           
private static String[] mol2Records
           
private static String[] moldenFileStartRecords
           
private static String[] mopacContainsRecords
           
private static String[] nwchemContainsRecords
           
private static String[] pdbLineStartRecords
           
private static String[] pqrLineStartRecords
           
private static String[] psiContainsRecords
           
private static String[] qchemContainsRecords
           
private static String[] readerSets
           
private static String[] shelxLineStartRecords
           
private static String[] spartanBinaryContainsRecords
           
private static String[] spartanContainsRecords
           
private static 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_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 String[][] specialTags
           
private static String[] uicrcifContainsRecords
           
private static String[] webmoFileStartRecords
           
private static String[] xmlContainsRecords
           
 
Constructor Summary
Resolver()
           
 
Method Summary
private static boolean checkAims(String[] lines)
           
private static boolean checkAlchemy(String line)
           
private static boolean checkCastep(String[] lines)
           
private static boolean checkCrystal(String[] lines)
           
private static boolean checkCube(String[] lines)
           
private static boolean checkFoldingXyz(String[] lines)
           
private static boolean checkGenNBO(String[] lines)
           
private static boolean checkGromacs(String[] lines)
           
private static boolean checkMol(String[] lines)
           
private static boolean checkMopacGraphf(String[] lines)
           
private static boolean checkOdyssey(String[] lines)
           
private static String checkSpecial(int nLines, String[] lines, boolean isEnd)
           
(package private) static StringBuffer checkSpecialData(InputStream is, 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 String[] checkSpecialInZip(String[] zipDirectory)
          called by SmarterJmolAdapter to see if we can automatically assign a file from the zip file.
private static String checkType(String[][] typeTags, String type)
           
private static boolean checkWien2k(String[] lines)
           
private static boolean checkXyz(String[] lines)
           
private static String determineAtomSetCollectionReader(BufferedReader bufferedReader, boolean returnLines)
          the main resolver method.
(package private) static Object DOMResolve(Object DOMNode, Hashtable 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 Object getAtomCollectionReader(String fullName, String type, BufferedReader bufferedReader, Hashtable htParams, int ptFile)
          the main method for reading files.
(package private) static String getFileType(BufferedReader br)
          From SmarterJmolAdapter.getFileTypeName(Object atomSetCollectionOrReader) just return the file type with no exception issues
static String getReaderClassBase(String type)
           
private static String getReaderFromType(String type)
           
private static String[] getSpartanDirs(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 String[] getSpartanFileList(String name, String[] dirNums)
          returns the list of files to read for every Spartan spardir.
private static String getXmlType(netscape.javascript.JSObject DOMNode)
           
private static String getXmlType(String header)
           
(package private) static String[] specialLoad(String name, 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 String classBase
See Also:
Constant Field Values

readerSets

private static final String[] readerSets

CML_NAMESPACE_URI

private static final 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_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 String[][] specialTags

LEADER_CHAR_MAX

private static final int LEADER_CHAR_MAX
See Also:
Constant Field Values

cubeFileStartRecords

private static final String[] cubeFileStartRecords

mol2Records

private static final String[] mol2Records

webmoFileStartRecords

private static final String[] webmoFileStartRecords

moldenFileStartRecords

private static final String[] moldenFileStartRecords

fileStartsWithRecords

private static final String[][] fileStartsWithRecords

pqrLineStartRecords

private static final String[] pqrLineStartRecords

pdbLineStartRecords

private static final String[] pdbLineStartRecords

shelxLineStartRecords

private static final String[] shelxLineStartRecords

cifLineStartRecords

private static final String[] cifLineStartRecords

ghemicalMMLineStartRecords

private static final String[] ghemicalMMLineStartRecords

jaguarLineStartRecords

private static final String[] jaguarLineStartRecords

mdlLineStartRecords

private static final String[] mdlLineStartRecords

spartanSmolLineStartRecords

private static final String[] spartanSmolLineStartRecords

csfLineStartRecords

private static final String[] csfLineStartRecords

mdTopLineStartRecords

private static final String[] mdTopLineStartRecords

hyperChemLineStartRecords

private static final String[] hyperChemLineStartRecords

lineStartsWithRecords

private static final String[][] lineStartsWithRecords

xmlContainsRecords

private static final String[] xmlContainsRecords

gaussianContainsRecords

private static final String[] gaussianContainsRecords

ampacContainsRecords

private static final String[] ampacContainsRecords

mopacContainsRecords

private static final String[] mopacContainsRecords

qchemContainsRecords

private static final String[] qchemContainsRecords

gamessUKContainsRecords

private static final String[] gamessUKContainsRecords

gamessUSContainsRecords

private static final String[] gamessUSContainsRecords

spartanBinaryContainsRecords

private static final String[] spartanBinaryContainsRecords

spartanContainsRecords

private static final String[] spartanContainsRecords

adfContainsRecords

private static final String[] adfContainsRecords

dgridContainsRecords

private static final String[] dgridContainsRecords

psiContainsRecords

private static final String[] psiContainsRecords

nwchemContainsRecords

private static final String[] nwchemContainsRecords

uicrcifContainsRecords

private static final String[] uicrcifContainsRecords

crystalContainsRecords

private static final String[] crystalContainsRecords

containsRecords

private static final String[][] containsRecords
Constructor Detail

Resolver

public Resolver()
Method Detail

getReaderClassBase

public static final String getReaderClassBase(String type)

getFileType

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

Parameters:
br -
Returns:
String file type

specialLoad

static String[] specialLoad(String name,
                            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 String[] checkSpecialInZip(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 StringBuffer checkSpecialData(InputStream is,
                                     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 Object getAtomCollectionReader(String fullName,
                                      String type,
                                      BufferedReader bufferedReader,
                                      Hashtable htParams,
                                      int ptFile)
                               throws 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:
Exception

DOMResolve

static Object DOMResolve(Object DOMNode,
                         Hashtable htParams)
                  throws 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:
Exception

getSpartanFileList

private static String[] getSpartanFileList(String name,
                                           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 String[] getSpartanDirs(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 String getXmlType(netscape.javascript.JSObject DOMNode)

determineAtomSetCollectionReader

private static String determineAtomSetCollectionReader(BufferedReader bufferedReader,
                                                       boolean returnLines)
                                                throws 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:
Exception

getXmlType

private static String getXmlType(String header)
                          throws Exception
Throws:
Exception

checkSpecial

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

checkGenNBO

private static boolean checkGenNBO(String[] lines)

checkGromacs

private static boolean checkGromacs(String[] lines)

checkCrystal

private static boolean checkCrystal(String[] lines)

checkWien2k

private static boolean checkWien2k(String[] lines)

checkCastep

private static boolean checkCastep(String[] lines)

checkAims

private static boolean checkAims(String[] lines)

getReaderFromType

private static final String getReaderFromType(String type)

checkType

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

checkOdyssey

private static boolean checkOdyssey(String[] lines)

checkMol

private static boolean checkMol(String[] lines)

checkAlchemy

private static boolean checkAlchemy(String line)

checkXyz

private static boolean checkXyz(String[] lines)

checkFoldingXyz

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

checkMopacGraphf

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

checkCube

private static boolean checkCube(String[] lines)