Revision: 21331 http://sourceforge.net/p/jmol/code/21331 Author: hansonr Date: 2017-01-23 23:31:55 +0000 (Mon, 23 Jan 2017) Log Message: ----------- GenNBO tool - avoid reset of orientation when different bases are loaded.
Modified Paths: -------------- trunk/Jmol/src/org/openscience/jmol/app/nbo/NBODialogView.java trunk/Jmol/src/org/openscience/jmol/app/nbo/NBOFileHandler.java Modified: trunk/Jmol/src/org/openscience/jmol/app/nbo/NBODialogView.java =================================================================== --- trunk/Jmol/src/org/openscience/jmol/app/nbo/NBODialogView.java 2017-01-23 19:08:22 UTC (rev 21330) +++ trunk/Jmol/src/org/openscience/jmol/app/nbo/NBODialogView.java 2017-01-23 23:31:55 UTC (rev 21331) @@ -1002,8 +1002,7 @@ betaList = list; else alphaList = list; - String s = getJmolFilename(); - loadModelFileQueued(f, f.getAbsolutePath().equals(s), false); + loadModelFileQueued(f, NBOFileHandler.pathWithoutExtension(f.getAbsolutePath()).equals(NBOFileHandler.pathWithoutExtension(getJmolFilename())), false); } protected void setLastOrbitalSelection() { @@ -1390,47 +1389,51 @@ runScriptQueued("select bonds " + bonds + ";wireframe 0"); return; } - + Map<String, Object> moData = (Map<String, Object>) vwr .getCurrentModelAuxInfo().get("moData"); String type = basis.getSelectedItem().toString(); if (type.charAt(0) == 'P') type = type.substring(1); boolean isBeta = isOpenShell && !alphaSpin.isSelected(); - String[] a = ((Map<String, String[]>) moData.get("nboLabelMap")) - .get((isBeta ? "beta_" : "") + type); - DefaultComboBoxModel<String> list = (isBeta ? betaList : alphaList); - for (int i = 0; i < a.length; i++) - list.addElement((i + 1) + ". " + a[i]); - orbitals.setModel(list); - setLastOrbitalSelection(); + try { + String[] a = ((Map<String, String[]>) moData.get("nboLabelMap")) + .get((isBeta ? "beta_" : "") + type); + DefaultComboBoxModel<String> list = (isBeta ? betaList : alphaList); + for (int i = 0; i < a.length; i++) + list.addElement((i + 1) + ". " + a[i]); + orbitals.setModel(list); + setLastOrbitalSelection(); - resetValues(); - settingsBox.setVisible(true); - // for(int i = 0; i < 5; i++) - // panel.getComponents()[i].setVisible(true); - if (!inputFileHandler.getChooseList()) - logInfo("Error reading $CHOOSE list", Logger.LEVEL_ERROR); - showAtomNums(true); + resetValues(); + settingsBox.setVisible(true); + // for(int i = 0; i < 5; i++) + // panel.getComponents()[i].setVisible(true); + if (!inputFileHandler.getChooseList()) + logInfo("Error reading $CHOOSE list", Logger.LEVEL_ERROR); + showAtomNums(true); - if (!useWireMesh) { - runScriptQueued("nbo nomesh fill translucent " + opacityOp); - runScriptQueued("mo nomesh fill translucent " + opacityOp); - } + if (!useWireMesh) { + runScriptQueued("nbo nomesh fill translucent " + opacityOp); + runScriptQueued("mo nomesh fill translucent " + opacityOp); + } - runScriptQueued("nbo color " + color2 + " " + color1); - runScriptQueued("mo color " + color2 + " " + color1); - if (isOpenShell) { - alphaSpin.setVisible(true); - betaSpin.setVisible(true); - } else { - alphaSpin.setVisible(false); - betaSpin.setVisible(false); + runScriptQueued("nbo color " + color2 + " " + color1); + runScriptQueued("mo color " + color2 + " " + color1); + if (isOpenShell) { + alphaSpin.setVisible(true); + betaSpin.setVisible(true); + } else { + alphaSpin.setVisible(false); + betaSpin.setVisible(false); + } + setBonds(true); + for (int i = 0; i < panel.getComponentCount(); i++) { + panel.getComponent(i).setVisible(true); + } + } catch (NullPointerException e) { + log(e.getMessage() + " reading file", 'r'); } - setBonds(true); - for (int i = 0; i < panel.getComponentCount(); i++) { - panel.getComponent(i).setVisible(true); - } } protected void setViewerBasis() { Modified: trunk/Jmol/src/org/openscience/jmol/app/nbo/NBOFileHandler.java =================================================================== --- trunk/Jmol/src/org/openscience/jmol/app/nbo/NBOFileHandler.java 2017-01-23 19:08:22 UTC (rev 21330) +++ trunk/Jmol/src/org/openscience/jmol/app/nbo/NBOFileHandler.java 2017-01-23 23:31:55 UTC (rev 21331) @@ -345,11 +345,15 @@ //useful file manipulation methods ///////////////////////////// protected static File newNBOFile(File f, String ext) { - String fname = f.toString().replace('\\', '/'); + return new File(pathWithoutExtension(f.toString().replace('\\', '/')) + "." + ext); + } + + protected static String pathWithoutExtension(String fname) { int pt = fname.lastIndexOf("."); - return new File((pt < 0 ? fname : fname.substring(0, pt)) + "." + ext); + return (pt < 0 ? fname : fname.substring(0, pt)); } + protected void clearInputFile() { // if (jobStem.length() == 0) // return; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, SlashDot.org! http://sdm.link/slashdot _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits