Revision: 20646
          http://sourceforge.net/p/jmol/code/20646
Author:   hansonr
Date:     2015-07-09 04:37:42 +0000 (Thu, 09 Jul 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.3.15_2015.07.08c"

bug fix: load files "xxx.png|xxxx" "xxx.png|zzzz"  not read from state properly
bug fix: polyhedra not saved in state property
bug fix: moving atoms with 4x4 matrix not saved in state
bug fix: moving of an atom having a polyhedron fails to move the polyhedron as 
well


new feature: smiles2.find("SMILES",smiles1, asMap, allMappings)
  -- asMap = TRUE (default false) indicates you want an atom 
     correlation map indicating positions in smiles2 corresponding to smiles1 
  -- allMappings = TRUE (default false) indicates you want 
     all mappings, not just the first found 
  -- returns a number, -1, 0, n>0 when asMap is false (allMappings ignored)
  -- returns int[] when allMappings is false
  -- returns int[][] when allMappings is true  
  -- example:
    var s1 = atom1.polyhedron.getProperty("SMILES")
    var coords = atom2.polyhedron.getProperty("vertices")
    var s2 = atom2.polyhedron.getProperty("SMILES")
    var coords2 = atom2.polyhedron.getProperty("vertices")
    var map12 = s2.find("SMILES", s1, true, false)
    var coords2Mapped = []
    for (var i in map12) coords2Mapped.push(coords2[i + 1]) 
    coords2 = coords2Mapped
    var mat = compare(coords1, coords2)
    select {1.1}
    rotateselected @mat
    

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/io/FilesReader.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/shapespecial/Polyhedra.java
    trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java
    trunk/Jmol/src/org/jmol/smiles/SmilesMatcher.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/viewer/StateCreator.java
    
trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/console/ConsoleTextArea.java

Modified: trunk/Jmol/src/org/jmol/io/FilesReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/io/FilesReader.java 2015-07-08 16:15:03 UTC (rev 
20645)
+++ trunk/Jmol/src/org/jmol/io/FilesReader.java 2015-07-09 04:37:42 UTC (rev 
20646)
@@ -91,7 +91,7 @@
     String name = fullPathNamesIn[i];
     String[] subFileList = null;
     htParams.remove("subFileList");
-    if (name.indexOf("|") >= 0) {
+    if (name.indexOf("|") >= 0  && !htParams.containsKey("isStateScript")) {
       subFileList = PT.split(name, "|");
       name = subFileList[0];
     }

Modified: trunk/Jmol/src/org/jmol/modelset/ModelSet.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/ModelSet.java      2015-07-08 16:15:03 UTC 
(rev 20645)
+++ trunk/Jmol/src/org/jmol/modelset/ModelSet.java      2015-07-09 04:37:42 UTC 
(rev 20646)
@@ -3641,8 +3641,10 @@
   public void moveAtoms(M4 m4, M3 mNew, M3 rotation, V3 translation, BS bs,
                         P3 center, boolean isInternal, boolean 
translationOnly) {
     if (m4 != null) {
-      for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1))
+      for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
         m4.rotTrans(at[i]);
+        taintAtom(i, TAINT_COORD);
+      }
       mat4.setM4(m4);
       translation = null;
     } else if (!translationOnly) {
@@ -3689,8 +3691,10 @@
       }
     }
     if (translation != null) {
-      for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1))
+      for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
         at[i].add(translation);
+        taintAtom(i, TAINT_COORD);
+      }
       if (!translationOnly) {
         mat4t.setIdentity();
         mat4t.setTranslation(translation);

Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-07-08 16:15:03 UTC 
(rev 20645)
+++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2015-07-09 04:37:42 UTC 
(rev 20646)
@@ -3179,6 +3179,11 @@
       String propertyName = null;
       Object propertyValue = null;
       switch (getToken(i).tok) {
+      case T.hash:
+        propertyName = "info";
+        propertyValue = e.theToken.value;
+        needsGenerating = true;
+        break;
       case T.unitcell:
         propertyName = "unitCell";
         propertyValue = Boolean.TRUE;

Modified: trunk/Jmol/src/org/jmol/scriptext/MathExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/MathExt.java      2015-07-08 16:15:03 UTC 
(rev 20645)
+++ trunk/Jmol/src/org/jmol/scriptext/MathExt.java      2015-07-09 04:37:42 UTC 
(rev 20646)
@@ -115,7 +115,7 @@
       return evaluateList(mp, op.intValue, args);
     case T.array:
     case T.leftsquare:
-      return evaluateArray(mp, args, tok == T.leftsquare);
+      return evaluateArray(mp, args, false);
     case T.axisangle:
     case T.quaternion:
       return evaluateQuaternion(mp, args, tok);

Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-07-08 16:15:03 UTC 
(rev 20645)
+++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-07-09 04:37:42 UTC 
(rev 20646)
@@ -45,6 +45,7 @@
 import org.jmol.java.BS;
 import org.jmol.modelset.Atom;
 import org.jmol.modelset.Bond;
+import org.jmol.script.SV;
 import org.jmol.script.T;
 import org.jmol.shape.AtomShape;
 import org.jmol.util.BSUtil;
@@ -52,12 +53,10 @@
 import org.jmol.util.Logger;
 import org.jmol.util.Normix;
 
-
-
 public class Polyhedra extends AtomShape {
 
   private final static float DEFAULT_DISTANCE_FACTOR = 1.85f;
-//  private final static float DEFAULT_MANY_VERTEX_DISTANCE_FACTOR = 1.5f;
+  //  private final static float DEFAULT_MANY_VERTEX_DISTANCE_FACTOR = 1.5f;
   private final static float DEFAULT_FACECENTEROFFSET = 0.25f;
   private final static int EDGES_NONE = 0;
   public final static int EDGES_ALL = 1;
@@ -68,12 +67,13 @@
   private V3[] normalsT = new V3[MAX_VERTICES + 1];
   private int[][] planesT = new int[MAX_VERTICES][3];
   private final static P3 randomPoint = P3.new3(3141f, 2718f, 1414f);
-  
+
   private static final int MODE_BONDING = 1;
   private static final int MODE_POINTS = 2;
   private static final int MODE_ITERATE = 3;
   private static final int MODE_BITSET = 4;
   private static final int MODE_UNITCELL = 5;
+  private static final int MODE_INFO = 6;
   /**
    * a dot product comparison term
    */
@@ -89,7 +89,6 @@
   float faceCenterOffset;
   float distanceFactor = Float.NaN;
   boolean isCollapsed;
-  
 
   private boolean iHaveCenterBitSet;
   private boolean bondedOnly;
@@ -98,11 +97,13 @@
   private BS centers;
   private BS bsVertices;
   private BS bsVertexCount;
-  
+
   private boolean useUnitCell;
   private int nPoints;
   private float planarParam;
+  private Map<String, SV> info;
 
+  @SuppressWarnings("unchecked")
   @Override
   public void setProperty(String propertyName, Object value, BS bs) {
 
@@ -115,6 +116,7 @@
       bsVertices = null;
       useUnitCell = false;
       centers = null;
+      info = null;
       bsVertexCount = new BS();
       bondedOnly = isCollapsed = iHaveCenterBitSet = false;
       haveBitSetVertices = false;
@@ -140,9 +142,9 @@
 
     if ("nVertices" == propertyName) {
       int n = ((Integer) value).intValue();
-      if(n < 0) {
+      if (n < 0) {
         if (-n >= nVertices) {
-          bsVertexCount.setBits(nVertices, -n);
+          bsVertexCount.setBits(nVertices, 1 - n);
           nVertices = -n;
         }
       } else {
@@ -203,6 +205,13 @@
       return;
     }
 
+    if ("info" == propertyName) {
+      info = (Map<String, SV>) value;
+      centers = BSUtil.newAndSetBit(((SV) info.get("atomIndex")).intValue);
+      iHaveCenterBitSet = true;
+      return;
+    }
+
     if ("delete" == propertyName) {
       if (!iHaveCenterBitSet)
         centers = bs;
@@ -283,6 +292,7 @@
     if (propertyName == "deleteModelAtoms") {
       int modelIndex = ((int[]) ((Object[]) value)[2])[0];
       for (int i = polyhedronCount; --i >= 0;) {
+        polyhedrons[i].info = null;
         if (polyhedrons[i].modelIndex == modelIndex) {
           polyhedronCount--;
           polyhedrons = (Polyhedron[]) AU.deleteElements(polyhedrons, i, 1);
@@ -296,7 +306,6 @@
     setPropAS(propertyName, value, bs);
   }
 
-  
   @Override
   public boolean getPropertyData(String property, Object[] data) {
     int iatom;
@@ -358,7 +367,7 @@
       iatom = ((Integer) data[0]).intValue();
       for (int i = polyhedronCount; --i >= 0;) {
         if (polyhedrons[i].centralAtom.i == iatom) {
-          data[1] = polyhedrons[i].getInfo(vwr);
+          data[1] = polyhedrons[i].getInfo(vwr, true);
           return true;
         }
       }
@@ -366,15 +375,15 @@
     }
     return false;
   }
-  
+
   @Override
   public Lst<Map<String, Object>> getShapeDetail() {
     Lst<Map<String, Object>> lst = new Lst<Map<String, Object>>();
     for (int i = 0; i < polyhedronCount; i++)
-      lst.addLast(polyhedrons[i].getInfo(vwr));
+      lst.addLast(polyhedrons[i].getInfo(vwr, true));
     return lst;
   }
-  
+
   private void setLighting(boolean isFullyLit, BS bs) {
     for (int i = polyhedronCount; --i >= 0;)
       if (bs.get(polyhedrons[i].centralAtom.i)) {
@@ -421,13 +430,11 @@
 
   private void buildPolyhedra() {
     boolean useBondAlgorithm = radius == 0 || bondedOnly;
-    int mode = (nPoints > 0 ? MODE_POINTS 
-        : haveBitSetVertices ? MODE_BITSET 
-        : useUnitCell ? MODE_UNITCELL 
-        : useBondAlgorithm ? MODE_BONDING
-        : MODE_ITERATE);
-    AtomIndexIterator iter = (mode == MODE_ITERATE ? 
ms.getSelectedAtomIterator(null,
-        false, false, false, false) : null);
+    int mode = (info != null ? MODE_INFO : nPoints > 0 ? MODE_POINTS
+        : haveBitSetVertices ? MODE_BITSET : useUnitCell ? MODE_UNITCELL
+            : useBondAlgorithm ? MODE_BONDING : MODE_ITERATE);
+    AtomIndexIterator iter = (mode == MODE_ITERATE ? ms
+        .getSelectedAtomIterator(null, false, false, false, false) : null);
     for (int i = centers.nextSetBit(0); i >= 0; i = centers.nextSetBit(i + 1)) 
{
       Atom atom = atoms[i];
       Polyhedron p = null;
@@ -448,6 +455,9 @@
         vwr.setIteratorForAtom(iter, i, radius);
         p = constructRadiusPolyhedron(atom, iter);
         break;
+      case MODE_INFO:
+        p = new Polyhedron().setInfo(info, vwr.ms.at);
+        break;
       }
       if (p != null) {
         if (polyhedronCount == polyhedrons.length)
@@ -465,7 +475,8 @@
     return validatePolyhedron(atom, nPoints, otherAtoms);
   }
 
-  private Polyhedron constructUnitCellPolygon(Atom atom, boolean 
useBondAlgorithm) {
+  private Polyhedron constructUnitCellPolygon(Atom atom,
+                                              boolean useBondAlgorithm) {
     SymmetryInterface unitcell = vwr.ms.getUnitCellForAtom(atom.i);
     if (unitcell == null)
       return null;
@@ -474,7 +485,8 @@
       bsAtoms.and(bsVertices);
     if (bsAtoms.isEmpty())
       return null;
-    AtomIndexIterator iter = unitcell.getIterator(vwr, atom, atoms, bsAtoms, 
useBondAlgorithm ? 5f : radius);
+    AtomIndexIterator iter = unitcell.getIterator(vwr, atom, atoms, bsAtoms,
+        useBondAlgorithm ? 5f : radius);
     if (!useBondAlgorithm)
       return constructRadiusPolyhedron(atom, iter);
     float myBondingRadius = atom.getBondingRadius();
@@ -489,7 +501,8 @@
       float otherRadius = other.getBondingRadius();
       P3 pt = iter.getPosition();
       float distance2 = atom.distanceSquared(pt);
-      if (!vwr.ms.isBondable(myBondingRadius, otherRadius, distance2, 
minBondDistance2, bondTolerance))
+      if (!vwr.ms.isBondable(myBondingRadius, otherRadius, distance2,
+          minBondDistance2, bondTolerance))
         continue;
       otherAtoms[bondCount++] = pt;
       if (bondCount >= MAX_VERTICES)
@@ -508,17 +521,17 @@
         if (!bond.isCovalent())
           continue;
         Atom other = bond.getOtherAtom(atom);
-        if (bsVertices != null && !bsVertices.get(i) 
-            || radius > 0 && other.distance(atom) > radius)
+        if (bsVertices != null && !bsVertices.get(i) || radius > 0
+            && other.distance(atom) > radius)
           continue;
         otherAtoms[bondCount++] = other;
         if (bondCount >= MAX_VERTICES)
           break;
       }
     }
-    return (bondCount < 3 || bondCount >= MAX_VERTICES 
-        || nVertices > 0 && !bsVertexCount.get(bondCount) ? null
-        : validatePolyhedron(atom, bondCount, otherAtoms));
+    return (bondCount < 3 || bondCount >= MAX_VERTICES || nVertices > 0
+        && !bsVertexCount.get(bondCount) ? null : validatePolyhedron(atom,
+        bondCount, otherAtoms));
   }
 
   private Polyhedron constructBitSetPolyhedron(Atom atom) {
@@ -529,8 +542,7 @@
     return validatePolyhedron(atom, otherAtomCount, otherAtoms);
   }
 
-  private Polyhedron constructRadiusPolyhedron(Atom atom,
-                                               AtomIndexIterator iter) {
+  private Polyhedron constructRadiusPolyhedron(Atom atom, AtomIndexIterator 
iter) {
     int otherAtomCount = 0;
     while (iter.hasNext()) {
       Atom other = atoms[iter.next()];
@@ -548,18 +560,19 @@
       otherAtoms[otherAtomCount++] = pt;
     }
     return (otherAtomCount < 3 || nVertices > 0
-        && !bsVertexCount.get(otherAtomCount) ? null : validatePolyhedron(
-        atom, otherAtomCount, otherAtoms));
+        && !bsVertexCount.get(otherAtomCount) ? null : validatePolyhedron(atom,
+        otherAtomCount, otherAtoms));
   }
 
   private Polyhedron validatePolyhedron(Atom centralAtom, int vertexCount,
-                                           P3[] otherAtoms) {
+                                        P3[] otherAtoms) {
     int planeCount = 0;
     int iCenter = vertexCount;
     int nPoints = iCenter + 1;
     float distMax = 0;
     float dAverage = 0;
-    float planarParam = (Float.isNaN(this.planarParam) ? DEFAULT_PLANAR_PARAM 
: this.planarParam);
+    float planarParam = (Float.isNaN(this.planarParam) ? DEFAULT_PLANAR_PARAM
+        : this.planarParam);
 
     P3[] points = new P3[MAX_VERTICES * 3];
     points[iCenter] = otherAtoms[iCenter] = centralAtom;
@@ -574,8 +587,8 @@
     boolean isComplex = (nother1 > 6);
     // for many-vertex polygons we reduce the  distance allowed to avoid 
through-polyhedron faces
     float factor = (!Float.isNaN(distanceFactor) ? distanceFactor
-        //: isComplex ? DEFAULT_MANY_VERTEX_DISTANCE_FACTOR 
-            : DEFAULT_DISTANCE_FACTOR);
+    //: isComplex ? DEFAULT_MANY_VERTEX_DISTANCE_FACTOR 
+        : DEFAULT_DISTANCE_FACTOR);
     BS bs = BS.newN(iCenter);
     boolean isOK = (dAverage == 0);
 
@@ -606,7 +619,7 @@
           if (Logger.debugging) {
             Logger.debug("Polyhedra distanceFactor for " + iCenter
                 + " atoms increased to " + factor + " in order to include "
-                + otherAtoms[i] );
+                + otherAtoms[i]);
           }
           break;
         }
@@ -653,8 +666,8 @@
     int vmax = MAX_VERTICES;
     P3 rpt = randomPoint;
     BS bsTemp = Normix.newVertexBitSet();
-    V3[] normals = normalsT; 
-    Map<Integer,String> htNormMap = new Hashtable<Integer, String>();
+    V3[] normals = normalsT;
+    Map<Integer, String> htNormMap = new Hashtable<Integer, String>();
     BS bsFlat = new BS();
     boolean doCheckPlane = isComplex;
     for (int i = 0; i < nother2; i++)
@@ -700,7 +713,7 @@
           if (collapsed || isFlat && facetCatalog.indexOf(facet) < 0) {
             facetCatalog += facet;
             p[planeCount] = new int[] { isWindingOK ? i : j,
-                isWindingOK ? j : i, nRef , isFlat ? -7 : -6};
+                isWindingOK ? j : i, nRef, isFlat ? -15 : -6 };
             getNormalFromCenter(points[k], points[i], points[j], ptRef, false,
                 normal);
             if (isFlat)
@@ -711,7 +724,7 @@
           if (collapsed || isFlat && facetCatalog.indexOf(facet) < 0) {
             facetCatalog += facet;
             p[planeCount] = new int[] { isWindingOK ? i : k, nRef,
-                isWindingOK ? k : i , isFlat ? -7 : -5};
+                isWindingOK ? k : i, isFlat ? -15 : -5 };
             getNormalFromCenter(points[j], points[i], ptRef, points[k], false,
                 normal);
             if (isFlat)
@@ -722,7 +735,7 @@
           if (collapsed || isFlat && facetCatalog.indexOf(facet) < 0) {
             facetCatalog += facet;
             p[planeCount] = new int[] { nRef, isWindingOK ? j : k,
-                isWindingOK ? k : j , isFlat ? -7 : -4};
+                isWindingOK ? k : j, isFlat ? -15 : -4 };
             getNormalFromCenter(points[i], ptRef, points[j], points[k], false,
                 normal);
             if (isFlat)
@@ -735,7 +748,7 @@
             } else {
               // finally, the standard face:
               p[planeCount] = new int[] { isWindingOK ? i : j,
-                  isWindingOK ? j : i, k, -7};
+                  isWindingOK ? j : i, k, -7 };
               normals[planeCount] = normal;
               if (!doCheckPlane
                   || checkPlane(points, iCenter, p, normals, planeCount, plane,
@@ -746,17 +759,17 @@
         }
       }
     nPoints--;
-    
+
     if (Logger.debugging) {
       Logger
           .info("Polyhedron planeCount=" + planeCount + " nPoints=" + nPoints);
-      for (int i = 0; i < planeCount; i++) 
+      for (int i = 0; i < planeCount; i++)
         Logger.info("Polyhedron " + getKey(p[i], i));
     }
-    return new Polyhedron(centralAtom, iCenter, nPoints, planeCount,
-        otherAtoms, normals, bsFlat, p, collapsed, offset, factor, 
planarParam);
+    return new Polyhedron().set(centralAtom, iCenter, nPoints, planeCount,
+        otherAtoms, normals, bsFlat, p, collapsed);
   }
-  
+
   /**
    * 
    * @param ptCenter
@@ -765,10 +778,10 @@
    * @param ptC
    * @param isOutward
    * @param normal
-   * @return        true if winding is proper; false if not
+   * @return true if winding is proper; false if not
    */
-  private boolean getNormalFromCenter(P3 ptCenter, P3 ptA, P3 ptB,
-                            P3 ptC, boolean isOutward, V3 normal) {
+  private boolean getNormalFromCenter(P3 ptCenter, P3 ptA, P3 ptB, P3 ptC,
+                                      boolean isOutward, V3 normal) {
     V3 vAB = new V3();
     float d = Measure.getNormalThroughPoints(ptA, ptB, ptC, normal, vAB);
     boolean isReversed = (Measure.distanceToPlaneV(normal, d, ptCenter) > 0);
@@ -778,7 +791,6 @@
     return !isReversed;
   }
 
-
   /**
    * Clean out oeverlapping triangles based on normals. For now, we use
    * normixes, which are approximations of normals. It is not 100% guaranteed
@@ -792,25 +804,25 @@
    * @param plane
    * @param vNorm
    * @param htNormMap
-   * @param planarParam 
-   * @param bsTemp 
+   * @param planarParam
+   * @param bsTemp
    * @return true if valid
    */
   private boolean checkPlane(P3[] points, int ptCenter, int[][] planes,
                              V3[] normals, int index, P4 plane, V3 vNorm,
-                             Map<Integer, String> htNormMap, float 
planarParam, BS bsTemp) {
-    
+                             Map<Integer, String> htNormMap, float planarParam,
+                             BS bsTemp) {
+
     int[] p1 = planes[index];
-    
-    
+
     // Check here for a 3D convex hull: 
     plane = Measure.getPlaneThroughPoints(points[p1[0]], points[p1[1]],
         points[p1[2]], vNorm, vAB, plane);
-//    P3 ptest = P3.newP(points[p1[0]]);
-//    ptest.add(points[p1[1]]);
-//    ptest.add(points[p1[2]]);
-//    ptest.scale(1/3f);
-//    System.out.println("$draw ID p" + index +" vector " + ptest  + vNorm);
+    //    P3 ptest = P3.newP(points[p1[0]]);
+    //    ptest.add(points[p1[1]]);
+    //    ptest.add(points[p1[2]]);
+    //    ptest.scale(1/3f);
+    //    System.out.println("$draw ID p" + index +" vector " + ptest  + 
vNorm);
 
     // See if all vertices are OUTSIDE the the plane we are considering.      
     for (int j = 0; j < ptCenter; j++) {
@@ -826,12 +838,12 @@
     if (list == null) {
       // we must see if there is a close normix to this
       V3[] norms = Normix.getVertexVectors();
-      for (Entry<Integer, String> e: htNormMap.entrySet()) {
+      for (Entry<Integer, String> e : htNormMap.entrySet()) {
         if (norms[e.getKey().intValue()].dot(norm) > planarParam) {
           list = e.getValue();
           break;
         }
-      }      
+      }
     }
     int ipt;
     String match = getKey(p1, index);
@@ -867,8 +879,8 @@
           planes[ipt] = pnew;
           list = PT.rep(list, getKey(p0, ipt), getKey(pnew, ipt));
           htNormMap.put(normix, list);
-//          System.out.println("" + normix + " " + 
Normix.getVertexVectors()[normix] + " " + getKey(p0, ipt) + " + "
-  //            + getKey(p1, index) + " = " + getKey(pnew, ipt));
+          //          System.out.println("" + normix + " " + 
Normix.getVertexVectors()[normix] + " " + getKey(p0, ipt) + " + "
+          //            + getKey(p1, index) + " = " + getKey(pnew, ipt));
           return false;
         }
       }
@@ -923,25 +935,23 @@
 
   @Override
   public void setModelVisibilityFlags(BS bsModels) {
-     /*
-     * set all fixed objects visible; others based on model being displayed 
note
-     * that this is NOT done with atoms and bonds, because they have mads. When
-     * you say "frame 0" it is just turning on all the mads.
-     */
+    /*
+    * set all fixed objects visible; others based on model being displayed note
+    * that this is NOT done with atoms and bonds, because they have mads. When
+    * you say "frame 0" it is just turning on all the mads.
+    */
     for (int i = polyhedronCount; --i >= 0;) {
       Polyhedron p = polyhedrons[i];
       if (ms.at[p.centralAtom.i].isDeleted())
         p.isValid = false;
-      p.visibilityFlags = (p.visible 
-          && bsModels.get(p.modelIndex)
-          && !ms.isAtomHidden(p.centralAtom.i) 
-          && !ms.at[p.centralAtom.i].isDeleted() ? vf
-          : 0);
+      p.visibilityFlags = (p.visible && bsModels.get(p.modelIndex)
+          && !ms.isAtomHidden(p.centralAtom.i)
+          && !ms.at[p.centralAtom.i].isDeleted() ? vf : 0);
       if (p.visibilityFlags != 0)
         setShapeVisibility(atoms[p.centralAtom.i], true);
     }
   }
-  
+
   @Override
   public String getShapeState() {
     if (polyhedronCount == 0)
@@ -949,7 +959,7 @@
     SB s = new SB();
     for (int i = 0; i < polyhedronCount; i++)
       if (polyhedrons[i].isValid)
-        s.append(polyhedrons[i].getState());
+        s.append(polyhedrons[i].getState(vwr));
     if (drawEdges == EDGES_FRONT)
       appendCmd(s, "polyhedra frontedges");
     else if (drawEdges == EDGES_ALL)
@@ -957,11 +967,17 @@
     s.append(vwr.getAtomShapeState(this));
     for (int i = 0; i < polyhedronCount; i++) {
       Polyhedron p = polyhedrons[i];
-      if (p.isValid && p.colixEdge != C.INHERIT_ALL && 
bsColixSet.get(p.centralAtom.i))
-        appendCmd(s, "select ({" + p.centralAtom.i + "}); color polyhedra " 
-      + (C.isColixTranslucent(colixes[p.centralAtom.i]) ? "translucent " : "") 
-      + C.getHexCode(colixes[p.centralAtom.i]) + " "  + 
C.getHexCode(p.colixEdge));
-  }
+      if (p.isValid && p.colixEdge != C.INHERIT_ALL
+          && bsColixSet.get(p.centralAtom.i))
+        appendCmd(
+            s,
+            "select ({"
+                + p.centralAtom.i
+                + "}); color polyhedra "
+                + (C.isColixTranslucent(colixes[p.centralAtom.i]) ? 
"translucent "
+                    : "") + C.getHexCode(colixes[p.centralAtom.i]) + " "
+                + C.getHexCode(p.colixEdge));
+    }
     return s.toString();
   }
 }

Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java        2015-07-08 
16:15:03 UTC (rev 20645)
+++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java        2015-07-09 
04:37:42 UTC (rev 20646)
@@ -4,7 +4,9 @@
 import java.util.Map;
 
 import javajs.util.AU;
+import javajs.util.Lst;
 import javajs.util.M4;
+import javajs.util.Measure;
 import javajs.util.P3;
 import javajs.util.V3;
 
@@ -12,41 +14,47 @@
 import org.jmol.api.SymmetryInterface;
 import org.jmol.java.BS;
 import org.jmol.modelset.Atom;
+import org.jmol.modelset.ModelSet;
+import org.jmol.script.SV;
 import org.jmol.script.T;
 import org.jmol.util.C;
+import org.jmol.util.Escape;
+import org.jmol.util.Node;
 import org.jmol.util.Normix;
+import org.jmol.util.Point3fi;
 import org.jmol.viewer.Viewer;
 
 public class Polyhedron {
 
   int modelIndex;
-  public final Atom centralAtom;
-  public final P3[] vertices;
+  public Atom centralAtom;
+  public P3[] vertices;
+  public int[][] faces;
   int nVertices;
-  boolean visible;
-  private final V3[] normals;
+  boolean collapsed = false;
+  private BS bsFlat;
+  
+  private V3[] normals;
   private short[] normixes;
-  public int[][] faces;
-  public int visibilityFlags = 0;
-  boolean collapsed = false;
-  float faceCenterOffset, distanceFactor, planarParam;
+  public String smiles, smarts;
+  private SymmetryInterface pointGroup;
+  private Float volume;
+
+  boolean visible = true;
   boolean isFullyLit;
   public boolean isValid = true;
   public short colixEdge = C.INHERIT_ALL;
-  public String smiles, smarts;
-  private SymmetryInterface pointGroup;
-  Float volume;
-  private BS bsFlat;
+  public int visibilityFlags = 0;
 
-  Polyhedron(Atom centralAtom, int nVertices, int nPoints, int planeCount,
-      P3[] otherAtoms, V3[] normals, BS bsFlat, int[][] planes,
-      boolean collapsed, float faceCenterOffset, float distanceFactor,
-      float planarParam) {
+  Polyhedron() {  
+  }
+  
+  Polyhedron set(Atom centralAtom, int nVertices, int nPoints, int planeCount,
+      P3[] otherAtoms, V3[] normals, BS bsFlat, int[][] planes, boolean 
collapsed) {
     this.centralAtom = centralAtom;
     modelIndex = centralAtom.mi;
     this.nVertices = nVertices;
     this.vertices = new P3[nPoints + 1];
-    this.visible = true;
     this.normals = new V3[planeCount];
     this.bsFlat = bsFlat;
     this.faces = AU.newInt2(planeCount);
@@ -58,38 +66,98 @@
     for (int i = planeCount; --i >= 0;)
       this.faces[i] = planes[i];
     this.collapsed = collapsed;
-    this.faceCenterOffset = faceCenterOffset;
-    this.distanceFactor = distanceFactor;
-    this.planarParam = planarParam;
+    return this;
   }
 
-  Map<String, Object> getInfo(Viewer vwr) {
+  Map<String, Object> info;
+  
+  Map<String, Object> getInfo(Viewer vwr, boolean isAll) {
+    if (isAll && this.info != null)
+      return this.info;
     Map<String, Object> info = new Hashtable<String, Object>();
-    Object energy = vwr.ms.getInfo(centralAtom.mi, "Energy");
-    if (energy != null)
-      info.put("energy", energy);
-    info.put("modelIndex", Integer.valueOf(centralAtom.mi));
-    info.put("modelNumber", Integer.valueOf(centralAtom.getModelNumber()));
-    info.put("center", P3.newP(centralAtom));
+    if (isAll) {
+      this.info = info;
+      info.put("modelIndex", Integer.valueOf(centralAtom.mi));
+      info.put("modelNumber", Integer.valueOf(centralAtom.getModelNumber()));
+      info.put("center", P3.newP(centralAtom));
+      info.put("atomNumber", Integer.valueOf(centralAtom.getAtomNumber()));
+      info.put("atomName", centralAtom.getInfo());
+      info.put("element", centralAtom.getElementSymbol());
+      info.put("vertexCount", Integer.valueOf(nVertices));
+      info.put("faceCount", Integer.valueOf(faces.length));
+      info.put("volume", getVolume());
+      if (smarts != null)
+        info.put("smarts", smarts);
+      if (smiles != null)
+        info.put("smiles", smiles);
+      if (pointGroup != null)
+        info.put("pointGroup", pointGroup.getPointGroupName());
+      Object energy = vwr.ms.getInfo(centralAtom.mi, "Energy");
+      if (energy != null)
+        info.put("energy", energy);
+    } else {
+      info.put("bsFlat", bsFlat);
+      if (collapsed)
+        info.put("collapsed", Boolean.valueOf(collapsed));
+      info.put("ptRef", vertices[nVertices]);
+    }
     info.put("atomIndex", Integer.valueOf(centralAtom.i));
-    info.put("atomNumber", Integer.valueOf(centralAtom.getAtomNumber()));
-    info.put("atomName", centralAtom.getInfo());
-    info.put("element", centralAtom.getElementSymbol());
-    info.put("vertexCount", Integer.valueOf(nVertices));
     info.put("vertices", AU.arrayCopyPt(vertices, nVertices));
-    info.put("faceCount", Integer.valueOf(faces.length));
     info.put("faces", AU.arrayCopyII(faces, faces.length));
-    info.put("volume", getVolume());
-    if (smarts != null)
-      info.put("smarts", smarts);
-    if (smiles != null)
-      info.put("smiles", smiles);
-    if (pointGroup != null)
-      info.put("pointGroup", pointGroup.getPointGroupName());
+    int[] elemNos = new int[nVertices];
+    for (int i = 0; i < nVertices; i++) {
+      P3 pt = vertices[i];
+      elemNos[i] = (pt instanceof Node ? ((Node) pt).getElementNumber()
+          : pt instanceof Point3fi ? ((Point3fi) pt).sD : -2);
+    }
+    info.put("elemNos", elemNos);
     return info;
   }
 
+  Polyhedron setInfo(Map<String, SV> info, Atom[] at) {
+    try {
+      centralAtom = at[info.get("atomIndex").intValue];
+      modelIndex = centralAtom.mi;
+      Lst<SV> lst = info.get("vertices").getList();
+      vertices = new P3[lst.size() + 1];
+      nVertices = vertices.length - 1;
+      for (int i = nVertices; --i >= 0;)
+        vertices[i] = SV.ptValue(lst.get(i));
+      lst = info.get("elemNos").getList();
+      for (int i = nVertices; --i >= 0;) {
+        int n = lst.get(i).intValue;
+        if (n > 0) {
+          Point3fi p = new Point3fi();
+          p.setT(vertices[i]);
+          p.sD = (short) n;
+          vertices[i] = p;
+        }
+      }
+      vertices[nVertices] = SV.ptValue(info.get("ptRef"));
+      lst = info.get("faces").getList();
+      faces = AU.newInt2(lst.size());
+      normals = new V3[faces.length];
+      V3 vAB = new V3();
+      for (int i = faces.length; --i >= 0;) {
+        Lst<SV> lst2 = lst.get(i).getList();
+        int[] a = new int[lst2.size()];
+        for (int j = a.length; --j >= 0;)
+          a[j] = lst2.get(j).intValue;
+        faces[i] = a;
+        normals[i] = new V3();
+        Measure.getNormalThroughPoints(vertices[a[0]], vertices[a[1]],
+            vertices[a[2]], normals[i], vAB);
+      }
+      bsFlat = SV.getBitSet(info.get("bsFlat"), false);
+      collapsed = info.containsKey("collapsed");
+    } catch (Exception e) {
+      return null;
+    }
+    return this;
+  }
+
   void getSymmetry(Viewer vwr, boolean withPointGroup) {
+    info = null;
     SmilesMatcherInterface sm = vwr.getSmilesMatcher();
     try {
       if (smarts == null) {
@@ -138,23 +206,14 @@
     return vAC.dot(vTemp);
   }
 
-  String getState() {
-    P3 ptemp = new P3();
-    String s = "({" + centralAtom.i + "}) TO [";
-    for (int i = 0; i < nVertices; i++) {
-      ptemp.setT(vertices[i]);
-      s += ptemp;
-    }
-    s += "]";
-    return "  polyhedra " + s + (collapsed ? " collapsed" : "")
-        + " distanceFactor " + distanceFactor + " faceCenterOffset "
-        + faceCenterOffset
-        //    +  " planarParam " + planarParam 
+  String getState(Viewer vwr) {
+    return "  var p = " + Escape.e(getInfo(vwr, false)) + ";polyhedron @p" 
         + (isFullyLit ? " fullyLit" : "") + ";"
-        + (visible ? "" : "polyhedra off;") + "\n";
+        + (visible ? "" : "polyhedra ({"+centralAtom.i+"}) off;") + "\n";
   }
 
   public void move(M4 mat) {
+    info = null;
     for (int i = 0; i < nVertices; i++) {
       P3 p = vertices[i];
       if (p instanceof Atom)

Modified: trunk/Jmol/src/org/jmol/smiles/SmilesMatcher.java
===================================================================
--- trunk/Jmol/src/org/jmol/smiles/SmilesMatcher.java   2015-07-08 16:15:03 UTC 
(rev 20645)
+++ trunk/Jmol/src/org/jmol/smiles/SmilesMatcher.java   2015-07-09 04:37:42 UTC 
(rev 20646)
@@ -276,8 +276,6 @@
    * @param atoms
    * @param ac
    * @param bsSelected
-   * @param isSmarts
-   * @param firstMatchOnly
    * @return BitSet indicating which atoms match the pattern.
    */
 
@@ -340,8 +338,6 @@
    * @param ac
    * @param bsSelected
    * @param bsAromatic
-   * @param isSmarts
-   * @param firstMatchOnly
    * @return BitSet Array indicating which atoms match the pattern.
    * @throws Exception
    */
@@ -409,10 +405,7 @@
    * @param pattern
    *        SMILES or SMARTS pattern.
    * @param atoms
-   * @param ac
    * @param bsSelected
-   * @param isSmarts
-   * @param firstMatchOnly
    * @return a set of atom correlations
    * 
    */

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-07-08 16:15:03 UTC 
(rev 20645)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-07-09 04:37:42 UTC 
(rev 20646)
@@ -46,10 +46,16 @@
 such that any call to yyy outside of the SPT sees those variable "xxx"?
 
 
-there is something wrong with JSmol and zoneDemo. Just slow? or 
+TODO: there is something wrong with JSmol and zoneDemo. Just slow? or what?
 
-Jmol.___JmolVersion="14.3.15_2015.07.08"
+Jmol.___JmolVersion="14.3.15_2015.07.08c"
 
+bug fix: load files "xxx.png|xxxx" "xxx.png|zzzz"  not read from state properly
+bug fix: polyhedra not saved in state property
+bug fix: moving atoms with 4x4 matrix not saved in state
+bug fix: moving of an atom having a polyhedron fails to move the polyhedron as 
well
+
+
 new feature: smiles2.find("SMILES",smiles1, asMap, allMappings)
   -- asMap = TRUE (default false) indicates you want an atom 
      correlation map indicating positions in smiles2 corresponding to smiles1 
@@ -71,8 +77,6 @@
     select {1.1}
     rotateselected @mat
     
-bug fix: moving of an atom having a polyhedron fails to move the polyhedron as 
well
-
 JmolVersion="14.3.15_2015.07.07c"
 
 bug fix: x.getProperty("[select name where composition[1] == 0.5]")

Modified: trunk/Jmol/src/org/jmol/viewer/StateCreator.java
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/StateCreator.java    2015-07-08 16:15:03 UTC 
(rev 20645)
+++ trunk/Jmol/src/org/jmol/viewer/StateCreator.java    2015-07-09 04:37:42 UTC 
(rev 20646)
@@ -570,23 +570,25 @@
     }
     commands.append("# frame state;\n");
     commands.append("# modelCount ").appendI(modelCount).append(";\n# first ")
-        .append(vwr.getModelNumberDotted(0)).append(";\n# last ").append(
-            vwr.getModelNumberDotted(modelCount - 1)).append(";\n");
+        .append(vwr.getModelNumberDotted(0)).append(";\n# last ")
+        .append(vwr.getModelNumberDotted(modelCount - 1)).append(";\n");
     if (am.backgroundModelIndex >= 0)
-      app(commands, "set backgroundModel "
-          + vwr.getModelNumberDotted(am.backgroundModelIndex));
+      app(commands,
+          "set backgroundModel "
+              + vwr.getModelNumberDotted(am.backgroundModelIndex));
     if (vwr.tm.bsFrameOffsets != null) {
       app(commands, "frame align " + Escape.eBS(vwr.tm.bsFrameOffsets));
     } else if (vwr.ms.translations != null) {
       for (int i = modelCount; --i >= 0;) {
         P3 t = (vwr.ms.getTranslation(i));
         if (t != null)
-          app(commands, "frame " + vwr.ms.getModelNumberDotted(i) + " align " 
+ t);          
+          app(commands, "frame " + vwr.ms.getModelNumberDotted(i) + " align "
+              + t);
       }
     }
-    app(commands, "frame RANGE "
-        + am.getModelSpecial(AnimationManager.FRAME_FIRST) + " "
-        + am.getModelSpecial(AnimationManager.FRAME_LAST));
+    app(commands,
+        "frame RANGE " + am.getModelSpecial(AnimationManager.FRAME_FIRST) + " "
+            + am.getModelSpecial(AnimationManager.FRAME_LAST));
     app(commands, "animation DIRECTION "
         + (am.animationDirection == 1 ? "+1" : "-1"));
     app(commands, "animation FPS " + am.animationFps);
@@ -601,9 +603,10 @@
       app(commands, "frame " + (i + 1));
       showModel = (am.cmi != am.modelIndexForFrame(i));
     }
-    if (showModel)
-      app(commands, "model "
-          + am.getModelSpecial(AnimationManager.MODEL_CURRENT));
+    if (showModel) {
+      String s = am.getModelSpecial(AnimationManager.MODEL_CURRENT);
+      app(commands, s.equals("0") ? "frame *" : "model " + s);
+    }
     app(commands, "animation "
         + (!am.animationOn ? "OFF" : am.currentDirection == 1 ? "PLAY"
             : "PLAYREV"));

Modified: 
trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/console/ConsoleTextArea.java
===================================================================
--- 
trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/console/ConsoleTextArea.java  
    2015-07-08 16:15:03 UTC (rev 20645)
+++ 
trunk/Jmol/src/org/openscience/jmol/app/jmolpanel/console/ConsoleTextArea.java  
    2015-07-09 04:37:42 UTC (rev 20646)
@@ -23,14 +23,15 @@
  */
 package org.openscience.jmol.app.jmolpanel.console;
 
+import java.io.BufferedReader;
+import java.io.IOException;
 import java.io.InputStream;
+import java.io.InputStreamReader;
 import java.io.PrintStream;
-import java.io.InputStreamReader;
-import java.io.BufferedReader;
-import java.io.IOException;
+
+import javax.swing.JOptionPane;
 import javax.swing.JTextArea;
-import javax.swing.JOptionPane;
-import javax.swing.text.Document;
+
 import org.jmol.i18n.GT;
 import org.openscience.jmol.app.jmolpanel.LoopedStreams;
 
@@ -73,16 +74,16 @@
         StringBuilder sb = new StringBuilder();
         try {
           String s;
-          Document doc = getDocument();
+          //Document doc = getDocument();
           s = br.readLine();
           while (s != null) {
-            boolean caretAtEnd = false;
-            caretAtEnd = (getCaretPosition() == doc.getLength());
+            //boolean caretAtEnd = false;
+            //caretAtEnd = (getCaretPosition() == doc.getLength());
             sb.setLength(0);
             append(sb.append(s).append('\n').toString());
-            if (caretAtEnd) {
-              setCaretPosition(doc.getLength());
-            }
+            //if (caretAtEnd) {
+              //setCaretPosition(doc.getLength());
+           //}
             s = br.readLine();
           }
         } catch (IOException e) {

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


------------------------------------------------------------------------------
Don't Limit Your Business. Reach for the Cloud.
GigeNET's Cloud Solutions provide you with the tools and support that
you need to offload your IT needs and focus on growing your business.
Configured For All Businesses. Start Your Cloud Today.
https://www.gigenetcloud.com/
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to