Revision: 21608
          http://sourceforge.net/p/jmol/code/21608
Author:   hansonr
Date:     2017-05-18 04:50:52 +0000 (Thu, 18 May 2017)
Log Message:
-----------
Jmol.___JmolVersion="14.15.5"

bug fix: CML reader does not read 2D wedge/hash information

bug fix: CIP fix for missing branch descriptors; 984 lines 

bug fix: CIP adds helicene M/P chirality  
  - validated using CCDC structures HEXHEL02 HEXHEL03 HEXHEL04 ODAGOS ODAHAF
  - http://pubs.rsc.org/en/content/articlehtml/2017/CP/C6CP07552E
  

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java  2017-05-17 22:09:46 UTC 
(rev 21607)
+++ trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java  2017-05-18 04:50:52 UTC 
(rev 21608)
@@ -278,7 +278,9 @@
   static final int TIED = NO_CHIRALITY;
   static final int B_WINS = 1;
   static final int A_WINS = -1;
-  static final int DIASTEREOMERIC = Integer.MAX_VALUE;
+  static final int DIASTEREOMERIC = -3;
+  static final int DIASTEREOMERIC_A_WINS = -2;
+  static final int DIASTEREOMERIC_B_WINS = 2;
   static final int IGNORE = Integer.MIN_VALUE;
   static final int NOT_RELEVANT = Integer.MIN_VALUE;
 
@@ -2198,7 +2200,7 @@
     private int checkRule4And5(int i, int j) {
       return (rule4List[i] == null && rule4List[j] == null ? TIED
           : rule4List[j] == null ? A_WINS : rule4List[i] == null ? B_WINS
-              : compareRootMataPair(i, j));
+              : compareMataPair(i, j));
     }
     
     /**
@@ -2214,7 +2216,7 @@
      * @return 0 (TIED), -1 (A_WINS), or 1 (B_WINS), or Integer.MIN_VALUE
      *         (IGNORE)
      */
-    private int compareRootMataPair(int ia, int ib) {
+    private int compareMataPair(int ia, int ib) {
       boolean isRule5 = (currentRule == RULE_5);
       // note that opposites will need to generate "R" or "S" keys, which will 
be 
       // resolved as "r" or "s" 
@@ -2473,7 +2475,7 @@
       String subRS = "";
       String s = (node1 == null ? "" : "~");
       boolean isBranch = false;
-      boolean isrs = false;
+      boolean noPseudo = false;
       if (atom != null) {
         rule4List = new String[4]; // full list based on atoms[]
         int[] mataList = new int[4]; //sequential pointers into rule4List
@@ -2513,12 +2515,13 @@
         case 2:
           if (node1 != null) {
             // we want to now if these two are enantiomorphic, identical, or 
diastereomorphic.
-            adj = (compareRule4aEnantiomers(rule4List[mataList[0]],
-                rule4List[mataList[1]]));
+            adj = (compareRule4aIsomers(mataList[0],mataList[1]));
             switch (adj) {
-            case DIASTEREOMERIC:
+            case TIED:
+              // identical
               isBranch = true;
-              s = "";
+              s = "~";
+              subRS = "";
               break;
             case NOT_RELEVANT:
               s = "";
@@ -2525,16 +2528,15 @@
               isBranch = true;
               adj = TIED;
               break;
-            case TIED:
-              // identical
-              isBranch = true;
-              s = "~"; // was "u"
-              subRS = "";
-              break;
+            case DIASTEREOMERIC_A_WINS:
+            case DIASTEREOMERIC_B_WINS:
+              adj -= sign(adj);
+              subRS = "r";
+              //$FALL-THROUGH$
             case A_WINS:
             case B_WINS:
               isBranch = true;
-              isrs = subRS.indexOf("r") >= 0;
+              noPseudo = subRS.indexOf("r") >= 0;
               // enantiomers -- we have an r/s situation
               // process to determine chirality, but then set ret[0] to be null
               subRS = "";
@@ -2543,9 +2545,44 @@
           }
           break;
         case 3:
+          // 
+          // check for exactly one enantiomeric pair among the three groups
+          //
+          //    {RRS}    e      d     
+          //           {SSR}    d
+          //                  {SRS}  two enantiomers and a diastereomer (r/s)
+          //
+          //
+          int irs = 0, jrs = 0, adj0 = TIED;
+          for (int i = 0; i < 2; i++) {
+            for (int j = i + 1; j < 3; j++) {
+              adj0 = (compareRule4aIsomers(mataList[i],mataList[j]));
+              switch (adj0) {
+              case A_WINS:
+              case B_WINS:
+                if (adj == TIED) {
+                  adj = adj0;
+                  irs = i;
+                  jrs = j;
+                  continue;
+                }
+                i = j = 3;
+                adj = TIED;
+                break;
+              default:  
+                break;
+              }
+            }
+          }
+          if (adj != TIED) {
+            mataList[0] = mataList[irs];
+            mataList[1] = mataList[jrs];
+          }
+          //$FALL-THROUGH$
         case 4:
           s = "";
           isBranch = true;
+          break;
         }
         if (isBranch) {
           subRS = "";
@@ -2552,7 +2589,6 @@
           if (ret != null)
             ret[0] = this;
         }
-
         if (!isBranch || adj == A_WINS || adj == B_WINS) {
           if (isAlkene) {
             if (!isBranch && alkeneChild != null) {
@@ -2601,6 +2637,9 @@
           } else if (node1 != null
               && (bondCount == 4 && nPriorities >= 3 - Math.abs(adj) || 
isTrigonalPyramidal
                   && nPriorities >= 2 - Math.abs(adj))) {
+            // if adj is 1 or -1, then we check for one fewer priorities 
because
+            // it means we had two groups that were either enantiomers or 
diasteriomers
+            
             if (isBranch) {
               // if here, adj is A_WINS (-1), or B_WINS (1) 
               // we check based on A winning, but then reverse it if B 
actually won
@@ -2612,8 +2651,8 @@
                 s = (adj == A_WINS ? "s" : "r");
                 break;
               }
-              if (isrs)
-                s = s.toUpperCase(); // Rule 4c // AY-236.148
+              if (noPseudo)
+                s = s.toUpperCase(); // Rule 4c or diasteriomers // AY-236.148
               auxChirality = s;
               subRS = "";
               if (ret != null)
@@ -2626,10 +2665,7 @@
                 atom1.sortByRule(RULE_1a);
                 rs = atom1.checkHandedness();
                 s = (rs == STEREO_R ? "R" : rs == STEREO_S ? "S" : "~");
-//                if (root.atomIndex == 12) {
-//                System.out.println("determining " + s + " for " + root + 
"->" + atom1);
-//                rs = atom1.checkHandedness();
-//                }
+                System.out.println("determining " + s + " for " + root + "->" 
+ atom1);
                 node1.addMataRef(sphere, priority, rs);
               }
             }
@@ -2687,13 +2723,15 @@
     /**
      * Check for enantiomeric strings such as S;R; or SR
      * 
-     * @param rs1
-     * @param rs2
+     * @param i1
+     * @param i2
      * @return NOT_RELEVANT if there is no stereochemistry, TIED if they are 
equal,
-     *         A_WINS for enantiomer Rxxx, B_WINS for Sxxxx, or DIASTEREOMERIC
-     *         if diastereomeric
+     *         A_WINS for enantiomer Rxxx, B_WINS for Sxxxx, or 
DIASTERIOMERIC_A_WINS
+     *          or DIASTERIOMERIC_B_WINS
      */
-    private int compareRule4aEnantiomers(String rs1, String rs2) {
+    private int compareRule4aIsomers(int i1, int i2) {
+      String rs1 = rule4List[i1];
+      String rs2 = rule4List[i2];
       if (rs1.charAt(0) != rs2.charAt(0))
         return NOT_RELEVANT;
       int n = rs1.length(); 
@@ -2702,7 +2740,16 @@
       if (rs1.equals(rs2))
         return TIED;      
       String rs = (rs1.indexOf("R") < 0 && rs1.indexOf("S") < 0 ? "~rs" : 
"~RS");
-      return checkEnantiomer(rs1, rs2, 1, n, rs);
+      int score = checkEnantiomer(rs1, rs2, 1, n, rs);
+      if (score == DIASTEREOMERIC) {
+        switch (compareMataPair(i1, i2)) {
+        case A_WINS:
+          return DIASTEREOMERIC_A_WINS;
+        case B_WINS:
+          return DIASTEREOMERIC_B_WINS;          
+        }
+      }
+      return score;
     }
 
     /**
@@ -2728,8 +2775,9 @@
         int score = i1 + rs.indexOf(rs2.charAt(i));
         if (score == 0)
           continue;
-        if (score != STEREO_BOTH_RS)
+        if (score != STEREO_BOTH_RS) {
           return DIASTEREOMERIC;
+        }
         if (finalScore == TIED)
           finalScore =  (i1 == STEREO_R ? A_WINS : B_WINS);
       }

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2017-05-17 22:09:46 UTC 
(rev 21607)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2017-05-18 04:50:52 UTC 
(rev 21608)
@@ -57,18 +57,42 @@
 
 Jmol.___JmolVersion="14.15.5"
 
+bug fix: CML reader does not read 2D wedge/hash information
 
+bug fix: CIP fix for missing branch descriptors; 984 lines 
+
+bug fix: CIP adds helicene M/P chirality  
+  - validated using CCDC structures HEXHEL02 HEXHEL03 HEXHEL04 ODAGOS ODAHAF
+  - http://pubs.rsc.org/en/content/articlehtml/2017/CP/C6CP07552E
+  
 code: CIP: additional simplification;   
 code: CIP status: implementation complete, including:
          All subrules implemented fully: 1a, 1b, 2, 3, 4a, 4b, 4c, 5
-         R/S, E/Z, M/P, r/s, seqCis/seqTrans (as Z/E)
+         R/S, E/Z, M/P (odd-cumulene and helicene), r/s, seqCis/seqTrans (as 
Z/E)
          benzenoid (including fused benzenoid heteroaromatic) Mancude ring 
"Kekule weighted" atom number adjustments 
-         proposed Rule 1b amendment:
-             A duplicate atom in a Kekule-weighted system is given a root 
distance equal to 
-             its sphere, not the sphere of its duplicated atom.
 
-IUPAC Blue Book 2103 errors:
+ * Added logic to Rule 1b: The root distance for a Kekule-ambiguous duplicate
+ * atom is its own sphere, not the sphere of its duplicated atom.
+ * 
+ * Stated more precisely:
+ * 
+ * Proposed amended Sequence Rule 1:
+ * 
+ * (1a) higher atomic number precedes lower;
+ * 
+ * (1b) in comparing two duplicate nodes, lower root distance precedes higher
+ * root distance, where "root distance" is defined:
+ * 
+ * (i) in the case of a duplicate atom for which the atomic number is averaged
+ * over two or more atoms in applying Rule 1a, the distance from the duplicate
+ * node itself to the root node; and
+ * 
+ * (ii) in all other cases, the distance of its corresponding nonduplicated 
atom
+ * node to the root node.
+ * 
 
+IUPAC Blue Book 2013 errors of note:
+
 ,"147":"r,,,R,,,,r,,,S" // chiral phosphine -- disagrees with BB P-93.5.1.1.2 
for S vs R
 {
   "id"  :  "148"
@@ -151,11 +175,11 @@
 
 var skip = ({27 229}) || // E/Z only; missing chirality
            ({95 96 98 99 100 101 102 103 104 108 109 110 111 112 200}) || // 
trigonal planar, square planar, or hypervalent
-           ({32 33})  || // helicene
+           ({32 33})  || // helicene // added in Jmol 14.15.5
            ({201 202})|| // spirocyclic central (redundant) atom designation 
missing (axial designation option)
            ({212 213})|| // chiral conformation 1,4-benzene in a ring
            ({38 84})  || // ignore -- 38: Mancude for cyclopentadienyl; 84: 
unknown error with P compound
-           ({203})    || // // chiral bridgehead amine 
+           ({203})    || // // chiral bridgehead amine  // fixed in Jmol 
14.15.5
 
 Issue: Full implementation of the rules requires a slight modification of Rule 
1b. 
 Specifically, aromatic duplicate atoms must reference the sphere of their own 
parent, not their

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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to