Revision: 18620
          http://sourceforge.net/p/jmol/code/18620
Author:   hansonr
Date:     2013-08-22 15:12:02 +0000 (Thu, 22 Aug 2013)
Log Message:
-----------
incommensurate work

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/JanaReader.java
    trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java
    trunk/Jmol/src/org/jmol/util/Modulation.java
    trunk/Jmol/src/org/jmol/util/ModulationSet.java

Modified: trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java  2013-08-22 
05:44:50 UTC (rev 18619)
+++ trunk/Jmol/src/org/jmol/adapter/readers/cif/CifReader.java  2013-08-22 
15:12:02 UTC (rev 18620)
@@ -47,6 +47,7 @@
 import org.jmol.util.P3;
 import org.jmol.util.SimpleUnitCell;
 import org.jmol.util.TextFormat;
+import org.jmol.util.V3;
 
 
 /**
@@ -818,6 +819,7 @@
   final private static byte DISORDER_ASSEMBLY = 58;
   final private static byte ASYM_ID = 59;
   final private static byte SUBSYS_ID = 60;
+  final private static byte SITE_MULT = 61;
 
 
   final private static String[] atomFields = { 
@@ -881,7 +883,8 @@
       "_chem_comp_atom_pdbx_model_cartn_z_ideal", 
       "_atom_site_disorder_assembly",
       "_atom_site_label_asym_id",
-      "_atom_site_subsystem_code"
+      "_atom_site_subsystem_code",
+      "_atom_site_symmetry_multiplicity"
   };
 
   /* to: hans...@stolaf.edu
@@ -933,6 +936,7 @@
     int iAtom = -1;
     int modelField = -1;
     String subid = null;
+    int siteMult = 0;
     while (tokenizer.getData()) {
       Atom atom = new Atom();
       assemblyId = '\0';
@@ -1141,6 +1145,9 @@
         case SUBSYS_ID:
           subid = field;
           break;
+        case SITE_MULT:
+          if (incommensurate)
+            siteMult = parseIntStr(field); 
         }
       }
       if (isAnisoData)
@@ -1175,9 +1182,10 @@
             htHetero);
         htHetero = null;
       }
-      if (subid != null) {
+      if (subid != null)
         addSubsystem(subid, null, atom.atomName);
-      }
+      if (siteMult != 0)
+        atom.vib = V3.new3(siteMult, 0, Float.NaN);
         
     }
     if (isPDB)
@@ -2321,6 +2329,9 @@
   private final static int FP_DISP_ID = 43;
   private final static int FP_OCC_ID = 44;
   private final static int FP_U_ID = 45;
+  
+  private final static int JANA_OCC_ABS_LABEL = 46;
+  private final static int JANA_OCC_ABS_O_0 = 47;
 
   final private static String[] modulationFields = {
       "_cell_wave_vector_seq_id", 
@@ -2372,6 +2383,9 @@
       "_atom_site_displace_fourier_param_id",
       "_atom_site_occ_fourier_param_id",
       "_atom_site_u_fourier_param_id",
+      
+      "_jana_atom_site_occ_fourier_absolute_site_label",
+      "_jana_atom_site_occ_fourier_absolute"
   };
   
   /**
@@ -2440,7 +2454,12 @@
           }
           id += field;
           break;
+        case JANA_OCC_ABS_LABEL:
+          id = "J_O";
+          pt.x = pt.z = 1;
+          //$FALL-THROUGH$
         case DISP_SPEC_LABEL:
+          if (id == null)
           id = "D_S";
           //$FALL-THROUGH$
         case OCC_SPECIAL_LABEL:
@@ -2503,6 +2522,7 @@
         case FWV_U_PHASE:
         case OCC_CRENEL_W:
         case DISP_SAW_AY:
+        case JANA_OCC_ABS_O_0:
           pt.y = parseFloatStr(field);
           break;
         case WV_Z:
@@ -2529,6 +2549,7 @@
         case 'D':
         case 'O':
         case 'U':
+        case 'J':
           if (atomLabel == null || axis == null)
             continue;
           if (id.equals("D_S")) {

Modified: trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java   
2013-08-22 05:44:50 UTC (rev 18619)
+++ trunk/Jmol/src/org/jmol/adapter/readers/cif/ModulationReader.java   
2013-08-22 15:12:02 UTC (rev 18620)
@@ -320,6 +320,7 @@
   private int iopLast = -1;
   private Matrix3f gammaE;
   private Matrix4f gammaIS;
+  private int nOps;
   
   /**
    * The displacement will be set as the atom vibration vector; the string
@@ -353,6 +354,7 @@
       gammaE = new Matrix3f();
       symmetry.getSpaceGroupOperation(iop).getRotationScale(gammaE);
       gammaIS = symmetry.getOperationGammaIS(iop);
+      nOps = symmetry.getSpaceGroupOperationCount();
     }
     if (Logger.debugging) {
       Logger.debug("setModulation iop = " + iop + " "
@@ -361,11 +363,32 @@
     Matrix4f q123w = Matrix4f.newMV(q123, new V3());
     setSubsystemMatrix(a.atomName, q123w);
     ModulationSet ms = new ModulationSet(a.index + " " + a.atomName, 
-        P3.newP(a), a.foccupancy, modDim, list, gammaE, gammaIS, q123w, qlen);
-    a.vib = ms;
+        P3.newP(a), modDim, list, gammaE, gammaIS, q123w, qlen);
     ms.calculate();
     if (!Float.isNaN(ms.vOcc)) {
-      a.foccupancy = Math.min(1, Math.max(0, ms.vOcc0 + ms.vOcc));
+      P3 pt = getMod("J_O#0;" + a.atomName);
+      float occ0 = ms.vOcc0;
+      float occ;
+      if (Float.isNaN(occ0)) {
+        // Crenel
+        occ = ms.vOcc; 
+      } else if (pt == null) {
+        // cif Fourier
+        // _atom_site_occupancy + SUM
+        occ = a.foccupancy + ms.vOcc; 
+      } else if (a.vib != null) {
+        // cif with m40 Fourier
+        // occ_site * (occ_0 + SUM)
+        float site_mult = a.vib.x;
+        float o_site = a.foccupancy * site_mult / nOps / pt.y;
+        occ = o_site * (pt.y + ms.vOcc);  
+      } else {
+        // m40 Fourier
+        // occ_site * (occ_0 + SUM)
+        occ = pt.x * (pt.y + ms.vOcc);  
+      }
+      a.foccupancy = Math.min(1, Math.max(0, occ));
+      a.vib = ms;
 //      if (!modVib) {
 //        if (occ < 0.5f) {
 //          a.foccupancy = 0;

Modified: trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java        
2013-08-22 05:44:50 UTC (rev 18619)
+++ trunk/Jmol/src/org/jmol/adapter/readers/xtal/JanaReader.java        
2013-08-22 15:12:02 UTC (rev 18620)
@@ -221,7 +221,9 @@
   //  0.000000 0.000000 0.000000 0.000000 0.000000 0.000000      000000
   //  0.000000 0.000000 0.000000 0.000000 0.000000 0.000000      000000
   //
-  //                             x        y        z             CS?  O  D  U
+  //                                                         SPECIAL   COUNTS
+  //                                                             ---  -------
+  //                             x        y        z             ODU  O  D  U
   // Zn        5  1     0.500000 0.250000 0.406400 0.244000      000  0  2  0
   //
   // 0         1         2         3         4         5         6         7
@@ -231,7 +233,25 @@
   //  0.015300 0.000000 0.000000-0.010100 0.000000 0.000000      000000
   //  0.000000 0.000200-0.000100 0.000000 0.000500-0.000400      000000
   //  0.000000                                                   0
+  // ...
+  //                   [occ_site]
+  // Na1       1  2     0.500000 0.500000 0.000000 0.000000      000  1  1  1
+  //  0.034155-0.007468 0.002638 0.000000-0.005723 0.000000      0000111010
+  // [occ_0 for Fourier or width for crenel] 
+  //  0.848047                                                   1
+  // [center for Crenel; ]
+  //  0.000000 0.312670                                          01
+  //  0.029441 0.000000 0.003581 0.000000 0.000000 0.000000      101000
+  //  0.000000 0.000000 0.000000 0.000000 0.000000 0.000000      000000
+  // -0.051170 0.000624-0.008585 0.000000 0.014781 0.000000      111010
+  //  0.000000
+  //
 
+  /**
+   * read the M40 file
+   * 
+   * @throws Exception 
+   */
   private void readM40Data() throws Exception {
     String name = filePath;
     int ipt = name.lastIndexOf(".");
@@ -266,7 +286,7 @@
           iSub++;
         addSubsystem("" + iSub, null, atom.atomName);
       }
-      atom.foccupancy = floats[2];
+      float o_site = atom.foccupancy = floats[2];
       setAtomCoordXYZ(atom, floats[3], floats[4], floats[5]);
       atomSetCollection.addAtom(atom);
       if (!incommensurate)
@@ -296,20 +316,30 @@
 
       // read occupancy parameters
       P3 pt;
-      if (nOcc > 0 && !haveSpecialOcc)
-        r.readLine(); //"1.00000"
+      float o_0 = (nOcc > 0 && !haveSpecialOcc ? parseFloatStr(r.readLine()) : 
1);
+      // we add a pt that save the original (unadjusted) o_0 and o_site
+      // will implement 
+      //
+      //  O = o_site (o_0 + SUM)
+      //
+      // However, first we need to adjust o_0 because the value given in m40 
is 
+      // divided by the number of operators giving this site.
+      if (o_0 != 1) {
+        addModulation(null, "J_O#0;" + atom.atomName, P3.new3(o_site, o_0, 0), 
-1);
+      }
+      atom.foccupancy = o_0 * o_site;
       int wv = 0;
       float a1, a2;
       for (int j = 0; j < nOcc; j++) {
         if (haveSpecialOcc) {
           float[][] data = readM40FloatLines(2, 1, r);
-          a1 = data[1][0];
-          a2 = data[0][0];
+          a2 = data[0][0]; // width (first line)
+          a1 = data[1][0]; // center (second line)
         } else {
           wv = j + 1;
           readM40Floats(r);
-          a1 = floats[1];
-          a2 = floats[0];
+          a2 = floats[0];  // sin (first line)
+          a1 = floats[1];  // cos (second line)
         }
         id = "O_" + wv + "#0" + label;
         pt = P3.new3(a1, a2, 0);
@@ -445,7 +475,9 @@
   }
 
   /**
-   * M40 occupancies are divided by the site multiplicity
+   * M40 occupancies are divided by the site multiplicity; 
+   * here we factor that back in.
+   * 
    */
   private void adjustM40Occupancies() {
     Map<String, Integer> htSiteMult = new Hashtable<String, Integer>();    
@@ -454,9 +486,8 @@
       Atom a = atoms[i];
       Integer ii = htSiteMult.get(a.atomName);
       if (ii == null) {
-        System.out.println(a.atomName);
         htSiteMult.put(a.atomName, ii = 
Integer.valueOf(atomSetCollection.getSymmetry().getSiteMultiplicity(a)));
-        System.out.println(a.atomName + " " + ii + " " + a.bsSymmetry + " " + 
a.foccupancy);
+        //System.out.println(a.atomName + " " + ii + " " + a.bsSymmetry + " " 
+ a.foccupancy);
       }
       a.foccupancy *= ii.intValue();
     }

Modified: trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java   2013-08-22 05:44:50 UTC 
(rev 18619)
+++ trunk/Jmol/src/org/jmol/adapter/smarter/Atom.java   2013-08-22 15:12:02 UTC 
(rev 18620)
@@ -41,7 +41,7 @@
   public String atomName;
   public int formalCharge = Integer.MIN_VALUE;
   public float partialCharge = Float.NaN;
-  public V3 vib;
+  public V3 vib; // .x and .y can be used for in-reader purposes as long as 
vib.z is left Float.NaN
   public float bfactor = Float.NaN;
   public float foccupancy = 1;
   public float radius = Float.NaN;

Modified: trunk/Jmol/src/org/jmol/util/Modulation.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/Modulation.java        2013-08-22 05:44:50 UTC 
(rev 18619)
+++ trunk/Jmol/src/org/jmol/util/Modulation.java        2013-08-22 15:12:02 UTC 
(rev 18620)
@@ -154,7 +154,7 @@
 
       x -= Math.floor(x);
       ms.vOcc = (range(x) ? 1 : 0);
-      ms.vOcc0 = 0; // absolute
+      ms.vOcc0 = Float.NaN; // absolute
       //System.out.println("MOD " + ms.r + " " +  ms.delta + " " + ms.epsilon 
+ " " + ms.id + " " + ms.v + " l=" + left + " x=" + x4 + " r=" + right);
       return;
     case TYPE_DISP_SAWTOOTH:

Modified: trunk/Jmol/src/org/jmol/util/ModulationSet.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/ModulationSet.java     2013-08-22 05:44:50 UTC 
(rev 18619)
+++ trunk/Jmol/src/org/jmol/util/ModulationSet.java     2013-08-22 15:12:02 UTC 
(rev 18620)
@@ -45,11 +45,10 @@
    * 
    */
 
-  public ModulationSet(String id, P3 r, float vocc0, int modDim, 
+  public ModulationSet(String id, P3 r, int modDim, 
                        JmolList<Modulation> mods, Matrix3f gammaE, 
                        Matrix4f gammaIS, Matrix4f q123w, double[] qlen) {
     this.id = id;
-    this.vOcc0 = vocc0;
     this.modDim = modDim;
     this.mods = mods;
     

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


------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&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