Revision: 20244
          http://sourceforge.net/p/jmol/code/20244
Author:   hansonr
Date:     2015-01-27 13:49:18 +0000 (Tue, 27 Jan 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.3.12_2015.01.26"

new feature: frame [1 3 5 6]
 -- sets limited number of frames for animation and frame * 
 -- same as animation frame [1 3 5 6]; frame *
 
bug fix: @3 for "atomno=3" should not extend to models that are not part of the 
current model set
 -- commonly used for shortcut at the console
 -- provides a function distinct from "atomno=3"
 
new feature: CGO PostScript option

bug fix: CGO LINE_LOOP not closing
bug fix: configuration 1  broken
bug fix: display configuration=1  broken (in Jmol 12.0, 2011)

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/modelset/AtomCollection.java
    trunk/Jmol/src/org/jmol/modelset/ModelSet.java
    trunk/Jmol/src/org/jmol/script/ScriptEval.java
    trunk/Jmol/src/org/jmol/script/ScriptExpr.java
    trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/viewer/Viewer.java

Modified: trunk/Jmol/src/org/jmol/modelset/AtomCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java        2015-01-27 
05:24:40 UTC (rev 20243)
+++ trunk/Jmol/src/org/jmol/modelset/AtomCollection.java        2015-01-27 
13:49:18 UTC (rev 20244)
@@ -278,7 +278,7 @@
     return (i < 0 ? null : at[i].group.getQuaternion(qtype));
   } 
 
-  public int getAtomIndexFromAtomNumber(int atomNumber, BS bsVisibleFrames) {
+  public int getFirstAtomIndexFromAtomNumber(int atomNumber, BS 
bsVisibleFrames) {
     //definitely want FIRST (model) not last here
     for (int i = 0; i < ac; i++) {
       Atom atom = at[i];

Modified: trunk/Jmol/src/org/jmol/modelset/ModelSet.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/ModelSet.java      2015-01-27 05:24:40 UTC 
(rev 20243)
+++ trunk/Jmol/src/org/jmol/modelset/ModelSet.java      2015-01-27 13:49:18 UTC 
(rev 20244)
@@ -4079,6 +4079,21 @@
     return ret;
   }
 
+  public BS getAtomsFromAtomNumberInFrame(int atomNumber) {
+    BS bs = new BS();
+    BS bsModels = vwr.getVisibleFramesBitSet();
+    for (int i = ac; --i >= 0;) {
+      Atom atom = at[i];
+      if (!bsModels.get(atom.mi)) {
+        i = am[atom.mi].firstAtomIndex;
+        continue;
+      }
+      if (atom.getAtomNumber() == atomNumber)
+        bs.set(i);
+    }
+    return bs;
+  }
 
+
 }
 

Modified: trunk/Jmol/src/org/jmol/script/ScriptEval.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptEval.java      2015-01-27 05:24:40 UTC 
(rev 20243)
+++ trunk/Jmol/src/org/jmol/script/ScriptEval.java      2015-01-27 13:49:18 UTC 
(rev 20244)
@@ -2754,20 +2754,10 @@
         vwr.setAnimDisplay(bs);
       return;
     case T.frame:
-      if (isArrayParameter(2)) {
-        int[] frames = expandFloatArray(
-            floatParameterSet(2, 0, Integer.MAX_VALUE), 1);
-        checkLength(iToken + 1);
-        if (chk)
-          return;
-        Map<String, Object> movie = new Hashtable<String, Object>();
-        if (frames.length > 0)
-          movie.put("frames", frames);
-        movie.put("currentFrame", Integer.valueOf(0));
-        vwr.am.setMovie(movie);
-      } else {
+      if (isArrayParameter(2))
+        setFrameSet(2);
+      else
         cmdModel(2);
-      }
       break;
     case T.mode:
       float startDelay = 1,
@@ -2823,6 +2813,19 @@
     }
   }
 
+  private void setFrameSet(int i) throws ScriptException {
+    int[] frames = expandFloatArray(
+        floatParameterSet(i, 0, Integer.MAX_VALUE), 1);
+    checkLength(iToken + 1);
+    if (chk)
+      return;
+    Map<String, Object> movie = new Hashtable<String, Object>();
+    if (frames.length > 0)
+      movie.put("frames", frames);
+    movie.put("currentFrame", Integer.valueOf(0));
+    vwr.am.setMovie(movie);
+  }
+
   private void cmdAxes(int index) throws ScriptException {
     // axes (index==1) or set axes (index==2)
     TickInfo tickInfo = tickParamAsStr(index, true, true, false);
@@ -4960,9 +4963,9 @@
   }
 
   /**
-   * ONE difference between FRAME and MODEL:
-   *   model 1  sets model NAMED one in the case of PDB
-   *   frame 1  always sets the first model
+   * ONE difference between FRAME and MODEL: model 1 sets model NAMED one in 
the
+   * case of PDB frame 1 always sets the first model
+   * 
    * @param offset
    * @throws ScriptException
    */
@@ -4994,8 +4997,7 @@
         return;
       BS bsa = new BS();
       bsa.set(i);
-      vwr.setCurrentModelIndex(vwr.ms.getModelBS(bsa, false).nextSetBit(
-          0));
+      vwr.setCurrentModelIndex(vwr.ms.getModelBS(bsa, false).nextSetBit(0));
       return;
     case T.create:
       iToken = 1;
@@ -5028,8 +5030,7 @@
       if (checkLength23() > 0)
         if (!chk)
           vwr.setFrameTitleObj(slen == 2 ? "@{_modelName}"
-              : (tokAt(2) == T.varray ? SV.strListValue(st[2])
-                  : paramAsStr(2)));
+              : (tokAt(2) == T.varray ? SV.strListValue(st[2]) : 
paramAsStr(2)));
       return;
     case T.align:
       BS bs = (slen == 2 || tokAt(2) == T.none ? null : atomExpressionAt(2));
@@ -5056,87 +5057,91 @@
     int nFrames = 0;
     float fFrame = 0;
     boolean haveFileSet = vwr.haveFileSet();
-
-    for (int i = offset; i < slen; i++) {
-      switch (getToken(i).tok) {
-      case T.all:
-      case T.times:
-        checkLength(offset + (isRange ? 2 : 1));
-        isAll = true;
-        break;
-      case T.minus: // ignore
-        if (nFrames != 1)
-          invArg();
-        isHyphen = true;
-        break;
-      case T.none:
-        checkLength(offset + 1);
-        break;
-      case T.decimal:
-        useModelNumber = false;
-        if ((fFrame = floatParameter(i)) < 0) {
-          checkLength(i + 1);
-          if (!chk)
-            vwr.am.morph(-fFrame);
-          return;
-        }
-        //$FALL-THROUGH$
-      case T.integer:
-      case T.string:
-        if (nFrames == 2)
-          invArg();
-        int iFrame = (theTok == T.string ? getFloatEncodedInt((String) 
theToken.value)
-            : theToken.intValue);
-        if (iFrame < 0 && nFrames == 1) {
+    if (isArrayParameter(1)) {
+      setFrameSet(1);
+      isAll = true;
+    } else {
+      for (int i = offset; i < slen; i++) {
+        switch (getToken(i).tok) {
+        case T.all:
+        case T.times:
+          checkLength(offset + (isRange ? 2 : 1));
+          isAll = true;
+          break;
+        case T.minus: // ignore
+          if (nFrames != 1)
+            invArg();
           isHyphen = true;
-          iFrame = -iFrame;
-          if (haveFileSet && iFrame < 1000000)
-            iFrame *= 1000000;
-        }
-        if (theTok == T.decimal && haveFileSet && fFrame == (int) fFrame)
-          iFrame = (int) fFrame * 1000000;
-        if (iFrame == Integer.MAX_VALUE) {
-          if (i == 1) {
-            String id = theToken.value.toString();
-            int modelIndex = (chk ? -1 : vwr.getModelIndexFromId(id));
-            if (modelIndex >= 0) {
-              checkLength(2);
-              vwr.setCurrentModelIndex(modelIndex);
-              return;
+          break;
+        case T.none:
+          checkLength(offset + 1);
+          break;
+        case T.decimal:
+          useModelNumber = false;
+          if ((fFrame = floatParameter(i)) < 0) {
+            checkLength(i + 1);
+            if (!chk)
+              vwr.am.morph(-fFrame);
+            return;
+          }
+          //$FALL-THROUGH$
+        case T.integer:
+        case T.string:
+          if (nFrames == 2)
+            invArg();
+          int iFrame = (theTok == T.string ? getFloatEncodedInt((String) 
theToken.value)
+              : theToken.intValue);
+          if (iFrame < 0 && nFrames == 1) {
+            isHyphen = true;
+            iFrame = -iFrame;
+            if (haveFileSet && iFrame < 1000000)
+              iFrame *= 1000000;
+          }
+          if (theTok == T.decimal && haveFileSet && fFrame == (int) fFrame)
+            iFrame = (int) fFrame * 1000000;
+          if (iFrame == Integer.MAX_VALUE) {
+            if (i == 1) {
+              String id = theToken.value.toString();
+              int modelIndex = (chk ? -1 : vwr.getModelIndexFromId(id));
+              if (modelIndex >= 0) {
+                checkLength(2);
+                vwr.setCurrentModelIndex(modelIndex);
+                return;
+              }
             }
+            iFrame = 0; // frame 0.0
           }
-          iFrame = 0; // frame 0.0
-        }
-        if (iFrame == -1) {
-          checkLength(offset + 1);
-          if (!chk)
-            vwr.setAnimation(T.prev);
+          if (iFrame == -1) {
+            checkLength(offset + 1);
+            if (!chk)
+              vwr.setAnimation(T.prev);
+            return;
+          }
+          if (iFrame >= 1000 && iFrame < 1000000 && haveFileSet)
+            iFrame = (iFrame / 1000) * 1000000 + (iFrame % 1000); // initial 
way
+          if (!useModelNumber && iFrame == 0 && nFrames == 0)
+            isAll = true; // 0.0 means ALL; 0 means "all in this range
+          if (iFrame >= 1000000)
+            useModelNumber = false;
+          frameList[nFrames++] = iFrame;
+          break;
+        case T.play:
+          isPlay = true;
+          break;
+        case T.range:
+          isRange = true;
+          break;
+        case T.property:
+          propName = stringParameter(3);
+          SV sv = setVariable(4, -1, "", false);
+          if (sv != null)
+            prop = SV.oValue(sv);
+          i = slen;
+          break;
+        default:
+          frameControl(offset);
           return;
         }
-        if (iFrame >= 1000 && iFrame < 1000000 && haveFileSet)
-          iFrame = (iFrame / 1000) * 1000000 + (iFrame % 1000); // initial way
-        if (!useModelNumber && iFrame == 0 && nFrames == 0)
-          isAll = true; // 0.0 means ALL; 0 means "all in this range
-        if (iFrame >= 1000000)
-          useModelNumber = false;
-        frameList[nFrames++] = iFrame;
-        break;
-      case T.play:
-        isPlay = true;
-        break;
-      case T.range:
-        isRange = true;
-        break;
-      case T.property:
-        propName = stringParameter(3);
-        SV sv = setVariable(4, -1, "", false);
-        if (sv != null)
-          prop = SV.oValue(sv);
-        i = slen;
-        break;
-      default:
-        frameControl(offset);
-        return;
       }
     }
     if (isRange && nFrames == 0)
@@ -5160,7 +5165,7 @@
           frameList[i] %= 1000000;
     int modelIndex = vwr.ms.getModelNumberIndex(frameList[0], useModelNumber,
         false);
-    
+
     int modelIndex2 = -1;
     if (haveFileSet && modelIndex < 0 && frameList[0] != 0) {
       // may have frame 2.0 or frame 2 meaning the range of models in file 2

Modified: trunk/Jmol/src/org/jmol/script/ScriptExpr.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptExpr.java      2015-01-27 05:24:40 UTC 
(rev 20243)
+++ trunk/Jmol/src/org/jmol/script/ScriptExpr.java      2015-01-27 13:49:18 UTC 
(rev 20244)
@@ -2323,7 +2323,7 @@
           v = (vt.tok == T.varray ? vt : SV.oValue(vt));
         } else {
           if (tokAt(i) == T.integer) {
-            v = vwr.ms.getAtoms(T.atomno, Integer.valueOf(st[i].intValue));
+            v = vwr.ms.getAtomsFromAtomNumberInFrame(st[i].intValue);
           } else {
             v = getParameter(var, T.nada, true);
           }

Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-01-27 05:24:40 UTC 
(rev 20243)
+++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-01-27 13:49:18 UTC 
(rev 20244)
@@ -1127,7 +1127,7 @@
           ptFloat = (ptFloat + 1) % 2;
           rangeMinMax[ptFloat] = iParam;
         } else {
-          atomIndex = vwr.getAtomIndexFromAtomNumber(iParam);
+          atomIndex = vwr.ms.getFirstAtomIndexFromAtomNumber(iParam, 
vwr.getVisibleFramesBitSet());
           if (!chk && atomIndex < 0)
             return;
           if (value != null)

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-01-27 05:24:40 UTC 
(rev 20243)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-01-27 13:49:18 UTC 
(rev 20244)
@@ -19,6 +19,14 @@
 
 Jmol.___JmolVersion="14.3.12_2015.01.26"
 
+new feature: frame [1 3 5 6]
+ -- sets limited number of frames for animation and frame * 
+ -- same as animation frame [1 3 5 6]; frame *
+ 
+bug fix: @3 for "atomno=3" should not extend to models that are not part of 
the current model set
+ -- commonly used for shortcut at the console
+ -- provides a function distinct from "atomno=3"
+ 
 new feature: CGO PostScript option
 
 bug fix: CGO LINE_LOOP not closing

Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Viewer.java  2015-01-27 05:24:40 UTC (rev 
20243)
+++ trunk/Jmol/src/org/jmol/viewer/Viewer.java  2015-01-27 13:49:18 UTC (rev 
20244)
@@ -2783,11 +2783,6 @@
         null, atomIndexNot, allowCyclic, true);
   }
 
-  public int getAtomIndexFromAtomNumber(int atomNumber) {
-    return ms.getAtomIndexFromAtomNumber(atomNumber,
-        getVisibleFramesBitSet());
-  }
-
   @Override
   public BS getElementsPresentBitSet(int modelIndex) {
     return ms.getElementsPresentBitSet(modelIndex);

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


------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to