Revision: 21589
          http://sourceforge.net/p/jmol/code/21589
Author:   hansonr
Date:     2017-05-09 21:41:02 +0000 (Tue, 09 May 2017)
Log Message:
-----------
CIP JM3 fix 

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

Modified: trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java  2017-05-09 20:03:13 UTC 
(rev 21588)
+++ trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java  2017-05-09 21:41:02 UTC 
(rev 21589)
@@ -2387,6 +2387,7 @@
       String subRS = "";
       String s = (node1 == null ? "" : "~");
       boolean isBranch = false;
+      boolean isrs = false;
       if (atom != null) {
         rule4List = new String[4]; // full list based on atoms[]
         int[] mataList = new int[4]; //sequential pointers into rule4List
@@ -2426,8 +2427,10 @@
         case 2:
           if (node1 != null) {
             // we want to now if these two are enantiomorphic, identical, or 
diastereomorphic.
-            switch (adj = (compareRule4aEnantiomers(rule4List[mataList[0]],
-                rule4List[mataList[1]]))) {
+            if (root.atomIndex == 21)
+              System.out.println("testing21");
+            adj = (compareRule4aEnantiomers(rule4List[mataList[0]], 
rule4List[mataList[1]]));
+            switch (adj) {
             case DIASTEREOMERIC:
               isBranch = true;
               s = "";
@@ -2450,6 +2453,7 @@
             case A_WINS:
             case B_WINS:
               isBranch = true;
+              isrs = subRS.indexOf("r") >= 0;
               // enantiomers -- we have an r/s situation
               // process to determine chirality, but then set ret[0] to be null
               subRS = "";
@@ -2488,6 +2492,8 @@
                 System.out.println("for " + atoms[mataList[0]] + 
atoms[mataList[1]] + " adj=" + adj + "S->rs=" + s);
                 break;
               }
+              if (isrs)
+                s = s.toUpperCase(); // Rule 4c
               subRS = "";
               if (ret != null)
                 ret[0] = null;
@@ -2553,8 +2559,7 @@
      *         if diastereomeric
      */
     private int compareRule4aEnantiomers(String rs1, String rs2) {
-      if (rs1.indexOf("R") < 0 && rs1.indexOf("S") < 0
-          || rs1.charAt(0) != rs2.charAt(0))
+      if (rs1.charAt(0) != rs2.charAt(0))
         return NOT_RELEVANT;
       int n = rs1.length(); 
       if (n != rs2.length())
@@ -2561,8 +2566,9 @@
         return NOT_RELEVANT; // TODO: ?? this may not be true -- paths with 
and without O, N, C for example, that still have stereochemistry
       if (rs1.equals(rs2))
         return TIED;      
+      String rs = (rs1.indexOf("R") < 0 && rs1.indexOf("S") < 0 ? "~rs" : 
"~RS");
 //      System.out.println("testing ~RS here with " + rs1 + " and " + rs2);
-      return checkEnantiomer(rs1, rs2, 1, n, "~RS");
+      return checkEnantiomer(rs1, rs2, 1, n, rs);
     }
 
     private int checkEnantiomer(String rs1, String rs2, int m, int n, String 
rs) {

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