Revision: 21490 http://sourceforge.net/p/jmol/code/21490 Author: hansonr Date: 2017-04-07 00:38:50 +0000 (Fri, 07 Apr 2017) Log Message: ----------- Jmol.___JmolVersion="14.12.0" // 2017-04-06
new feature: {atom}.chirality -- uses Cohen-Ingold-Prelog rules to assign R or S to a carbon center -- ignores sulfur chirality -- may not fully implement high symmetry cases -- not fully tested -- Checked using: function checkchiral(m) { if (m) load @m background label yellow color labels black select _C label %[atomname] refresh var b = {_C} for (var a in b) { var c = a.chirality; print _smilesString + " " + a + c if (c) { select a c = a.atomname + " " + c label @c } } select * } checkchiral("$(R)-glycidol") delay 1 checkchiral("$glucose") delay 1 checkchiral("$(2S,3R)-2,3-oxiranediol") delay 1 checkchiral("$(S)-2-butanol") delay 1 checkchiral("$(R)-2-butanol") delay 1 checkchiral("$(2S,3R)-2,3-butanediol") delay 1 checkchiral("$(2S,3S)-2,3-butanediol") delay 1 checkchiral("$(2R,3R)-2,3-butanediol") delay 1 checkchiral("$(2R,3S)-2,3-butanediol") delay 1 checkchiral("$1,4-dimethylcyclohexane") delay 1 checkchiral("$cholesterol") // (3S,8S,9S,10R,13R,14S,17R) and sidechain R 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-04-07 00:35:17 UTC (rev 21489) +++ trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java 2017-04-07 00:38:50 UTC (rev 21490) @@ -88,7 +88,7 @@ public String getRorS(CIPAtom a) { try { - CIPAtom[] atoms = sortFourAtoms(a.atoms, false); + CIPAtom[] atoms = sortSubstituents(a.atoms, false); if (atoms == null) return ""; SmilesMatcherInterface sm = vwr.getSmilesMatcher(); @@ -108,13 +108,14 @@ } /** - * The main loop that starts all the iteration of breakTie. + * Sort the substituents of an atom in preparation for comparing the set with other atoms * - * @param atoms + * @param atoms may be 3 or 4 atoms here + * @param allowTie * * @return true if we have four distinct atoms in the end */ - private static CIPAtom[] sortFourAtoms(CIPAtom[] atoms, boolean allowTie) { + private static CIPAtom[] sortSubstituents(CIPAtom[] atoms, boolean allowTie) { int n = atoms.length; for (int i = 0; i < n; i++) atoms[i].isAbove = 0; @@ -187,8 +188,8 @@ // all are the same -- check to break tie next level // now isDummy counts - a.atoms = sortFourAtoms(a.atoms, true); - b.atoms = sortFourAtoms(b.atoms, true); + a.atoms = sortSubstituents(a.atoms, true); + b.atoms = sortSubstituents(b.atoms, true); for (int i = 0; i < a.nAtoms; i++) { CIPAtom ai = a.atoms[i]; 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