Jmol.___JmolVersion="14.15.2" // 4/23/17

- CIPChirality.java 633 lines all except Rule 4b (Mata) and Rule 5 for
those cases.
- adds P, S, As, Se, Sb, Te, Bi, Po trigonal pyramidal and tetrahedral
- validates on 79 known chiral compounds testing a variety of nuances
- still some opportunity for optimization
- multi-path Mata analysis data is collected; just not being parsed.

Pseudocode follows. Actual code is a bit more than this, but this is the
basic idea. It's slightly modified from my original statement in that the
returned score, rather than just 1, 0, or -1, is a number that indicates
both the winner (positive or negative) and the sphere in which that win was
achieved (magnitude). This allows efficient and rapid forward processing
through the spheres.

The idea is to do both a "shallow" (intra-sphere) and a "deep"
(inter-sphere) comparison, iterating as necessary. Extensive use of
auxiliary descriptors is made by cloning atoms on the fly and following
their paths backward rather than forward. Note that the methods
sortSubstituents, breakTie, and compareDeeply are mutually entrant, leading
to the following of the digraph exactly as per IUPAC specifications.

Rules 4 and 5 still need a little fleshing out. All the information needed
is there; I'm just not processing it. I decided to add P and S and lone
pairs today first. One thing at a time!

Wolf and John, you had concerns that a full treatment might explode in some
way, I think. I don't doubt that that might be the case -- I can't prove
otherwise. I would not be surprised if certain combinations of alkenes and
chiral centers could do something like that, but extensive use of auxiliary
descriptors is made here, and I think that removes much of that issue. What
do you think?

The code is designed to fail gracefully by not assigning some centers
rather than assigning them incorrectly. Not saying it is done -- just
saying that I am satisfied that  it is quite manageable for general use.

Continued thanks to all for contributing to this discussion -- especially
the skepticism!

Bob

getChirality(molecule) {
  checkForAlkenes()
  if (haveAlkenes) checkForSmallRings()
  for(all atoms) getChirality(applyRules1-3)
  for(all double bonds) checkEZ()
  for(all atoms still without designations) getChirality(applyRules4and5)
   if (haveAlkenes) removeUnnecessaryEZDesignations()
}

 getChirality(atom) {
  for (each Rule){
    sortSubstituents()
    if (done) exit checkHandedness();
  }
  exit NO_CHIRALITY
 }

 sortSubstituents() {
   for (all pairs of substituents a and b) {
     score = a.compareTo(b, currentRule)
     if (score == TIED)
       score = breakTie(a,b)
 }

 breakTie(a,b) {
    score = compareShallowly(a, b)
    if (score != TIED) return score
    a.sortSubstituents(), b.sortSubstituents()
    return compareDeeply(a, b)
 }

 compareShallowly(a, b) {
    for (each substituent pairing i in a and b) {
      score = applyCurrentRule(a_i, b_i)
      if (score != TIED) return score
    }
    return TIED
 }

 compareDeeply(a, b) {
    currentScore = Integer.MAX_VALUE
    for (each substituent pairing i in a and b) {
      score = min(currentScore, breakTie(a_i, b_i)
    }
    return TIED
 }
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Blueobelisk-discuss mailing list
Blueobelisk-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/blueobelisk-discuss

Reply via email to