Revision: 18552
          http://sourceforge.net/p/jmol/code/18552
Author:   hansonr
Date:     2013-08-12 20:16:55 +0000 (Mon, 12 Aug 2013)
Log Message:
-----------
___JmolVersion="13.3.4_dev_2013.08.12"

new feature: incommensurate modulation of ADPs.

bug fix: set loglevel 6 (debugHigh) not working
bug fix: {*}.tensor("", "id") not implemented
bug fix: {*}.tensor("") not implemented
bug fix: {*}.tensor("adp") fails
bug fix: {*}.symmetry fails when space group is P1
bug fix: atom tensors lost when merging

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java
    trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java
    trunk/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java
    trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java
    trunk/Jmol/src/org/jmol/adapter/readers/xtal/MagresReader.java
    trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java
    trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
    trunk/Jmol/src/org/jmol/api/SymmetryInterface.java
    trunk/Jmol/src/org/jmol/modelset/Atom.java
    trunk/Jmol/src/org/jmol/modelset/AtomCollection.java
    trunk/Jmol/src/org/jmol/modelset/ModelCollection.java
    trunk/Jmol/src/org/jmol/quantum/NMRCalculation.java
    trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java
    trunk/Jmol/src/org/jmol/script/SV.java
    trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java
    trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java
    trunk/Jmol/src/org/jmol/shapespecial/Ellipsoid.java
    trunk/Jmol/src/org/jmol/shapespecial/Ellipsoids.java
    trunk/Jmol/src/org/jmol/symmetry/SpaceGroup.java
    trunk/Jmol/src/org/jmol/symmetry/Symmetry.java
    trunk/Jmol/src/org/jmol/symmetry/UnitCell.java
    trunk/Jmol/src/org/jmol/util/Logger.java
    trunk/Jmol/src/org/jmol/util/Modulation.java
    trunk/Jmol/src/org/jmol/util/ModulationSet.java
    trunk/Jmol/src/org/jmol/util/Tensor.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/openscience/jmol/app/surfacetool/SurfaceTool.java

Modified: trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java  2013-08-12 
02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java  2013-08-12 
20:16:55 UTC (rev 18552)
@@ -42,7 +42,6 @@
 
 
 import org.jmol.util.BS;
-import org.jmol.util.Escape;
 import org.jmol.util.Logger;
 import org.jmol.util.Matrix4f;
 import org.jmol.util.P3;
@@ -239,7 +238,6 @@
           String key = TextFormat.simpleReplace(auditBlockCode, "_MOD_", 
"_REFRNCE_");
           if ((atomSetCollection.symmetry = (SymmetryInterface) 
htAudit.get(key)) != null) {
             notionalUnitCell = 
atomSetCollection.symmetry.getNotionalUnitCell();
-            System.out.println(Escape.eAF(notionalUnitCell));
             iHaveUnitCell = true;
           }
         } else if (htAudit != null && symops != null) {
@@ -2510,6 +2508,8 @@
             continue;
           if (id.equals("D_S")) {
             // saw tooth displacement  center/width/Axyz
+            if (Float.isNaN(c) || Float.isNaN(w))
+              continue;
             if (pt.x != 0)
               addMod("D_S#x;" + atomLabel, fid, P3.new3(c, w, pt.x));
             if (pt.y != 0)
@@ -2579,25 +2579,4 @@
     return m4;
   }
 
-//  static {
-//    System.out.println(92345678);
-//    System.out.println(999999999);
-//    System.out.println(Parser.parseFloatStr("-8.6634100000000014E-01")
-//        + " " + Float.valueOf(("-8.6634100000000014E-01")));
-//    System.out.println(Parser.parseFloatStr("-0.0000000000663415E-01")
-//            + " " + Float.valueOf(("-0.0000000000663415E-01")));
-//
-//    System.out.println(Parser.parseFloatStr("-0.0000663415E-01")
-//        + " " + Float.valueOf(("-0.0000663415E-01")));
-//    System.out.println(Parser.parseFloatStr("-0.00663415E-01")
-//        + " " + Float.valueOf(("-0.00663415E-01")));
-//    System.out.println(Parser.parseFloatStr("-0.00000000663415E-01")
-//        + " " + Float.valueOf(("-0.00000000663415E-01")));
-//    System.out.println(Parser.parseFloatStr("-0.0663415E-01")
-//        + " " + Float.valueOf(("-0.0663415E-01")));
-//    System.out.println(Parser.parseFloatStr("-0.663415E-01")
-//        + " " + Float.valueOf(("-0.663415E-01")));
-//
-//  }
-
 }

Modified: trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java   
2013-08-12 02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java   
2013-08-12 20:16:55 UTC (rev 18552)
@@ -40,6 +40,7 @@
 import org.jmol.util.ModulationSet;
 import org.jmol.util.P3;
 import org.jmol.util.SB;
+import org.jmol.util.Tensor;
 import org.jmol.util.TextFormat;
 import org.jmol.util.V3;
 
@@ -85,6 +86,8 @@
     modAxes = getFilter("MODAXES=");
     modVib = checkFilterKey("MODVIB"); // then use MODULATION ON  to see 
modulation
     modAverage = checkFilterKey("MODAVE");
+    if (!modVib && !modAverage)
+      addJmolScript("modulation on");
     checkSpecial = !checkFilterKey("NOSPECIAL");
     atomSetCollection.setCheckSpecial(checkSpecial);
     allowRotations = !checkFilterKey("NOSYM");
@@ -206,7 +209,8 @@
         params = getMod(atomName.substring(pt_ + 2));
         atomName = atomName.substring(0, pt_);
       }
-      System.out.println(key + " " + params);
+      if (Logger.debuggingHigh)
+        Logger.debug("SetModulation: " + key + " " + params);
       int type = key.charAt(0);
       pt_ = key.indexOf("#") + 1;
       String utens = null;
@@ -282,7 +286,8 @@
       iop = 0;
     // now set to 
     int mdim = 0;    // just the first row -- assuming d=1 here
-    //System.out.println("=========MR i=" + a.index + " " + a.atomName + " " + 
a + " " + a.occupancy);
+    if (Logger.debuggingHigh)
+      Logger.debug("setModulation: i=" + a.index + " " + a.atomName + " xyz=" 
+ a + " occ=" + a.occupancy);
     if (iop != iopLast) {
       symmetry.getMod456Row(iop, mdim, f4);
       //System.out.println("mdim=" + mdim + " op=" + (iop + 1) + " " + 
symmetry.getSpaceGroupOperation(iop) + " " + symmetry.getSpaceGroupXyz(iop, 
false));
@@ -307,11 +312,22 @@
     if (ms.htValues != null) {
       // Uiso or Uij. We add the displacements, create the tensor, then rotate 
it, 
       // replacing the tensor already present for that atom.
-      System.out.println("U1: " + a.index + " " + a.atomName + " " + a + " " + 
Escape.eAF(a.anisoBorU));
+      if (Logger.debuggingHigh) {
+        Logger.debug("setModulation Uij(initial)=" + Escape.eAF(a.anisoBorU));
+        Logger.debug("setModulation tensor=" + 
Escape.e(a.tensors.get(0).getInfo("all")));
+      }
       for (Entry<String, Float>e : ms.htValues.entrySet())
         addUStr(a, e.getKey(), e.getValue().floatValue());
-      atomSetCollection.addRotatedTensor(a, symmetry.getTensor(a.anisoBorU), 
iop, true);
-      System.out.println("U2: " + a.index + " " + a.atomName + " " + a + " " + 
Escape.eAF(a.anisoBorU) + "\n");
+      
+      if (a.tensors != null)
+        a.tensors.get(0).isUnmodulated = true;
+      Tensor t = atomSetCollection.addRotatedTensor(a, 
symmetry.getTensor(a.anisoBorU), iop, false);
+      t.isModulated = true;
+      System.out.println("Uij modulation for " + a.atomName);
+      if (Logger.debuggingHigh) {
+        Logger.debug("setModulation Uij(final)=" + Escape.eAF(a.anisoBorU) + 
"\n");
+        Logger.debug("setModulation tensor=" + 
a.tensors.get(0).getInfo("all"));
+      }
     }
 
     // set property_modT to be Math.floor (q.r/|q|) -- really only for d=1
@@ -323,10 +339,10 @@
       sb.append(((int) t) + "\n");
     }
     // displace the atom and reverse the vector only if not filter "MODVIB"
-    if (!modVib) {
-      a.add(ms);
-      ms.setModT(true, Integer.MAX_VALUE);
-    }
+//    if (!modVib) {
+  //    a.add(ms);
+    //  ms.setModT(true, Integer.MAX_VALUE);
+   // }
     symmetry.toCartesian(ms, true);
     //System.out.println("a.vib(xyz)=" + a.vib);
   }
@@ -344,7 +360,8 @@
   
   private void addUStr(Atom atom, String id, float val) {
     int i = U_LIST.indexOf(id) / 3;
-    System.out.println("adding " + id + " " + i + " " + val + " to " + 
atom.anisoBorU[i]);
+    if (Logger.debuggingHigh)
+      Logger.debug("MOD RDR adding " + id + " " + i + " " + val + " to " + 
atom.anisoBorU[i]);
     setU(atom, i, val + atom.anisoBorU[i]);
   }
   

Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java      
2013-08-12 02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CastepReader.java      
2013-08-12 20:16:55 UTC (rev 18552)
@@ -570,7 +570,7 @@
     for (int p = 0, i = 0; i < 3; i++)
       for (int j = 0; j < 3; j++)
         a[i][j] = data[p++];
-    atom.addTensor(Tensor.getTensorFromAsymmetricTensor(a, "charge"), null, 
false);
+    atom.addTensor(Tensor.getTensorFromAsymmetricTensor(a, "charge", 
atom.atomName + " " + line0), null, false);
     if (!haveCharges)
       appendLoadNote("Ellipsoids set \"charge\": Born Effective Charges");
     haveCharges = true;

Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java     
2013-08-12 02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/CrystalReader.java     
2013-08-12 20:16:55 UTC (rev 18552)
@@ -1022,7 +1022,7 @@
        
atoms[index].addTensor(Tensor.getTensorFromEigenVectors(directLatticeVectors, 
            new float[] {parseFloatStr(tokens[1]), 
            parseFloatStr(tokens[3]), 
-           parseFloatStr(tokens[5]) }, "unknown"), null, false);
+           parseFloatStr(tokens[5]) }, "unknown", atoms[index].atomName), 
null, false);
        readLine();
      }
      return true;

Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/MagresReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/xtal/MagresReader.java      
2013-08-12 02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/MagresReader.java      
2013-08-12 20:16:55 UTC (rev 18552)
@@ -273,36 +273,39 @@
    */
   private boolean readTensor() throws Exception {
     String[] tokens = getTokens();
-    String id = tokens[0];
-    String units = magresUnits.get(id);
+    String type = tokens[0];
+    String units = magresUnits.get(type);
     if (units == null) {
-      Logger.warn(id + " ignored; no units defined; line: " + line);
+      Logger.warn(type + " ignored; no units defined; line: " + line);
       return true;
     }
-    boolean isIsc = id.startsWith("isc");
+    boolean isIsc = type.startsWith("isc");
     if (tokens.length == 10) {
       // raw vector - you get ONE
-      magresUnits.remove(id);
+      magresUnits.remove(type);
       float[] data = new float[9];
       for (int i = 0; i < 9;)
         data[i] = parseFloatStr(tokens[++i]);
-      Logger.info("Magres reader creating magres_" + id + ": " + 
Escape.eAF(data));
-      atomSetCollection.setAtomSetAuxiliaryInfo("magres_" + id, data);
+      Logger.info("Magres reader creating magres_" + type + ": " + 
Escape.eAF(data));
+      atomSetCollection.setAtomSetAuxiliaryInfo("magres_" + type, data);
     }
     String atomName1 = getAtomName(tokens[1], tokens[2]);
     int pt = 3;
     String atomName2 = (isIsc ? getAtomName(tokens[pt++], tokens[pt++]) : 
null);
     if (atomName1.equals(atomName2)) {
-      Logger.warn(id + " ignored; atom1 == atom2 for " + atomName1 + " line: " 
+ line);
+      Logger.warn(type + " ignored; atom1 == atom2 for " + atomName1 + " line: 
" + line);
       return true;
     }
+    String id = atomName1;
+    if (atomName2 != null)
+      id += "//" + atomName2;
     double[][] a = new double[3][3];
     for (int i = 0; i < 3; i++)
       for (int j = 0; j < 3; j++)
         a[i][j] = Double.valueOf(tokens[pt++]).doubleValue();
     int index1 = atomSetCollection.getAtomIndexFromName(atomName1);
     int index2;
-    Tensor t = Tensor.getTensorFromAsymmetricTensor(a, id);
+    Tensor t = Tensor.getTensorFromAsymmetricTensor(a, type, id);
     if (atomName2 == null) {
       index2 = -1;
       atomSetCollection.getAtoms()[index1].addTensor(t, null, false);

Modified: trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java   2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java   2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -24,6 +24,7 @@
 
 package org.jmol.adapter.smarter;
 
+import org.jmol.util.ArrayUtil;
 import org.jmol.util.BS;
 import org.jmol.util.JmolList;
 import org.jmol.util.P3;
@@ -55,14 +56,15 @@
   public float[] anisoBorU; //[6] = 1 for U, 0 for B; [7] = bFactor
   public JmolList<Tensor> tensors;
   
-  public void addTensor(Tensor tensor, String type, boolean reset) {
+  public Tensor addTensor(Tensor tensor, String type, boolean reset) {
     if (tensor == null)
-      return;
+      return null;
     if (reset || tensors == null)
       tensors = new JmolList<Tensor>();
     tensors.addLast(tensor);
     if (type != null)
       tensor.setType(type);
+    return tensor;
   }
 
   
@@ -80,7 +82,14 @@
   public Atom getClone() throws CloneNotSupportedException {
     // note that anisoBorU and ellipsoid are not copied
     // we consider them "final" in a sense
-    return (Atom)clone();
+    Atom a = (Atom)clone();
+    if (vib != null)
+      a.vib = V3.newV(a.vib);
+    if (anisoBorU != null)
+      a.anisoBorU = ArrayUtil.arrayCopyF(anisoBorU, -1);
+
+    
+    return a;
   }
 
   public String getElementSymbol() {

Modified: trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java      
2013-08-12 02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/adapter/smarter/AtomSetCollection.java      
2013-08-12 20:16:55 UTC (rev 18552)
@@ -1160,6 +1160,10 @@
       rmaxz = -Float.MAX_VALUE;
     }
     // always do the 555 cell first
+    
+    // incommensurate symmetry can have lattice centering, reulting in 
+    // duplication of operators.
+    checkAll = checkSpecial && symmetry.hasLatticeCentering();
     Matrix4f op = symmetry.getSpaceGroupOperation(0);
     if (doPackUnitCell)
       ptOffset.set(0, 0, 0);
@@ -1208,7 +1212,6 @@
     }
     
     // now apply all the translations
-    
     iCell = 0;
     for (int tx = minXYZ.x; tx < maxXYZ.x; tx++)
       for (int ty = minXYZ.y; ty < maxXYZ.y; ty++)
@@ -1259,6 +1262,7 @@
   private int bondIndex0;
   private boolean applySymmetryToBonds = false;
   private boolean checkSpecial = true;
+  private boolean checkAll = false;
 
   public void setCheckSpecial(boolean TF) {
     checkSpecial = TF;
@@ -1267,8 +1271,9 @@
   private P3 ptTemp;
   private Matrix3f mTemp;
   
-  private int symmetryAddAtoms(int iAtomFirst, int noSymmetryCount, int transX,
-                               int transY, int transZ, int baseCount, int pt,
+  private int symmetryAddAtoms(int iAtomFirst, int noSymmetryCount, 
+                               int transX, int transY, int transZ, 
+                               int baseCount, int pt,
                                int iCellOpPt, P3[] cartesians) throws 
Exception {
     boolean isBaseCell = (baseCount == 0);
     boolean addBonds = (bondCount0 > bondIndex0 && applySymmetryToBonds);
@@ -1324,7 +1329,7 @@
             transZ);
         Atom special = null;
         P3 cartesian = P3.newP(ptAtom);
-        symmetry.toCartesian(cartesian, false);
+        symmetry. toCartesian(cartesian, false);
         if (doPackUnitCell) {
           symmetry.toUnitCell(cartesian, ptOffset);
           ptAtom.setT(cartesian);
@@ -1343,11 +1348,14 @@
           float minDist2 = Float.MAX_VALUE;
           if (checkSymmetryRange && !isInSymmetryRange(cartesian))
             continue;
-          for (int j = pt0; --j >= 0;) {
+          int j0 = (checkAll ? atomCount : pt0);
+          for (int j = j0; --j >= 0;) {
             float d2 = cartesian.distanceSquared(cartesians[j]);
             if (checkSpecial && d2 < 0.0001) {
               special = atoms[iAtomFirst + j];
-              break;
+              if (special.atomName == null || 
special.atomName.equals(atoms[i].atomName))
+                break;
+              special = null;
             }
             if (checkRange111 && j < baseCount && d2 < minDist2)
               minDist2 = d2;
@@ -1403,14 +1411,14 @@
     return pt;
   }
   
-  public void addRotatedTensor(Atom a, Tensor t, int iSym, boolean reset) {
+  public Tensor addRotatedTensor(Atom a, Tensor t, int iSym, boolean reset) {
     if (ptTemp == null) {
       ptTemp = new P3();
       mTemp = new Matrix3f();
     }
-    a.addTensor(Tensor.getTensorFromEigenVectors(symmetry
+    return a.addTensor(Tensor.getTensorFromEigenVectors(symmetry
         .rotateAxes(iSym, t.eigenVectors, ptTemp, mTemp),
-        t.eigenValues, t.type), null, reset);
+        t.eigenValues, t.isIsotropic ? "iso" : t.type, t.id), null, reset);
   }
 
   public void applySymmetryBio(JmolList<Matrix4f> biomts, float[] 
notionalUnitCell, boolean applySymmetryToBonds, String filter) {
@@ -1481,7 +1489,6 @@
       mat.m23 /= notionalUnitCell[2];
       if (symmetry != null && i > 0)
         symmetry.addSpaceGroupOperationM(mat);
-      //System.out.println("biomt " + i + " " + atomCount);
     }
     int noSymmetryCount = atomMax - iAtomFirst;
     setAtomSetAuxiliaryInfo("presymmetryAtomIndex", 
Integer.valueOf(iAtomFirst));
@@ -1965,7 +1972,6 @@
     for (int i = 0; i < bondCount; i++) {
       info[i] = new String[] { atoms[bonds[i].atomIndex1].atomName, 
         atoms[bonds[i].atomIndex2].atomName, "" + bonds[i].order };
-      //System.out.println("testing asc getBondList  " + info[i][0] + " " + 
info[i][1] + " " + info[i][2]);
     }
     return info;
   }

Modified: trunk/Jmol/src/org/jmol/api/SymmetryInterface.java
===================================================================
--- trunk/Jmol/src/org/jmol/api/SymmetryInterface.java  2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/api/SymmetryInterface.java  2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -176,5 +176,7 @@
   public void unitize(P3 ptFrac);
 
   public void addLatticeVectors(JmolList<float[]> lattvecs);
+
+  public boolean hasLatticeCentering();
   
 }

Modified: trunk/Jmol/src/org/jmol/modelset/Atom.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/Atom.java  2013-08-12 02:02:51 UTC (rev 
18551)
+++ trunk/Jmol/src/org/jmol/modelset/Atom.java  2013-08-12 20:16:55 UTC (rev 
18552)
@@ -291,7 +291,14 @@
 
   public float getADPMinMax(boolean isMax) {
     Tensor[] tensors = getTensors();
-    return (tensors == null || tensors[0] == null || tensors[0].iType != 
Tensor.TYPE_ADP? 0 : tensors[0].getFactoredValue(isMax ? 2 : 1)); 
+    if (tensors == null)
+      return 0;
+    Tensor t = tensors[0];
+    if (t == null || t.iType != Tensor.TYPE_ADP)
+      return 0;
+    if (group.chain.model.modelSet.isModulated(index) && t.isUnmodulated)
+      t = tensors[1];
+    return t.getFactoredValue(isMax ? 2 : 1); 
   }
 
   public Tensor[] getTensors() {
@@ -723,7 +730,7 @@
       for (int j = 0; j < nOps; j++)
         if (atomSymmetry.get(pt++))
           str += "," + (j + 1) + "" + cellRange[i];
-    return str.substring(1);
+    return (str.length() == 0 ? "" : str.substring(1));
   }
    
   public int getModelIndex() {

Modified: trunk/Jmol/src/org/jmol/modelset/AtomCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/AtomCollection.java        2013-08-12 
02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/modelset/AtomCollection.java        2013-08-12 
20:16:55 UTC (rev 18552)
@@ -105,6 +105,8 @@
     ionicRadii = mergeModelSet.ionicRadii;
     partialCharges = mergeModelSet.partialCharges;
     atomTensors = mergeModelSet.atomTensors;
+    atomTensorList = mergeModelSet.atomTensorList;
+    bsModulated = mergeModelSet.bsModulated;
     setHaveStraightness(false);
     surfaceDistance100s = null;
   }
@@ -2508,6 +2510,12 @@
     return bs;
   }
 
+  BS bsModulated;
+  
+  public boolean isModulated(int i) {
+    return bsModulated != null && bsModulated.get(i);
+  }
+
   protected void deleteModelAtoms(int firstAtomIndex, int nAtoms, BS bsAtoms) {
     // all atoms in the model are being deleted here
     atoms = (Atom[]) ArrayUtil.deleteElements(atoms, firstAtomIndex, nAtoms);
@@ -2516,6 +2524,10 @@
       atoms[j].index = j;
       atoms[j].modelIndex--;
     }
+    // fix modulation and tensors    
+    if (bsModulated != null)
+      BSUtil.deleteBits(bsModulated, bsAtoms);
+
     deleteAtomTensors(bsAtoms);
     atomNames = (String[]) ArrayUtil.deleteElements(atomNames, firstAtomIndex,
         nAtoms);
@@ -2631,12 +2643,14 @@
 
   public Tensor getAtomTensor(int i, String type) {
     Tensor[] tensors = getAtomTensorList(i);
-    if (tensors == null || type == null)
-      return null;
-    type = type.toLowerCase();
-    for (int j = 0; j < tensors.length; j++)
-      if (tensors[j] != null && type.equals(tensors[j].type))
-        return tensors[j];
+    if (tensors != null && type != null) {
+      type = type.toLowerCase();
+      for (int j = 0; j < tensors.length; j++) {
+        Tensor t = tensors[j];
+        if (t != null && (type.equals(t.type) || type.equals(t.altType)))
+          return t;
+      }
+    }
     return null;
   }
 

Modified: trunk/Jmol/src/org/jmol/modelset/ModelCollection.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/ModelCollection.java       2013-08-12 
02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/modelset/ModelCollection.java       2013-08-12 
20:16:55 UTC (rev 18552)
@@ -2876,7 +2876,7 @@
       unitCells = (SymmetryInterface[]) ArrayUtil.deleteElements(unitCells,
           modelIndex, 1);
     }
-
+    
     // correct stateScripts, particularly CONNECT scripts
     for (int i = stateScripts.size(); --i >= 0;) {
       if (!stateScripts.get(i).deleteAtoms(modelIndex, bsBonds, bsAtoms)) {
@@ -3120,7 +3120,7 @@
     if (partialCharges != null)
       for (int i = i0; i < atomCount; i++)
         partialCharges[i] = partialCharges[map[i]];
-    if (atomTensors != null) {
+    if (atomTensorList != null) {
       for (int i = i0; i < atomCount; i++) {
         Tensor[] list = atomTensorList[i] = atomTensorList[map[i]];
         for (int j = list.length; --j >= 0;) {
@@ -3152,7 +3152,7 @@
       bfactor100s = ArrayUtil.arrayCopyShort(bfactor100s, newLength);
     if (partialCharges != null)
       partialCharges = ArrayUtil.arrayCopyF(partialCharges, newLength);
-    if (atomTensors != null)
+    if (atomTensorList != null)
       atomTensorList = (Tensor[][]) ArrayUtil.arrayCopyObject(atomTensorList, 
newLength);
     if (atomNames != null)
       atomNames = ArrayUtil.arrayCopyS(atomNames, newLength);
@@ -3458,6 +3458,8 @@
   }
 
   public void setModulation(BS bs, boolean isOn, int t) {
+    if (bsModulated == null)
+      bsModulated = new BS();    
     //System.out.println("setModulation " + isOn + " " + t);
     for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
       Vibration v = getVibration(i, false);
@@ -3491,6 +3493,7 @@
           a.sub(ms);
         break;
       }
+      bsModulated.setBitTo(i, ms.enabled);
       //System.out.println(a.x + " " + a.y + " " + a.z + " ms is " + ms + " " 
+ ms.enabled + " " + ms.t);
     }
   }

Modified: trunk/Jmol/src/org/jmol/quantum/NMRCalculation.java
===================================================================
--- trunk/Jmol/src/org/jmol/quantum/NMRCalculation.java 2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/quantum/NMRCalculation.java 2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -1,4 +1,4 @@
-  /* $RCSfile$
+/* $RCSfile$
  * $Author: hansonr $
  * $Date: 2006-05-13 19:17:06 -0500 (Sat, 13 May 2006) $
  * $Revision: 5114 $
@@ -100,8 +100,8 @@
    */
   @SuppressWarnings("unchecked")
   private JmolList<Tensor> getInteractionTensorList(String type, BS bsA) {
-    type = type.toLowerCase();
-
+    if (type != null)
+      type = type.toLowerCase();
     BS bsModels = viewer.getModelBitSet(bsA, false);
     BS bs1 = getAtomSiteBS(bsA);
     int iAtom = (bs1.cardinality() == 1 ? bs1.nextSetBit(0) : -1);
@@ -114,7 +114,7 @@
       int n = tensors.size();
       for (int j = 0; j < n; j++) {
         Tensor t = tensors.get(j);
-        if (t.type.equals(type) && t.isSelected(bs1, iAtom))
+        if (type == null  || t.type.equals(type) && t.isSelected(bs1, iAtom))
           list.addLast(t);
       }
     }
@@ -391,10 +391,11 @@
 
   public JmolList<Object> getTensorInfo(String tensorType, String infoType,
                                         BS bs) {
-
+    if ("".equals(tensorType))
+      tensorType = null;
     JmolList<Object> data = new JmolList<Object>();
     JmolList<Object> list1;
-    if (infoType.equals(";dc.")) {
+    if (";dc.".equals(infoType)) {
       // tensorType is irrelevant for dipolar coupling constant
       Atom[] atoms = viewer.modelSet.atoms;
       for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1))
@@ -406,7 +407,9 @@
               .addLast(Float.valueOf(getDipolarConstantHz(atoms[i], 
atoms[j])));
           data.addLast(list1);
         }
-    } else if (tensorType.startsWith("isc")) {
+      return data;
+    }
+    if (tensorType == null || tensorType.startsWith("isc")) {
       boolean isJ = infoType.equals(";j.");
       JmolList<Tensor> list = getInteractionTensorList(tensorType, bs);
       int n = (list == null ? 0 : list.size());
@@ -419,9 +422,17 @@
             : t.getInfo(infoType));
         data.addLast(list1);
       }
-    } else {
-      boolean isChi = tensorType.startsWith("efg") && infoType.equals(";chi.");
-      for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
+      if (tensorType != null)
+        return data;
+    }
+    boolean isChi = tensorType != null && tensorType.startsWith("efg")
+        && infoType.equals(";chi.");
+    for (int i = bs.nextSetBit(0); i >= 0; i = bs.nextSetBit(i + 1)) {
+      if (tensorType == null) {
+        Tensor[] a = viewer.modelSet.getAtomTensorList(i);
+        for (int j = 0; j < a.length; j++)
+          data.addLast(a[j].getInfo(infoType));
+      } else {
         Tensor t = viewer.modelSet.getAtomTensor(i, tensorType);
         data.addLast(t == null ? null : isChi ? Float
             .valueOf(getQuadrupolarConstant(t)) : t.getInfo(infoType));

Modified: trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java
===================================================================
--- trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java       
2013-08-12 02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/renderspecial/EllipsoidsRenderer.java       
2013-08-12 20:16:55 UTC (rev 18552)
@@ -197,6 +197,7 @@
     boolean needTranslucent = false;
     Iterator<Ellipsoid> e = ht.values().iterator();
     Atom atom = null;
+    System.out.println("ellipsoidrend");
     while (e.hasNext()) {
       Ellipsoid ellipsoid = e.next();
       if (!ellipsoid.visible)
@@ -213,6 +214,7 @@
         needTranslucent = true;
         continue;
       }
+      System.out.println(ellipsoid.tensor.getInfo("all"));
       viewer.transformPtScr(ellipsoid.center, s0);
       renderOne(ellipsoid);
     }

Modified: trunk/Jmol/src/org/jmol/script/SV.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/SV.java      2013-08-12 02:02:51 UTC (rev 
18551)
+++ trunk/Jmol/src/org/jmol/script/SV.java      2013-08-12 20:16:55 UTC (rev 
18552)
@@ -548,17 +548,17 @@
     case bitset:
       return iValue(x);
     case point3f:
-      return ((P3) x.value).distance(pt0);
+      return ((P3) x.value).length();
     case point4f:
       return Measure.distanceToPlane((P4) x.value, pt0);
     case matrix3f:
       P3 pt = new P3();
       ((Matrix3f) x.value).transform(pt);
-      return pt.distance(pt0);
+      return pt.length();
     case matrix4f:
       P3 pt1 = new P3();
       ((Matrix4f) x.value).transform(pt1);
-      return pt1.distance(pt0);
+      return pt1.length();
     default:
       return 0;
     }

Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -1388,7 +1388,6 @@
 
     // preliminarty checks we only want to do once:
 
-    P3 zero = (minmaxtype == T.allfloat ? new P3() : null);
     P3 pt = (isPt || !isAtoms ? new P3() : null);
     if (isExplicitlyAll || isString && !haveIndex
         && minmaxtype != T.allfloat && minmaxtype != T.min)
@@ -1738,7 +1737,7 @@
             fout[i] = Parser.parseFloatStr((String) v);
             break;
           case 3:
-            fout[i] = ((P3) v).distance(zero);
+            fout[i] = ((P3) v).length();
             break;
           }
         }
@@ -11284,7 +11283,7 @@
       break;
     case T.set:
       sm.loadShape(JC.SHAPE_ELLIPSOIDS);
-      setShapeProperty(JC.SHAPE_ELLIPSOIDS, "select", stringParameter(2));
+      setShapeProperty(JC.SHAPE_ELLIPSOIDS, "select", parameterAsString(2));
       i = iToken;
       checkMore = true;
       isSet = true;

Modified: trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java
===================================================================
--- trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java     2013-08-12 
02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java     2013-08-12 
20:16:55 UTC (rev 18552)
@@ -835,17 +835,18 @@
   }
 
   private boolean evaluateTensor(SV[] args) throws ScriptException {
+    // {*}.tensor()
+    // {*}.tensor("isc")            // only within this atom set
+    // {atomindex=1}.tensor("isc")  // all to this atom
     // {*}.tensor("efg","eigenvalues")
-    // T.tensor is set to allow exactly 2 parameters
-    // change that in T.java to adjust
-    if (args.length == 0 || args.length > 2)
+    if (args.length > 2)
       return false;
     BS bs = SV.getBitSet(getX(), false);
-    String tensorType = SV.sValue(args[0]).toLowerCase();
+    String tensorType = (args.length == 0 ? null : 
SV.sValue(args[0]).toLowerCase());
     String infoType = ";"
-        + (args.length == 1 ? "all" : SV.sValue(args[1]).toLowerCase()) + ".";
+        + (args.length < 2 ? "all" : SV.sValue(args[1]).toLowerCase()) + ".";
     JmolNMRInterface calc = viewer.getNMRCalculation();      
-    if (tensorType.equals("unique"))
+    if ("unique".equals(tensorType))
       return addXBs(calc.getUniqueTensorSet(bs));
     return addXList(calc.getTensorInfo(tensorType, infoType, bs));
   }

Modified: trunk/Jmol/src/org/jmol/shapespecial/Ellipsoid.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Ellipsoid.java 2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/shapespecial/Ellipsoid.java 2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -128,7 +128,7 @@
 
   protected void setEquation(double[] coef) {
     isValid = false;
-    tensor = Tensor.getTensorFromThermalEquation(coef);
+    tensor = Tensor.getTensorFromThermalEquation(coef, null);
     validate(true);
   }
 

Modified: trunk/Jmol/src/org/jmol/shapespecial/Ellipsoids.java
===================================================================
--- trunk/Jmol/src/org/jmol/shapespecial/Ellipsoids.java        2013-08-12 
02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/jmol/shapespecial/Ellipsoids.java        2013-08-12 
20:16:55 UTC (rev 18552)
@@ -216,9 +216,13 @@
         bs = selectedAtoms;
       if (isOn)
         setSize(Integer.MAX_VALUE, bs);
-      for (Ellipsoid e : atomEllipsoids.values())
-        if (e.tensor.type.equals(typeSelected) && e.tensor.isSelected(bs, -1))
+      for (Ellipsoid e : atomEllipsoids.values()) {
+        Tensor t = e.tensor;
+        if ((t.type.equals(typeSelected) || typeSelected.equals(t.altType))
+            && t.isSelected(bs, -1)) {
           e.isOn = isOn;
+        }
+      }
       return;
     }
 
@@ -235,7 +239,7 @@
           e.options = options;
       return;
     }
-    
+
     if ("color" == propertyName) {
       short colix = C.getColixO(value);
       byte pid = EnumPalette.pidOf(value);
@@ -389,11 +393,19 @@
     Iterator<Ellipsoid> e = ellipsoids.values().iterator();
     while (e.hasNext()) {
       Ellipsoid ellipsoid = e.next();
-      ellipsoid.visible = ellipsoid.isValid && ellipsoid.isOn
-          && (ellipsoid.modelIndex < 0 || bs.get(ellipsoid.modelIndex));
-      if (ellipsoid.tensor.atomIndex1 >= 0)
-        
atoms[ellipsoid.tensor.atomIndex1].setShapeVisibility(myVisibilityFlag, true);
-
+      Tensor t = ellipsoid.tensor; 
+      boolean isOK = true;
+      if (t.atomIndex1 >= 0) {
+        if (t.iType == Tensor.TYPE_ADP) {
+          boolean isModTensor = t.isModulated;
+          boolean isUnmodTensor = t.isUnmodulated;
+          boolean isModAtom = modelSet.isModulated(t.atomIndex1);
+          isOK =(!isModTensor && !isUnmodTensor || isModTensor == isModAtom);
+        }
+        atoms[t.atomIndex1].setShapeVisibility(myVisibilityFlag, true);
+      }
+      ellipsoid.visible = isOK && ellipsoid.isValid && ellipsoid.isOn
+      && (ellipsoid.modelIndex < 0 || bs.get(ellipsoid.modelIndex));
     }
   }
 

Modified: trunk/Jmol/src/org/jmol/symmetry/SpaceGroup.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/SpaceGroup.java    2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/symmetry/SpaceGroup.java    2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -73,7 +73,10 @@
 
 class SpaceGroup {
 
+  private static String[] canonicalSeitzList;
+  
   int index;
+  
   String name = "unknown!";
   String hallSymbol;
   //String schoenfliesSymbol; //parsed but not read
@@ -96,9 +99,18 @@
   int latticeParameter;
   char latticeCode = '\0';
   SymmetryOperation[] operations;
+  SymmetryOperation[] finalOperations;
   int operationCount;
+  boolean hasLatticeCentering;
+  Map<String, Integer> xyzList = new Hashtable<String, Integer>();
+
+  private int modulationDimension;
+
   boolean doNormalize = true;
 
+  
+  
+
   static SpaceGroup getNull() {
     getSpaceGroups();
     return new SpaceGroup(null);
@@ -142,8 +154,6 @@
     return addOperation(xyz, opId);
   }
    
-  SymmetryOperation[] finalOperations;
-  
   void setFinalOperations(P3[] atoms, int atomIndex, int count,
                           boolean doNormalize) {
     //from AtomSetCollection.applySymmetry only
@@ -285,9 +295,7 @@
   }
 
   ///// private methods /////
-  
-  private static String[] canonicalSeitzList;
-  
+    
   /**
    * 
    * @return either a String or a SpaceGroup, depending on index.
@@ -390,9 +398,6 @@
     return sg;
   }
   
-  Map<String, Integer> xyzList = new Hashtable<String, Integer>();
-  private int modulationDimension;
-  
   private int addOperation(String xyz0, int opId) {
     if (xyz0 == null || xyz0.length() < 3) {
       xyzList = new Hashtable<String, Integer>();
@@ -425,6 +430,8 @@
       // ! in character 0 indicates we are using the symop() function and want 
to be explicit
       if (xyzList.containsKey(xyz))
         return xyzList.get(xyz).intValue();
+      if (!hasLatticeCentering && 
xyzList.containsKey(TextFormat.simpleReplace(TextFormat.simpleReplace(xyz, 
"+1/2", ""), "+1/2", "")))
+        hasLatticeCentering = true;
       xyzList.put(xyz, Integer.valueOf(operationCount));
     }
     if (xyz != null && !xyz.equals(xyz0))
@@ -1374,6 +1381,7 @@
   }
 
   public void addLatticeVectors(JmolList<float[]> lattvecs) {
+    hasLatticeCentering = true; 
     int nOps = operationCount;
     for (int j = 0; j < lattvecs.size(); j++) {
       float[] data = lattvecs.get(j);

Modified: trunk/Jmol/src/org/jmol/symmetry/Symmetry.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/Symmetry.java      2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/symmetry/Symmetry.java      2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -652,4 +652,8 @@
     spaceGroup.addLatticeVectors(lattvecs);
   }
 
+  public boolean hasLatticeCentering() {
+    return spaceGroup.hasLatticeCentering;
+  }
+
 }  

Modified: trunk/Jmol/src/org/jmol/symmetry/UnitCell.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/UnitCell.java      2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/symmetry/UnitCell.java      2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -26,6 +26,7 @@
 package org.jmol.symmetry;
 
 import org.jmol.util.BoxInfo;
+import org.jmol.util.Escape;
 import org.jmol.util.Matrix3f;
 import org.jmol.util.Matrix4f;
 import org.jmol.util.P3;
@@ -302,7 +303,7 @@
       float[] eigenValues = new float[] {f, f, f};
       // sqrt will be taken when converted to lengths later
       // no factor of 0.5 pi^2
-      return Tensor.getTensorFromEigenVectors(unitVectors, eigenValues, "iso");
+      return Tensor.getTensorFromEigenVectors(unitVectors, eigenValues, "iso", 
"Uiso=" + f);
     }
 
     double[] Bcart = new double[6];
@@ -362,7 +363,8 @@
 
     //System.out.println("UnitCell Bcart=" + Bcart[0] + " " + Bcart[1] + " "
       //  + Bcart[2] + " " + Bcart[3] + " " + Bcart[4] + " " + Bcart[5]);
-    return Tensor.getTensorFromThermalEquation(Bcart);
+
+    return Tensor.getTensorFromThermalEquation(Bcart, Escape.eAF(parBorU));
   }
   
   P3[] getCanonicalCopy(float scale) {

Modified: trunk/Jmol/src/org/jmol/util/Logger.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/Logger.java    2013-08-12 02:02:51 UTC (rev 
18551)
+++ trunk/Jmol/src/org/jmol/util/Logger.java    2013-08-12 20:16:55 UTC (rev 
18552)
@@ -84,6 +84,7 @@
   public static void setLogger(LoggerInterface logger) {
     _logger = logger;
     debugging = isActiveLevel(LEVEL_DEBUG) || isActiveLevel(LEVEL_DEBUGHIGH);
+    debuggingHigh = (debugging && _activeLevels[LEVEL_DEBUGHIGH]);
   }
 
   /**
@@ -110,6 +111,7 @@
       level = LEVEL_MAX - 1;
     _activeLevels[level] = active;
     debugging = isActiveLevel(LEVEL_DEBUG) || isActiveLevel(LEVEL_DEBUGHIGH);
+    debuggingHigh = (debugging && _activeLevels[LEVEL_DEBUGHIGH]);
   }
 
   /**

Modified: trunk/Jmol/src/org/jmol/util/Modulation.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/Modulation.java        2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/util/Modulation.java        2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -134,7 +134,8 @@
         v += a1 * Math.cos(theta);
       if (a2 != 0)
         v += a2 * Math.sin(theta);
-      //System.out.println("MOD v " + v + " a1 a2 " + a1 + " " + a2 + " / " + 
theta + " " +  ms.t);
+      if (Logger.debuggingHigh)
+        Logger.debug("MOD v " + v + " a1 a2 " + a1 + " " + a2 + " / " + theta 
+ " " +  ms.t);
       break;
     case TYPE_OCC_CRENEL:
 

Modified: trunk/Jmol/src/org/jmol/util/ModulationSet.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/ModulationSet.java     2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/util/ModulationSet.java     2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -46,7 +46,8 @@
     if (htValues == null)
       htValues = new Hashtable<String, Float>();
     Float f = htValues.get(utens);
-    System.out.println("MOD " + id + " n=" + n + " utens=" + utens + " f=" + f 
+ " v="+ v);
+    if (Logger.debuggingHigh)
+      Logger.debug("MODSET " + id + " n=" + n + " utens=" + utens + " f=" + f 
+ " v="+ v);
     if(f != null)
       v += f.floatValue();
     htValues.put(utens, Float.valueOf(v));

Modified: trunk/Jmol/src/org/jmol/util/Tensor.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/Tensor.java    2013-08-12 02:02:51 UTC (rev 
18551)
+++ trunk/Jmol/src/org/jmol/util/Tensor.java    2013-08-12 20:16:55 UTC (rev 
18552)
@@ -45,8 +45,10 @@
   
   private static EigenSort tSort; // used for sorting eigenvector/values
 
+
   // base data:
   
+  public String id;
   public String type;
   public int iType = TYPE_OTHER;
   
@@ -114,13 +116,16 @@
   public int modelIndex;
   public int atomIndex1 = -1;
   public int atomIndex2 = -1;
+  public boolean isModulated;
+  public boolean isUnmodulated;
 
   private static final String infoList = 
     ";............." + ";eigenvalues.." + ";eigenvectors."
   + ";asymmatrix..." + ";symmatrix...." + ";value........"
   + ";isotropy....." + ";anisotropy..." + ";asymmetry...." 
   + ";eulerzyz....." + ";eulerzxz....." + ";quaternion..." 
-  + ";indices......" + ";string......." + ";type.........";
+  + ";indices......" + ";string......." + ";type........."
+  + ";id...........";
   /**
    * returns an object of the specified type, including "eigenvalues",
    * "eigenvectors", "asymmetric", "symmetric", "trace", "indices", and "type"
@@ -137,8 +142,11 @@
       Map<String, Object> info = new Hashtable<String, Object>();
       String[] s = Parser.getTokens(TextFormat.replaceAllCharacter(infoList, 
";.", ' ').trim());
       Arrays.sort(s);
-      for (int i = 0; i < s.length; i++)
-        info.put(s[i], getInfo(s[i]));
+      for (int i = 0; i < s.length; i++) {
+        Object o = getInfo(s[i]);
+        if (o != null)
+          info.put(s[i], o);
+      }
       return info;
       
     case 1:
@@ -195,6 +203,9 @@
       return this.toString();
     case 14:
       return type;
+      
+    case 15:
+      return id;
     }
   }
 
@@ -222,6 +233,7 @@
     t.modelIndex = t0.modelIndex;
     t.atomIndex1 = t0.atomIndex1;
     t.atomIndex2 = t0.atomIndex2;
+    t.id = t0.id;
     return t;
   }
 
@@ -237,9 +249,10 @@
    * 
    * @param asymmetricTensor
    * @param type
+   * @param id 
    * @return Tensor
    */
-  public static Tensor getTensorFromAsymmetricTensor(double[][] 
asymmetricTensor, String type) {
+  public static Tensor getTensorFromAsymmetricTensor(double[][] 
asymmetricTensor, String type, String id) {
     double[][] a = new double[3][3];    
     for (int i = 3; --i >= 0;)
       for (int j = 3; --j >= 0;)
@@ -284,9 +297,10 @@
     V3[] vectors = new V3[3];
     float[] values = new float[3];
     eigen.fillArrays(vectors, values);
-    Tensor t = newTensorType(vectors, values, type);
+    Tensor t = newTensorType(vectors, values, type, id);
     t.asymMatrix = asymmetricTensor;
     t.symMatrix = a;
+    t.id = id;
     return t;
   }
 
@@ -296,17 +310,18 @@
    * @param eigenVectors
    * @param eigenValues
    * @param type
+   * @param id 
    * @return Tensor
    */
   public static Tensor getTensorFromEigenVectors(V3[] eigenVectors,
-                                            float[] eigenValues, String type) {
+                                            float[] eigenValues, String type, 
String id) {
     float[] values = new float[3];
     V3[] vectors = new V3[3];
     for (int i = 0; i < 3; i++) {
       vectors[i] = V3.newV(eigenVectors[i]);
       values[i] = eigenValues[i];
     }    
-    return newTensorType(vectors, values, type);
+    return newTensorType(vectors, values, type, id);
   }
 
   /**
@@ -340,12 +355,14 @@
    * (see http://www.iucr.org/iucr-top/comm/cnom/adp/finrepone/finrepone.html)
    * 
    * @param coefs
+   * @param id  
    * @return Tensor
    */
-  public static Tensor getTensorFromThermalEquation(double[] coefs) {
+  public static Tensor getTensorFromThermalEquation(double[] coefs, String id) 
{
     Tensor t = new Tensor();
     t.eigenValues = new float[3];
     t.eigenVectors = new V3[3];
+    t.id = (id == null ? "coefs=" + Escape.eAD(coefs) : id);
     // assumes an ellipsoid centered on 0,0,0
     // called by UnitCell for the initial creation from PDB/CIF ADP data    
     double[][] mat = new double[3][3];
@@ -406,15 +423,17 @@
    * @param vectors
    * @param values
    * @param type
+   * @param id 
    * @return Tensor
    */
-  private static Tensor newTensorType(V3[] vectors, float[] values, String 
type) {
+  private static Tensor newTensorType(V3[] vectors, float[] values, String 
type, String id) {
     Tensor t = new Tensor();
     t.eigenValues = values;
     t.eigenVectors = vectors;
     for (int i = 0; i < 3; i++)
       t.eigenVectors[i].normalize();
     t.setType(type);
+    t.id = id;
     t.sortAndNormalize();
     t.eigenSignMask = (t.eigenValues[0] >= 0 ? 1 : 0)
         + (t.eigenValues[1] >= 0 ? 2 : 0) + (t.eigenValues[2] >= 0 ? 4 : 0);

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-08-12 02:02:51 UTC 
(rev 18551)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-08-12 20:16:55 UTC 
(rev 18552)
@@ -11,8 +11,17 @@
 #  The quotes above look odd for a parameter file, but they are 
 #  important for the JavaScript version of Jmol.
 
-___JmolVersion="13.3.4_dev_2013.08.11"
+___JmolVersion="13.3.4_dev_2013.08.12"
 
+new feature: incommensurate modulation of ADPs.
+
+bug fix: set loglevel 6 (debugHigh) not working
+bug fix: {*}.tensor("", "id") not implemented
+bug fix: {*}.tensor("") not implemented
+bug fix: {*}.tensor("adp") fails
+bug fix: {*}.symmetry fails when space group is P1
+bug fix: atom tensors lost when merging
+
 bug fix: Jsmol menu and console broken in 2013.08.07 when jQuery calls were 
all moved into JSmolCore.js
 
 bug fix: float parser broken in dev_2013.08.07

Modified: trunk/Jmol/src/org/openscience/jmol/app/surfacetool/SurfaceTool.java
===================================================================
--- trunk/Jmol/src/org/openscience/jmol/app/surfacetool/SurfaceTool.java        
2013-08-12 02:02:51 UTC (rev 18551)
+++ trunk/Jmol/src/org/openscience/jmol/app/surfacetool/SurfaceTool.java        
2013-08-12 20:16:55 UTC (rev 18552)
@@ -150,7 +150,7 @@
       //set positionMin to minimum of BBoxCornerMin.x .y or .z or if all are 
       //negative -1* distance from origin. PositionMax similarly.
       if (negCorner.x < 0 && negCorner.y < 0 && negCorner.z < 0) {
-        positionMin = -1 * negCorner.distance(P3.new3(0, 0, 0));
+        positionMin = -1 * negCorner.length();
       } else {
         positionMin = Math.min(negCorner.x, negCorner.y);
         positionMin = Math.min(negCorner.z, positionMin);

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


------------------------------------------------------------------------------
Get 100% visibility into Java/.NET code with AppDynamics Lite!
It's a free troubleshooting tool designed for production.
Get down to code-level detail for bottlenecks, with <2% overhead. 
Download for free and get started troubleshooting in minutes. 
http://pubads.g.doubleclick.net/gampad/clk?id=48897031&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to