Revision: 18443
          http://sourceforge.net/p/jmol/code/18443
Author:   hansonr
Date:     2013-07-11 06:49:27 +0000 (Thu, 11 Jul 2013)
Log Message:
-----------


Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/CifReader.java
    trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java
    trunk/Jmol/src/org/jmol/symmetry/SpaceGroup.java
    trunk/Jmol/src/org/jmol/symmetry/Symmetry.java
    trunk/Jmol/src/org/jmol/symmetry/SymmetryOperation.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/CifReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/CifReader.java       
2013-07-10 12:52:33 UTC (rev 18442)
+++ trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/CifReader.java       
2013-07-11 06:49:27 UTC (rev 18443)
@@ -220,7 +220,8 @@
       } else if (key.startsWith("_cell_")) {
         processCellParameter();
       } else if (key.startsWith("_symmetry_space_group_name_H-M")
-          || key.startsWith("_symmetry_space_group_name_Hall")) {
+          || key.startsWith("_symmetry_space_group_name_Hall")
+          || key.startsWith("_space_group_ssg_name")) {
         processSymmetrySpaceGroupName();
       } else if (key.startsWith("_atom_sites_fract_tran")) {
         processUnitCellTransformMatrix();
@@ -287,6 +288,8 @@
 
   private int nMolecular = 0;
 
+  private boolean incommensurate;
+
   @Override
   public void applySymmetryAndSetTrajectory() throws Exception {
     // This speeds up calculation, because no crosschecking
@@ -356,7 +359,8 @@
    * @throws Exception
    */
   private void processSymmetrySpaceGroupName() throws Exception {
-    setSpaceGroupName((key.equals("_symmetry_space_group_name_H-M") ? "HM:" : 
"Hall:") + data);
+    incommensurate = (key.indexOf("_ssg_") >= 0);
+    setSpaceGroupName((key.indexOf("H-M") > 0 ? "HM:" : incommensurate ? 
"SSG:" : "Hall:") + data);
   }
 
   /**
@@ -506,7 +510,6 @@
       return;
     }
     if (str.startsWith("_symmetry_equiv_pos")
-        || str.startsWith("_space_group_symop")
         || str.startsWith("_space_group_symop")) {
       if (ignoreFileSymmetryOperators) {
         Logger.warn("ignoring file-based symmetry operators");

Modified: trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java      
2013-07-10 12:52:33 UTC (rev 18442)
+++ trunk/Jmol/src/org/jmol/adapter/readers/pymol/PyMOLReader.java      
2013-07-11 06:49:27 UTC (rev 18443)
@@ -650,7 +650,7 @@
       break;
     case PyMOL.OBJECT_MAPMESH:
     case PyMOL.OBJECT_MAPDATA:
-      processMap(pymolObject, type == PyMOL.OBJECT_MAPMESH);
+      processMap(pymolObject, type == PyMOL.OBJECT_MAPMESH, false);
       break;
     case PyMOL.OBJECT_GADGET:
       processGadget(pymolObject);
@@ -721,7 +721,7 @@
    */
   private void processGadget(JmolList<Object> pymolObject) {
     if (objectName.endsWith("_e_pot"))
-      processMap(pymolObject, true);
+      processMap(pymolObject, true, true);
   }
 
   /**
@@ -729,12 +729,13 @@
    * 
    * @param pymolObject
    * @param isObject
+   * @param isGadget 
    */
-  private void processMap(JmolList<Object> pymolObject, boolean isObject) {
+  private void processMap(JmolList<Object> pymolObject, boolean isObject, 
boolean isGadget) {
     if (isObject) {
       if (isStateScript)
         return;
-      if (isHidden)
+      if (isHidden && !isGadget)
         return; // for now
       if (mapObjects == null)
         mapObjects = new JmolList<JmolList<Object>>();

Modified: trunk/Jmol/src/org/jmol/symmetry/SpaceGroup.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/SpaceGroup.java    2013-07-10 12:52:33 UTC 
(rev 18442)
+++ trunk/Jmol/src/org/jmol/symmetry/SpaceGroup.java    2013-07-11 06:49:27 UTC 
(rev 18443)
@@ -397,18 +397,25 @@
   }
   
   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>();
       return -1;
     }
+    if (xyz0.startsWith("x1,x2,x3,x4")) {
+      xyzList.clear();
+      operationCount = 0;
+      modulationDimension = 
Parser.parseInt(xyz0.substring(xyz0.lastIndexOf("x") + 1)); 
+    }
     boolean isSpecial = (xyz0.charAt(0) == '=');
     if (isSpecial) xyz0 = xyz0.substring(1);
     if (xyzList.containsKey(xyz0))
       return xyzList.get(xyz0).intValue();
 
     SymmetryOperation symmetryOperation = new SymmetryOperation(null, null, 0, 
opId, doNormalize);
-    if (!symmetryOperation.setMatrixFromXYZ(xyz0)) {
+    if (!symmetryOperation.setMatrixFromXYZ(xyz0, modulationDimension)) {
       Logger.error("couldn't interpret symmetry operation: " + xyz0);      
       return -1;
     }

Modified: trunk/Jmol/src/org/jmol/symmetry/Symmetry.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/Symmetry.java      2013-07-10 12:52:33 UTC 
(rev 18442)
+++ trunk/Jmol/src/org/jmol/symmetry/Symmetry.java      2013-07-11 06:49:27 UTC 
(rev 18443)
@@ -211,8 +211,8 @@
     return SymmetryOperation.fcoord(p);
   }
 
-  public String getMatrixFromString(String xyz, float[] temp, boolean 
allowScaling) {
-    return SymmetryOperation.getMatrixFromString(xyz, temp, false, 
allowScaling);
+  public String getMatrixFromString(String xyz, float[] rotTransMatrix, 
boolean allowScaling) {
+    return SymmetryOperation.getMatrixFromString(xyz, rotTransMatrix, null, 
false, allowScaling);
   }
 
   public P3 ijkToPoint3f(int nnn) {

Modified: trunk/Jmol/src/org/jmol/symmetry/SymmetryOperation.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/SymmetryOperation.java     2013-07-10 
12:52:33 UTC (rev 18442)
+++ trunk/Jmol/src/org/jmol/symmetry/SymmetryOperation.java     2013-07-11 
06:49:27 UTC (rev 18443)
@@ -147,7 +147,7 @@
         .append("{\t0\t0\t0\t1\t}\n").toString();
   }
   
-  boolean setMatrixFromXYZ(String xyz) {
+  boolean setMatrixFromXYZ(String xyz, int modulationDimension) {
     /*
      * sets symmetry based on an operator string "x,-y,z+1/2", for example
      * 
@@ -156,7 +156,8 @@
       return false;
     xyzOriginal = xyz;
     xyz = xyz.toLowerCase();
-    float[] temp = new float[16];
+    float[] rotTransMatrix = new float[16];
+    float[] modulation = (modulationDimension == 0 ? null : new float[2 * 
modulationDimension]);
     boolean isReverse = (xyz.startsWith("!"));
     if (isReverse)
       xyz = xyz.substring(1);
@@ -179,19 +180,19 @@
        * The coordinates we are using here 
        */
       this.xyz = xyz;
-      Parser.parseStringInfestedFloatArray(xyz, null, temp);
+      Parser.parseStringInfestedFloatArray(xyz, null, rotTransMatrix);
       for (int i = 0; i < 16; i++) {
-        if (Float.isNaN(temp[i]))
+        if (Float.isNaN(rotTransMatrix[i]))
           return false;
-        float v = temp[i];
+        float v = rotTransMatrix[i];
         if (Math.abs(v) < 0.00001f)
           v = 0;
         if (i % 4 == 3)
           v = normalizeTwelfths((v < 0 ? -1 : 1) * Math.round(Math.abs(v * 
12)), doNormalize);
-        temp[i] = v;
+        rotTransMatrix[i] = v;
       }
-      temp[15] = 1;
-      setA(temp);
+      rotTransMatrix[15] = 1;
+      setA(rotTransMatrix);
       isFinalized = true;
       if (isReverse)
         invertM(this);
@@ -200,12 +201,12 @@
     }
     if (xyz.indexOf("[[") == 0) {
       xyz = xyz.replace('[',' ').replace(']',' ').replace(',',' ');
-      Parser.parseStringInfestedFloatArray(xyz, null, temp);
+      Parser.parseStringInfestedFloatArray(xyz, null, rotTransMatrix);
       for (int i = 0; i < 16; i++) {
-        if (Float.isNaN(temp[i]))
+        if (Float.isNaN(rotTransMatrix[i]))
           return false;
       }
-      setA(temp);
+      setA(rotTransMatrix);
       isFinalized = true;
       if (isReverse)
         invertM(this);
@@ -213,10 +214,10 @@
       //System.out.println("SymmetryOperation: " + xyz + "\n" + (Matrix4f)this 
+ "\n" + this.xyz);
       return true;
     }
-    String strOut = getMatrixFromString(xyz, temp, doNormalize, false);
+    String strOut = getMatrixFromString(xyz, rotTransMatrix, rotTransMatrix, 
doNormalize, false);
     if (strOut == null)
       return false;
-    setA(temp);
+    setA(rotTransMatrix);
     if (isReverse) {
       invertM(this);
       this.xyz = getXYZFromMatrix(this, true, false, false);
@@ -228,11 +229,12 @@
     return true;
   }
 
-  static String getMatrixFromString(String xyz, float[] temp,
+  static String getMatrixFromString(String xyz, float[] rotTransMatrix, 
float[] modulation,
                                     boolean doNormalize, boolean allowScaling) 
{
     boolean isDenominator = false;
     boolean isDecimal = false;
     boolean isNegative = false;
+    boolean incommensurate = (modulation != null);
     char ch;
     int x = 0;
     int y = 0;
@@ -241,15 +243,14 @@
     String strOut = "";
     String strT;
     int rowPt = -1;
+    
     float decimalMultiplier = 1f;
-    while (xyz.indexOf("x4") >= 0) {
-      Logger.info("ignoring last parameter in " + xyz);
-      xyz = xyz.substring(0, xyz.lastIndexOf(","));
+    xyz += ",";
+    if (incommensurate) {
       xyz = TextFormat.simpleReplace(xyz, "x1", "x");
       xyz = TextFormat.simpleReplace(xyz, "x2", "y");
       xyz = TextFormat.simpleReplace(xyz, "x3", "z");
     }
-    xyz += ",";
     for (int i = 0; i < xyz.length(); i++) {
       ch = xyz.charAt(i);
       switch (ch) {
@@ -270,11 +271,17 @@
         continue;
       case 'X':
       case 'x':
-        x = (isNegative ? -1 : 1);
+        int val = (isNegative ? -1 : 1);
         if (allowScaling && iValue != 0) {
-          x *= iValue;
+          val *= iValue;
           iValue = 0;
         }
+        if (incommensurate && rowPt >= 0) {
+          int pt = 2 * (rowPt + 1);
+          modulation[pt] = val;   
+        } else {
+          x = val;
+        }
         break;
       case 'Y':
       case 'y':
@@ -293,17 +300,20 @@
         }
         break;
       case ',':
-        if (++rowPt > 2) {
+        if (++rowPt > 2 && !incommensurate) {
           Logger.warn("Symmetry Operation? " + xyz);
           return null;
         }
-        int tpt = rowPt * 4;
         // put translation into 12ths
         iValue = normalizeTwelfths(iValue, doNormalize);
-        temp[tpt++] = x;
-        temp[tpt++] = y;
-        temp[tpt++] = z;
-        temp[tpt] = iValue;
+        if (rowPt > 2 && incommensurate) {
+        modulation[2 * rowPt + 1] = iValue;
+        } else {
+        int tpt = rowPt * 4;
+        rotTransMatrix[tpt++] = x;
+        rotTransMatrix[tpt++] = y;
+        rotTransMatrix[tpt++] = z;
+        rotTransMatrix[tpt] = iValue;
         strT = "";
         strT += (x == 0 ? "" : x < 0 ? "-x" : strT.length() == 0 ? "x" : "+x");
         strT += (y == 0 ? "" : y < 0 ? "-y" : strT.length() == 0 ? "y" : "+y");
@@ -312,9 +322,10 @@
         strOut += (strOut == "" ? "" : ",") + strT;
         //note: when ptLatt[3] = -1, ptLatt[rowPt] MUST be 0.
         if (rowPt == 2) {
-          temp[15] = 1;
+          rotTransMatrix[15] = 1;
           return strOut;
         }
+        }
         x = y = z = 0;
         iValue = 0;
         break;

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-07-10 12:52:33 UTC 
(rev 18442)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2013-07-11 06:49:27 UTC 
(rev 18443)
@@ -9,7 +9,7 @@
 #  The quotes above look odd for a parameter file, but they are 
 #  important for the JavaScript version of Jmol.
 
-___JmolVersion="13.1.19_dev_2013.07.09"
+___JmolVersion="13.1.19_dev_2013.07.11"
 
 code: org.jmol.quantum.NMRCalculation smoothly handles J-coupling and dipolar 
coupling constant display. 
   

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


------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&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