Revision: 20865
          http://sourceforge.net/p/jmol/code/20865
Author:   hansonr
Date:     2015-11-18 15:28:51 +0000 (Wed, 18 Nov 2015)
Log Message:
-----------
Jmol.___JmolVersion="14.4.0_2015.11.18"

bug fix: loading mmCIF files where label_asym_id != auth_asym_id will apply 
biomolecule symmetry to wrong chain

Modified Paths:
--------------
    branches/v14_4/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java
    branches/v14_4/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java
    branches/v14_4/Jmol/src/org/jmol/console/GenericConsole.java
    branches/v14_4/Jmol/src/org/jmol/script/ScriptMathProcessor.java
    branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties
    trunk/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java
    trunk/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java
    trunk/Jmol/src/org/jmol/console/GenericConsole.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: branches/v14_4/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java
===================================================================
--- branches/v14_4/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java       
2015-11-16 15:39:29 UTC (rev 20864)
+++ branches/v14_4/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java       
2015-11-18 15:28:51 UTC (rev 20865)
@@ -30,7 +30,6 @@
 import javajs.util.M4;
 import javajs.util.P3;
 import javajs.util.PT;
-import javajs.util.Rdr;
 import javajs.util.SB;
 
 import org.jmol.adapter.smarter.Atom;
@@ -841,6 +840,7 @@
     M4 mident = M4.newM4(null);
     String[] ops = PT.split((String) biomolecule.get("operators"), ",");
     String assemblies = (String) biomolecule.get("assemblies");
+    biomolecule.put("asemblyIdAtoms", assemblyIdAtoms);
     P3 sum = new P3();
     int count = 0;
     int nAtoms = 0;
@@ -851,10 +851,8 @@
       chainlist += ":" + id + ";";
       if (assemblyIdAtoms != null) {
         BS bs = assemblyIdAtoms.get(id);
-        if (bs != null) {
-          //System.out.println(id + " " + bs.cardinality());
+        if (bs != null)
           bsAll.or(bs);
-        }
       } else if (isCourseGrained) {
         P3 asum = chainAtomMap.get(id);
         int c = chainAtomCounts.get(id)[0];

Modified: branches/v14_4/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java
===================================================================
--- branches/v14_4/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java  
2015-11-16 15:39:29 UTC (rev 20864)
+++ branches/v14_4/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java  
2015-11-18 15:28:51 UTC (rev 20865)
@@ -1083,6 +1083,8 @@
       firstSymmetryAtom = atomMax++;
       break;
     }
+    Map<String, BS> assemblyIdAtoms = (Map<String, BS>) thisBiomolecule
+        .get("asemblyIdAtoms");
     if (filter.indexOf("#<") >= 0) {
       len = Math.min(len,
           PT.parseInt(filter.substring(filter.indexOf("#<") + 2)) - 1);
@@ -1090,6 +1092,7 @@
     }
     for (int iAtom = firstSymmetryAtom; iAtom < atomMax; iAtom++)
       atoms[iAtom].bsSymmetry = BSUtil.newAndSetBit(0);
+    BS bsAtoms = asc.bsAtoms;
     for (int i = (biomtchains == null ? 1 : 0); i < len; i++) {
       if (filter.indexOf("!#") >= 0) {
         if (filter.indexOf("!#" + (i + 1) + ";") >= 0)
@@ -1100,12 +1103,21 @@
       }
       M4 mat = biomts.get(i);
       String chains = (biomtchains == null ? null : biomtchains.get(i));
-
+      if (chains != null && assemblyIdAtoms != null) {
+        // must use label_asym_id, not auth_asym_id // bug fix 11/18/2015 
+        bsAtoms = new BS();
+        for (Entry<String, BS> e : assemblyIdAtoms.entrySet())
+          if (chains.indexOf(":" + e.getKey() + ";") >= 0)
+            bsAtoms.or(e.getValue());
+        if (asc.bsAtoms != null)
+          bsAtoms.and(asc.bsAtoms);
+        chains = null;
+      }
       for (int iAtom = firstSymmetryAtom; iAtom < atomMax; iAtom++) {
-        if (asc.bsAtoms != null && !asc.bsAtoms.get(iAtom))
-          continue;
-        if (chains != null
-            && chains.indexOf(":" + acr.vwr.getChainIDStr(atoms[iAtom].chainID)
+        if (bsAtoms != null
+            && !bsAtoms.get(iAtom)
+            || chains != null
+            && chains.indexOf(":" + acr.vwr.getChainIDStr(atoms[i].chainID)
                 + ";") < 0)
           continue;
         try {

Modified: branches/v14_4/Jmol/src/org/jmol/console/GenericConsole.java
===================================================================
--- branches/v14_4/Jmol/src/org/jmol/console/GenericConsole.java        
2015-11-16 15:39:29 UTC (rev 20864)
+++ branches/v14_4/Jmol/src/org/jmol/console/GenericConsole.java        
2015-11-18 15:28:51 UTC (rev 20865)
@@ -375,12 +375,18 @@
   }
 
   private void outputMsg(String message) {
-    if (message == null) {
+    int n = (message == null ? -1 : message.length());
+    switch (n) {
+    case -1:
       output.setText("");
       return;
+    default:
+      if (message.charAt(n - 1) == '\n')
+        break;
+      //$FALL-THROUGH$
+    case 0:
+      message += "\n";
     }
-    if (message.charAt(message.length() - 1) != '\n')
-      message += "\n";
     output.append(message);
   }
 

Modified: branches/v14_4/Jmol/src/org/jmol/script/ScriptMathProcessor.java
===================================================================
--- branches/v14_4/Jmol/src/org/jmol/script/ScriptMathProcessor.java    
2015-11-16 15:39:29 UTC (rev 20864)
+++ branches/v14_4/Jmol/src/org/jmol/script/ScriptMathProcessor.java    
2015-11-18 15:28:51 UTC (rev 20865)
@@ -1255,7 +1255,7 @@
         return (isDecimal(x2) || isDecimal(x1) ? addXFloat(x1.asFloat()
             * x2.asFloat()) : addXInt(x1.asInt() * x2.asInt()));
       }
-      pt = (x1.tok == T.matrix3f ? ptValue(x2)
+      pt = (x1.tok == T.matrix3f || x1.tok == T.matrix4f ? ptValue(x2)
           : x2.tok == T.matrix3f ? ptValue(x1) : null);
       pt4 = (x1.tok == T.matrix4f ? planeValue(x2)
           : x2.tok == T.matrix4f ? planeValue(x1) : null);
@@ -1268,9 +1268,10 @@
           // pt * m
           M3 m3b = M3.newM3((M3) x2.value);
           m3b.transpose();
-          m3b.rotate(pt);
+          P3 pt1 = P3.newP(pt);
+          m3b.rotate(pt1);
           return (x1.tok == T.varray ? addX(SV.getVariableAF(new float[] {
-              pt.x, pt.y, pt.z })) : addXPt(pt));
+              pt1.x, pt1.y, pt1.z })) : addXPt(pt1));
         }
         if (pt4 != null)
           // q * m --> q
@@ -1283,9 +1284,10 @@
         if (pt4 != null) {
           M4 m4b = M4.newM4((M4) x2.value);
           m4b.transpose();
-          m4b.transform(pt4);
+          P4 pt41 = P4.newPt(pt4);
+          m4b.transform(pt41);
           return (x1.tok == T.varray ? addX(SV.getVariableAF(new float[] {
-              pt4.x, pt4.y, pt4.z, pt4.w })) : addXPt4(pt4));
+              pt41.x, pt41.y, pt41.z, pt41.w })) : addXPt4(pt41));
         }
         break;
       }
@@ -1293,9 +1295,10 @@
       case T.matrix3f:
         M3 m3 = (M3) x1.value;
         if (pt != null) {
-          m3.rotate(pt);
+          P3 pt1 = P3.newP(pt);
+          m3.rotate(pt1);
           return (x2.tok == T.varray ? addX(SV.getVariableAF(new float[] {
-              pt.x, pt.y, pt.z })) : addXPt(pt));
+              pt1.x, pt1.y, pt1.z })) : addXPt(pt1));
         }
         switch (x2.tok) {
         case T.matrix3f:
@@ -1315,9 +1318,10 @@
       case T.matrix4f:
         M4 m4 = (M4) x1.value;
         if (pt != null) {
-          m4.rotTrans(pt);
+          P3 pt1 = P3.newP(pt);
+          m4.rotTrans(pt1);
           return (x2.tok == T.varray ? addX(SV.getVariableAF(new float[] {
-              pt.x, pt.y, pt.z })) : addXPt(pt));
+              pt1.x, pt1.y, pt1.z })) : addXPt(pt1));
         }
         if (pt4 != null) {
           m4.transform(pt4);

Modified: branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties     2015-11-16 
15:39:29 UTC (rev 20864)
+++ branches/v14_4/Jmol/src/org/jmol/viewer/Jmol.properties     2015-11-18 
15:28:51 UTC (rev 20865)
@@ -8,11 +8,16 @@
 # see also http://chemapps.stolaf.edu/jmol/zip for daily updates
        
 
-Jmol.___JmolVersion="14.4.0_2015.11.12"
+Jmol.___JmolVersion="14.4.0_2015.11.18"
 
+bug fix: loading mmCIF files where label_asym_id != auth_asym_id will apply 
biomolecule symmetry to wrong chain
+
+JmolVersion="14.4.0_2015.11.13"
+
+bug fix: echo "" fails in applet
 bug fix: 3x3 and 4x4 matrix multiplication of points changes the point itself.
 
-Jmol.___JmolVersion="14.4.0_2015.11.06"
+JmolVersion="14.4.0_2015.11.06"
 
 bug fix: restoring bonds to a model having fewer bonds than the model for 
which they were saved throws an exception
 bug fix: CIF reader does not read incommensurately modulated magCIF files

Modified: trunk/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java        
2015-11-16 15:39:29 UTC (rev 20864)
+++ trunk/Jmol/src/org/jmol/adapter/readers/cif/MMCifReader.java        
2015-11-18 15:28:51 UTC (rev 20865)
@@ -30,7 +30,6 @@
 import javajs.util.M4;
 import javajs.util.P3;
 import javajs.util.PT;
-import javajs.util.Rdr;
 import javajs.util.SB;
 
 import org.jmol.adapter.smarter.Atom;
@@ -841,6 +840,7 @@
     M4 mident = M4.newM4(null);
     String[] ops = PT.split((String) biomolecule.get("operators"), ",");
     String assemblies = (String) biomolecule.get("assemblies");
+    biomolecule.put("asemblyIdAtoms", assemblyIdAtoms);
     P3 sum = new P3();
     int count = 0;
     int nAtoms = 0;
@@ -851,10 +851,8 @@
       chainlist += ":" + id + ";";
       if (assemblyIdAtoms != null) {
         BS bs = assemblyIdAtoms.get(id);
-        if (bs != null) {
-          //System.out.println(id + " " + bs.cardinality());
+        if (bs != null)
           bsAll.or(bs);
-        }
       } else if (isCourseGrained) {
         P3 asum = chainAtomMap.get(id);
         int c = chainAtomCounts.get(id)[0];

Modified: trunk/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java
===================================================================
--- trunk/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java   2015-11-16 
15:39:29 UTC (rev 20864)
+++ trunk/Jmol/src/org/jmol/adapter/smarter/XtalSymmetry.java   2015-11-18 
15:28:51 UTC (rev 20865)
@@ -1010,7 +1010,6 @@
     }
     int particleMode = (filter.indexOf("BYCHAIN") >= 0 ? PARTICLE_CHAIN
         : filter.indexOf("BYSYMOP") >= 0 ? PARTICLE_SYMOP : PARTICLE_NONE);
-
     doNormalize = false;
     Lst<M4> biomts = (Lst<M4>) thisBiomolecule.get("biomts");
     Lst<String> biomtchains = (Lst<String>) thisBiomolecule.get("chains");
@@ -1083,6 +1082,8 @@
       firstSymmetryAtom = atomMax++;
       break;
     }
+    Map<String, BS> assemblyIdAtoms = (Map<String, BS>) thisBiomolecule
+        .get("asemblyIdAtoms");
     if (filter.indexOf("#<") >= 0) {
       len = Math.min(len,
           PT.parseInt(filter.substring(filter.indexOf("#<") + 2)) - 1);
@@ -1090,6 +1091,7 @@
     }
     for (int iAtom = firstSymmetryAtom; iAtom < atomMax; iAtom++)
       atoms[iAtom].bsSymmetry = BSUtil.newAndSetBit(0);
+    BS bsAtoms = asc.bsAtoms;
     for (int i = (biomtchains == null ? 1 : 0); i < len; i++) {
       if (filter.indexOf("!#") >= 0) {
         if (filter.indexOf("!#" + (i + 1) + ";") >= 0)
@@ -1100,12 +1102,21 @@
       }
       M4 mat = biomts.get(i);
       String chains = (biomtchains == null ? null : biomtchains.get(i));
-
+      if (chains != null && assemblyIdAtoms != null) {
+        // must use label_asym_id, not auth_asym_id // bug fix 11/18/2015 
+        bsAtoms = new BS();
+        for (Entry<String, BS> e : assemblyIdAtoms.entrySet())
+          if (chains.indexOf(":" + e.getKey() + ";") >= 0)
+            bsAtoms.or(e.getValue());
+        if (asc.bsAtoms != null)
+          bsAtoms.and(asc.bsAtoms);
+        chains = null;
+      }
       for (int iAtom = firstSymmetryAtom; iAtom < atomMax; iAtom++) {
-        if (asc.bsAtoms != null && !asc.bsAtoms.get(iAtom))
-          continue;
-        if (chains != null
-            && chains.indexOf(":" + acr.vwr.getChainIDStr(atoms[iAtom].chainID)
+        if (bsAtoms != null
+            && !bsAtoms.get(iAtom)
+            || chains != null
+            && chains.indexOf(":" + acr.vwr.getChainIDStr(atoms[i].chainID)
                 + ";") < 0)
           continue;
         try {

Modified: trunk/Jmol/src/org/jmol/console/GenericConsole.java
===================================================================
--- trunk/Jmol/src/org/jmol/console/GenericConsole.java 2015-11-16 15:39:29 UTC 
(rev 20864)
+++ trunk/Jmol/src/org/jmol/console/GenericConsole.java 2015-11-18 15:28:51 UTC 
(rev 20865)
@@ -375,12 +375,18 @@
   }
 
   private void outputMsg(String message) {
-    if (message == null) {
+    int n = (message == null ? -1 : message.length());
+    switch (n) {
+    case -1:
       output.setText("");
       return;
+    default:
+      if (message.charAt(n - 1) == '\n')
+        break;
+      //$FALL-THROUGH$
+    case 0:
+      message += "\n";
     }
-    if (message.charAt(message.length() - 1) != '\n')
-      message += "\n";
     output.append(message);
   }
 

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-11-16 15:39:29 UTC 
(rev 20864)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2015-11-18 15:28:51 UTC 
(rev 20865)
@@ -62,13 +62,17 @@
 
 TODO: consider if models with no atoms will cause issues in relation to 
model.firstAtomIndex
 
-Jmol.___JmolVersion="14.5.0_2015.11.12"
+Jmol.___JmolVersion="14.5.0_2015.11.18"
 
+bug fix: loading mmCIF files where label_asym_id != auth_asym_id will apply 
biomolecule symmetry to wrong chain
+
+JmolVersion="14.5.0_2015.11.13"
+
+bug fix: echo "" fails in applet
 bug fix: 3x3 and 4x4 matrix multiplication of points changes the point itself.
 
+JmolVersion="14.5.0_2015.11.06"
 
-Jmol.___JmolVersion="14.5.0_2015.11.06"
-
 bug fix: restoring bonds to a model having fewer bonds than the model for 
which they were saved throws an exception
 bug fix: CIF reader does not read incommensurately modulated magCIF files
 bug fix: WRITE xxx.ZIP  crashes Jmol

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


------------------------------------------------------------------------------
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to