From: <ha...@us...> - 2006-04-30 12:37:47
|
Revision: 5033 Author: hansonr Date: 2006-04-30 05:37:27 -0700 (Sun, 30 Apr 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=5033&view=rev Log Message: ----------- bob200603 only -- totally experimental --introduces more flexible "specialstring2" for compiler --introduces passing parameters to the file readers --introduces CIF selective model file loading in multi-model file --introduces CIF selective application of symmetry upon file load --introduces CIF unit cell {na,nb,nc} options on loading Modified Paths: -------------- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Resolver.java branches/bob200603/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Symmetry.java branches/bob200603/Jmol/src/org/jmol/api/JmolAdapter.java branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java branches/bob200603/Jmol/src/org/jmol/viewer/FileManager.java branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java branches/bob200603/Jmol/src/org/jmol/viewer/Model.java branches/bob200603/Jmol/src/org/jmol/viewer/Token.java branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -342,21 +342,46 @@ notionalUnitcell[i] = info[i]; return true; } - - void applySymmetry(boolean normalize) { + void applySymmetry(boolean normalize) { + applySymmetry(normalize, 0, 0, 0); + } + + void applySymmetry(boolean normalize, int[] unitCells) { + applySymmetry(normalize, unitCells[0], unitCells[1], unitCells[2]); + } + + void applySymmetry(boolean normalize, int maxX, int maxY, int maxZ) { if (! coordinatesAreFractional) return; int count = getLastAtomSetAtomCount(); - int atomIndex = getLastAtomSetAtomIndex(); - + int atomIndex = getLastAtomSetAtomIndex(); + for (int tx = 0; tx < maxX; tx++) + for (int ty = 0; ty < maxY; ty++) + for (int tz = 0; tz < maxZ; tz++) + symmetryAddAtoms(atomIndex, count, normalize, tx, ty, tz); + setAtomSetAuxiliaryInfo("presymmetryAtomIndex", new Integer(atomIndex)); + setAtomSetAuxiliaryInfo("presymmetryAtomCount", new Integer(count)); + setAtomSetAuxiliaryInfo("symmetryOperations", symmetries); + setAtomSetAuxiliaryInfo("coordinatesAreFractional", Boolean.TRUE); + setAtomSetAuxiliaryInfo("notionalUnitcell", notionalUnitcell); + setAtomSetAuxiliaryInfo("spaceGroup",spaceGroup); + symmetryCount = 0; + symmetries = new Symmetry[4]; + notionalUnitcell = new float[6]; + iHaveSymmetry = false; + coordinatesAreFractional = false; //turn off global fractional conversion -- this wil be model by model + setAtomSetCollectionAuxiliaryInfo("someModelsHaveSymmetry", Boolean.TRUE); + } + + void symmetryAddAtoms(int atomIndex, int count, boolean normalize, int transX, int transY, int transZ) { for (int iSym = 0; iSym < symmetryCount; iSym++) { int i1 = atomIndex; int i2 = i1 + count; for (int i = i1; i < i2; i++) { Atom atom = new Atom(); - symmetries[iSym].newPoint(atoms[i], atom, normalize); - if (atomExistsAtPoint(atom)) { + symmetries[iSym].newPoint(atoms[i], atom, normalize, transX, transY, transZ); + if (atomExistsAtPoint(atom, i1)) { //System.out.println("skipping " + "{" + atom.x + " " + atom.y //+ " " + atom.z + "}"); continue; @@ -365,32 +390,22 @@ atom1.x = atom.x; atom1.y = atom.y; atom1.z = atom.z; - /* + /* System.out.println(symmetries[iSym].xyz + "\n" + symmetries[iSym].operation + "\n{" + atoms[i].x + " " + atoms[i].y + " " + atoms[i].z + "} --> {" + atom.x + " " + atom.y + " " + atom.z + "}"); */ } } - setAtomSetAuxiliaryInfo("symmetryOperations", symmetries); - setAtomSetAuxiliaryInfo("coordinatesAreFractional", Boolean.TRUE); - setAtomSetAuxiliaryInfo("notionalUnitcell", notionalUnitcell); - setAtomSetAuxiliaryInfo("spaceGroup",spaceGroup); - - symmetryCount = 0; - symmetries = new Symmetry[4]; - notionalUnitcell = new float[6]; - iHaveSymmetry = false; - coordinatesAreFractional = false; //turn off global fractional conversion -- this wil be model by model - setAtomSetCollectionAuxiliaryInfo("someModelsHaveSymmetry", Boolean.TRUE); } - - boolean atomExistsAtPoint(Atom atom) { + + boolean atomExistsAtPoint(Atom atom, int atomFirst) { - for (int j = atomCount - 1; --j >= 0; ) { - if ((atom.x - atoms[j].x)*(atom.x - atoms[j].x) + - (atom.y - atoms[j].y)*(atom.y - atoms[j].y) + - (atom.z - atoms[j].z)*(atom.z - atoms[j].z) < 0.001) + for (int j = atomCount; --j >= atomFirst; ) { + float d = (atom.x - atoms[j].x)*(atom.x - atoms[j].x) + + (atom.y - atoms[j].y)*(atom.y - atoms[j].y) + + (atom.z - atoms[j].z)*(atom.z - atoms[j].z); + if (d < 0.001) return true; } return false; Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/AtomSetCollectionReader.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -42,6 +42,9 @@ void initialize() { } + void initialize(int[] params) { + } + abstract AtomSetCollection readAtomSetCollection(BufferedReader reader) throws Exception; Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/CifReader.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -38,7 +38,10 @@ class CifReader extends AtomSetCollectionReader { float[] notionalUnitcell; - + int[] unitCells = new int[3]; + int desiredModelNumber; + int modelNumber = 0; + boolean normalize = true; BufferedReader reader; String line; @@ -46,8 +49,24 @@ new RidiculousFileFormatTokenizer(); void initialize() { + desiredModelNumber = -1; + unitCells[0] = unitCells[1] = unitCells[2] = 0; } - + + void initialize(int[] params) { + initialize(); + if (params == null) + return; + int ipt = 0; + if (params.length == 1 || params.length == 4) + desiredModelNumber = params[ipt++]; + if (params.length < ipt + 3) + return; + unitCells[0] = params[ipt++]; + unitCells[1] = params[ipt++]; + unitCells[2] = params[ipt++]; + } + boolean iHaveUnitCell = false; void initializeUnitcell() { iHaveUnitCell = false; @@ -67,18 +86,27 @@ // or you will get stuck in an infinite loop line = reader.readLine(); initializeUnitcell(); + modelNumber = 0; + boolean skipping = false; while (line != null) { if (line.startsWith("loop_")) { - processLoopBlock(); + if (!skipping) { + processLoopBlock(); // there is already an unprocessed line in the firing chamber - continue; + continue; + } } else if (line.startsWith("data_")) { - processDataParameter(); - initializeUnitcell(); + skipping = (++modelNumber != desiredModelNumber && desiredModelNumber > 0); + if (!skipping) { + processDataParameter(); + initializeUnitcell(); + } } else if (line.startsWith("_cell_") || line.startsWith("_cell.")) { - processCellParameter(); + if (!skipping) + processCellParameter(); } else if (line.startsWith("_symmetry_space_group_name_H-M")) { - processSymmetrySpaceGroupNameHM(); + if (!skipping) + processSymmetrySpaceGroupNameHM(); } line = reader.readLine(); } @@ -148,7 +176,7 @@ processAtomSiteLoopBlock(); if (iHaveUnitCell && atomSetCollection.setNotionalUnitcell(notionalUnitcell, logger) && atomSetCollection.haveSymmetry()) - atomSetCollection.applySymmetry(normalize); + atomSetCollection.applySymmetry(normalize, unitCells); return; } if (line.startsWith("_geom_bond")) { Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Resolver.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Resolver.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Resolver.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -66,6 +66,41 @@ return atomSetCollection; } + static Object resolve(String name, BufferedReader bufferedReader, + JmolAdapter.Logger logger, int[] params) throws Exception { + AtomSetCollectionReader atomSetCollectionReader; + String atomSetCollectionReaderName = + determineAtomSetCollectionReader(bufferedReader, logger); + logger.log("The Resolver thinks", atomSetCollectionReaderName); + String className = + "org.jmol.adapter.smarter." + atomSetCollectionReaderName + "Reader"; + + if (atomSetCollectionReaderName == null) + return "unrecognized file format"; + + try { + Class atomSetCollectionReaderClass = Class.forName(className); + atomSetCollectionReader = + (AtomSetCollectionReader)atomSetCollectionReaderClass.newInstance(); + } catch (Exception e) { + String err = "Could not instantiate:" + className; + logger.log(err); + return err; + } + + atomSetCollectionReader.setLogger(logger); + atomSetCollectionReader.initialize(params); + + AtomSetCollection atomSetCollection = + atomSetCollectionReader.readAtomSetCollection(bufferedReader); + atomSetCollection.freeze(); + if (atomSetCollection.errorMessage != null) + return atomSetCollection.errorMessage; + if (atomSetCollection.atomCount == 0) + return "No atoms in file"; + return atomSetCollection; + } + static Object DOMResolve(Object DOMNode, JmolAdapter.Logger logger) throws Exception { AtomSetCollectionReader atomSetCollectionReader; String atomSetCollectionReaderName = "Cml"; Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/SmarterJmolAdapter.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -51,6 +51,28 @@ } public Object openBufferedReader(String name, + BufferedReader bufferedReader, int[] params) { + try { + Object atomSetCollectionOrErrorMessage = + Resolver.resolve(name, bufferedReader, logger, params); + if (atomSetCollectionOrErrorMessage instanceof String) + return atomSetCollectionOrErrorMessage; + if (atomSetCollectionOrErrorMessage instanceof AtomSetCollection) { + AtomSetCollection atomSetCollection = + (AtomSetCollection)atomSetCollectionOrErrorMessage; + if (atomSetCollection.errorMessage != null) + return atomSetCollection.errorMessage; + return atomSetCollection; + } + return "unknown reader error"; + } catch (Exception e) { + e.printStackTrace(); + return "" + e; + } + } + + + public Object openBufferedReader(String name, BufferedReader bufferedReader) { try { Object atomSetCollectionOrErrorMessage = Modified: branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Symmetry.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Symmetry.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/adapter/smarter/Symmetry.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -129,7 +129,7 @@ return false; } - void newPoint(Atom atom1, Atom atom2, boolean normalize) { + void newPoint(Atom atom1, Atom atom2, boolean normalize, int transX, int transY, int transZ) { Point4f temp = new Point4f(atom1.x, atom1.y, atom1.z, 1); operation.transform(temp, temp); if (normalize) { @@ -146,9 +146,9 @@ while (temp.z < 0) temp.z += 1f; } - atom2.x = temp.x; - atom2.y = temp.y; - atom2.z = temp.z; + atom2.x = temp.x + transX; + atom2.y = temp.y + transY; + atom2.z = temp.z + transZ; } boolean isUnityOperation() { Modified: branches/bob200603/Jmol/src/org/jmol/api/JmolAdapter.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/api/JmolAdapter.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/api/JmolAdapter.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -71,6 +71,7 @@ this.logger = (logger == null ? new Logger() : logger); } + /** * Associate a clientFile object with a bufferedReader. * @@ -93,7 +94,7 @@ */ public Object openBufferedReader(String name, BufferedReader bufferedReader) { - return openBufferedReader(name, bufferedReader, null); + return openBufferedReader(name, bufferedReader, null, null); } /** @@ -106,9 +107,35 @@ public Object openBufferedReader(String name, BufferedReader bufferedReader, Logger logger) { + return openBufferedReader(name, bufferedReader, null, null); + } + + /** + * @param name File name, String or URL acting as the source of the reader + * @param bufferedReader The BufferedReader + * @param params Optional integer parameters + * @return The clientFile or String with an error message + * @see #openBufferedReader(String, BufferedReader) + */ + public Object openBufferedReader(String name, + BufferedReader bufferedReader, int[] params) { + return openBufferedReader(name, bufferedReader, null, params); + } + + /** + * @param name File name, String or URL acting as the source of the reader + * @param bufferedReader The BufferedReader + * @param logger The logger + * @param params Optional integer parameters + * @return The clientFile or String with an error message + * @see #openBufferedReader(String, BufferedReader) + */ + public Object openBufferedReader(String name, + BufferedReader bufferedReader, Logger logger, int[] params) { return null; } + /** * Associate a clientFile object with an array of BufferedReader. * Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Compiler.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -95,6 +95,7 @@ int ichCurrentCommand; + boolean iHaveQuotedString = false; boolean compile0() { cchScript = script.length(); ichToken = 0; @@ -133,6 +134,7 @@ lineIndices[iCommand] = (short) ichCurrentCommand; ltoken.setSize(0); tokCommand = Token.nada; + iHaveQuotedString = false; } if (ichToken < cchScript) { if (endOfLine) @@ -145,6 +147,7 @@ if (lookingAtString()) { String str = getUnescapedStringLiteral(); ltoken.addElement(new Token(Token.string, str)); + iHaveQuotedString = true; continue; } if (tokCommand == Token.load && lookingAtLoadFormat()) { @@ -153,8 +156,9 @@ ltoken.addElement(new Token(Token.identifier, strFormat)); continue; } - if ((tokCommand & Token.specialstring) != 0 && - lookingAtSpecialString()) { + if (((tokCommand & Token.specialstring) != 0 + || (tokCommand & Token.specialstring2) != 0 && !iHaveQuotedString) + && lookingAtSpecialString()) { String str = script.substring(ichToken, ichToken + cchToken); ltoken.addElement(new Token(Token.string, str)); continue; @@ -535,8 +539,8 @@ boolean lookingAtSpecialString() { int ichT = ichToken; char ch; - while (ichT < cchScript && - (ch = script.charAt(ichT)) != ';' && ch != '\r' && ch != '\n') + while (ichT < cchScript && (ch = script.charAt(ichT)) != ';' && ch != '\r' + && ch != '\n') ++ichT; cchToken = ichT - ichToken; log("lookingAtSpecialString cchToken=" + cchToken); Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -590,6 +590,7 @@ void logDebugScript() { strbufLog.setLength(0); + System.out.println(statement[0]); for (int i = 1; i < statementLength; ++i) { strbufLog.append(statement[i]+"\n"); System.out.println(statement[i]); @@ -1018,6 +1019,9 @@ refreshed = true; stack[sp++] = copyBitSet(viewer.getVisibleSet()); break; + case Token.symmetry: + stack[sp++] = viewer.getAtomBits((String) instruction.value); + break; case Token.hetero: case Token.hydrogen: case Token.protein: @@ -1619,6 +1623,18 @@ if (statementLength == i + 1) { filename = (String) statement[i].value; viewer.openFile(filename); + } else if (statement[i + 1].tok == Token.leftbrace || statement[i + 1].tok == Token.integer) { + filename = (String) statement[i++].value; + int[] params = new int[4]; + if (statement[i].tok == Token.integer) + params[0] = statement[i++].intValue; + if (statement[i].tok == Token.leftbrace) { + Point3f unitCells = getCoordinate(i); + params[1] = (int) unitCells.x; + params[2] = (int) unitCells.y; + params[3] = (int) unitCells.z; + } + viewer.openFile(filename, params); } else { String modelName = (String) statement[i].value; i++; Modified: branches/bob200603/Jmol/src/org/jmol/viewer/FileManager.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/FileManager.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/viewer/FileManager.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -82,7 +82,15 @@ } void openFile(String name) { - System.out.println("FileManager.openFile(" + name + ")"); + openFile(name, null); + } + + void openFile(String name, int[] params) { + String sp = ""; + if (params != null) + for (int i = 0; i < params.length; i++) + sp+="," + params[i]; + System.out.println("FileManager.openFile(" + name + sp + ")"); nameAsGiven = name; openErrorMessage = fullPathName = fileName = null; classifyName(name); @@ -90,7 +98,7 @@ System.out.println("openErrorMessage=" + openErrorMessage); return; } - fileOpenThread = new FileOpenThread(fullPathName, name); + fileOpenThread = new FileOpenThread(fullPathName, name, params); fileOpenThread.run(); } @@ -370,12 +378,20 @@ String nameAsGivenInThread; Object clientFile; Reader reader; + int[] params; FileOpenThread(String fullPathName, String nameAsGiven) { this.fullPathNameInThread = fullPathName; this.nameAsGivenInThread = nameAsGiven; + this.params = null; } + FileOpenThread(String fullPathName, String nameAsGiven, int[] params) { + this.fullPathNameInThread = fullPathName; + this.nameAsGivenInThread = nameAsGiven; + this.params = params; + } + FileOpenThread(String name, Reader reader) { nameAsGivenInThread = fullPathNameInThread = name; this.reader = reader; @@ -423,14 +439,14 @@ private void openReader(Reader reader) { Object clientFile = modelAdapter.openBufferedReader(fullPathNameInThread, - new BufferedReader(reader)); + new BufferedReader(reader), params); if (clientFile instanceof String) errorMessage = (String)clientFile; else this.clientFile = clientFile; } } - + class FilesOpenThread implements Runnable { boolean terminated; String errorMessage; Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -1575,19 +1575,23 @@ void doUnitcellStuff() { if (someModelsHaveSymmetry) { int modelCount = getModelCount(); - for (int i = 0; i < modelCount; i++) { - if (mmset.getModelAuxiliaryInfoBoolean(i, "coordinatesAreFractional")) { - notionalUnitcell = (float[]) mmset.getModelAuxiliaryInfo(i, "notionalUnitcell"); - constructFractionalMatrices(); - calcUnitcellDimensions(); - for (int j = 0; j < 8; j++) - unitcellVertexList[i][j] = new Point3f(unitcellVertices[j]); - fractionalMatrices[i] = new Matrix3f(matrixFractionalToEuclidean); - } else { - fractionalMatrices[i] = null; - } - } - convertFractionalToEuclidean(fractionalMatrices); + for (int i = 0; i < modelCount; i++) { + mmset.setSymmetryAtomInfo(i, mmset.getModelAuxiliaryInfoInt(i, + "presymmetryAtomIndex"), mmset.getModelAuxiliaryInfoInt(i, + "presymmetryAtomCount")); + if (mmset.getModelAuxiliaryInfoBoolean(i, "coordinatesAreFractional")) { + notionalUnitcell = (float[]) mmset.getModelAuxiliaryInfo(i, + "notionalUnitcell"); + constructFractionalMatrices(); + calcUnitcellDimensions(); + for (int j = 0; j < 8; j++) + unitcellVertexList[i][j] = new Point3f(unitcellVertices[j]); + fractionalMatrices[i] = new Matrix3f(matrixFractionalToEuclidean); + } else { + fractionalMatrices[i] = null; + } + } + convertFractionalToEuclidean(fractionalMatrices); return; } if (notionalUnitcell != null) { @@ -1598,11 +1602,11 @@ convertFractionalToEuclidean(); } /* - mth 2004 03 06 - We do not want to pack the unitcell automatically. - rmh 2006 04 23 - putAtomsInsideUnitcell(); - */ + mth 2004 03 06 + We do not want to pack the unitcell automatically. + rmh 2006 04 23 + putAtomsInsideUnitcell(); + */ } void constructFractionalMatrices() { @@ -1773,6 +1777,8 @@ BitSet getAtomBits(String setType) { System.out.println("getAtomBits" + setType); + if (setType.equals("symmetry")) + return getSymmetrySet(); if (setType.equals("hetero")) return getHeteroSet(); if (setType.equals("hydrogen")) @@ -1824,6 +1830,23 @@ return bsHetero; } + BitSet getSymmetrySet() { + //presumption here is that one cannot DELETE atoms + BitSet bs = new BitSet(atomCount); + for (int i = atomCount; --i >= 0;) + bs.set(i); + int modelCount = getModelCount(); + for (int i = 0; i < modelCount; i++) { + int atomIndex = mmset.getPreSymmetryAtomIndex(i); + int preSymAtomCount = mmset.getPreSymmetryAtomCount(i); + if (atomIndex < 0) + continue; + for (int iatom = atomIndex + preSymAtomCount; --iatom >= atomIndex;) + bs.clear(iatom); + } + return bs; + } + BitSet getHydrogenSet() { BitSet bsHydrogen = new BitSet(); for (int i = atomCount; --i >= 0;) { Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Mmset.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -120,6 +120,14 @@ && ((Boolean)modelSetAuxiliaryInfo.get(keyName)).booleanValue()); } + int getModelSetAuxiliaryInfoInt(String keyName) { + if (modelSetAuxiliaryInfo != null + && modelSetAuxiliaryInfo.containsKey(keyName)) { + return ((Integer)modelSetAuxiliaryInfo.get(keyName)).intValue(); + } + return Integer.MIN_VALUE; + } + void setModelCount(int modelCount) { // System.out.println("setModelCount(" + modelCount + ")"); if (this.modelCount != 0) @@ -134,6 +142,19 @@ modelCount); } + void setSymmetryAtomInfo(int modelIndex, int atomIndex, int atomCount) { + models[modelIndex].preSymmetryAtomIndex = atomIndex; + models[modelIndex].preSymmetryAtomCount = atomCount; + } + + int getPreSymmetryAtomIndex(int modelIndex) { + return models[modelIndex].preSymmetryAtomIndex; + } + + int getPreSymmetryAtomCount(int modelIndex) { + return models[modelIndex].preSymmetryAtomCount; + } + String getModelName(int modelIndex) { return modelNames[modelIndex]; } @@ -166,6 +187,15 @@ && ((Boolean)info.get(keyName)).booleanValue()); } + int getModelAuxiliaryInfoInt(int modelIndex, String keyName) { + Hashtable info = modelAuxiliaryInfo[modelIndex]; + if (info != null && info.containsKey(keyName)) { + return ((Integer)info.get(keyName)).intValue(); + } + return Integer.MIN_VALUE; + } + + Model getModel(int modelIndex) { return models[modelIndex]; } Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Model.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Model.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Model.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -29,7 +29,9 @@ Mmset mmset; int modelIndex; String modelTag; - + int preSymmetryAtomIndex = -1; + int preSymmetryAtomCount; + private int chainCount = 0; private Chain[] chains = new Chain[8]; @@ -43,6 +45,10 @@ this.modelTag = modelTag; } + void setSymmetryAtomInfo(int atomIndex, int atomCount) { + preSymmetryAtomIndex = atomIndex; + preSymmetryAtomCount = atomCount; + } void freeze() { // System.out.println("Mmset.freeze() chainCount=" + chainCount); chains = (Chain[])Util.setLength(chains, chainCount); Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Token.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Token.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Token.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -84,7 +84,7 @@ final static int comparator = (1 << 17) | expression; final static int predefinedset = (1 << 18) | expression; final static int colorparam = (1 << 19); - final static int specialstring = (1 << 20); // load, echo, label + final static int specialstring = (1 << 20); // echo, label // generally, the minus sign is used to denote atom ranges // this property is used for the few commands which allow negative integers final static int negnums = (1 << 21); @@ -94,6 +94,11 @@ final static int setspecial = (1 << 22); final static int coordinate = (1 << 23); final static int objectid = (1 << 24); + + // allows initial quote to indicate some parameters may not be strings + // Bob Hanson 2006/04 + final static int specialstring2 = (1 << 25); // echo, label + // These are unrelated final static int varArgCount = (1 << 4); @@ -119,7 +124,7 @@ final static int hbond = command | 13 | setparam | bool; final static int help = command | 14; final static int label = command | 15 | specialstring; - final static int load = command | 16 | specialstring; + final static int load = command | 16 | specialstring2; final static int molecule = command | 17; final static int monitor = command | 18 | setparam | bool | embeddedExpression; final static int pause = command | 19 | misc; @@ -245,7 +250,7 @@ final static int chain = showparam | 5 | expression; final static int atom = showparam | 6; final static int sequence = showparam | 7; - final static int symmetry = showparam | 8; + final static int symmetry = showparam | 8 | expression | predefinedset; final static int translation = showparam | 9; // zoom // chime show parameters Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java 2006-04-29 14:32:48 UTC (rev 5032) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Viewer.java 2006-04-30 12:37:27 UTC (rev 5033) @@ -970,21 +970,20 @@ } public void openFile(String name) { - /* - * System.out.println("openFile(" + name + ") thread:" + - * Thread.currentThread() + " priority:" + - * Thread.currentThread().getPriority()); - */ - + openFile(name, null); + } + + public void openFile(String name, int[] params) { clear(); - // keep old screen image while new file is being loaded - // forceRefresh(); long timeBegin = System.currentTimeMillis(); - //System.out.println("openFile3(" + name + ")"); - fileManager.openFile(name); + fileManager.openFile(name, params); long ms = System.currentTimeMillis() - timeBegin; setStatusFileLoaded(1, name, "", modelManager.getModelSetName(), null, null); - System.out.println("openFile(" + name + ") " + ms + " ms"); + String sp = ""; + if (params != null) + for (int i = 0; i < params.length; i++) + sp+="," + params[i]; + System.out.println("openFile(" + name + sp + ")" + ms + " ms"); } public void openFiles(String modelName, String[] names) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |