Revision: 5198
Author:   hansonr
Date:     2006-06-03 02:41:15 -0700 (Sat, 03 Jun 2006)
ViewCVS:  http://svn.sourceforge.net/jmol/?rev=5198&view=rev

Log Message:
-----------
bob200603 set measureAllModels

Modified Paths:
--------------
    branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java
    branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java      2006-06-03 
09:39:58 UTC (rev 5197)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Frame.java      2006-06-03 
09:41:15 UTC (rev 5198)
@@ -708,7 +708,8 @@
   }
 
   int getAtomIndexFromAtomNumber(int atomNumber) {
-    for (int i = atomCount; --i >= 0;) {
+    //definitely want FIRST (model) not last here
+    for (int i = 0; i < atomCount; i++) {
       if (atoms[i].getAtomNumber() == atomNumber)
         return i;
     }
@@ -1797,7 +1798,7 @@
   }
   
   int firstAtomOf(BitSet bs) {
-    for (int i = atomCount; --i >= 0;)
+    for (int i = 0; i < atomCount; i++)
       if (bs.get(i)) {
         return i;
       }
@@ -1939,6 +1940,8 @@
       return getSpecSeqcode(specInfo);
     if (setType.equals("SpecChain"))
       return getSpecChain((char) specInfo);
+    if (setType.equals("atomno"))
+      return getSpecAtomNumber(specInfo);
     return null;
   }
 
@@ -1952,6 +1955,15 @@
     return bsRes;
   }
 
+  BitSet getSpecAtomNumber(int atomno) {
+    BitSet bsRes = new BitSet();
+    for (int i = atomCount; --i >= 0;) {
+      if (atoms[i].getAtomNumber() == atomno)
+        bsRes.set(i);
+    }
+    return bsRes;
+  }
+
   BitSet getSpecResid(int resid) {
     BitSet bsRes = new BitSet();
     for (int i = atomCount; --i >= 0;) {

Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java   2006-06-03 
09:39:58 UTC (rev 5197)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Measures.java   2006-06-03 
09:41:15 UTC (rev 5198)
@@ -64,9 +64,23 @@
   }
 
   void define(int[] atomCountPlusIndices) {
-    
+    if (viewer.getMeasureAllModelsFlag()) {
+      Vector measureList = new Vector();
+      int nPoints = atomCountPlusIndices[0];
+      for (int i = 1; i <= nPoints; i++) {
+        Atom atom = frame.atoms[atomCountPlusIndices[i]];
+        measureList.add(viewer.getAtomBits("atomno", atom.getAtomNumber()));
+      }
+      define(measureList);
+      return;
+    }    
+    defineOnly(atomCountPlusIndices);
+  }
+  
+  void defineOnly(int[] atomCountPlusIndices) {
     if (isDefined(atomCountPlusIndices))
       return;
+    
     float value = frame.getMeasurement(atomCountPlusIndices);
     //System.out.println("measures define value,maxmin "+value+" 
"+rangeMinMax[0]+" "+rangeMinMax[1]);
     
@@ -82,9 +96,9 @@
                                                   measurementGrowthIncrement);
     }
     viewer.setStatusNewDefaultModeMeasurement("measureCompleted" , 
measurementCount, measureNew.toVector().toString());
-    measurements[measurementCount++] = measureNew;
+    measurements[measurementCount++] = measureNew;    
   }
-  
+
   boolean delete(Object value) {
     if (value instanceof int[])
       return delete((int[])value);
@@ -139,7 +153,6 @@
    *simple!
    *
    */
-  
     int nPoints = monitorExpressions.size();
     if (nPoints < 2)
       return;
@@ -149,6 +162,7 @@
         isOneToOne = false;
     int[] atomCountPlusIndices = new int[5];
     atomCountPlusIndices[0] = nPoints;
+    //System.out.println("measure define "+ nPoints + " " + isOneToOne);
     nextMeasure(0, nPoints, monitorExpressions, atomCountPlusIndices, 
isOneToOne ? -1 : 0);
   }
 
@@ -162,7 +176,7 @@
         if (thispt > 0 && i == atomCountPlusIndices[thispt])
           continue;
         int modelIndex = frame.atoms[i].getModelIndex();
-        //System.out.println("nextMeasure i"+i+" modelIndex:"+modelIndex);
+        //System.out.println("nextMeasure i "+i+" modelIndex:"+modelIndex + " 
thismodel = "+thisModel);
         if (thisModel >= 0) {
           if (thispt == 0) {
             thisModel = modelIndex;
@@ -173,7 +187,7 @@
         atomCountPlusIndices[thispt + 1] = i;
         if (thispt == nPoints - 1) {
           if (!isDefined(atomCountPlusIndices))
-            define(atomCountPlusIndices);
+            defineOnly(atomCountPlusIndices);
         } else {
           nextMeasure(thispt + 1, nPoints, monitorExpressions,
               atomCountPlusIndices, thisModel);


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



_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to