Revision: 21578 http://sourceforge.net/p/jmol/code/21578 Author: hansonr Date: 2017-04-29 23:15:49 +0000 (Sat, 29 Apr 2017) Log Message: ----------- Jmol.___JmolVersion="14.15.3"
bug fix: CIP chirality may not show M/P for atropisomeric atoms test: load "$2,2'-dibromobiphenyl"; calculate chirality; print {*}.chirality.join("") 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-04-29 20:03:21 UTC (rev 21577) +++ trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java 2017-04-29 23:15:49 UTC (rev 21578) @@ -160,7 +160,6 @@ static final int STEREO_BOTH_RS = STEREO_R | STEREO_S; static final int STEREO_BOTH_EZ = STEREO_Z | STEREO_E; - static final int RULE_0 = 0; static final int RULE_1 = 1; static final int RULE_2 = 2; static final int RULE_3 = 3; @@ -204,16 +203,22 @@ Lst<BS> lstSmallRings = new Lst<BS>(); /** - * Max priorities across an entire molecule, for cyclic loops + * max priorities across an entire molecule, for cyclic loops */ int nPriorityMax; /** - * Max ring size from closures, across a molecule + * max ring size from closures, across a molecule * */ int maxRingSize; + /** + * don't do this atom again (atropisomer) + * + */ + BS bsAtropisomeric; + V3 vNorm = new V3(); V3 vNorm2 = new V3(); V3 vTemp = new V3(); @@ -243,6 +248,9 @@ public void getChiralityForAtoms(Node[] atoms, BS bsAtoms, BS bsAtropisomeric) { if (bsAtoms.isEmpty()) return; + + this.bsAtropisomeric = bsAtropisomeric; + init(); BS bsToDo = BSUtil.copy(bsAtoms); @@ -271,7 +279,7 @@ // using BSAtoms here because we need the entire graph, even starting with an H atom. getSmallRings(atoms[bsAtoms.nextSetBit(0)]); for (int i = bsToDo.nextSetBit(0); i >= 0; i = bsToDo.nextSetBit(i + 1)) - getAtomBondChirality(atoms[i], false, RULE_3, lstEZ, bsToDo, bsAtropisomeric); + getAtomBondChirality(atoms[i], false, RULE_3, lstEZ, bsToDo); } @@ -286,7 +294,7 @@ if (haveAlkenes) { for (int i = bsToDo.nextSetBit(0); i >= 0; i = bsToDo.nextSetBit(i + 1)) - getAtomBondChirality(atoms[i], false, RULE_5, lstEZ, bsToDo, bsAtropisomeric); + getAtomBondChirality(atoms[i], false, RULE_5, lstEZ, bsToDo); } @@ -456,6 +464,8 @@ * @param lstEZ */ private void clearSmallRingEZ(Node[] atoms, Lst<int[]> lstEZ) { + for (int j = lstSmallRings.size(); --j >= 0;) + lstSmallRings.get(j).andNot(bsAtropisomeric); for (int i = lstEZ.size(); --i >= 0;) { int[] ab = lstEZ.get(i); for (int j = lstSmallRings.size(); --j >= 0;) { @@ -523,18 +533,17 @@ * @param ruleMax * @param lstEZ * @param bsToDo - * @param bsAtrop */ private void getAtomBondChirality(Node atom, boolean allBonds, int ruleMax, - Lst<int[]> lstEZ, BS bsToDo, BS bsAtrop) { + Lst<int[]> lstEZ, BS bsToDo) { int index = atom.getIndex(); Edge[] bonds = atom.getEdges(); - if (bsAtrop.get(index)) { + if (bsAtropisomeric.get(index)) { for (int j = bonds.length; --j >= 0;) { Node atom1 = bonds[j].getOtherAtomNode(atom); int index1 = atom1.getIndex(); - if (!allBonds && index1 < index || !bsAtrop.get(index1)) + if (!bsAtropisomeric.get(index1)) continue; getAxialOrEZChirality(atom, atom1, true, ruleMax); break; @@ -549,8 +558,6 @@ if ((allBonds || index2 > index) && getBondChiralityLimited(bond, atom, ruleMax) != NO_CHIRALITY) { lstEZ.addLast(new int[] { index, index2 }); - //bsToDo.clear(index); - //bsToDo.clear(index2); } } } @@ -728,16 +735,14 @@ int c = NO_CHIRALITY; if (atop >= 0 && btop >= 0) { if (isAxial) { - c = (isPos(b2.atoms[btop], b2, a1, a1.atoms[atop]) ? STEREO_P - : STEREO_M); + c = (isPos(b2.atoms[btop], b2, a1, a1.atoms[atop]) ? STEREO_P : STEREO_M); if ((a2.ties == null) != (b2.ties == null)) c |= JC.CIP_CHIRALITY_PSEUDO_FLAG; } else { - c = (isCis(b2.atoms[btop], b2, a1, a1.atoms[atop]) ? STEREO_Z - : STEREO_E); + c = (isCis(b2.atoms[btop], b2, a1, a1.atoms[atop]) ? STEREO_Z : STEREO_E); } } - if (c != NO_CHIRALITY) { + if (c != NO_CHIRALITY && (isAxial || !isAtropisomeric(a) && !isAtropisomeric(b))) { a.setCIPChirality(c); b.setCIPChirality(c); if (Logger.debugging) @@ -746,6 +751,10 @@ return c; } + private boolean isAtropisomeric(Node a) { + return bsAtropisomeric != null && bsAtropisomeric.get(a.getIndex()); + } + /** * Check cis vs. trans nature of a--b==c--d. * @@ -1211,7 +1220,7 @@ Logger.info(" too many bonds on " + atom); return null; } - if (parent == null && currentRule != RULE_0) { + if (parent == null) { // For top level, we do not allow two 1H atoms. int atomIsotope = other.getAtomicAndIsotopeNumber(); if (atomIsotope == 1) { @@ -1508,8 +1517,6 @@ public int checkCurrentRule(CIPAtom b) { switch (currentRule) { default: - case RULE_0: - return b.atom == atom ? TIED : b.atom == null ? A_WINS : atom == null ? B_WINS : TIED; case RULE_1: int score = checkRule1a(b); return (score == TIED ? checkRule1b(b) : score); Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2017-04-29 20:03:21 UTC (rev 21577) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2017-04-29 23:15:49 UTC (rev 21578) @@ -49,8 +49,13 @@ # 10. Run jmol/tools build-release.xml # -Jmol.___JmolVersion="14.15.2" // 4/29/17 +Jmol.___JmolVersion="14.15.3" +bug fix: CIP chirality may not show M/P for atropisomeric atoms + test: load "$2,2'-dibromobiphenyl"; calculate chirality; print {*}.chirality.join("") + +JmolVersion="14.15.2" // 4/29/17 + bug fix: CIP chirality adds axial chirality (M/P[Ra/Sa], m/p[ra/sa]) for cumulenes bug fix: CIP chirality adds atropisomer chirality (M/P[Ra/Sa], m/p[ra/sa]) for biaryls bug fix: CIP chirality adds cumulene E/Z chirality 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