Revision: 20158
          http://sourceforge.net/p/jmol/code/20158
Author:   hansonr
Date:     2014-12-05 04:21:46 +0000 (Fri, 05 Dec 2014)
Log Message:
-----------
Jmol.___JmolVersion="14.2.11_2014.12.02"

bug fix: for (x in yUpperCase) fails
bug fix: draw SYMOP fails for incommensurate space groups
bug fix: incommensurate magnetic CIF reading does not apply magnetic spin 
operation to spin modulations
bug fix: CIF reader can cycle infinitely if loop_ keywords are not followed by 
any data

Modified Paths:
--------------
    branches/v14_2/Jmol/src/javajs/util/CifDataParser.java
    branches/v14_2/Jmol/src/org/jmol/script/ScriptEval.java
    branches/v14_2/Jmol/src/org/jmol/symmetry/SymmetryDesc.java
    branches/v14_2/Jmol/src/org/jmol/symmetry/SymmetryOperation.java
    branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: branches/v14_2/Jmol/src/javajs/util/CifDataParser.java
===================================================================
--- branches/v14_2/Jmol/src/javajs/util/CifDataParser.java      2014-12-05 
04:07:05 UTC (rev 20157)
+++ branches/v14_2/Jmol/src/javajs/util/CifDataParser.java      2014-12-05 
04:21:46 UTC (rev 20158)
@@ -263,7 +263,7 @@
     for (int i = 0; i < fieldCount; ++i)
       if ((loopData[i] = getNextDataToken()) == null)
         return false;
-    return true;
+    return (fieldCount > 0);
   }
 
   /**

Modified: branches/v14_2/Jmol/src/org/jmol/script/ScriptEval.java
===================================================================
--- branches/v14_2/Jmol/src/org/jmol/script/ScriptEval.java     2014-12-05 
04:07:05 UTC (rev 20157)
+++ branches/v14_2/Jmol/src/org/jmol/script/ScriptEval.java     2014-12-05 
04:21:46 UTC (rev 20158)
@@ -8579,9 +8579,9 @@
       if (key.startsWith("_"))
         invArg();
       if (key.indexOf("/") >= 0)
-        contextVariables.put(key, t = SV.newI(0));
+        contextVariables.put(key.toLowerCase(), t = SV.newI(0));
       else
-      t = vwr.g.getOrSetNewVariable(key, true);
+        t = vwr.g.getOrSetNewVariable(key, true);
     }
     return t;
   }

Modified: branches/v14_2/Jmol/src/org/jmol/symmetry/SymmetryDesc.java
===================================================================
--- branches/v14_2/Jmol/src/org/jmol/symmetry/SymmetryDesc.java 2014-12-05 
04:07:05 UTC (rev 20157)
+++ branches/v14_2/Jmol/src/org/jmol/symmetry/SymmetryDesc.java 2014-12-05 
04:21:46 UTC (rev 20158)
@@ -462,8 +462,8 @@
     if (haveCentering)
       info1 += "|centering " + strCoord(op.centering, op.isBio);
 
-    if (op.timeReversal != 0)
-      info1 += "|spin " + (op.timeReversal == 1 ? "m" : "-m");
+    if (op.timeReversal != 0 && op.getSpinOp() == -1)
+      info1 += "|spin flipped";
 
     String cmds = null;
     String xyzNew = (op.isBio ? op.xyzOriginal : SymmetryOperation
@@ -484,7 +484,7 @@
       draw1
           .append(
               ("// " + op.xyzOriginal + "|" + xyzNew + "|" + info1).replace(
-                  '\n', ' ')).append("\n").append(drawid).append("* delete");
+                  '\n', ' ')).appendC('\n').append(drawid).append("* delete");
 
       // draw the initial frame
 
@@ -762,8 +762,8 @@
     }
     xyzNew = (op.isBio ? m2.toString() : op.modDim > 0 ? op.xyzOriginal
         : SymmetryOperation.getXYZFromMatrix(m2, false, false, false));
-    if (op.timeReversal != 0)
-      xyzNew += (op.timeReversal == 1 ? ",m" : ",-m");
+    //if (op.timeReversal != 0)
+      //xyzNew += (op.timeReversal == 1 ? ",m" : ",-m");
     return new Object[] { xyzNew, op.xyzOriginal, info1, cmds, approx0(ftrans),
         approx0(trans), approx0(ipt), approx0(pa1), approx0(ax1),
         Integer.valueOf(ang1), m2, vtrans, op.centering };
@@ -846,14 +846,9 @@
     if (xyz == null) {
       SymmetryOperation[] ops = (SymmetryOperation[]) uc
           .getSymmetryOperations();
-      if (ops == null || op == 0 || Math.abs(op) > ops.length) {
+      if (ops == null || op == 0 || Math.abs(op) > ops.length)
         return (type == T.draw ? "draw ID sym_* delete" : "");
-      }
-      if (op > 0) {
-        xyz = ops[iop = op - 1].xyz;
-      } else {
-        xyz = ops[iop = -1 - op].xyz;
-      }
+      xyz = ops[iop = Math.abs(op) - 1].xyz;
       centering = ops[iop].centering;
     } else {
       iop = op = 0;
@@ -957,12 +952,12 @@
       if (sb.length() > 0)
         sb.appendC('\n');
       if (prettyMat) {
-        sb.append(SymmetryOperation.cleanMatrix((M4) infolist[i][10])).append(
-            "\t");
+        SymmetryOperation.getPrettyMatrix(sb, (M4) infolist[i][10]);
+        sb.appendC('\t');
       } else if (!labelOnly) {
         if (symOp < 0)
-          sb.appendI(i + 1).append("\t");
-        sb.append((String) infolist[i][0]).append("\t"); //xyz
+          sb.appendI(i + 1).appendC('\t');
+        sb.append((String) infolist[i][0]).appendC('\t'); //xyz
       }
       sb.append((String) infolist[i][2]); //desc
     }

Modified: branches/v14_2/Jmol/src/org/jmol/symmetry/SymmetryOperation.java
===================================================================
--- branches/v14_2/Jmol/src/org/jmol/symmetry/SymmetryOperation.java    
2014-12-05 04:07:05 UTC (rev 20157)
+++ branches/v14_2/Jmol/src/org/jmol/symmetry/SymmetryOperation.java    
2014-12-05 04:21:46 UTC (rev 20158)
@@ -77,7 +77,7 @@
   private Matrix sigma;
   int index;
   String subsystemCode;
-  public int timeReversal;
+  int timeReversal;
   
   void setSigma(String subsystemCode, Matrix sigma) {
     this.subsystemCode = subsystemCode;
@@ -217,11 +217,7 @@
       return false;
     xyzOriginal = xyz;
     xyz = xyz.toLowerCase();
-    int n = (modDim + 4) * (modDim + 4);
-    this.modDim = modDim;
-    if (modDim > 0)
-      myLabels = labelsXn;
-    linearRotTrans = new float[n];
+    setModDim(modDim);
     boolean isReverse = (xyz.startsWith("!"));
     if (isReverse)
       xyz = xyz.substring(1);
@@ -243,23 +239,30 @@
        * 
        */
       this.xyz = xyz;
-      Parser.parseStringInfestedFloatArray(xyz, null, linearRotTrans);        
+      Parser.parseStringInfestedFloatArray(xyz, null, linearRotTrans);
       return setFromMatrix(null, isReverse);
     }
     if (xyz.indexOf("[[") == 0) {
-      xyz = xyz.replace('[',' ').replace(']',' ').replace(',',' ');
+      xyz = xyz.replace('[', ' ').replace(']', ' ').replace(',', ' ');
       Parser.parseStringInfestedFloatArray(xyz, null, linearRotTrans);
-      for (int i = 0; i < n; i++) {
-        float v = linearRotTrans[i];
-        if (Float.isNaN(v))
+      for (int i = linearRotTrans.length; --i >= 0;)
+        if (Float.isNaN(linearRotTrans[i]))
           return false;
-      }
       setMatrix(isReverse);
       isFinalized = true;
       isBio = (xyz.indexOf("bio") >= 0);
-      this.xyz = (isBio ? toString() : getXYZFromMatrix(this, false, false, 
false));
+      this.xyz = (isBio ? toString() : getXYZFromMatrix(this, false, false,
+          false));
       return true;
     }
+    if (modDim == 0 && xyz.indexOf("x4") >= 0) {
+      for (int i = 14; --i >= 4;) {
+        if (xyz.indexOf("x" + i) >= 0) {
+          setModDim(i - 3);
+          break;
+        }
+      }
+    }
     if (xyz.endsWith("m")) {
       timeReversal = (xyz.indexOf("-m") >= 0 ? -1 : 1);
       allowScaling = true;
@@ -277,6 +280,13 @@
     return true;
   }
 
+  private void setModDim(int dim) {
+    int n = (dim + 4) * (dim + 4);
+    modDim = dim;
+    if (dim > 0)
+      myLabels = labelsXn;
+    linearRotTrans = new float[n];
+  }
 
   private void setMatrix(boolean isReverse) {
     if (linearRotTrans.length > 16) {
@@ -668,13 +678,13 @@
     return PT.approx(f, 100);
   }
 
-  public static void normalizeTranslation(M4 operation) {
+  static void normalizeTranslation(M4 operation) {
     operation.m03 = ((int)operation.m03 + 12) % 12;
     operation.m13 = ((int)operation.m13 + 12) % 12;
     operation.m23 = ((int)operation.m23 + 12) % 12;    
   }
 
-  public static String getXYZFromRsVs(Matrix rs, Matrix vs, boolean is12ths) {
+  static String getXYZFromRsVs(Matrix rs, Matrix vs, boolean is12ths) {
     double[][] ra = rs.getArray();
     double[][] va = vs.getArray();
     int d = ra.length;
@@ -697,33 +707,47 @@
     return (rsvs == null ? super.toString() : super.toString() + " " + 
rsvs.toString());
   }
 
-  float magOp = Float.MAX_VALUE;
+  private boolean unCentered;
   boolean isCenteringOp;
-  private boolean unCentered;
-  public float getSpinOp() {
+
+  private float magOp = Float.MAX_VALUE;
+  /**
+   * Magnetic spin operations have a flag m=1 or m=-1 (m or -m)
+   * that indicates how the vector quantity changes with symmetry.
+   * This we call "timeReversal." 
+   * 
+   * To apply, timeReversal must be multiplied by the 3x3 determinant, which
+   * is always 1 (standard rotation) or -1 (rotation-inversion). This we store
+   * as magOp. 
+   * 
+   * For example, a vector perpendicular to a plane of symmetry (det=-1) will 
be
+   * flipped (m=1), while a vector parallel to that plane will not be flipped 
(m=-1)
+   * 
+   * @return +1, -1, or 0
+   */
+  float getSpinOp() {
     if (magOp == Float.MAX_VALUE)
       magOp = determinant3() * timeReversal;
     //System.out.println("sym op " + index + " " + xyz + " has tr " + 
timeReversal + " and magop " + magOp);
     return magOp;
   }
 
-  public void setTimeReversal(int magRev) {
+  void setTimeReversal(int magRev) {
     timeReversal = magRev;
     if (xyz.indexOf("m") >= 0)
       xyz = xyz.substring(0, xyz.indexOf("m"));
     xyz += (magRev == 1 ? ",m" : magRev == -1 ? ",-m" : "");
   }
 
-  public static String cleanMatrix(M4 m4) {
-    SB sb = new SB();
+  static String getPrettyMatrix(SB sb, M4 m4) {
     sb.append("[ ");
     float[] row = new float[4];
     for (int i = 0; i < 3; i++) {
       m4.getRow(i, row);
       sb.append("[ ")
-        .appendI((int)row[0]).append(" ")
-        .appendI((int)row[1]).append(" ")
-        .appendI((int)row[2]).append(" ");      
+        .appendI((int)row[0]).appendC(' ')
+        .appendI((int)row[1]).appendC(' ')
+        .appendI((int)row[2]).appendC(' ');      
       sb.append(twelfthsOf(row[3]*12)).append(" ]");
     }
     return sb.append(" ]").toString();
@@ -737,7 +761,7 @@
    *        TODO
    * @return centering
    */
-  public V3 setCentering(V3 c, boolean isFinal) {
+  V3 setCentering(V3 c, boolean isFinal) {
     if (centering == null && !unCentered) {
       if (modDim == 0 && index > 1 && m00 == 1 && m11 == 1 && m22 == 1
           && m01 == 0 && m02 == 0 && m10 == 0 && m12 == 0 && m20 == 0

Modified: branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties     2014-12-05 
04:07:05 UTC (rev 20157)
+++ branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties     2014-12-05 
04:21:46 UTC (rev 20158)
@@ -4,7 +4,7 @@
 # THIS IS THE RELEASE BRANCH 
 # BUG FIXES ONLY, PLEASE
 
-Jmol.___JmolVersion="14.3.11_2014.12.02"
+Jmol.___JmolVersion="14.2.11_2014.12.02"
 
 bug fix: for (x in yUpperCase) fails
 bug fix: draw SYMOP fails for incommensurate space groups

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


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&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