Revision: 21666 http://sourceforge.net/p/jmol/code/21666 Author: hansonr Date: 2017-07-20 13:40:04 +0000 (Thu, 20 Jul 2017) Log Message: ----------- CIP Rule 2 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-07-20 11:42:01 UTC (rev 21665) +++ trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java 2017-07-20 13:40:04 UTC (rev 21666) @@ -55,6 +55,8 @@ * * - deeply validated * + * - included revised Rules 1b, and 2. + * * - implemented in Java (Jmol) and JavaScript (JSmol) * * - only two Java classes; roughly 1000 lines @@ -209,6 +211,28 @@ * simple models. By moving that distance to be the sphere of the parent atom of * the duplicate, the problem is resolved. * + * Added clarification to Rule 2: + * + * Rule 2: Higher mass precedes lower mass, where mass is defined in the + * case of nonduplicate atoms with identified isotopes for elements as + * their exact isotopic mass and, in all other cases, as their + * element's atomic weight. + * + * Rationale: BB is not self-consistent, including both "mass number" (in the rule) + * and "atomic mass" in the description, where "79Br < Br < 81Br". And again we have the + * same Kekule-ambiguous issue as in Rule 1b. The added clarification fixes the Kekule + * issue (not using isotope mass number for duplicate atoms), solves the problem + * that F < 19F (though 100% nat. abundance), and is easily programmable. + * + * In Jmol the logic is very simple, actually using the isotope mass number, actually, + * but doing two checks: + * + * a) if one of five specific isotopes, reverse the test, and + * b) if on the list of 100% natural isotopes or one of the non-natural elements, + * use the average atomic mass. + * + * See CIPAtom.getMass(); + * * @author Bob Hanson hans...@stolaf.edu */ public class CIPChirality { @@ -1781,7 +1805,7 @@ private boolean isType(String rule2Type) { return PT.isOneOf( - ";" + (int) mass + Elements.elementSymbolFromNumber((int) elemNo), + (int) mass + Elements.elementSymbolFromNumber((int) elemNo), rule2Type); } @@ -2016,10 +2040,6 @@ Logger.info("---"); } - // if this is Rule 4b or 5, then we do a check of the forward-based stereochemical path - - boolean checkRule4List = (rule4List != null && (currentRule == RULE_4b || currentRule == RULE_5)); - int loser, score; for (int i = 0; i < 4; i++) { CIPAtom a = atoms[i]; @@ -2092,9 +2112,9 @@ if (currentRule == RULE_5 && nPriorities == 4 && nPrioritiesPrev == 2) { // Rule 5 has decided the issue, but how many decisions did we make? - // If priorities [0 0 2 2] went to [1 2 3 4] then + // If priorities [0 0 2 2] went to [0 1 2 3] then // we have two Rule-5 decisions -- R,S,R',S'. - // In that case, Rule 5 resuls in R/S, not r/s. + // In that case, Rule 5 results in R/S, not r/s. // // S // - @@ -2520,7 +2540,11 @@ * @return 0 (TIED), -1 (A_WINS), or 1 (B_WINS) */ private int checkRule2(CIPAtom b) { - return (b.getMass() == getMass() ? TIED : reverseRule2 == (b.mass > mass) ? A_WINS : B_WINS); + System.out.println(getMass() + " vs " + b.getMass() + " " + (b.getMass() == getMass() ? TIED : + (reverseRule2 || b.reverseRule2) == (b.mass > mass) ? A_WINS : B_WINS)); + + return (b.getMass() == getMass() ? TIED : + (reverseRule2 || b.reverseRule2) == (b.mass > mass) ? A_WINS : B_WINS); } /** 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