Revision: 18627 http://sourceforge.net/p/jmol/code/18627 Author: hansonr Date: 2013-08-29 10:32:22 +0000 (Thu, 29 Aug 2013) Log Message: ----------- ___JmolVersion="13.3.5_dev_2013.08.29"
new feature: show NMR taps into NMRDB directly -- for now, application only Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/more/JcampdxReader.java trunk/Jmol/src/org/jmol/api/JmolViewer.java trunk/Jmol/src/org/jmol/modelset/ModelCollection.java trunk/Jmol/src/org/jmol/modelset/ModelLoader.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java trunk/Jmol/src/org/jmol/util/ModulationSet.java trunk/Jmol/src/org/jmol/viewer/JC.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/PropertyManager.java trunk/Jmol/src/org/jmol/viewer/StateCreator.java trunk/Jmol/src/org/jmol/viewer/Viewer.java trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/more/JcampdxReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/more/JcampdxReader.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/adapter/readers/more/JcampdxReader.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -26,10 +26,12 @@ import java.io.BufferedReader; import java.io.StringReader; +import java.util.ArrayList; +import java.util.Hashtable; +import java.util.List; +import java.util.Map; + import org.jmol.util.JmolList; - - - import org.jmol.util.TextFormat; import org.jmol.adapter.readers.molxyz.MolReader; @@ -96,7 +98,7 @@ public class JcampdxReader extends MolReader { - private String modelID; + private String thisModelID; private AtomSetCollection models; private String modelIdList = ""; private JmolList<String> peakData = new JmolList<String>(); @@ -152,7 +154,9 @@ if (label.equals("##$MODELS")) return readModels(); if (label.equals("##$PEAKS")) - return readPeaks(); + return (readPeaks(false) > 0); + if (label.equals("##$SIGNALS")) + return (readPeaks(true) > 0); return true; } @@ -180,7 +184,7 @@ // load xxx.jdx 0 will mean "load only the base model(s)" models = null; line = ""; - modelID = ""; + thisModelID = ""; boolean isFirst = true; while (true) { int model0 = atomSetCollection.getCurrentAtomSetIndex(); @@ -208,11 +212,11 @@ private void updateModelIDs(int model0, boolean isFirst) { int n = atomSetCollection.getAtomSetCount(); if (isFirst && n == model0 + 2) { - atomSetCollection.setAtomSetAuxiliaryInfo("modelID", modelID); + atomSetCollection.setAtomSetAuxiliaryInfo("modelID", thisModelID); return; } for (int pt = 0, i = model0; ++i < n;) { - atomSetCollection.setAtomSetAuxiliaryInfoForSet("modelID", modelID + "." + atomSetCollection.setAtomSetAuxiliaryInfoForSet("modelID", thisModelID + "." + (++pt), i); } } @@ -223,10 +227,10 @@ } private AtomSetCollection getModelAtomSetCollection() throws Exception { - lastModel = modelID; - modelID = getAttribute(line, "id"); + lastModel = thisModelID; + thisModelID = getAttribute(line, "id"); // read model only once for a given ID - String key = ";" + modelID + ";"; + String key = ";" + thisModelID + ";"; if (modelIdList.indexOf(key) >= 0) { discardLinesUntilContains("</ModelData>"); return null; @@ -276,7 +280,7 @@ for (int i = a.getAtomCount(); --i >= 0;) atoms[i].scaleVector(vibScale); } - Logger.info("jdx model=" + modelID + " type=" + a.getFileTypeName()); + Logger.info("jdx model=" + thisModelID + " type=" + a.getFileTypeName()); return a; } @@ -312,23 +316,170 @@ } } - private boolean readPeaks() throws Exception { - if (line.indexOf("<Peaks") < 0) - discardLinesUntilContains2("<Peaks", "##"); - if (line.indexOf("<Peaks") < 0) - return false; - String type = getAttribute(line, "type").toUpperCase(); - if (type.equals("HNMR")) - type = "1HNMR"; - else if (type.equals("CNMR")) - type = "13CNMR"; - while (readLine() != null && !(line = line.trim()).startsWith("</Peaks>")) - if (line.startsWith("<PeakData")) - peakData.addLast("<PeakData file=" + peakFilePath + " index=\"" + (++peakIndex[0]) + "\"" + " type=\"" + type + "\" " + line.substring(9).trim()); - return true; + String piUnitsX, piUnitsY; + + /** + * read a <Peaks> or <Signals> block See similar method in + * JSpecViewLib/src/jspecview/source/FileReader.java + * + * @param isSignals + * @return true if successful + * @throws Exception + */ + private int readPeaks(boolean isSignals) throws Exception { + JcampdxReader reader = this; + Object spectrum = null; + + try { + String tag1 = (isSignals ? "Signals" : "Peaks"); + String tag2 = (isSignals ? "<Signal" : "<PeakData"); + String line = discardUntil(reader, tag1); + if (line.indexOf("<" + tag1) < 0) + line = discardUntil(reader, "<" + tag1); + if (line.indexOf("<" + tag1) < 0) + return 0; + + String file = getPeakFilePath(); + String model = getQuotedAttribute(line, "model"); + model = " model=" + escape(model == null ? thisModelID : model); + String type = getQuotedAttribute(line, "type"); + if ("HNMR".equals(type)) + type = "1HNMR"; + else if ("CNMR".equals(type)) + type = "13CNMR"; + type = (type == null ? "" : " type=" + escape(type)); + piUnitsX = getQuotedAttribute(line, "xLabel"); + piUnitsY = getQuotedAttribute(line, "yLabel"); + Map<String, Object[]> htSets = new Hashtable<String, Object[]>(); + List<Object[]> list = new ArrayList<Object[]>(); + while ((line = reader.readLine()) != null + && !(line = line.trim()).startsWith("</" + tag1)) { + if (line.startsWith(tag2)) { + info(line); + String title = getQuotedAttribute(line, "title"); + if (title == null) { + title = (type == "1HNMR" ? "atom%S%: %ATOMS%; integration: %NATOMS%" : ""); + title = " title=" + escape(title); + } else { + title = ""; + } + String stringInfo = "<PeakData " + + file + + " index=\"%INDEX%\"" + + title + + type + + (getQuotedAttribute(line, "model") == null ? model + : "") + " " + line.substring(tag2.length()).trim(); + String atoms = getQuotedAttribute(stringInfo, "atoms"); + if (atoms != null) + stringInfo = simpleReplace(stringInfo, "atoms=\"" + + atoms + "\"", "atoms=\"%ATOMS%\""); + String key = ((int) (parseFloatStr(getQuotedAttribute(line, "xMin")) * 100)) + + "_" + + ((int) (parseFloatStr(getQuotedAttribute(line, + "xMax")) * 100)); + Object[] o = htSets.get(key); + if (o == null) { + o = new Object[] { stringInfo, + (atoms == null ? null : new BS()) }; + htSets.put(key, o); + list.add(o); + } + BS bs = (BS) o[1]; + if (bs != null) { + atoms = atoms.replace(',', ' '); + bs.or(unescapeBitSet("({" + atoms + "})")); + } + } + } + int nH = 0; + int n = list.size(); + for (int i = 0; i < n; i++) { + Object[] o = list.get(i); + String stringInfo = (String) o[0]; + stringInfo = simpleReplace(stringInfo, "%INDEX%", "" + + getPeakIndex()); + BS bs = (BS) o[1]; + if (bs != null) { + String s = ""; + for (int j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1)) + s += "," + (j + 1); + int na = bs.cardinality(); + nH += na; + stringInfo = simpleReplace(stringInfo, "%ATOMS%", s + .substring(1)); + stringInfo = simpleReplace(stringInfo, "%S%", + (na == 1 ? "" : "s")); + stringInfo = simpleReplace(stringInfo, "%NATOMS%", "" + + na); + } + info("Jmol using " + stringInfo); + add(peakData, stringInfo); + } + setSpectrumPeaks(spectrum, peakData, nH); + return n; + } catch (Exception e) { + return 0; + } } + private void info(String s) { + Logger.info(s); + } + + private BS unescapeBitSet(String s) { + return Escape.uB(s); + } + + private String simpleReplace(String s, String sfrom, String sto) { + return TextFormat.simpleReplace(s, sfrom, sto); + } + + private String escape(String s) { + return Escape.eS(s); + } + + private String getQuotedAttribute(String s, String attr) { + return Parser.getQuotedAttribute(s, attr); + } + /** + * @param o1 + * @param o2 + * @param nH + */ + private void setSpectrumPeaks(Object o1, Object o2, + int nH) { + // only in JSpecView + } + + private void add(JmolList<String> peakData, String info) { + peakData.addLast(info); + } + + private String getPeakFilePath() { + return " file=" + Escape.eS(peakFilePath); + } + + + /** + * @param ignored + * @param tag + * @return line + * @throws Exception + */ + private String discardUntil(Object ignored, String tag) throws Exception { + return discardLinesUntilContains2("<" + tag, "##"); + } + + /** + * @return index + */ + private int getPeakIndex() { + return ++peakIndex[0]; + } + + /** * integrate the <PeakAssignment> records into the associated models, and delete unreferenced n.m models */ @SuppressWarnings("unchecked") @@ -341,10 +492,10 @@ for (int p = 0; p < n; p++) { line = peakData.get(p); String type = getAttribute(line, "type"); - modelID = getAttribute(line, "model"); - int i = findModelById(modelID); + thisModelID = getAttribute(line, "model"); + int i = findModelById(thisModelID); if (i < 0) { - Logger.warn("cannot find model " + modelID + " required for " + line); + Logger.warn("cannot find model " + thisModelID + " required for " + line); continue; } addType(i, type); @@ -372,9 +523,9 @@ } n = atomSetCollection.getAtomSetCount(); for (int i = n; --i >= 0;) { - modelID = (String) atomSetCollection + thisModelID = (String) atomSetCollection .getAtomSetAuxiliaryInfoValue(i, "modelID"); - if (havePeaks && !bsModels.get(i) && modelID.indexOf(".") >= 0) { + if (havePeaks && !bsModels.get(i) && thisModelID.indexOf(".") >= 0) { atomSetCollection.removeAtomSet(i); n--; } Modified: trunk/Jmol/src/org/jmol/api/JmolViewer.java =================================================================== --- trunk/Jmol/src/org/jmol/api/JmolViewer.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/api/JmolViewer.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -618,6 +618,7 @@ */ abstract public String runScript(String script); abstract public int modelGetLastVibrationIndex(int i, int tok); + abstract public String extractMolData(String what); } Modified: trunk/Jmol/src/org/jmol/modelset/ModelCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -197,6 +197,10 @@ return (String) getModelAuxiliaryInfoValue(modelIndex, "fileName"); } + public String getModelFileType(int modelIndex) { + return (String) getModelAuxiliaryInfoValue(modelIndex, "fileType"); + } + public void setFrameTitle(BS bsFrames, Object title) { if (title instanceof String) { for (int i = bsFrames.nextSetBit(0); i >= 0; i = bsFrames @@ -1010,10 +1014,6 @@ return models[modelIndex].nInsertions; } - public String getModelFileType(int modelIndex) { - return (String) getModelAuxiliaryInfoValue(modelIndex, "fileType"); - } - public static int modelFileNumberFromFloat(float fDotM) { //only used in the case of select model = someVariable //2.1 and 2.10 will be ambiguous and reduce to 2.1 @@ -3397,13 +3397,14 @@ String fname = null; for (int i = 0; i < modelCount; i++) { String mid = (String) getModelAuxiliaryInfoValue(i, "modelID"); - if (mid == null && (mid = getModelTitle(i)) == null) + String mnum = (id.startsWith("~") ? "~" + getModelNumberDotted(i) : null); + if (mnum == null && mid == null && (mid = getModelTitle(i)) == null) continue; if (haveFile) { fname = getModelFileName(i) + "#"; mid = fname + mid; } - if (id.equalsIgnoreCase(mid)) + if (id.equalsIgnoreCase(mid) || id.equalsIgnoreCase(mnum)) return (isBaseModel ? viewer.getJDXBaseModelIndex(i) : i); if (fname != null && id.startsWith(fname)) errCode = -2; Modified: trunk/Jmol/src/org/jmol/modelset/ModelLoader.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelLoader.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/modelset/ModelLoader.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -686,6 +686,7 @@ } Model[] models = modelSet.models; for (int i = baseModelCount; i < modelCount; ++i) { + modelSet.setModelAuxiliaryInfo(i, "fileType", modelSet.modelSetTypeName); if (fileHeader != null) modelSet.setModelAuxiliaryInfo(i, "fileHeader", fileHeader); int filenumber = modelNumbers[i] / 1000000; Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -14646,9 +14646,12 @@ if (optParameterAsString(2).equalsIgnoreCase("1H")) { len = 3; if (!chk) - msg = viewer.getNMRPredict(viewer.getModelExtract("selected", true, false, "V2000")); + msg = viewer.getNMRPredict(false); + break; } - break; + if (!chk) + viewer.getNMRPredict(true); + return; case T.smiles: case T.drawing: case T.chemical: @@ -14665,13 +14668,6 @@ } msg = "Could not show drawing -- Either insufficient atoms are selected or the model is a PDB file."; break; - case T.nmr: - if (msg.length() > 0) { - viewer.showNMR(msg); - return; - } - msg = "Could not show nmr -- Either insufficient atoms are selected or the model is a PDB file."; - break; case T.chemical: len = 3; String info = null; Modified: trunk/Jmol/src/org/jmol/util/ModulationSet.java =================================================================== --- trunk/Jmol/src/org/jmol/util/ModulationSet.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/util/ModulationSet.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -30,16 +30,35 @@ V3 x456; /** - * A collection of modulations for a specific atom. + * A collection of modulations for a specific atom. * + * We treat the set of modulation vectors q1,q2,q3,... as + * a matrix Q with row 1 = q1, row 2 = q2, etc. Then we + * have Qr = [q1.r, q2.r, q3.r,...]. + * + * Similarly, we express the x1' - xn' aspects of the operators + * as the matrix Gamma_I (epsilons) and s_I (shifts). However, + * since we are only considering up to n = 3, we can express these + * together as a 4x4 matrix just for storage. + * + * Then for X defined as [x4,x5,x6...] (column vector, really) + * we have: + * + * X' = Gamma_I * X + s_I + * + * and + * + * X = Gamma_I^-1(X' - S_I) + * + * not figured out for composite structures + * * @param id * @param r - * @param vocc0 * @param modDim * @param mods * @param gammaE * @param gammaIS - * @param q123 + * @param q123w * @param qlen * * Modified: trunk/Jmol/src/org/jmol/viewer/JC.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JC.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/viewer/JC.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -1292,7 +1292,7 @@ "ligand", "http://www.rcsb.org/pdb/files/ligand/%FILE.cif", "mp", "http://www.materialsproject.org/materials/%FILE/cif", "nci", "http://cactus.nci.nih.gov/chemical/structure/%FILE", - "nmr", "http://www.nmrdb.org/predictor?smiles=", + "nmr", "http://www.nmrdb.org/predictor?POST?molfile=", "nmrdb", "http://www.nmrdb.org/service/predictor?POST?molfile=", "pdb", "http://www.rcsb.org/pdb/files/%FILE.pdb.gz", "pubchem", "http://pubchem.ncbi.nlm.nih.gov/rest/pug/compound/%FILE/SDF?record_type=3d" Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2013-08-29 10:32:22 UTC (rev 18627) @@ -11,8 +11,13 @@ # The quotes above look odd for a parameter file, but they are # important for the JavaScript version of Jmol. -___JmolVersion="13.3.4" +___JmolVersion="13.3.5_dev_2013.08.29" +new feature: show NMR taps into NMRDB directly + -- for now, application only + +JmolVersion="13.3.4" + bug fix: select 1-5 broken JmolVersion="13.3.4_dev_2013.08.21" Modified: trunk/Jmol/src/org/jmol/viewer/PropertyManager.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/PropertyManager.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/viewer/PropertyManager.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -1156,6 +1156,7 @@ sb.append("\nid").append(s).append(Escape.eS(id)); sb.append("\ntitle").append(s).append(Escape.eS(ms.getModelTitle(i))); sb.append("\nname").append(s).append(Escape.eS(ms.getModelName(i))); + sb.append("\ntype").append(s).append(Escape.eS(ms.getModelFileType(i))); } return sb.toString(); } Modified: trunk/Jmol/src/org/jmol/viewer/StateCreator.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/StateCreator.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/viewer/StateCreator.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -2126,6 +2126,7 @@ sm.setSyncDriver(StatusManager.SYNC_DISABLE); if (script.indexOf("Mouse: ") != 0) { if (script.startsWith("Select: ")) { + // from JSpecView peak pick String filename = Parser.getQuotedAttribute(script, "file"); String modelID = Parser.getQuotedAttribute(script, "model"); String baseModel = Parser.getQuotedAttribute(script, "baseModel"); Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -515,7 +515,6 @@ fileManager = new FileManager(this); definedAtomSets = new Hashtable<String, Object>(); setJmolStatusListener(statusListener); - if (isApplet) { Logger.info("viewerOptions: \n" + Escape.escapeMap(viewerOptions)); jsDocumentBase = appletDocumentBase; @@ -3185,15 +3184,11 @@ @Override public int getModelNumber(int modelIndex) { - if (modelIndex < 0) - return modelIndex; - return modelSet.getModelNumber(modelIndex); + return (modelIndex < 0 ? modelIndex : modelSet.getModelNumber(modelIndex)); } public int getModelFileNumber(int modelIndex) { - if (modelIndex < 0) - return 0; - return modelSet.getModelFileNumber(modelIndex); + return (modelIndex < 0 ? 0 : modelSet.getModelFileNumber(modelIndex)); } @Override @@ -5183,7 +5178,9 @@ global.setS("_modelTitle", (modelIndex < 0 ? "" : getModelTitle(modelIndex))); global.setS("_modelFile", (modelIndex < 0 ? "" - : getModelFileName(modelIndex))); + : modelSet.getModelFileName(modelIndex))); + global.setS("_modelType", (modelIndex < 0 ? "" + : modelSet.getModelFileType(modelIndex))); if (currentFrame == prevFrame) return; @@ -8574,20 +8571,34 @@ return xyzdata; } - public String getNMRPredict(String molFile) { - // nmrdb cannot handle "." separator and cannot handle c=c + @Override + public String extractMolData(String what) { + if (what == null) { + int i = getCurrentModelIndex(); + if (i < 0) + return null; + what = getModelNumberDotted(i); + } + return getModelExtract(what, true, false, "V2000"); + } + public String getNMRPredict(boolean openURL) { + String molFile = getModelExtract("selected", true, false, "V2000"); int pt = molFile.indexOf("\n"); molFile = "Jmol " + version_date + molFile.substring(pt); + if (openURL) { + if (isApplet) { + //TODO -- can do this if connected + showUrl(global.nmrUrlFormat + molFile); + } else { + syncScript("true", "*", 0); + syncScript("JSpecView:", ".", 0); + } + return null; + } String url = global.nmrPredictFormat + molFile; return getFileAsString(url); } - public void showNMR(String smiles) { - // nmrdb cannot handle "." separator and cannot handle c=c - showUrl(global.nmrUrlFormat - + Escape.escapeUrl(getChemicalInfo(smiles, '/', "smiles"))); - } - public void getHelp(String what) { if (global.helpPath.indexOf("?") < 0) { if (what.length() > 0 && what.indexOf("?") != 0) @@ -8781,6 +8792,7 @@ } public int getModelIndexFromId(String id) { + // from JSpecView peak pick and model "ID" return modelSet.getModelIndexFromId(id); } Modified: trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java =================================================================== --- trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java 2013-08-28 06:42:53 UTC (rev 18626) +++ trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/StatusListener.java 2013-08-29 10:32:22 UTC (rev 18627) @@ -74,6 +74,7 @@ private JmolViewer viewer; private MainFrame jSpecViewFrame; + private boolean jSpecViewForceNew; void setViewer(JmolViewer viewer) { this.viewer = viewer; } @@ -131,6 +132,8 @@ display.status.setStatus(1, menuName); if (jmol.frame != null) jmol.frame.setTitle(menuName); +// if (jSpecViewFrame != null) +// setJSpecView("", true); } return; case SCRIPT: @@ -167,7 +170,7 @@ break; case SYNC: if (strInfo != null && strInfo.toLowerCase().startsWith("jspecview")) { - setJSpecView(strInfo.substring(9).trim()); + setJSpecView(strInfo.substring(9).trim(), false, false); return; } jmol.sendNioMessage(((Integer) data[3]).intValue(), strInfo); @@ -262,10 +265,13 @@ title = modelName; jmol.notifyFileOpen(fullPathName == null ? null : fullPathName + (isAsync == Boolean.TRUE ? " (*)" : ""), title); if (jSpecViewFrame != null) { + jSpecViewForceNew = jSpecViewFrame.isVisible(); if (fullPathName == null) { jSpecViewFrame.syncScript("close ALL"); - } else if (fullPathName.endsWith(".jdx")) - jSpecViewFrame.syncScript("load CHECK " + Escape.eS(fullPathName)); + } else { + setJSpecView("", true, true); + } + jSpecViewForceNew = true; } } @@ -359,7 +365,7 @@ return jmol.resizeInnerPanel(data); } - public void setJSpecView(String peaks) { + public void setJSpecView(String peaks, boolean doLoadCheck, boolean isFileLoad) { if (!display.isRotateMode()) return; if (peaks.startsWith(":")) @@ -367,15 +373,35 @@ if (jSpecViewFrame == null) { jSpecViewFrame = new MainFrame((Component) viewer.getDisplay(), this); jSpecViewFrame.setSize(800, 500); - jSpecViewFrame.setLocation(400, 400); + jSpecViewFrame.setLocation(jmol.frame.getLocation().x + 10, jmol.frame + .getLocation().y + 100); jSpecViewFrame.register("Jmol", this); if (peaks.length() == 0) { - String s = "" + viewer.getParameter("_modelfile"); - if (s.indexOf("/") >= 0) - peaks = "hidden false; load " + Escape.eS(s); + doLoadCheck = true; } } - if (!jSpecViewFrame.isVisible() && !peaks.toLowerCase().startsWith("hidden")) { + if (doLoadCheck || jSpecViewForceNew) { + String type = "" + viewer.getParameter("_modelType"); + if (type.equalsIgnoreCase("jcampdx")) { + jSpecViewForceNew = false; + String file = "" + viewer.getParameter("_modelFile"); + if (file.indexOf("/") < 0) + return; + peaks = "hidden true; load CHECK " + Escape.eS(file) + ";hidden false"; + } else if (isFileLoad && !jSpecViewForceNew) { + return; + } else { + jSpecViewForceNew = false; + String model = "" + viewer.getParameter("_modelNumber"); + String data = viewer.extractMolData(null); + if (data == null) + return; + peaks = "hidden true; load CHECK MOL " + + Escape.eS("id='~" + model + "';" + data) + ";hidden false"; + } + } + if (!jSpecViewFrame.isVisible()) { + // && !peaks.toLowerCase().startsWith("hidden")) { jSpecViewFrame.awaken(true); display.setViewer(viewer); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Learn the latest--Visual Studio 2012, SharePoint 2013, SQL 2012, more! Discover the easy way to master current and previous Microsoft technologies and advance your career. Get an incredible 1,500+ hours of step-by-step tutorial videos with LearnDevNow. Subscribe today and save! http://pubads.g.doubleclick.net/gampad/clk?id=58040911&iu=/4140/ostg.clktrk _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits