Revision: 20551
          http://sourceforge.net/p/jmol/code/20551
Author:   hansonr
Date:     2015-06-05 05:18:22 +0000 (Fri, 05 Jun 2015)
Log Message:
-----------
echo @{"cb="+cb} does not access function variable cb.  There is some question 
as to whether it should...
AtomSetCollection.java not clearing bsAtoms when a set is deleted

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/adapter/readers/aflow/AFLOWReader.java
    trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
    trunk/Jmol/src/org/jmol/api/JmolScriptEvaluator.java
    trunk/Jmol/src/org/jmol/script/ScriptEval.java
    trunk/Jmol/src/org/jmol/viewer/Viewer.java

Modified: trunk/Jmol/src/org/jmol/adapter/readers/aflow/AFLOWReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/aflow/AFLOWReader.java      
2015-06-05 05:06:35 UTC (rev 20550)
+++ trunk/Jmol/src/org/jmol/adapter/readers/aflow/AFLOWReader.java      
2015-06-05 05:18:22 UTC (rev 20551)
@@ -37,7 +37,7 @@
   private String aabb;  
   private boolean readPRE;
 //  private boolean readPOST;
-  private float fracA = Float.NaN;
+  private float fracB = Float.NaN;
   private Map<String, float[]> compositions;
   private boolean getComposition;
   private String listKey, listKeyCase;
@@ -111,14 +111,22 @@
   protected void initializeReader() throws Exception {
     readPRE = checkFilterKey("PRE");
 //    readPOST = !checkFilterKey("NOPOST");
-    String s = getFilter("CA=");
     forcePacked = !checkFilterKey("NOPACK");
+
+    String s;
+    
+    s = getFilter("CA=");
     if (s != null)
-      fracA = parseFloatStr(s.substring(1));
+      fracB = (1 - parseFloatStr(s.substring(1)));
+    
+    s = getFilter("CB=");
+    if (s != null)
+      fracB = parseFloatStr(s.substring(1));
+    
     s = getFilter("LIST=");
     listKey = (s == null ? "HF" : s);
     listKeyCase = listKey;
-    getComposition = !Float.isNaN(fracA);
+    getComposition = !Float.isNaN(fracB);
     discardLinesUntilStartsWith("[");
     //asc.setAtomSetName(title = line.trim());
     aabb = line.substring(1, line.indexOf("]"));
@@ -143,7 +151,7 @@
   private boolean readPrePost() throws Exception {
     fileModelNumber++;
     String titleMsg = "" + (modelNumber+1)
-        + (getComposition ? "," + fileModelNumber + "," + fracA : "");
+        + (getComposition ? "," + fileModelNumber + ", Cb=" + fracB : "");
     elementLabel = null;
     if (readPRE) {
       readStructure(titleMsg);
@@ -180,12 +188,17 @@
       if (key.toUpperCase().startsWith(listKey)) {
         listKey = key.toUpperCase();
         listKeyCase = key;
-        asc.setAtomSetName(aabb + " " + (getComposition ? fracA + " " : " ") + 
key + "=" + val);
+        asc.setAtomSetName(aabb + " " + (getComposition ? fracB + " " : " ") + 
key + "=" + val);
         listVal = parseFloatStr(val);
       }
+      if (key.equals("Ca")) {
+        float ca = parseFloatStr(val);
+        if (getComposition && Math.abs((1 - ca) - fracB) > 0.01f)
+          return false;
+      } else
       if (key.equals("Cb")) {
         float cb = parseFloatStr(strcb = val);
-        if (getComposition && Math.abs(cb - fracA) > 0.01f)
+        if (getComposition && Math.abs(cb - fracB) > 0.01f)
           return false;
       }
     }

Modified: trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java      
2015-06-05 05:06:35 UTC (rev 20550)
+++ trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java      
2015-06-05 05:18:22 UTC (rev 20551)
@@ -450,7 +450,10 @@
   public void removeCurrentAtomSet() {
     if (iSet < 0)
       return;
-    ac = atomSetAtomIndexes[iSet];
+    int ai = atomSetAtomIndexes[iSet];
+    if (bsAtoms != null)
+      bsAtoms.clearBits(ai, ac);
+    ac = ai;
     atomSetAtomCounts[iSet] = 0;
     iSet--;
     atomSetCount--;

Modified: trunk/Jmol/src/org/jmol/api/JmolScriptEvaluator.java
===================================================================
--- trunk/Jmol/src/org/jmol/api/JmolScriptEvaluator.java        2015-06-05 
05:06:35 UTC (rev 20550)
+++ trunk/Jmol/src/org/jmol/api/JmolScriptEvaluator.java        2015-06-05 
05:18:22 UTC (rev 20551)
@@ -74,8 +74,6 @@
 
   void deleteAtomsInVariables(BS bsDeleted);
 
-  Map<String, SV> getContextVariables();
-
   boolean evalParallel(ScriptContext context, ShapeManager shapeManager);
 
   void runScript(String script) throws ScriptException;

Modified: trunk/Jmol/src/org/jmol/script/ScriptEval.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptEval.java      2015-06-05 05:06:35 UTC 
(rev 20550)
+++ trunk/Jmol/src/org/jmol/script/ScriptEval.java      2015-06-05 05:18:22 UTC 
(rev 20551)
@@ -802,6 +802,8 @@
     ScriptEval e = (new ScriptEval()).setViewer(vwr);
     try {
       // disallow end-of-script message and JavaScript script queuing
+      e.thisContext = thisContext;
+      e.contextVariables = contextVariables;
       e.pushContext(null, "evalExp");
       e.allowJSThreads = false;
     } catch (ScriptException e1) {
@@ -819,13 +821,11 @@
         if (compileScript(null, "e_x_p_r_e_s_s_i_o_n = " + expr, false)) {
           if (compileOnly)
             return aatoken[0];
-          contextVariables = vwr.getContextVariables();
           setStatement(aatoken[0]);
           return (asVariable ? parameterExpressionList(2, -1, false).get(0)
               : parameterExpressionString(2, 0));
         }
       } else if (expr instanceof T[]) {
-        contextVariables = vwr.getContextVariables();
         BS bs = atomExpression((T[]) expr, 0, 0, true, false, true, false);
         return (asVariable ? SV.newV(T.bitset, bs) : bs);
 
@@ -1368,12 +1368,7 @@
   
   // ///////////////// Script context support //////////////////////
 
-  @Override
-  public Map<String, SV> getContextVariables() {
-    return contextVariables;
-  }
-
-  @Override
+ @Override
   public ScriptContext getThisContext() {
     return thisContext;
   }

Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Viewer.java  2015-06-05 05:06:35 UTC (rev 
20550)
+++ trunk/Jmol/src/org/jmol/viewer/Viewer.java  2015-06-05 05:18:22 UTC (rev 
20551)
@@ -8956,10 +8956,6 @@
         atomExpression));
   }
 
-  public Map<String, SV> getContextVariables() {
-    return (getScriptManager() == null ? null : eval.getContextVariables());
-  }
-
   public ScriptContext getScriptContext(String why) {
     return (getScriptManager() == null ? null : eval.getScriptContext(why));
   }

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to