Revision: 20860
          http://sourceforge.net/p/jmol/code/20860
Author:   hansonr
Date:     2015-11-07 00:19:29 +0000 (Sat, 07 Nov 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.5.0_2015.11.06"

bug fix: restoring bonds to a model having fewer bonds than the model for which 
they were saved throws an exception
bug fix: mCIF does not read incommensurately modulated mCIF files
bug fix: WRITE xxx.ZIP  crashes Jmol
bug fix: POLYHEDRA ... {xxx} TO {yyy} not working

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/modelset/AtomCollection.java
    trunk/Jmol/src/org/jmol/modelset/ModelSet.java
    trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
    trunk/Jmol/src/org/jmol/scriptext/MathExt.java
    trunk/Jmol/src/org/jmol/symmetry/PointGroup.java
    trunk/Jmol/src/org/jmol/util/Modulation.java
    trunk/Jmol/src/org/jmol/util/ModulationSet.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/viewer/StateManager.java

Modified: trunk/Jmol/src/org/jmol/modelset/AtomCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java        2015-11-06 
04:48:47 UTC (rev 20859)
+++ trunk/Jmol/src/org/jmol/modelset/AtomCollection.java        2015-11-07 
00:19:29 UTC (rev 20860)
@@ -224,8 +224,9 @@
   
   public Lst<P3> getAtomPointVector(BS bs) {
     Lst<P3> v = new  Lst<P3>();
+    int n = ac;
     if (bs != null) {
-      for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i+1)) {
+      for (int i = bs.nextSetBit(0); i >= 0 && i < n; i = bs.nextSetBit(i+1)) {
         v.addLast(at[i]);
       }
     }

Modified: trunk/Jmol/src/org/jmol/modelset/ModelSet.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/ModelSet.java      2015-11-06 04:48:47 UTC 
(rev 20859)
+++ trunk/Jmol/src/org/jmol/modelset/ModelSet.java      2015-11-07 00:19:29 UTC 
(rev 20860)
@@ -530,7 +530,6 @@
     SymmetryInterface pointGroup = this.pointGroup;
     boolean isPolyhedron = (type != null && 
type.toUpperCase().indexOf(":POLY") >= 0);
     if (isPolyhedron) {
-
       Object[] data = new Object[] { Integer.valueOf(iAtom), null };
       vwr.shm.getShapePropertyData(JC.SHAPE_POLYHEDRA, "points", data);
       pts = (T3[]) data[1];

Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-11-06 04:48:47 UTC 
(rev 20859)
+++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-11-07 00:19:29 UTC 
(rev 20860)
@@ -3294,10 +3294,10 @@
       case T.to:
         if (nAtomSets > 1 || id != null && !haveCenter)
           invPO();
-        if ((tokAt(++i) == T.bitset || tokAt(i) == T.expressionBegin)
-            && !needsGenerating) {
+        nAtomSets = 3; // don't allow two of these
+        if (tokAt(++i) == T.bitset || tokAt(i) == T.expressionBegin) {
           // select... polyhedron .... to ....
-          propertyName = "toBitSet";
+          propertyName = (needsGenerating ? "to" : "toBitSet");
           propertyValue = atomExpressionAt(i);
         } else if (eval.isArrayParameter(i)) {
           // select... polyhedron .... to [...]
@@ -3329,8 +3329,7 @@
         }
         propertyValue = atomExpressionAt(i);
         i = eval.iToken;
-        if (i + 1 == slen)
-          needsGenerating = true;
+        needsGenerating |= (i + 1 == slen);
         break;
       case T.color:
       case T.translucent:
@@ -3408,7 +3407,7 @@
     } else if (!edgeParameterSeen && offset == null && Float.isNaN(scale)) {// 
&& lighting == T.nada)
       error(ScriptError.ERROR_insufficientArguments);
     }
-    if (offset != null) 
+    if (offset != null)
       setShapeProperty(JC.SHAPE_POLYHEDRA, "offset", offset);
     if (!Float.isNaN(scale))
       setShapeProperty(JC.SHAPE_POLYHEDRA, "scale", Float.valueOf(scale));
@@ -3914,7 +3913,8 @@
       } else if (data == "ZIP" || data == "ZIPALL") {
         if (fileName != null) {
           params = new Hashtable<String, Object>();
-          params.put("data", scripts);
+          if (scripts != null)
+            params.put("data", scripts);
           if ((bytes = data = (String) vwr.createZip(fileName, type, params)) 
== null)
             eval.evalError("#CANCELED#", null);
         }

Modified: trunk/Jmol/src/org/jmol/scriptext/MathExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/MathExt.java      2015-11-06 04:48:47 UTC 
(rev 20859)
+++ trunk/Jmol/src/org/jmol/scriptext/MathExt.java      2015-11-07 00:19:29 UTC 
(rev 20860)
@@ -227,25 +227,69 @@
   private boolean evaluatePointGroup(ScriptMathProcessor mp, SV[] args) {
     // pointGroup(points)
     // pointGroup(points, center)
+    // pointGroup(points, center, distanceTolerance (def. 0.2 A), 
linearTolerance (def. 8 deg.)
+    // center can be non-point to ignore, such as 0 or ""
+    T3[] pts;
     P3 center = null;
-    T3[] pts;
+    float distanceTolerance = Float.NaN;
+    float linearTolerance = Float.NaN;
+    BS bsAtoms;
     switch (args.length) {
+    case 4:
+      linearTolerance = args[3].asFloat();
+      //$FALL-THROUGH$
+    case 3:
+      distanceTolerance = args[2].asFloat();
+      //$FALL-THROUGH$
     case 2:
-      center = SV.ptValue(args[1]);
+      switch  (args[1].tok) {
+      case T.point3f:
+        center = SV.ptValue(args[1]);
+        break;
+      case T.bitset:
+        bsAtoms = SV.getBitSet(args[0], false);
+        int iatom = bsAtoms.nextSetBit(0);
+        if (iatom < 0 || iatom >= vwr.ms.ac || bsAtoms.cardinality() != 1)
+          return false;
+        center = vwr.ms.at[iatom];
+        break;
+      }
       //$FALL-THROUGH$
     case 1:
+      switch (args[0].tok) {
+      case T.list:
       Lst<SV> points = args[0].getList();
       pts = new T3[points.size()];
       for (int i = pts.length; --i >= 0;)
         pts[i] = SV.ptValue(points.get(i));
       break;
+      case T.bitset:
+        bsAtoms = SV.getBitSet(args[0], false);
+        Lst<P3> atoms = vwr.ms.getAtomPointVector(bsAtoms);
+        pts = new T3[atoms.size()];
+        for (int i = pts.length; --i >= 0;)
+          pts[i] = atoms.get(i);
+        break;
+      default:
+        return false;
+      }
+      break;
     default:
-      return false;    
+      return false;
     }
-    SymmetryInterface pointGroup = vwr.ms.getSymTemp(true).setPointGroup(null, 
center, pts,
-        null, false,
-        vwr.getFloat(T.pointgroupdistancetolerance), 
vwr.getFloat(T.pointgrouplineartolerance), true);
-    return mp.addXMap((Map<String, ?>) pointGroup.getPointGroupInfo(-1, false, 
true, null, 0, 1));
+    SymmetryInterface pointGroup = vwr.ms.getSymTemp(true).setPointGroup(
+        null,
+        center,
+        pts,
+        null,
+        false,
+        Float.isNaN(distanceTolerance) ? vwr
+            .getFloat(T.pointgroupdistancetolerance) : distanceTolerance,
+        Float.isNaN(linearTolerance) ? vwr
+            .getFloat(T.pointgrouplineartolerance)
+        : linearTolerance, true);
+    return mp.addXMap((Map<String, ?>) pointGroup.getPointGroupInfo(-1, false,
+        true, null, 0, 1));
   }
 
   private boolean evaluateUnitCell(ScriptMathProcessor mp, SV[] args) {

Modified: trunk/Jmol/src/org/jmol/symmetry/PointGroup.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/PointGroup.java    2015-11-06 04:48:47 UTC 
(rev 20859)
+++ trunk/Jmol/src/org/jmol/symmetry/PointGroup.java    2015-11-07 00:19:29 UTC 
(rev 20860)
@@ -41,6 +41,7 @@
 import org.jmol.util.Escape;
 import org.jmol.util.Logger;
 import org.jmol.util.Node;
+import org.jmol.util.Point3fi;
 
 import javajs.util.P3;
 import javajs.util.V3;
@@ -410,6 +411,8 @@
         int bondIndex = (localEnvOnly ? 1 : 1 + Math.max(3,
             ((Node) p).getCovalentBondCount()));
         elements[nAtoms] = ((Node) p).getElementNumber() * bondIndex;
+      } else if (p instanceof Point3fi) {
+        elements[nAtoms] = ((Point3fi) p).sD;
       }
       if (needCenter)
         center.add(points[nAtoms]);
@@ -418,7 +421,7 @@
       center.scale(1f / nAtoms);
     for (int i = nAtoms; --i >= 0;) {
       float r = center.distance(points[i]);
-      if (r < distanceTolerance)
+      if (isAtoms && r < distanceTolerance)
         centerAtomIndex = i;
       radius = Math.max(radius, r);
     }

Modified: trunk/Jmol/src/org/jmol/util/Modulation.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/Modulation.java        2015-11-06 04:48:47 UTC 
(rev 20859)
+++ trunk/Jmol/src/org/jmol/util/Modulation.java        2015-11-07 00:19:29 UTC 
(rev 20860)
@@ -270,6 +270,8 @@
 
     if (isSpin) {
       float[] f = ms.axesLengths;
+      if (f == null)
+        System.out.println("Modulation.java axis error");
       switch (axis) {
       case 'x':
         ms.mxyz.x += v / f[0];

Modified: trunk/Jmol/src/org/jmol/util/ModulationSet.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/ModulationSet.java     2015-11-06 04:48:47 UTC 
(rev 20859)
+++ trunk/Jmol/src/org/jmol/util/ModulationSet.java     2015-11-07 00:19:29 UTC 
(rev 20860)
@@ -359,6 +359,9 @@
       vib.modScale = 1;
       mxyz = new V3(); // modulations of spin
       axesLengths = symmetry.getUnitCellParams(); // required for calculating 
mxyz
+      if (axesLengths == null)
+        axesLengths = symmetry.getUnitCellParams(); // required for 
calculating mxyz
+        
     }
     Matrix vR00 = Matrix.newT(r00, true);
     Matrix vR0 = Matrix.newT(r0, true);
@@ -575,24 +578,25 @@
   private ModulationSet getModCalc() {
     if (modCalc == null) {
       modCalc = new ModulationSet();
+      modCalc.axesLengths = axesLengths;
+      modCalc.enabled = true;
+      modCalc.fileOcc = fileOcc;
+      modCalc.gammaE = gammaE;
+      modCalc.gammaIinv = gammaIinv;
       modCalc.id = id;
-      modCalc.tau = tau;
-      modCalc.spinOp = spinOp;
+      modCalc.modDim = modDim;
       modCalc.mods = mods;
-      modCalc.gammaE = gammaE;
-      modCalc.modDim = modDim;
-      modCalc.gammaIinv = gammaIinv;
+      modCalc.nOps = nOps;
+      modCalc.occParams = occParams;
+      modCalc.occSiteMultiplicity = occSiteMultiplicity;
+      modCalc.r0 = r0;
+      modCalc.rI = rI;
       modCalc.sigma = sigma;
-      modCalc.r0 = r0;
+      modCalc.spinOp = spinOp;
+      modCalc.symmetry = symmetry;
+      modCalc.tau = tau;
       modCalc.v0 = v0;
       modCalc.vib = vib;
-      modCalc.symmetry = symmetry;
-      modCalc.rI = rI;
-      modCalc.fileOcc = fileOcc;
-      modCalc.occParams = occParams;
-      modCalc.occSiteMultiplicity = occSiteMultiplicity;
-      modCalc.nOps = nOps;
-      modCalc.enabled = true;
       if (mxyz != null)
         modCalc.mxyz = new V3();
     }

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-11-06 04:48:47 UTC 
(rev 20859)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-11-07 00:19:29 UTC 
(rev 20860)
@@ -62,8 +62,15 @@
 
 TODO: consider if models with no atoms will cause issues in relation to 
model.firstAtomIndex
 
-Jmol.___JmolVersion="14.5.0_2015.11.03"
+Jmol.___JmolVersion="14.5.0_2015.11.06"
 
+bug fix: restoring bonds to a model having fewer bonds than the model for 
which they were saved throws an exception
+bug fix: mCIF does not read incommensurately modulated mCIF files
+bug fix: WRITE xxx.ZIP  crashes Jmol
+bug fix: POLYHEDRA ... {xxx} TO {yyy} not working
+
+JmolVersion="14.5.0_2015.11.03"
+
 new feature: x = pointgroup([array of points],center)
   -- center is optional, defaulting to average of the points
   -- returns a map:

Modified: trunk/Jmol/src/org/jmol/viewer/StateManager.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/StateManager.java    2015-11-06 04:48:47 UTC 
(rev 20859)
+++ trunk/Jmol/src/org/jmol/viewer/StateManager.java    2015-11-07 00:19:29 UTC 
(rev 20860)
@@ -458,8 +458,8 @@
       b.colix = c.colix;
       b.shapeVisibilityFlags = c.shapeVisibilityFlags;
     }
-    for (int i = bondCount; --i >= 0;)
-      modelSet.bo[i].index = i;
+    for (int i = modelSet.bondCount; --i >= 0;)
+        modelSet.bo[i].index = i;
     vwr.setShapeProperty(JC.SHAPE_STICKS, "reportAll", null);
     return true;
   }

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