Revision: 21355
          http://sourceforge.net/p/jmol/code/21355
Author:   hansonr
Date:     2017-01-26 22:29:18 +0000 (Thu, 26 Jan 2017)
Log Message:
-----------
NBO message ***errmess***
isosurface enables NBO option; still not for alpha/beta

Modified Paths:
--------------
    trunk/Jmol/src/org/gennbo/NBODialog.java
    trunk/Jmol/src/org/gennbo/NBODialogView.java
    trunk/Jmol/src/org/gennbo/NBOService.java
    trunk/Jmol/src/org/jmol/scriptext/IsoExt.java

Modified: trunk/Jmol/src/org/gennbo/NBODialog.java
===================================================================
--- trunk/Jmol/src/org/gennbo/NBODialog.java    2017-01-26 14:20:52 UTC (rev 
21354)
+++ trunk/Jmol/src/org/gennbo/NBODialog.java    2017-01-26 22:29:18 UTC (rev 
21355)
@@ -788,13 +788,13 @@
         NBOFileHandler.getExt(inputFileHandler.inputFile).equals("47"));
   }
     
-  public void setStatus(String statusInfo) {
+  void setStatus(String statusInfo) {
     if (statusInfo.length() > 0)
       log(statusInfo, 'p');  
       statusLab.setText(statusInfo);
   }
 
-  public void processEnd(int dialogMode, AbstractListModel<String> list) {
+  void processEnd(int dialogMode, AbstractListModel<String> list) {
     statusLab.setText("");
     switch (dialogMode) {
     case NBOService.MODE_IMAGE:
@@ -822,11 +822,15 @@
     setStatus("OK mode=" + dialogMode);
   }
 
-  public void loadFromHandler(File file) {
+  void loadFromHandler(File file) {
     isNewModel = true;
     if (dialogMode == DIALOG_VIEW) 
       setViewerBasis();
      else
       loadModelFileQueued(file, false, false);
   }
+
+  void setLicense(String line) {
+    licenseInfo.setText("<html><div style='text-align: center'>" + line + 
"</html>");
+  }
 }

Modified: trunk/Jmol/src/org/gennbo/NBODialogView.java
===================================================================
--- trunk/Jmol/src/org/gennbo/NBODialogView.java        2017-01-26 14:20:52 UTC 
(rev 21354)
+++ trunk/Jmol/src/org/gennbo/NBODialogView.java        2017-01-26 22:29:18 UTC 
(rev 21355)
@@ -1725,7 +1725,8 @@
       DefaultListModel<String> model = (DefaultListModel<String>) getModel();
       String script = "select all";
       String beta = (betaSpin.isSelected() ? " beta" : "");
-
+      String type = basis.getSelectedItem().toString();
+      
       // get only the ones needing changing
       BS bsSel = new BS();
       int[] selected = getSelectedIndices();
@@ -1749,7 +1750,7 @@
         String id = "mo" + i;
         script += ";select *;if (" + bsKnown.get(i) + "){isosurface " + id + " 
on} else {isosurface " + id
             + " color " + (bsNeg.get(i) ? color1 + " " + color2 : color2 + " " 
+ color1)
-            + " cutoff 0.0316 MO " + (i + 1) + beta + " frontonly "
+            + " cutoff 0.0316 NBO " + type + " " + (i + 1) + beta + " 
frontonly "
             + (useWireMesh ? " mesh nofill" : " nomesh fill translucent " + 
opacityOp) + "}";
       }
 

Modified: trunk/Jmol/src/org/gennbo/NBOService.java
===================================================================
--- trunk/Jmol/src/org/gennbo/NBOService.java   2017-01-26 14:20:52 UTC (rev 
21354)
+++ trunk/Jmol/src/org/gennbo/NBOService.java   2017-01-26 22:29:18 UTC (rev 
21355)
@@ -310,13 +310,18 @@
           //boolean haveStart = false;
           boolean inOpener = false;
           boolean inRequest = false;
+          boolean inError = false;
           System.out.println("nboListener " + this + " running");
           while (!Thread.currentThread().isInterrupted()) {
             String line = null;
             try {
               while ((line = nboReader.readLine()) != null) {
-
-                logServerLine(line);
+                if (line.indexOf("***errmess***") == 0) {
+                  logServerLine(line, false);
+                  inError = !inError;
+                  continue;
+                }
+                logServerLine(line, inError);
                 // ignore the opener business
                 if (line.indexOf("DATA \" \"") >= 0) {
                   //nboDialog.logInfo(" DATA...", Logger.LEVEL_INFO);
@@ -349,10 +354,8 @@
                   nboDialog.alertError("NBOServe has stopped working");
                   restart();
                 }
-                if (line.indexOf("NBOServe") >= 0) {
-                  nboDialog.licenseInfo
-                      .setText("<html><div style='text-align: center'>" + line
-                          + "</html>");
+                if (line.indexOf("NBOServe v") >= 0) {
+                  nboDialog.setLicense(line);
                   isWorking = false;
                   continue;
                 }
@@ -467,14 +470,16 @@
 
   private int lineNo = 0;
 
-  protected void logServerLine(String line) {
+  protected void logServerLine(String line, boolean inError) {
+    
     nboDialog.logInfo((++lineNo) + "< " + line,
-        isFortranError(line) ? Logger.LEVEL_ERROR : Logger.LEVEL_DEBUG);
+        isFortranError(line) || inError ? Logger.LEVEL_ERROR : 
Logger.LEVEL_DEBUG);
   }
 
   protected boolean isFortranError(String line) {
     return line.indexOf("Permission denied") >= 0
-        || line.indexOf("PGFIO-F") >= 0 || line.indexOf("Invalid command") >= 
0;
+        || line.indexOf("PGFIO-F") >= 0 
+        || line.indexOf("Invalid command") >= 0;
   }
 
   public void closeProcess() {

Modified: trunk/Jmol/src/org/jmol/scriptext/IsoExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/IsoExt.java       2017-01-26 14:20:52 UTC 
(rev 21354)
+++ trunk/Jmol/src/org/jmol/scriptext/IsoExt.java       2017-01-26 22:29:18 UTC 
(rev 21355)
@@ -1016,8 +1016,8 @@
 
 
   @SuppressWarnings("unchecked")
-  private void setNBOType(Map<String, Object> moData, String type)
-      throws ScriptException {
+  private void setNBOType(Map<String, Object> moData, String type,
+                          boolean isBeta) throws ScriptException {
     //         31    32    33    34    35    36    37    38    39    40    41
     int ext = ";AO;  ;PNAO;;NAO; ;PNHO;;NHO; ;PNBO;;NBO; ;PNLMO;NLMO;;MO;  
;NO;"
         .indexOf(";" + type + ";");
@@ -1030,7 +1030,8 @@
     if (chk)
       return;
     try {
-      Lst<Map<String, Object>> orbitals = (Lst<Map<String, Object>>) 
moData.get(type + "_coefs");
+      Lst<Map<String, Object>> orbitals = (Lst<Map<String, Object>>) moData
+          .get(type + "_coefs");
       if (orbitals == null) {
         String fileName = moData.get("nboRoot") + "." + ext;
         String data = vwr.getFileAsString3(fileName, true, null);
@@ -1045,8 +1046,17 @@
           orbitals.addLast(mo);
           mo.put("dfCoefMaps", dfCoefMaps);
         }
-        ((QS) Interface.getInterface("org.jmol.quantum.QS", vwr, 
"script")).setNboLabels(nboLabels, n, orbitals, 0, type);
+        ((QS) Interface.getInterface("org.jmol.quantum.QS", vwr, "script"))
+            .setNboLabels(nboLabels, n, orbitals, 0, type);
         data = data.substring(data.lastIndexOf("--") + 2);
+        if (data.indexOf("alpha") >= 0) {
+          if (isBeta) {
+            if (data.indexOf("beta") >= 0)
+              data = data.substring(data.indexOf("beta") + 4);
+            else
+              data = "";
+          }
+        }
         int len = data.length();
         int[] next = new int[1];
         for (int i = 0; i < n; i++) {
@@ -1112,7 +1122,7 @@
       error(ScriptError.ERROR_moModelError);
     vwr.checkMenuUpdate();
     if (nboType != null) {
-      setNBOType(moData, nboType);
+      setNBOType(moData, nboType, isBeta);
       if (lc == null && moNumber == Integer.MAX_VALUE)
         return;
     }
@@ -1246,6 +1256,7 @@
     boolean haveSlab = false;
     boolean haveIntersection = false;
     boolean isFrontOnly = false;
+    String nbotype = null;
     float[] data = null;
     String cmd = null;
     int thisSetNumber = Integer.MIN_VALUE;
@@ -1870,7 +1881,12 @@
           error(ScriptError.ERROR_expressionExpected);
         }
         break;
+      case T.nbo:
+        nbotype = paramAsStr(++i).toUpperCase();
+        sbCommand.append(" nbo ").append(nbotype).append(" ");
       case T.mo:
+        if (nbotype == null)
+          sbCommand.append(" mo ");
         // mo 1-based-index
         int moNumber = Integer.MAX_VALUE;
         int offset = Integer.MAX_VALUE;
@@ -1883,7 +1899,7 @@
           eval.bad();
           break;
         case T.density:
-          sbCommand.append("mo [1] squared ");
+          sbCommand.append("[1] squared ");
           addShapeProperty(propertyList, "squareLinear", Boolean.TRUE);
           linearCombination = new float[] { 1 };
           offset = moNumber = 0;
@@ -1895,7 +1911,7 @@
           moNumber = 0;
           i = eval.iToken;
           //if (surfaceObjectSeen) {
-          sbCommand.append(" mo " + (isNegOffset ? "-" : "") + "HOMO ");
+          sbCommand.append((isNegOffset ? "-" : "") + "HOMO ");
           if (offset > 0)
             sbCommand.append("+");
           if (offset != 0)
@@ -1905,7 +1921,7 @@
         case T.integer:
           moNumber = intParameter(i);
           //if (surfaceObjectSeen)
-          sbCommand.append(" mo ").appendI(moNumber);
+          sbCommand.appendI(moNumber);
           if (tokAt(i + 1) == T.beta) {
             isBeta = true;
             i++;
@@ -1935,7 +1951,7 @@
               .appendI(seed);
         }
         setMoData(propertyList, moNumber, linearCombination, offset,
-            isNegOffset, modelIndex, null, null, isBeta);
+            isNegOffset, modelIndex, null, nbotype, isBeta);
         surfaceObjectSeen = true;
         continue;
       case T.nci:

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

Reply via email to