Revision: 20846
          http://sourceforge.net/p/jmol/code/20846
Author:   hansonr
Date:     2015-10-27 11:42:29 +0000 (Tue, 27 Oct 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.5.0_2015.10.24"

bug fix: polyhedra not read from state (14.5 only)
code: unnecessary FRAME commands removed from state

JmolVersion="14.5.0_2015.10.24"

bug fix: [{1,2,3},{4,5,6}].average fails
bug fix: [{1,2,3},{4,5,6}].pivot should return "NaN"

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
    trunk/Jmol/src/org/jmol/scriptext/MathExt.java
    trunk/Jmol/src/org/jmol/shape/Axes.java
    trunk/Jmol/src/org/jmol/shape/FontLineShape.java
    trunk/Jmol/src/org/jmol/shape/Uccage.java
    trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java
    trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/viewer/StateCreator.java

Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-10-22 18:25:23 UTC 
(rev 20845)
+++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-10-27 11:42:29 UTC 
(rev 20846)
@@ -674,7 +674,7 @@
       case T.pointgroup:
         if (!chk) {
           if (eval.tokAt(2) == T.polyhedra) {
-            showString((String) getShapePropertyIndex(JC.SHAPE_POLYHEDRA, 
"symmetry", 0));
+            showString((String) getShapePropertyIndex(JC.SHAPE_POLYHEDRA, 
"symmetry", tokAt(3) == T.off ? 0 : 1));
           } else {
             showString(vwr.ms.calculatePointGroup(vwr.bsA()));
           }

Modified: trunk/Jmol/src/org/jmol/scriptext/MathExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/MathExt.java      2015-10-22 18:25:23 UTC 
(rev 20845)
+++ trunk/Jmol/src/org/jmol/scriptext/MathExt.java      2015-10-27 11:42:29 UTC 
(rev 20846)
@@ -726,9 +726,8 @@
      * 
      * 
      */
-
-    boolean isBondCount = (tok == T.bondcount);
-    if (args.length > 5 || isBondCount && args.length != 1)
+    
+    if (args.length > 5)
       return false;
     float min = Integer.MIN_VALUE, max = Integer.MAX_VALUE;
     float fmin = 0, fmax = Float.MAX_VALUE;
@@ -740,6 +739,9 @@
     boolean isBonds = false;
     switch (tok) {
     case T.polyhedra:
+      // polyhedra()
+      // polyhedra(3)
+      // polyhedra(smilesString)
       int nv = Integer.MIN_VALUE;
       String smiles = null;
       if (args.length > 0) {
@@ -756,8 +758,9 @@
       vwr.shm.getShapePropertyData(JC.SHAPE_POLYHEDRA, "centers", data);
       return mp.addXBs(data[2] == null ? new BS() : (BS) data[2]);
     case T.bondcount:
+      // {atoms1}.bondCount({atoms2})
       SV x1 = mp.getX();
-      if (x1.tok != T.bitset)
+      if (x1.tok != T.bitset || args.length != 1 || args[0].tok != T.bitset)
         return false;
       atoms1 = SV.bsSelectVar(x1);
       atoms2 = SV.bsSelectVar(args[0]);
@@ -773,6 +776,8 @@
       }
       return mp.addXList(list);
     }
+    
+    // connected(
     for (int i = 0; i < args.length; i++) {
       SV var = args[i];
       switch (var.tok) {
@@ -2134,7 +2139,7 @@
    * @param mp
    * @param args
    * @param tok
-   * @return
+   * @return true
    * @throws ScriptException
    */
   private boolean evaluatePlane(ScriptMathProcessor mp, SV[] args, int tok)
@@ -3303,6 +3308,8 @@
     Map<String, Integer> htPivot = null;
     while (true) {
       if (AU.isAF(floatOrSVArray)) {
+        if (tok == T.pivot)
+          return "NaN";
         data = (float[]) floatOrSVArray;
         ndata = data.length;
         if (ndata == 0)
@@ -3315,6 +3322,8 @@
             break;
         } else {
           SV sv0 = sv.get(0);
+          if (sv0.tok == T.point3f)
+            return getMinMaxPoint(sv, tok);
           if (sv0.tok == T.string && ((String) sv0.value).startsWith("{")) {
             Object pt = SV.ptValue(sv0);
             if (pt instanceof P3)
@@ -3352,7 +3361,7 @@
       boolean isInt = true;
       boolean isPivot = (tok == T.pivot);
       for (int i = ndata; --i >= 0;) {
-        SV svi = sv.get(i);
+        SV svi = (sv == null ? SV.vF : sv.get(i));
         float v = (isPivot ? 1 : data == null ? SV.fValue(svi) : data[i]);
         if (Float.isNaN(v))
           continue;
@@ -3433,52 +3442,44 @@
       sv = (Lst<SV>) pointOrSVArray;
       ndata = sv.size();
     }
-    if (sv != null || data != null) {
-      P3 result = new P3();
-      float[] fdata = new float[ndata];
-      boolean ok = true;
-      for (int xyz = 0; xyz < 3 && ok; xyz++) {
-        for (int i = 0; i < ndata; i++) {
-          P3 pt = (data == null ? SV.ptValue(sv.get(i)) : data[i]);
-          if (pt == null) {
-            ok = false;
-            break;
-          }
-          switch (xyz) {
-          case 0:
-            fdata[i] = pt.x;
-            break;
-          case 1:
-            fdata[i] = pt.y;
-            break;
-          case 2:
-            fdata[i] = pt.z;
-            break;
-          }
-        }
-        if (!ok)
+    if (sv == null && data == null)
+      return "NaN";
+    P3 result = new P3();
+    float[] fdata = new float[ndata];
+    for (int xyz = 0; xyz < 3; xyz++) {
+      for (int i = 0; i < ndata; i++) {
+        P3 pt = (data == null ? SV.ptValue(sv.get(i)) : data[i]);
+        if (pt == null)
+          return "NaN";
+        switch (xyz) {
+        case 0:
+          fdata[i] = pt.x;
           break;
-        Object f = getMinMax(fdata, tok);
-        if (f instanceof Number) {
-          float value = ((Number) f).floatValue();
-          switch (xyz) {
-          case 0:
-            result.x = value;
-            break;
-          case 1:
-            result.y = value;
-            break;
-          case 2:
-            result.z = value;
-            break;
-          }
-        } else {
+        case 1:
+          fdata[i] = pt.y;
           break;
+        case 2:
+          fdata[i] = pt.z;
+          break;
         }
       }
-      return result;
+      Object f = getMinMax(fdata, tok);
+      if (!(f instanceof Number))
+        return "NaN";
+      float value = ((Number) f).floatValue();
+      switch (xyz) {
+      case 0:
+        result.x = value;
+        break;
+      case 1:
+        result.y = value;
+        break;
+      case 2:
+        result.z = value;
+        break;
+      }
     }
-    return "NaN";
+    return result;
   }
 
   private Object getMinMaxQuaternion(Lst<SV> svData, int tok) {

Modified: trunk/Jmol/src/org/jmol/shape/Axes.java
===================================================================
--- trunk/Jmol/src/org/jmol/shape/Axes.java     2015-10-22 18:25:23 UTC (rev 
20845)
+++ trunk/Jmol/src/org/jmol/shape/Axes.java     2015-10-27 11:42:29 UTC (rev 
20846)
@@ -198,7 +198,7 @@
     if (axisType != null) {
       sb.append("  axes type " + PT.esc(axisType));
     }
-    return super.getShapeState() + sb;
+    return getShapeStateFL() + sb;
   }
 
 }

Modified: trunk/Jmol/src/org/jmol/shape/FontLineShape.java
===================================================================
--- trunk/Jmol/src/org/jmol/shape/FontLineShape.java    2015-10-22 18:25:23 UTC 
(rev 20845)
+++ trunk/Jmol/src/org/jmol/shape/FontLineShape.java    2015-10-27 11:42:29 UTC 
(rev 20846)
@@ -66,6 +66,10 @@
 
   @Override
   public String getShapeState() {
+    return getShapeStateFL();
+  }
+
+  protected String getShapeStateFL() {
     String s = vwr.getFontState(myType, font3d);
     return (tickInfos == null ? s : vwr.getFontLineShapeState(s, myType, 
tickInfos));
   }

Modified: trunk/Jmol/src/org/jmol/shape/Uccage.java
===================================================================
--- trunk/Jmol/src/org/jmol/shape/Uccage.java   2015-10-22 18:25:23 UTC (rev 
20845)
+++ trunk/Jmol/src/org/jmol/shape/Uccage.java   2015-10-27 11:42:29 UTC (rev 
20846)
@@ -38,7 +38,7 @@
   public String getShapeState() {
     if (!ms.haveUnitCells)
       return "";
-    String st = super.getShapeState();
+    String st = getShapeStateFL();
     String s = st;
     int iAtom = vwr.am.cai;
     if (iAtom >= 0)

Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-10-22 18:25:23 UTC 
(rev 20845)
+++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-10-27 11:42:29 UTC 
(rev 20846)
@@ -358,7 +358,7 @@
   public Object getProperty(String propertyName, int index) {
     if (propertyName == "symmetry") {
       String s = "";
-      for (int i = polyhedronCount; --i >= 0;)
+      for (int i = 0; i < polyhedronCount; i++)
         s += polyhedrons[i].getSymmetry(vwr, true) + "\n";
       return s;
     }

Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java        2015-10-22 
18:25:23 UTC (rev 20845)
+++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java        2015-10-27 
11:42:29 UTC (rev 20846)
@@ -8,6 +8,7 @@
 import javajs.util.M4;
 import javajs.util.Measure;
 import javajs.util.P3;
+import javajs.util.T3;
 import javajs.util.V3;
 
 import org.jmol.api.SmilesMatcherInterface;
@@ -45,7 +46,14 @@
   private short[] normixes;
 
   public String smiles, smarts, polySmiles;
+  /**
+   * includes vertices as atoms, with atomic numbers
+   */
   private SymmetryInterface pointGroup;
+  /**
+   * includes vertices as generic points
+   */
+  private SymmetryInterface pointGroupFamily;
   private Float volume;
 
   boolean visible = true;
@@ -89,7 +97,7 @@
   Polyhedron setInfo(Map<String, SV> info, Atom[] at) {
     try {
       collapsed = info.containsKey("collapsed");
-      id = info.get("id").asString();
+      id = (info.containsKey("id") ? info.get("id").asString() : null);
       if (id == null) {
         centralAtom = at[info.get("atomIndex").intValue];
       } else {
@@ -174,6 +182,9 @@
         info.put("atomNumber", Integer.valueOf(centralAtom.getAtomNumber()));
         info.put("atomName", centralAtom.getInfo());
         info.put("element", centralAtom.getElementSymbol());
+        Object energy = vwr.ms.getInfo(centralAtom.mi, "Energy");
+        if (energy != null)
+          info.put("energy", energy);
       }
       info.put("triangleCount", Integer.valueOf(triangles.length));
       info.put("volume", getVolume());
@@ -195,9 +206,8 @@
         info.put("polySmiles", polySmiles);
       if (pointGroup != null)
         info.put("pointGroup", pointGroup.getPointGroupName());
-      Object energy = vwr.ms.getInfo(centralAtom.mi, "Energy");
-      if (energy != null)
-        info.put("energy", energy);
+      if (pointGroupFamily != null)
+        info.put("pointGroupFamily", pointGroupFamily.getPointGroupName());
     }
     if (id != null) {
       info.put("id", id);
@@ -239,25 +249,40 @@
   }
 
   String getSymmetry(Viewer vwr, boolean withPointGroup) {
-    if (id != null)
-      return "";
-    info = null;
-    SmilesMatcherInterface sm = vwr.getSmilesMatcher();
-    try {
-      String details = (distanceRef <= 0 ? null : "r=" + distanceRef);
-      if (smarts == null) {
-        smarts = sm.polyhedronToSmiles(centralAtom, faces, nVertices, null, 
JC.SMILES_TOPOLOGY, null);
-        smiles = sm.polyhedronToSmiles(centralAtom, faces, nVertices, 
vertices, JC.SMILES_TYPE_SMILES, null);
-        polySmiles = sm.polyhedronToSmiles(centralAtom, faces, nVertices, 
vertices,  JC.SMILES_TYPE_SMILES | JC.SMILES_POLYHEDRAL | 
JC.SMILES_ATOM_COMMENT, details);
+    if (id == null) {
+      info = null;
+      SmilesMatcherInterface sm = vwr.getSmilesMatcher();
+      try {
+        String details = (distanceRef <= 0 ? null : "r=" + distanceRef);
+        if (smarts == null) {
+          smarts = sm.polyhedronToSmiles(centralAtom, faces, nVertices, null,
+              JC.SMILES_TOPOLOGY, null);
+          smiles = sm.polyhedronToSmiles(centralAtom, faces, nVertices,
+              vertices, JC.SMILES_TYPE_SMILES, null);
+          polySmiles = sm.polyhedronToSmiles(centralAtom, faces, nVertices,
+              vertices, JC.SMILES_TYPE_SMILES | JC.SMILES_POLYHEDRAL
+                  | JC.SMILES_ATOM_COMMENT, details);
+        }
+      } catch (Exception e) {
       }
-    } catch (Exception e) {
     }
-    if (pointGroup == null && withPointGroup)
-      pointGroup = vwr.ms.getSymTemp(true).setPointGroup(null, vertices, null,
+    if (pointGroup == null && withPointGroup) {
+      T3[] pts = new T3[nVertices];
+      // first time through includes all atoms as atoms
+      for (int i = pts.length; --i >= 0;)
+        pts[i] = vertices[i];
+      pointGroup = vwr.ms.getSymTemp(true).setPointGroup(null, pts, null,
           false, vwr.getFloat(T.pointgroupdistancetolerance),
           vwr.getFloat(T.pointgrouplineartolerance), true);
-    return centralAtom + " " + pointGroup.getPointGroupName();
-
+      // second time through includes all atoms as points only
+      for (int i = pts.length; --i >= 0;)
+        pts[i] = P3.newP(vertices[i]);
+      pointGroupFamily = vwr.ms.getSymTemp(true).setPointGroup(null, pts, null,
+          false, vwr.getFloat(T.pointgroupdistancetolerance),
+          vwr.getFloat(T.pointgrouplineartolerance), true);
+    }
+    return (center == null ? centralAtom : center) + " " + 
pointGroup.getPointGroupName() + " "
+        + "("+pointGroupFamily.getPointGroupName()+")";
   }
 
   /**

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-10-22 18:25:23 UTC 
(rev 20845)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-10-27 11:42:29 UTC 
(rev 20846)
@@ -64,8 +64,18 @@
 
 TODO: working on ID for polyhedra without atom refs
 
-Jmol.___JmolVersion="14.5.0_2015.10.22"
+Jmol.___JmolVersion="14.5.0_2015.10.24"
 
+bug fix: polyhedra not read from state (14.5 only)
+code: unnecessary FRAME commands removed from state
+
+JmolVersion="14.5.0_2015.10.24"
+
+bug fix: [{1,2,3},{4,5,6}].average fails
+bug fix: [{1,2,3},{4,5,6}].pivot should return "NaN"
+
+JmolVersion="14.5.0_2015.10.22"
+
 bug fix: CIF parser fails to read CIF files containing only a single 
(non-loop) _struct_ref_seq_dif.align_id
 bug fix: WRITE .... AS does not properly allow for unquoted file name
 
@@ -8179,7 +8189,7 @@
 version=13.1.7
 
 FEATURE CHANGE: getProperty isosurfaceInfo no longer returns vertex data
-
+       
 new feature: getProperty isosurfaceData returns vertex data
 new feature: set cartoonFancy -- creates elliptical ribbon for cartoons 
        -- if ribbonAspectRatio is its default value of 16, it is reset to 4 
while cartoonFancy = true.

Modified: trunk/Jmol/src/org/jmol/viewer/StateCreator.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/StateCreator.java    2015-10-22 18:25:23 UTC 
(rev 20845)
+++ trunk/Jmol/src/org/jmol/viewer/StateCreator.java    2015-10-27 11:42:29 UTC 
(rev 20846)
@@ -315,32 +315,34 @@
           needOrientations = true;
           break;
         }
+      SB sb = new SB();
       for (int i = 0; i < modelCount; i++) {
-        String fcmd = "  frame " + ms.getModelNumberDotted(i);
+        sb.setLength(0);
         String s = (String) ms.getInfo(i, "modelID");
         if (s != null
             && !s.equals(ms.getInfo(i, "modelID0")))
-          commands.append(fcmd).append("; frame ID ").append(PT.esc(s))
+          sb.append("  frame ID ").append(PT.esc(s))
               .append(";\n");
         String t = ms.frameTitles[i];
         if (t != null && t.length() > 0)
-          commands.append(fcmd).append("; frame title ").append(PT.esc(t))
+          sb.append("  frame title ").append(PT.esc(t))
               .append(";\n");
         if (needOrientations && models[i].orientation != null
             && !ms.isTrajectorySubFrame(i))
-          commands.append(fcmd).append("; ").append(
+          sb.append("  ").append(
               models[i].orientation.getMoveToText(false)).append(";\n");
         if (models[i].frameDelay != 0 && !ms.isTrajectorySubFrame(i))
-          commands.append(fcmd).append("; frame delay ").appendF(
+          sb.append("  frame delay ").appendF(
               models[i].frameDelay / 1000f).append(";\n");
         if (models[i].simpleCage != null) {
-          commands.append(fcmd).append("; unitcell ").append(
+          sb.append("  unitcell ").append(
               Escape.eAP(models[i].simpleCage.getUnitCellVectors())).append(
               ";\n");
-          getShapeState(commands, isAll, JC.SHAPE_UCCAGE);
+          getShapeState(sb, isAll, JC.SHAPE_UCCAGE);
         }
+        if (sb.length() > 0)
+          commands.append("  frame " + ms.getModelNumberDotted(i) + 
";\n").appendSB(sb);
       }
-
       boolean loadUC = false;
       if (ms.unitCells != null) {
         boolean haveModulation = false;
@@ -348,10 +350,13 @@
           SymmetryInterface symmetry = ms.getUnitCell(i);
           if (symmetry == null)
             continue;
-          commands.append("  frame ").append(ms.getModelNumberDotted(i));
-          if (symmetry.getState(commands))
+          sb.setLength(0);
+          if (symmetry.getState(sb)) {
             loadUC = true;
-          commands.append(";\n");
+            commands.append("  frame ")
+              .append(ms.getModelNumberDotted(i))
+              .appendSB(sb).append(";\n");
+          }
           haveModulation |= (vwr.ms.getLastVibrationVector(i, T.modulation) >= 
0);
         }
         if (loadUC)

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