Revision: 20075
          http://sourceforge.net/p/jmol/code/20075
Author:   hansonr
Date:     2014-10-14 13:59:43 +0000 (Tue, 14 Oct 2014)
Log Message:
-----------
Jmol.___JmolVersion="14.3.8_2014.10.14"

bug fix: Legendre for U not implemented in msCIF reader - preliminary
bug fix: Legendre for D,U in Jana2006 reader not implemented - preliminary

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/adapter/readers/cif/MSCifRdr.java
    trunk/Jmol/src/org/jmol/adapter/readers/cif/MSRdr.java
    trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/adapter/readers/cif/MSCifRdr.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/cif/MSCifRdr.java   2014-10-14 
11:50:49 UTC (rev 20074)
+++ trunk/Jmol/src/org/jmol/adapter/readers/cif/MSCifRdr.java   2014-10-14 
13:59:43 UTC (rev 20075)
@@ -130,20 +130,21 @@
   private final static int LEG_DISP_ORDER = 63;
   private final static int LEG_DISP_COEF = 64;
 
-  private final static int LEG_OCC_LABEL = 65;
-  private final static int LEG_OCC_ORDER = 66;
-  private final static int LEG_OCC_COEF = 67;
+  private final static int LEG_U_LABEL = 65;
+  private final static int LEG_U_TENS = 66;
+  private final static int LEG_U_ORDER = 67;
+  private final static int LEG_U_COEF = 68;
 
-  private final static int LEG_U_LABEL = 68;
-  private final static int LEG_U_ORDER = 69;
-  private final static int LEG_U_COEF = 70;
+  private final static int LEG_OCC_LABEL = 69;
+  private final static int LEG_OCC_ORDER = 70;
+  private final static int LEG_OCC_COEF = 71;
 
-  private final static int DEPR_FD_COS = 71;
-  private final static int DEPR_FD_SIN = 72;
-  private final static int DEPR_FO_COS = 73;
-  private final static int DEPR_FO_SIN = 74;
-  private final static int DEPR_FU_COS = 75;
-  private final static int DEPR_FU_SIN = 76;
+  private final static int DEPR_FD_COS = 72;
+  private final static int DEPR_FD_SIN = 73;
+  private final static int DEPR_FO_COS = 74;
+  private final static int DEPR_FO_SIN = 75;
+  private final static int DEPR_FU_COS = 76;
+  private final static int DEPR_FU_SIN = 77;
   // * will be _atom_site
   final private static String[] modulationFields = {
     "*_fourier_wave_vector_seq_id",  // *_ must be first
@@ -219,18 +220,19 @@
     "*_displace_legendre_param_order", 
     "*_displace_legendre_param_coeff",
     "*_u_legendre_atom_site_label", // 65  
+    "*_u_legendre_tens_elem",
     "*_u_legendre_param_order", 
     "*_u_legendre_param_coeff",
     "*_occ_legendre_atom_site_label", 
     "*_occ_legendre_param_order",
-    "*_occ_legendre_param_coeff", // 70    
+    "*_occ_legendre_param_coeff", // 71    
     // deprecated:
-    "*_displace_fourier_cos", // 71
+    "*_displace_fourier_cos", // 72
     "*_displace_fourier_sin",
     "*_occ_fourier_cos",
     "*_occ_fourier_sin",
     "*_u_fourier_cos",
-    "*_u_fourier_sin" //76
+    "*_u_fourier_sin" //77
   };
   
   private static final int NONE = -1;
@@ -356,6 +358,10 @@
           if (type_id == null)
             type_id = "D_L";
           //$FALL-THROUGH$
+        case LEG_U_LABEL:
+          if (type_id == null)
+            type_id = "U_L";
+          //$FALL-THROUGH$
         case LEG_OCC_LABEL:
           if (type_id == null)
             type_id = "O_L";
@@ -377,6 +383,7 @@
           if (modAxes != null && modAxes.indexOf(axis.toUpperCase()) < 0)
             ignore = true;
           break;
+        case LEG_U_TENS:
         case FWV_U_TENS:
           axis = field.toUpperCase();
           break;
@@ -497,7 +504,10 @@
           continue;
         }
         if (type_id.indexOf("_L") == 1) {
-          axis += (int) pt[1];
+          if (type_id.startsWith("U"))
+            type_id += (int) pt[1]; // axis is Utype here
+          else
+            axis += (int) pt[1];
         }
         type_id += "#" + axis + ";" + atomLabel;
         break;

Modified: trunk/Jmol/src/org/jmol/adapter/readers/cif/MSRdr.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/cif/MSRdr.java      2014-10-14 
11:50:49 UTC (rev 20074)
+++ trunk/Jmol/src/org/jmol/adapter/readers/cif/MSRdr.java      2014-10-14 
13:59:43 UTC (rev 20075)
@@ -310,7 +310,7 @@
       map = htModulation;
     if (id.indexOf("@") < 0)
       id += "@" + (iModel >= 0 ? iModel : cr.asc.iSet);
-    if (id.startsWith("D_L#")) {
+    if (id.startsWith("D_L#") || id.startsWith("U_L")) {
       if (legendres == null)
         legendres = new Lst<String>();
       legendres.addLast(id);
@@ -571,7 +571,7 @@
       String utens = null;
       switch (type) {
       case 'U':
-        utens = key.substring(4, key.indexOf(";"));
+        utens = key.substring(pt_, key.indexOf(";"));
         //$FALL-THROUGH$
       case 'O':
       case 'D':

Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java        
2014-10-14 11:50:49 UTC (rev 20074)
+++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java        
2014-10-14 13:59:43 UTC (rev 20075)
@@ -313,6 +313,7 @@
   private P3 rho;
   private boolean firstPosition;
   private V3 vR, v0Cart;
+  private boolean isLegendre;
 
 
   /**
@@ -690,8 +691,8 @@
    * 
    * @throws Exception
    */
-  private float[][] readAtomRecord( Atom atom, P3 rm, P3 rp,
-                                   boolean isPos) throws Exception {
+  private float[][] readAtomRecord(Atom atom, P3 rm, P3 rp, boolean isPos)
+      throws Exception {
     String label = ";" + atom.atomName;
     int tType = (isPos ? -1 : getInt(13, 14));
     if (!isPos && molTtypes != null)
@@ -757,6 +758,7 @@
     atom.foccupancy *= o_0;
     int wv = 0;
     float a1, a2;
+    isLegendre = false;
     for (int j = 0; j < nOcc; j++) {
       if (haveSpecialOcc) {
         float[][] data = readM40FloatLines(2, 1);
@@ -782,10 +784,10 @@
         float w = floats[4]; // width
         for (int k = 0; k < 3; k++)
           if (floats[k] != 0)
-            ms.addModulation(null, "D_S#" + XYZ[k] + label,
-                new double[] { c, w, floats[k] }, -1);
+            ms.addModulation(null, "D_S#" + XYZ[k] + label, new double[] { c,
+                w, floats[k] }, -1);
       } else {
-        // Fourier displacements
+        // Fourier or Legendre displacements
         addSinCos(j, "D_", label, isPos);
       }
     }
@@ -797,27 +799,41 @@
 
     // finally read Uij sines and cosines
 
-    if (!isPos) // No TLS here
+    if (!isPos) { // No TLS here
+      if (isLegendre)
+        nUij *= 2;
       for (int j = 0; j < nUij; j++) {
-        ensureFourier(j);
         if (tType == 1) {
-          // fourier?
+          // Fourier displacements
           addSinCos(j, "U_", label, false);
         } else {
           if (haveSpecialUij) {
             //TODO
             Logger.error("JanaReader -- not interpreting SpecialUij flag: "
                 + line);
+          } else if (isLegendre) {
+            float[][] data = readM40FloatLines(1, 6);
+            int order = j + 1;
+            double coeff = 0;
+            for (int k = 0, p = 0; k < 6; k++, p += 3) {
+              if ((coeff = data[0][k]) != 0)
+                ms.addModulation(null,
+                    "U_L" + order + "#" + U_LIST.substring(p, p + 3) + label,
+                    new double[] { coeff, order, 0 }, -1);
+            }
           } else {
             float[][] data = readM40FloatLines(2, 6);
-            for (int k = 0, p = 0; k < 6; k++, p += 3)
+            for (int k = 0, p = 0; k < 6; k++, p += 3) {
+              double csin = data[1][k];
+              double ccos = data[0][k];
               ms.addModulation(null,
                   "U_" + (j + 1) + "#" + U_LIST.substring(p, p + 3) + label,
-                  new double[] { data[1][k], data[0][k], 0 }, -1);
+                  new double[] { csin, ccos, 0 }, -1);
+            }
           }
         }
       }
-
+    }
     // higher order temperature factor modulation ignored
 
     // phason ignored
@@ -825,7 +841,8 @@
   }
 
   /**
-   * Add x, y, and z modulations as [ csin, ccos, 0 ]
+   * Add x, y, and z modulations as [ csin, ccos, 0 ] or, possibly Legendre [
+   * coef, order, 0 ]
    * 
    * @param j
    * @param key
@@ -835,8 +852,25 @@
    */
   private void addSinCos(int j, String key, String label, boolean isPos)
       throws Exception {
+    readM40Floats();
+    if (isLegendre) {
+      for (int i = 0; i < 2; i++) {
+        int order = (j * 2 + i + 1);
+        for (int k = 0; k < 3; ++k) {
+          float coeff = floats[3 * i + k];
+          if (coeff == 0) {
+            continue;
+          }
+          String axis = XYZ[k % 3];
+          if (modAxes != null && modAxes.indexOf(axis.toUpperCase()) < 0)
+            continue;
+          String id = key + "L#" + axis + order + label;
+          ms.addModulation(null, id, new double[] { coeff, order, 0 }, -1);
+        }
+      }
+      return;
+    }
     ensureFourier(j);
-    readM40Floats();
     for (int k = 0; k < 3; ++k) {
       float csin = floats[k];
       float ccos = floats[k + 3];
@@ -845,7 +879,7 @@
           continue;
         csin = 1e-10f;
       }
-      String axis = XYZ[k%3];
+      String axis = XYZ[k % 3];
       if (modAxes != null && modAxes.indexOf(axis.toUpperCase()) < 0)
         continue;
       String id = key + (j + 1) + "#" + axis + label;
@@ -890,6 +924,8 @@
     float[][] data = new float[nLines][nFloats];
     for (int i = 0; i < nLines; i++) {
       readM40Floats();
+      if (line.indexOf("Legendre") == 19)
+        isLegendre = true;
       for (int j = 0; j < nFloats; j++)
         data[i][j] = floats[j];
     }

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2014-10-14 11:50:49 UTC 
(rev 20074)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2014-10-14 13:59:43 UTC 
(rev 20075)
@@ -14,10 +14,14 @@
 
 TODO: design and implement sidechain mutation -- MUTATE command ?
 TODO: remove HTML5 dependency on synchronous file loading
-TODO: legendre polynomials for modulation Jana2006
 
-Jmol.___JmolVersion="14.3.7_2014.10.13"
+Jmol.___JmolVersion="14.3.8_2014.10.14"
 
+bug fix: Legendre for U not implemented in msCIF reader - preliminary
+bug fix: Legendre for D,U in Jana2006 reader not implemented - preliminary
+
+JmolVersion="14.3.7_2014.10.13"
+
 new feature: modulation occupancy settable using {*}.occupancy = 
{*}.modulation('O',t)
   -- for example:
   

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


------------------------------------------------------------------------------
Comprehensive Server Monitoring with Site24x7.
Monitor 10 servers for $9/Month.
Get alerted through email, SMS, voice calls or mobile push notifications.
Take corrective actions from your mobile device.
http://p.sf.net/sfu/Zoho
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to