Revision: 21620
          http://sourceforge.net/p/jmol/code/21620
Author:   hansonr
Date:     2017-05-27 20:31:36 +0000 (Sat, 27 May 2017)
Log Message:
-----------
Jmol.___JmolVersion="14.17.2"

code: CIPChirality.java fully interfaced using SimpleNode and SimpleEdge

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/modelset/Bond.java
    trunk/Jmol/src/org/jmol/smiles/SmilesAromatic.java
    trunk/Jmol/src/org/jmol/smiles/SmilesBond.java
    trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java
    trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java
    trunk/Jmol/src/org/jmol/smiles/SmilesStereo.java
    trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java
    trunk/Jmol/src/org/jmol/symmetry/Symmetry.java
    trunk/Jmol/src/org/jmol/util/Edge.java
    trunk/Jmol/src/org/jmol/util/JmolMolecule.java
    trunk/Jmol/src/org/jmol/util/Node.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Added Paths:
-----------
    trunk/Jmol/src/org/jmol/util/SimpleEdge.java
    trunk/Jmol/src/org/jmol/util/SimpleNode.java

Modified: trunk/Jmol/src/org/jmol/modelset/Bond.java
===================================================================
--- trunk/Jmol/src/org/jmol/modelset/Bond.java  2017-05-27 17:45:55 UTC (rev 
21619)
+++ trunk/Jmol/src/org/jmol/modelset/Bond.java  2017-05-27 20:31:36 UTC (rev 
21620)
@@ -28,7 +28,7 @@
 import org.jmol.java.BS;
 import org.jmol.util.C;
 import org.jmol.util.Edge;
-import org.jmol.util.Node;
+import org.jmol.util.SimpleNode;
 import org.jmol.viewer.JC;
 
 public class Bond extends Edge {
@@ -38,7 +38,7 @@
   public Atom atom1;
   public Atom atom2;
 
-  public short mad;
+  public short mad; 
   public short colix;
 
   public int shapeVisibilityFlags;
@@ -162,7 +162,7 @@
   }
 
   @Override
-  public Node getOtherAtomNode(Node thisAtom) {
+  public SimpleNode getOtherNode(SimpleNode thisAtom) {
     return (atom1 == thisAtom ? atom2 : atom2 == thisAtom || thisAtom == null 
? atom1 : null);
   }
   

Modified: trunk/Jmol/src/org/jmol/smiles/SmilesAromatic.java
===================================================================
--- trunk/Jmol/src/org/jmol/smiles/SmilesAromatic.java  2017-05-27 17:45:55 UTC 
(rev 21619)
+++ trunk/Jmol/src/org/jmol/smiles/SmilesAromatic.java  2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -36,6 +36,7 @@
 import org.jmol.util.Edge;
 import org.jmol.util.Logger;
 import org.jmol.util.Node;
+import org.jmol.util.SimpleNode;
 
 public class SmilesAromatic {
 
@@ -98,7 +99,7 @@
           Edge[] aedges = a.getEdges();
           int ai = a.getIndex();
           for (int j = aedges.length; --j >= 0;) {
-            Node a2 = aedges[j].getOtherAtomNode(a);
+            SimpleNode a2 = aedges[j].getOtherNode(a);
             int a2i = a2.getIndex();
             if (a2i > ai && bs.get(a2i))
               edges.addLast(aedges[j]);
@@ -439,7 +440,7 @@
             // just check that the connected atom is either C or flat-aromatic
             // if it is, assign 1 pi electron; if it is not, set it to 0 as 
long
             // we are not being strict or discard this ring if we are.
-            Node het = b.getOtherAtomNode(atom);
+            SimpleNode het = b.getOtherNode(atom);
             n = (het.getElementNumber() == 6 || bsAromatic.get(het.getIndex()) 
? 1
                 : strictness > 0 ? -100 : 0);
             break;
@@ -516,7 +517,7 @@
         Edge[] bonds = jmolAtoms[i].getEdges();
         int naro = 0;
         for (int j = bonds.length; --j >= 0;) {
-          Node otherAtom = bonds[j].getOtherAtomNode(jmolAtoms[i]);
+          SimpleNode otherAtom = bonds[j].getOtherNode(jmolAtoms[i]);
           int order = bonds[j].getCovalentOrder();
           int ai2 = otherAtom.getIndex();
           boolean isJAro = bsAromatic.get(ai2);

Modified: trunk/Jmol/src/org/jmol/smiles/SmilesBond.java
===================================================================
--- trunk/Jmol/src/org/jmol/smiles/SmilesBond.java      2017-05-27 17:45:55 UTC 
(rev 21619)
+++ trunk/Jmol/src/org/jmol/smiles/SmilesBond.java      2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -25,7 +25,7 @@
 package org.jmol.smiles;
 
 import org.jmol.util.Edge;
-import org.jmol.util.Node;
+import org.jmol.util.SimpleNode;
 
 /**
  * Bond in a SmilesMolecule
@@ -270,7 +270,7 @@
   }
 
   @Override
-  public Node getOtherAtomNode(Node atom) {
+  public SimpleNode getOtherNode(SimpleNode atom) {
     return (atom == atom1 ? atom2 : atom == atom2 || atom == null ? atom1 : 
null);
   }
 

Modified: trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java
===================================================================
--- trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java 2017-05-27 17:45:55 UTC 
(rev 21619)
+++ trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java 2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -40,6 +40,7 @@
 import org.jmol.util.JmolMolecule;
 import org.jmol.util.Logger;
 import org.jmol.util.Node;
+import org.jmol.util.SimpleNode;
 import org.jmol.viewer.JC;
 
 /**
@@ -73,8 +74,8 @@
   private BS bsBondsUp = new BS();
   private BS bsBondsDn = new BS();
   private BS bsToDo;
-  private Node prevAtom;
-  private Node[] prevSp2Atoms;
+  private SimpleNode prevAtom;
+  private SimpleNode[] prevSp2Atoms;
   
   // outputs
 
@@ -403,7 +404,7 @@
    * @param atomFrom
    * @return   the correct character '/', '\\', '\0' (meaning "no 
stereochemistry")
    */
-  private char getBondStereochemistry(Edge bond, Node atomFrom) {
+  private char getBondStereochemistry(Edge bond, SimpleNode atomFrom) {
     if (bond == null)
       return '\0';
     int i = bond.index;
@@ -433,27 +434,27 @@
       for (int k = 0; k < bonds.length; k++) {
         Edge bond = bonds[k];
         int index = bond.index;
-        Node atom2;
+        SimpleNode atom2;
         if (bsDone.get(index) || bond.getCovalentOrder() != 2
-            || SmilesSearch.isRingBond(ringSets, null, i, (atom2 = 
bond.getOtherAtomNode(atom1)).getIndex()))
+            || SmilesSearch.isRingBond(ringSets, null, i, (atom2 = 
bond.getOtherNode(atom1)).getIndex()))
           continue;
         bsDone.set(index);
         int nCumulene = 0;
-        Node a10 = atom1;
+        SimpleNode a10 = atom1;
         while (atom2.getCovalentBondCount() == 2 && atom2.getValence() == 4) {
-          Edge[] e2 = atom2.getEdges();
-          Edge e = e2[e2[0].getOtherAtomNode(atom2) == a10 ? 1 : 0];
+          Edge[] e2 = (Edge[]) atom2.getEdges();
+          Edge e = e2[e2[0].getOtherNode(atom2) == a10 ? 1 : 0];
           bsDone.set(e.index);
           a10 = atom2;
-          atom2 = e.getOtherAtomNode(atom2);
+          atom2 = e.getOtherNode(atom2);
           nCumulene++;
         }
         if (nCumulene % 2 == 1)
           continue;
         Edge b0 = null;
-        Node a0 = null;
+        SimpleNode a0 = null;
         int i0 = 0;
-        Node[] atom12 = new Node[] { atom1, atom2 };
+        SimpleNode[] atom12 = new SimpleNode[] { atom1, atom2 };
         int edgeCount = 1;
         
         // OK, so we have a double bond. Only looking at single bonds around 
it.
@@ -463,10 +464,10 @@
         
         for (int j = 0; j < 2 && edgeCount > 0 && edgeCount < 3; j++) {
           edgeCount = 0;
-          Node atomA = atom12[j];
-          Edge[] bb = atomA.getEdges();
+          SimpleNode atomA = atom12[j];
+          Edge[] bb = ((Node) atomA).getEdges();
           for (int b = 0; b < bb.length; b++) {
-            if (bb[b].getCovalentOrder() != 1 || 
bb[b].getOtherAtomNode(atomA).getElementNumber() == 1)
+            if (bb[b].getCovalentOrder() != 1 || 
bb[b].getOtherNode(atomA).getElementNumber() == 1)
               continue;
             edges[j][edgeCount++] = bb[b];
             if (getBondStereochemistry(bb[b], atomA) != '\0') {
@@ -503,7 +504,7 @@
         // could ever get that with a real molecule. 
         
         char c0 = getBondStereochemistry(b0, atom12[i0]);
-        a0 = b0.getOtherAtomNode(atom12[i0]);
+        a0 = b0.getOtherNode(atom12[i0]);
         if (a0 == null)
           continue;
         for (int j = 0; j < 2; j++)
@@ -512,7 +513,7 @@
             if (b1 == null || b1 == b0)
               continue;
             int bi = b1.index;
-            Node a1 = b1.getOtherAtomNode(atom12[j]);
+            SimpleNode a1 = b1.getOtherNode(atom12[j]);
             if (a1 == null)
               continue;
             char c1 = getBondStereochemistry(b1, atom12[j]);
@@ -544,7 +545,7 @@
     }
   }
 
-  private Node getSmilesAt(SB sb, Node atom,
+  private Node getSmilesAt(SB sb, SimpleNode atom,
                            boolean allowConnectionsToOutsideWorld,
                            boolean allowBranches, boolean forceBrackets) {
     int atomIndex = atom.getIndex();
@@ -562,12 +563,12 @@
     Lst<Edge> v = new Lst<Edge>();
     Edge bondNext = null;
     Edge bondPrev = null;
-    Edge[] bonds = atom.getEdges();
+    Edge[] bonds = (Edge[])atom.getEdges();
     if (polySmilesCenter != null) {
       allowBranches = false;
       sortBonds(atom, prevAtom, polySmilesCenter);
     }
-    Node aH = null;
+    SimpleNode aH = null;
     int stereoFlag = (isAromatic ? 10 : 0);
     if (Logger.debugging)
       Logger.debug(sb.toString());
@@ -580,7 +581,7 @@
         Edge bond = bonds[i];
         if (!bond.isCovalent())
           continue;
-        Node atom1 = bonds[i].getOtherAtomNode(atom);
+        SimpleNode atom1 = bonds[i].getOtherNode(atom);
         int index1 = atom1.getIndex();
         if (index1 == prevIndex) {
           bondPrev = bonds[i];
@@ -615,7 +616,7 @@
 
     // add the bond from the previous atom and carry over the prev atom in 
case it is sp2
     
-    Node[] sp2Atoms = prevSp2Atoms;
+    SimpleNode[] sp2Atoms = prevSp2Atoms;
     int nSp2Atoms = (sp2Atoms == null ? 1 : 2);
     if (sp2Atoms == null)
       sp2Atoms = new Node[5];
@@ -635,9 +636,9 @@
     if (allowBranches)
       for (int i = 0; i < nBonds; i++) {
         Edge bond = v.get(i);
-        Node a = bond.getOtherAtomNode(atom);
+        SimpleNode a = bond.getOtherNode(atom);
         int n = a.getCovalentBondCount()
-            - (includeHs ? 0 : a.getCovalentHydrogenCount());
+            - (includeHs ? 0 : ((Node) a).getCovalentHydrogenCount());
         int order = bond.getCovalentOrder();
         if (n == 1 && (bondNext != null || i < nBonds - 1)) {
           bsBranches.set(bond.index);
@@ -647,7 +648,7 @@
           bondNext = bond;
         }
       }
-    Node atomNext = (bondNext == null ? null : 
bondNext.getOtherAtomNode(atom));
+    Node atomNext = (bondNext == null ? null : (Node) 
bondNext.getOtherNode(atom));
     int orderNext = (bondNext == null ? 0 : bondNext.getCovalentOrder());
 
     if (isAromatic || orderNext == 2 && nH > 1 || atomNext != null
@@ -656,7 +657,7 @@
     }
 
     // initialize stereo[] for stereochemistry 
-    Node[] stereo = new Node[7];
+    SimpleNode[] stereo = new Node[7];
 
     if (stereoFlag < 7 && bondPrev != null) {
       if (havePreviousSp2Atoms && bondPrev.getCovalentOrder() == 2 && 
orderNext == 2
@@ -693,7 +694,7 @@
       Edge bond = v.get(i);
       if (!bsBranches.get(bond.index))
         continue;
-      Node a = bond.getOtherAtomNode(atom);
+      SimpleNode a = bond.getOtherNode(atom);
       SB s2 = new SB();
       prevAtom = atom;
       prevSp2Atoms = null;
@@ -733,7 +734,7 @@
       Edge bond = v.get(i);
       if (bond == bondNext)
         continue;
-      Node a = bond.getOtherAtomNode(atom);
+      SimpleNode a = bond.getOtherNode(atom);
       strPrev = getBondOrder(bond, atomIndex, a.getIndex(), isAromatic);
       if (!deferStereo) {
         chBond = getBondStereochemistry(bond, atom);
@@ -776,10 +777,10 @@
     int charge = atom.getFormalCharge();
     int isotope = atom.getIsotopeNumber();
     int valence = atom.getValence();
-    float osclass = (openSMILES ? atom.getFloatProperty("property_atomclass")
+    float osclass = (openSMILES ? 
((Node)atom).getFloatProperty("property_atomclass")
         : Float.NaN);
     String atomName = atom.getAtomName();
-    String groupType = atom.getBioStructureTypeName();
+    String groupType = ((Node)atom).getBioStructureTypeName();
     // for bioSMARTS we provide the connecting atom if 
     // present. For example, in 1BLU we have 
     // .[CYS.SG#16] could match either the atom number or the element number 
@@ -788,7 +789,7 @@
     if (topologyOnly)
       sb.append("*");
     else if (isExtension && groupType.length() != 0 && atomName.length() != 0)
-      addBracketedBioName(sb, atom, "." + atomName, false);
+      addBracketedBioName(sb, (Node)atom, "." + atomName, false);
     else
       sb.append(SmilesAtom.getAtomLabel(
           atomicNumber,
@@ -841,7 +842,7 @@
     return atomNext;
   }
 
-  private Node[] atemp;
+  private SimpleNode[] atemp;
   /**
    * swap slices of an array [i0 i1) with [i1 i2)
    * @param a
@@ -849,7 +850,7 @@
    * @param i1
    * @param i2
    */
-  private void swapArray(Node[] a, int i0, int i1, int i2) {
+  private void swapArray(SimpleNode[] a, int i0, int i1, int i2) {
     int n = i1 - i0;
     if (atemp == null || atemp.length < n)
       atemp = new Node[n];
@@ -895,7 +896,7 @@
     return false;
   }
 
-  void sortBonds(Node atom, Node refAtom, P3 center) {
+  void sortBonds(SimpleNode atom, SimpleNode refAtom, P3 center) {
     if (smilesStereo == null)
       try {
         smilesStereo = SmilesStereo.newStereo(null);
@@ -917,22 +918,22 @@
    * @param vTemp 
    * @return  "@" or "@@" or ""
    */
-  private String sortInorganic(Node atom, Lst<Edge> v, VTemp vTemp) {
+  private String sortInorganic(SimpleNode atom, Lst<Edge> v, VTemp vTemp) {
     int atomIndex = atom.getIndex();
     int n = v.size();
     Lst<Edge[]> axialPairs = new  Lst<Edge[]>();
     Lst<Edge> bonds = new  Lst<Edge>();
-    Node a1, a2, a01 = null, a02 = null;
+    SimpleNode a1, a2, a01 = null, a02 = null;
     Edge bond1, bond2;
     BS bsDone = new BS();
     Edge[] pair0 = null;
-    Node[] stereo = new Node[6];
+    SimpleNode[] stereo = new Node[6];
     boolean isOK = true; // AX6 or AX5
     String s = "";
     int naxial = 0;
     for (int i = 0; i < n; i++) {
       bond1 = v.get(i);
-      stereo[0] = a1 = bond1.getOtherAtomNode(atom);
+      stereo[0] = a1 = bond1.getOtherNode(atom);
       // just looking for the opposite atom not being identical
       if (i == 0)
         s = addStereoCheck(0, atomIndex, a1, "", null);
@@ -946,7 +947,7 @@
         if (bsDone.get(j))
           continue;
         bond2 = v.get(j);
-        a2 = bond2.getOtherAtomNode(atom);
+        a2 = bond2.getOtherNode(atom);
         if (SmilesStereo.isDiaxial(atom, atom, a1, a2, vTemp, -0.95f)) {
           switch (++naxial) {
           case 1:
@@ -984,7 +985,7 @@
       return "";
     pair0 = axialPairs.get(0);
     bond1 = pair0[0];
-    stereo[0] = bond1.getOtherAtomNode(atom);
+    stereo[0] = bond1.getOtherNode(atom);
     
     // now sort them into the ligand vector in the proper order
     v.clear();
@@ -1000,10 +1001,10 @@
     for (int i = 0; i < bonds.size(); i++) {
       bond1 = bonds.get(i);
       v.addLast(bond1);
-      stereo[i + 1] = bond1.getOtherAtomNode(atom);
+      stereo[i + 1] = bond1.getOtherNode(atom);
     }
     v.addLast(pair0[1]);
-    stereo[n - 1] = pair0[1].getOtherAtomNode(atom);
+    stereo[n - 1] = pair0[1].getOtherNode(atom);
     
     // now deterimine the stereochemistry
     
@@ -1010,8 +1011,8 @@
     return SmilesStereo.getStereoFlag(atom, stereo, n, vTemp);
   }
 
-  private String checkStereoPairs(Node atom, int atomIndex,
-                                  Node[] stereo, int stereoFlag) {
+  private String checkStereoPairs(SimpleNode atom, int atomIndex,
+                                  SimpleNode[] stereo, int stereoFlag) {
     if (stereoFlag < 4)
       return "";
     if (stereoFlag == 4 && (atom.getElementNumber()) == 6) {
@@ -1041,14 +1042,14 @@
    * @param bsDone
    * @return null if duplicate
    */
-  private String addStereoCheck(int level, int atomIndex, Node atom, String s,
+  private String addStereoCheck(int level, int atomIndex, SimpleNode atom, 
String s,
                                 BS bsDone) {
     if (bsDone != null)
       bsDone.set(atomIndex);
     //System.out.println("level=" + level + " atomIndex=" + atomIndex + " 
atom=" + atom + " s=" + s);
-    int n = atom.getAtomicAndIsotopeNumber();
+    int n = ((Node)atom).getAtomicAndIsotopeNumber();
     int nx = atom.getCovalentBondCount();
-    int nh = (n == 6 && !explicitH ? atom.getCovalentHydrogenCount() : 0);
+    int nh = (n == 6 && !explicitH ? ((Node) atom).getCovalentHydrogenCount() 
: 0);
     // only carbon or singly-connected atoms are checked
     // for C we use nh -- CH3, for example.
     // for other atoms, we use number of bonds.
@@ -1064,12 +1065,12 @@
       case 2:
         if (bsDone == null)
           return s;
-        Edge[] edges = atom.getEdges();
+        Edge[] edges = ((Node)atom).getEdges();
         String s2 = "";
         String sa2 = "";
         int nunique = (nh == 2 ? 0 : 3);
         for (int j = atom.getBondCount(); --j >= 0;) {
-          Node a2 = edges[j].getOtherAtomNode(atom);
+          SimpleNode a2 = edges[j].getOtherNode(atom);
           int i2 = a2.getIndex();
           if (bsDone.get(i2) || !edges[j].isCovalent() || 
a2.getElementNumber() == 1)
             continue;
@@ -1094,7 +1095,7 @@
         // must check isotopes for CH3
         int ndt = 0;
         for (int j = 0; j < nx && ndt < 3; j++) {
-          int ia = atom.getBondedAtomIndex(j);
+          int ia = ((Node)atom).getBondedAtomIndex(j);
           if (ia == atomIndex)
             continue;
           ndt += atoms[ia].getAtomicAndIsotopeNumber();

Modified: trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java
===================================================================
--- trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java    2017-05-27 17:45:55 UTC 
(rev 21619)
+++ trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java    2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -40,6 +40,7 @@
 import org.jmol.util.JmolMolecule;
 import org.jmol.util.Logger;
 import org.jmol.util.Node;
+import org.jmol.util.SimpleNode;
 import org.jmol.viewer.JC;
 
 /**
@@ -654,7 +655,7 @@
             // clear out all atoms connected to the last atom only
             jmolBonds = a.getEdges();
             for (int k = 0; k < jmolBonds.length; k++)
-              bs.set(jmolBonds[k].getOtherAtomNode(a).getIndex());
+              bs.set(jmolBonds[k].getOtherNode(a).getIndex());
           }
         }
         boolean skipGroup = ((newPatternAtom.isBioAtomWild));
@@ -1509,9 +1510,9 @@
         while (sAtom2.getBondCount() == 2 && sAtom2.getValence() == 4) {
           nCumulene++;
           Edge[] e2 = sAtom2.getEdges();
-          Edge e = e2[e2[0].getOtherAtomNode(sAtom2) == a10 ? 1 : 0];
+          Edge e = e2[e2[0].getOtherNode(sAtom2) == a10 ? 1 : 0];
           a10 = sAtom2;
-          sAtom2 = (SmilesAtom) e.getOtherAtomNode(sAtom2);
+          sAtom2 = (SmilesAtom) e.getOtherNode(sAtom2);
         }
         if (nCumulene % 2 == 1)
           continue;
@@ -1577,7 +1578,7 @@
     Node a11 = Edge.getAtropismNode(b.matchingBond.order, a1, isFirst);
     SmilesBond[] b1 = s1.bonds;
     for (int i = s1.getBondCount(); --i >= 0;)
-      if (((SmilesAtom) b1[i].getOtherAtomNode(s1)).getMatchingAtom() == a11)
+      if (((SmilesAtom) b1[i].getOtherNode(s1)).getMatchingAtom() == a11)
         return i + 1;
     return 0;
   }
@@ -1644,8 +1645,8 @@
       Edge bond = bonds[k];
       if (bond.order == Edge.BOND_COVALENT_DOUBLE)
         continue;
-      Node atom = bond.getOtherAtomNode(dbAtom1);
-      atom.set(-1, (nBonds++ == 0) ? -1 : 1, 0);
+      SimpleNode atom = bond.getOtherNode(dbAtom1);
+      ((Node) atom).set(-1, (nBonds++ == 0) ? -1 : 1, 0);
       int mode = (bond.getAtomIndex2() == dbAtom1.getIndex() ? nBonds : 
-nBonds);
       switch (bond.order) {
       case Edge.BOND_STEREO_NEAR:
@@ -1657,15 +1658,15 @@
     }
     int dir2 = 0;
     nBonds = 0;
-    Node[] atoms = new Node[2];
+    SimpleNode[] atoms = new Node[2];
     bonds = dbAtom2.getEdges();
     for (int k = bonds.length; --k >= 0;) {
       Edge bond = bonds[k];
       if (bond.order == Edge.BOND_COVALENT_DOUBLE)
         continue;
-      Node atom = bond.getOtherAtomNode(dbAtom2);
+      SimpleNode atom = bond.getOtherNode(dbAtom2);
       atoms[nBonds] = atom;
-      atom.set(1, (nBonds++ == 0) ? 1 : -1, 0);
+      ((Node) atom).set(1, (nBonds++ == 0) ? 1 : -1, 0);
       int mode = (bond.getAtomIndex2() == dbAtom2.getIndex() ? nBonds : 
-nBonds);
       switch (bond.order) {
       case Edge.BOND_STEREO_NEAR:

Modified: trunk/Jmol/src/org/jmol/smiles/SmilesStereo.java
===================================================================
--- trunk/Jmol/src/org/jmol/smiles/SmilesStereo.java    2017-05-27 17:45:55 UTC 
(rev 21619)
+++ trunk/Jmol/src/org/jmol/smiles/SmilesStereo.java    2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -37,6 +37,8 @@
 import org.jmol.util.Escape;
 import org.jmol.util.Logger;
 import org.jmol.util.Node;
+import org.jmol.util.SimpleEdge;
+import org.jmol.util.SimpleNode;
 
 //import org.jmol.util.Logger;
 
@@ -477,7 +479,7 @@
     } 
     int n = bonds.length;
     for (int k = 0; k < n; k++) {
-      SmilesAtom bAtom = (SmilesAtom) bonds[k].getOtherAtomNode(atom);
+      SmilesAtom bAtom = (SmilesAtom) bonds[k].getOtherNode(atom);
       if (bAtom == cAtom) {
         map[i] = (k + 1) * 10 + n000 + i;
         return true;
@@ -505,12 +507,12 @@
    * @param bonds
    * @param vTemp 
    */
-  void sortBondsByStereo(Node atom, Node atomPrev, T3 ref, Edge[] bonds,
+  void sortBondsByStereo(SimpleNode atom, SimpleNode atomPrev, T3 ref, 
SimpleEdge[] bonds,
                           V3 vTemp) {
     if (bonds.length < 2 || !(atom instanceof T3))
       return;
     if (atomPrev == null)
-      atomPrev = bonds[0].getOtherAtomNode(atom);
+      atomPrev = bonds[0].getOtherNode(atom);
     Object[][] aTemp = new Object[bonds.length][0];
     if (sorter == null)
       sorter = new PolyhedronStereoSorter();
@@ -517,7 +519,7 @@
     vTemp.sub2((T3)atomPrev, ref);
     sorter.setRef(vTemp);
     for (int i = bonds.length; --i >= 0;) {
-      Node a = bonds[i].getOtherAtomNode(atom);
+      SimpleNode a = bonds[i].getOtherNode(atom);
       float f = (a == atomPrev ? 0 : 
         sorter.isAligned((T3) a, ref, (T3) atomPrev) ? -999 : 
           Measure.computeTorsion((T3) atom,
@@ -809,13 +811,13 @@
    * @param v
    * @return String
    */
-  static String getStereoFlag(Node atom0, Node[] atoms, int nAtoms, VTemp v) {
-    Node atom1 = atoms[0];
-    Node atom2 = atoms[1];
-    Node atom3 = atoms[2];
-    Node atom4 = atoms[3];
-    Node atom5 = atoms[4];
-    Node atom6 = atoms[5];
+  static String getStereoFlag(SimpleNode atom0, SimpleNode[] atoms, int 
nAtoms, VTemp v) {
+    SimpleNode atom1 = atoms[0];
+    SimpleNode atom2 = atoms[1];
+    SimpleNode atom3 = atoms[2];
+    SimpleNode atom4 = atoms[3];
+    SimpleNode atom5 = atoms[4];
+    SimpleNode atom6 = atoms[5];
     int chiralClass = TETRAHEDRAL;
     // what about POLYHEDRAL?
     switch (nAtoms) {
@@ -850,10 +852,10 @@
     return "";
   }
 
-  private static boolean checkStereochemistryAll(boolean isNot, Node atom0,
+  private static boolean checkStereochemistryAll(boolean isNot, SimpleNode 
atom0,
                                          int chiralClass, int order,
-                                         Node atom1, Node atom2, Node atom3,
-                                         Node atom4, Node atom5, Node atom6,
+                                         SimpleNode atom1, SimpleNode atom2, 
SimpleNode atom3,
+                                         SimpleNode atom4, SimpleNode atom5, 
SimpleNode atom6,
                                          VTemp v) {
 
     switch (chiralClass) {
@@ -927,7 +929,7 @@
     }
   }
 
-  static boolean isDiaxial(Node atomA, Node atomB, Node atom1, Node atom2,
+  static boolean isDiaxial(SimpleNode atomA, SimpleNode atomB, SimpleNode 
atom1, SimpleNode atom2,
                            VTemp v, float f) {
     v.vA.sub2((P3) atomA, (P3) atom1);
     v.vB.sub2((P3) atomB, (P3) atom2);
@@ -947,7 +949,7 @@
    * @param v
    * @return 1 for "@", 2 for "@@"
    */
-  static int getHandedness(Node a, Node b, Node c, Node pt, VTemp v) {
+  static int getHandedness(SimpleNode a, SimpleNode b, SimpleNode c, 
SimpleNode pt, VTemp v) {
     float d = Measure.getNormalThroughPoints((P3) a, (P3) b, (P3) c, v.vTemp, 
v.vA);    
 //    int atat = (distanceToPlane(v.vTemp, d, (P3) pt) > 0 ? 1 : 2);
 //    System.out.println("$ draw p1 " + P3.newP((P3)a) +" color red '"+a+" 
[2]'");

Modified: trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java  2017-05-27 17:45:55 UTC 
(rev 21619)
+++ trunk/Jmol/src/org/jmol/symmetry/CIPChirality.java  2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -13,9 +13,9 @@
 
 import org.jmol.java.BS;
 import org.jmol.util.BSUtil;
-import org.jmol.util.Edge;
 import org.jmol.util.Logger;
-import org.jmol.util.Node;
+import org.jmol.util.SimpleEdge;
+import org.jmol.util.SimpleNode;
 import org.jmol.viewer.JC;
 
 /**
@@ -56,7 +56,7 @@
  *  
  *  - reports atom descriptor along with the rule that ultimately decided it
  * 
- * Primary 236-compound Chapter-9 validation set (AY-236) provided by Andres
+ * Primary 236-compound Chapter-9 validation set (AY-236) provided by Andrey
  * Yerin, ACD/Labs (Moscow).
  * 
  * Mikko Vainio also supplied a 64-compound testing suite (MV-64), which is
@@ -68,7 +68,7 @@
  * Additional thanks to the IUPAC Blue Book Revision project, specifically
  * Karl-Heinz Hellwich for alerting me to the errata page for the 2013 IUPAC
  * specs (http://www.chem.qmul.ac.uk/iupac/bibliog/BBerrors.html), Gerry Moss
- * for discussions, Andres Yerin for discussion and digraph checking.
+ * for discussions, Andrey Yerin for discussion and digraph checking.
  * 
  * Many thanks to the members of the BlueObelisk-Discuss group, particularly
  * Mikko Vainio, John Mayfield (aka John May), Wolf Ihlenfeldt, and Egon 
Willighagen, for
@@ -108,6 +108,8 @@
  * 
  * code history:
  * 
+ * 5/27/17 Jmol 14.17.2 fully interfaced using SimpleNode and SimpleEdge
+ * 
  * 5/27/17 Jmol 14.17.1 fully validated; simplified code; 978 lines
  * 
  * 5/17/17 Jmol 14.16.1. adds helicene M/P chirality; 959 lines validated using
@@ -449,7 +451,7 @@
    *        aromatic atoms at the end of a positive helical turn;
    *        smarts("A{a}(.t:10,40)a(.t:10,40)aaa")
    */
-  public void getChiralityForAtoms(Node[] atoms, BS bsAtoms,
+  public void getChiralityForAtoms(SimpleNode[] atoms, BS bsAtoms,
                                    BS bsAtropisomeric, BS bsHelixM, BS 
bsHelixP) {
     if (bsAtoms.isEmpty())
       return;
@@ -473,7 +475,7 @@
     // set atom chiralities
 
     for (int i = bsToDo.nextSetBit(0); i >= 0; i = bsToDo.nextSetBit(i + 1)) {
-      Node a = atoms[i];
+      SimpleNode a = atoms[i];
       a.setCIPChirality(0);
       ptID = 0;
       int c = getAtomChiralityLimited(a, null, null, RULE_5);
@@ -525,10 +527,10 @@
    * @return a bit set of bridgehead nitrogens. I just liked the name
    *         "azacyclic".
    */
-  private BS getAzacyclic(Node[] atoms, BS bsAtoms) {
+  private BS getAzacyclic(SimpleNode[] atoms, BS bsAtoms) {
     BS bsAza = null;
     for (int i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1)) 
{
-      Node atom = atoms[i];
+      SimpleNode atom = atoms[i];
       if (atom.getElementNumber() != 7 || atom.getCovalentBondCount() != 3
           || bsKekuleAmbiguous.get(i))
         continue;
@@ -543,10 +545,10 @@
       if (nr < 2)
         continue;
       BS bsSubs = new BS();
-      Edge[] bonds = atom.getEdges();
+      SimpleEdge[] bonds = atom.getEdges();
       for (int b = bonds.length; --b >= 0;)
         if (bonds[b].isCovalent())
-          bsSubs.set(bonds[b].getOtherAtomNode(atom).getIndex());
+          bsSubs.set(bonds[b].getOtherNode(atom).getIndex());
       BS bsBoth = new BS();
       BS bsAll = new BS();
       for (int j = 0; j < nr - 1 && bsAll != null; j++) {
@@ -580,7 +582,7 @@
    * @param bsToDo
    * @return whether we have any alkenes that could be EZ
    */
-  private boolean preFilterAtomList(Node[] atoms, BS bsToDo) {
+  private boolean preFilterAtomList(SimpleNode[] atoms, BS bsToDo) {
     boolean haveAlkenes = false;
     for (int i = bsToDo.nextSetBit(0); i >= 0; i = bsToDo.nextSetBit(i + 1)) {
       if (!couldBeChiralAtom(atoms[i])) {
@@ -602,7 +604,7 @@
    * @return true for selected atoms and hybridizations
    * 
    */
-  private boolean couldBeChiralAtom(Node a) {
+  private boolean couldBeChiralAtom(SimpleNode a) {
     boolean mustBePlanar = false;
     switch (a.getCovalentBondCount()) {
     default:
@@ -642,13 +644,13 @@
       break;
     }
     // check that the atom has at most one 1H atom and whether it must be 
planar and has a double bond
-    Edge[] edges = a.getEdges();
+    SimpleEdge[] edges = a.getEdges();
     int nH = 0;
     boolean haveDouble = false;
     for (int j = edges.length; --j >= 0;) {
       if (mustBePlanar && edges[j].getCovalentOrder() == 2)
         haveDouble = true;
-      if (edges[j].getOtherAtomNode(a).getAtomicAndIsotopeNumber() == 1)
+      if (edges[j].getOtherNode(a).getIsotopeNumber() == 1)
         nH++;
     }
     return (nH < 2 && (haveDouble || mustBePlanar == Math.abs(getTrigonality(a,
@@ -665,7 +667,7 @@
    *        optional other atom
    * @return if the atom could be an EZ node
    */
-  private int couldBeChiralAlkene(Node a, Node b) {
+  private int couldBeChiralAlkene(SimpleNode a, SimpleNode b) {
     switch (a.getCovalentBondCount()) {
     default:
       return STEREO_UNDETERMINED;
@@ -680,13 +682,13 @@
         return STEREO_UNDETERMINED;
       break;
     }
-    Edge[] bonds = a.getEdges();
+    SimpleEdge[] bonds = a.getEdges();
     int n = 0;
     for (int i = bonds.length; --i >= 0;)
       if (bonds[i].getCovalentOrder() == 2) {
         if (++n > 1)
           return STEREO_M; //central allenes
-        Node other = bonds[i].getOtherAtomNode(a);
+        SimpleNode other = bonds[i].getOtherNode(a);
         if (!isFirstRow(other))
           return STEREO_UNDETERMINED;
         if (b != null && (other != b || b.getCovalentBondCount() == 1)) {
@@ -703,7 +705,7 @@
    * @param a
    * @return elemno > 2 && elemno <= 10
    */
-  boolean isFirstRow(Node a) {
+  boolean isFirstRow(SimpleNode a) {
     int n = a.getElementNumber();
     return (n > 2 && n <= 10);
   }
@@ -716,7 +718,7 @@
    * @param atoms
    * @return bsKekuleAmbiguous
    */
-  private BS getKekule(Node[] atoms) {
+  private BS getKekule(SimpleNode[] atoms) {
     int nRings = lstSmallRings.size();
     BS bs = new BS(), bsDone = new BS();
     for (int i = nRings; --i >= 0;) {
@@ -729,7 +731,7 @@
       }
       int nPI = 0;
       for (int j = bsRing.nextSetBit(0); j >= 0; j = bsRing.nextSetBit(j + 1)) 
{
-        Node a = atoms[j];
+        SimpleNode a = atoms[j];
         if (bs.get(a.getIndex())) {
           nPI++;
           continue;
@@ -736,12 +738,12 @@
         }
         int nb = a.getCovalentBondCount();
         if (nb == 3 || nb == 2) {
-          Edge[] bonds = a.getEdges();
+          SimpleEdge[] bonds = a.getEdges();
           for (int k = bonds.length; --k >= 0;) {
-            Edge b = bonds[k];
+            SimpleEdge b = bonds[k];
             if (b.getCovalentOrder() != 2)
               continue;
-            if (bsRing.get(b.getOtherAtomNode(a).getIndex())) {
+            if (bsRing.get(b.getOtherNode(a).getIndex())) {
               nPI++;
               break;
             }
@@ -764,7 +766,7 @@
    * @param bs
    *        tracks all atoms in this molecular unit
    */
-  private void getSmallRings(Node atom, BS bs) {
+  private void getSmallRings(SimpleNode atom, BS bs) {
     root = new CIPAtom().create(atom, null, false, false);
     addSmallRings(root, bs);
   }
@@ -783,13 +785,13 @@
       bs.clear(a.atom.getIndex());
     if (a.isTerminal || a.isDuplicate || a.atom.getCovalentBondCount() > 4)
       return;
-    Node atom2;
+    SimpleNode atom2;
     int pt = 0;
-    Edge[] bonds = a.atom.getEdges();
+    SimpleEdge[] bonds = a.atom.getEdges();
     for (int i = bonds.length; --i >= 0;) {
-      Edge bond = bonds[i];
+      SimpleEdge bond = bonds[i];
       if (!bond.isCovalent()
-          || (atom2 = bond.getOtherAtomNode(a.atom)).getCovalentBondCount() == 
1
+          || (atom2 = bond.getOtherNode(a.atom)).getCovalentBondCount() == 1
           || a.parent != null && atom2 == a.parent.atom)
         continue;
       CIPAtom r = a.addAtom(pt++, atom2, false, false);
@@ -808,7 +810,7 @@
    * @param atoms
    * @param lstEZ
    */
-  private void clearSmallRingEZ(Node[] atoms, Lst<int[]> lstEZ) {
+  private void clearSmallRingEZ(SimpleNode[] atoms, Lst<int[]> lstEZ) {
     for (int j = lstSmallRings.size(); --j >= 0;)
       lstSmallRings.get(j).andNot(bsAtropisomeric);
     for (int i = lstEZ.size(); --i >= 0;) {
@@ -834,18 +836,15 @@
    * @return distance from plane of first three covalently bonded nodes to this
    *         node
    */
-  float getTrigonality(Node a, V3 vNorm) {
-    P3[] pts = new P3[3];
-    Edge[] bonds = a.getEdges();
-    Node other;
-    for (int n = bonds.length, i = n, pt = 0; --i >= 0 && pt < 3;)
-      if (bonds[i].isCovalent()
-          && ((other = bonds[i].getOtherAtomNode(a))
-              .getAtomicAndIsotopeNumber() != 1 || n < 4))
-        pts[pt++] = other.getXYZ();
+  float getTrigonality(SimpleNode a, V3 vNorm) {
+    P3[] pts = new P3[4];
+    SimpleEdge[] bonds = a.getEdges();
+    for (int n = bonds.length, i = n, pt = 0; --i >= 0 && pt < 4;)
+      if (bonds[i].isCovalent())
+        pts[pt++] = bonds[i].getOtherNode(a).getXYZ();
     P4 plane = Measure.getPlaneThroughPoints(pts[0], pts[1], pts[2], vNorm,
         vTemp, new P4());
-    return Measure.distanceToPlane(plane, a.getXYZ());
+    return Measure.distanceToPlane(plane, (pts[3] == null ? a.getXYZ() : 
pts[3]));
   }
 
   /**
@@ -857,17 +856,17 @@
    * @param bsToDo
    */
 
-  private void getAtomBondChirality(Node atom, Lst<int[]> lstEZ, BS bsToDo) {
+  private void getAtomBondChirality(SimpleNode atom, Lst<int[]> lstEZ, BS 
bsToDo) {
     int index = atom.getIndex();
-    Edge[] bonds = atom.getEdges();
+    SimpleEdge[] bonds = atom.getEdges();
     int c = NO_CHIRALITY;
     boolean isAtropic = bsAtropisomeric.get(index);
     for (int j = bonds.length; --j >= 0;) {
-      Edge bond = bonds[j];
-      Node atom1;
+      SimpleEdge bond = bonds[j];
+      SimpleNode atom1;
       int index1;
       if (isAtropic) {
-        atom1 = bonds[j].getOtherAtomNode(atom);
+        atom1 = bonds[j].getOtherNode(atom);
         index1 = atom1.getIndex();
         if (!bsAtropisomeric.get(index1))
           continue;
@@ -901,10 +900,10 @@
    * @param parents
    * @return the terminal atom of this alkene or cumulene
    */
-  private Node getLastCumuleneAtom(Edge bond, Node atom, int[] nSP2,
-                                   Node[] parents) {
+  private SimpleNode getLastCumuleneAtom(SimpleEdge bond, SimpleNode atom, 
int[] nSP2,
+                                   SimpleNode[] parents) {
     // we know this is a double bond
-    Node atom2 = bond.getOtherAtomNode(atom);
+    SimpleNode atom2 = bond.getOtherNode(atom);
     if (parents != null) {
       parents[0] = atom2;
       parents[1] = atom;
@@ -916,9 +915,9 @@
     while (true) {
       if (atom2.getCovalentBondCount() != 2)
         return atom2;
-      Edge[] edges = atom2.getEdges();
+      SimpleEdge[] edges = atom2.getEdges();
       for (int i = edges.length; --i >= 0;) {
-        Node atom3 = (bond = edges[i]).getOtherAtomNode(atom2);
+        SimpleNode atom3 = (bond = edges[i]).getOtherNode(atom2);
         if (atom3 == atom)
           continue;
         // connected atom must only have one other bond, and it must be double 
to continue
@@ -957,7 +956,7 @@
    * @return if parent != null: [0:none, 1:R, 2:S] otherwise [0:none, 1:
    *         atoms[0] is higher, 2: atoms[1] is higher]
    */
-  private int getAtomChiralityLimited(Node atom, CIPAtom cipAtom,
+  private int getAtomChiralityLimited(SimpleNode atom, CIPAtom cipAtom,
                                       CIPAtom parent, int ruleMax) {
     int rs = NO_CHIRALITY;
     boolean isChiral = false, isAlkene = false;
@@ -1038,16 +1037,16 @@
    * @return one of: {NO_CHIRALITY | STEREO_Z | STEREO_E | STEREO_Ra | 
STEREO_Sa
    *         | STEREO_ra | STEREO_sa}
    */
-  private int getBondChiralityLimited(Edge bond, Node a, int ruleMax) {
+  private int getBondChiralityLimited(SimpleEdge bond, SimpleNode a, int 
ruleMax) {
     if (Logger.debugging)
       Logger.info("get Bond Chirality " + bond);
     if (a == null)
-      a = bond.getOtherAtomNode(null);
-    if (couldBeChiralAlkene(a, bond.getOtherAtomNode(a)) == 
STEREO_UNDETERMINED)
+      a = bond.getOtherNode(null);
+    if (couldBeChiralAlkene(a, bond.getOtherNode(a)) == STEREO_UNDETERMINED)
       return NO_CHIRALITY;
     int[] nSP2 = new int[1];
-    Node[] parents = new Node[2];
-    Node b = getLastCumuleneAtom(bond, a, nSP2, parents);
+    SimpleNode[] parents = new SimpleNode[2];
+    SimpleNode b = getLastCumuleneAtom(bond, a, nSP2, parents);
     boolean isAxial = nSP2[0] % 2 == 1;
     return setBondChirality(a, parents[0], parents[1], b, isAxial, ruleMax);
   }
@@ -1064,7 +1063,7 @@
    * @return one of: {NO_CHIRALITY | STEREO_Z | STEREO_E | STEREO_M | STEREO_P 
|
    *         STEREO_m | STEREO_p}
    */
-  private int setBondChirality(Node a, Node pa, Node pb, Node b,
+  private int setBondChirality(SimpleNode a, SimpleNode pa, SimpleNode pb, 
SimpleNode b,
                                boolean isAxial, int ruleMax) {
     CIPAtom a1 = new CIPAtom().create(a, null, false, true);
     int atop = getAlkeneEndTopPriority(a1, pa, isAxial, ruleMax);
@@ -1118,7 +1117,7 @@
    * @param ruleMax
    * @return -1, 0, or 1
    */
-  private int getAlkeneEndTopPriority(CIPAtom a, Node pa, boolean isAxial,
+  private int getAlkeneEndTopPriority(CIPAtom a, SimpleNode pa, boolean 
isAxial,
                                       int ruleMax) {
     a.canBePseudo = a.isAxialRoot = isAxial;
     return getAtomChiralityLimited(a.atom, a,
@@ -1165,7 +1164,7 @@
      * this in SMILES or Jmol
      * 
      */
-    Node atom;
+    SimpleNode atom;
 
     /**
      * unique ID for this CIPAtom for debugging only
@@ -1426,7 +1425,7 @@
      * @param isAlkene
      * @return this
      */
-    CIPAtom create(Node atom, CIPAtom parent, boolean isDuplicate,
+    CIPAtom create(SimpleNode atom, CIPAtom parent, boolean isDuplicate,
                    boolean isAlkene) {
       this.id = ++ptID;
       this.parent = parent;
@@ -1502,13 +1501,13 @@
      * @return an averaged element number
      */
     private float getKekuleElementNumber() {
-      Edge[] edges = atom.getEdges();
-      Edge bond;
+      SimpleEdge[] edges = atom.getEdges();
+      SimpleEdge bond;
       float ave = 0;
       int n = 0;
       for (int i = edges.length; --i >= 0;)
         if ((bond = edges[i]).isCovalent()) {
-          Node other = bond.getOtherAtomNode(atom);
+          SimpleNode other = bond.getOtherNode(atom);
           if (bsKekuleAmbiguous.get(other.getIndex())) {
             n++;
             ave += other.getElementNumber();
@@ -1549,16 +1548,16 @@
       if (isDuplicate)
         return true;
 
-      Edge[] bonds = atom.getEdges();
+      SimpleEdge[] bonds = atom.getEdges();
       int nBonds = bonds.length;
       if (Logger.debuggingHigh)
         Logger.info("set " + this);
       int pt = 0;
       for (int i = 0; i < nBonds; i++) {
-        Edge bond = bonds[i];
+        SimpleEdge bond = bonds[i];
         if (!bond.isCovalent())
           continue;
-        Node other = bond.getOtherAtomNode(atom);
+        SimpleNode other = bond.getOtherNode(atom);
         boolean isParentBond = (parent != null && parent.atom == other);
         int order = bond.getCovalentOrder();
         if (order == 2) {
@@ -1641,7 +1640,7 @@
      * @param isAlkene
      * @return new atom or null
      */
-    CIPAtom addAtom(int i, Node other, boolean isDuplicate, boolean isAlkene) {
+    CIPAtom addAtom(int i, SimpleNode other, boolean isDuplicate, boolean 
isAlkene) {
       if (i >= atoms.length) {
         if (Logger.debugging)
           Logger.info(" too many bonds on " + atom);
@@ -1649,7 +1648,7 @@
       }
       if (parent == null) {
         // For top level, we do not allow two 1H atoms.
-        int atomIsotope = other.getAtomicAndIsotopeNumber();
+        int atomIsotope = other.getIsotopeNumber();
         if (atomIsotope == 1) {
           if (++h1Count > 1) {
             if (Logger.debuggingHigh)
@@ -1797,7 +1796,9 @@
       if (ties != null) {
         switch (ties.size()) {
         case 1:
-          switch (checkPseudoHandedness(ties.get(0), indices)) {
+          // in the case of an alkene, we are just checking for a winner on 
one atom
+          // otherwise we need to check the chirality of this tie
+          switch (isAlkene ? STEREO_R : checkPseudoHandedness(ties.get(0), 
indices)) {
           case STEREO_R:
           case STEREO_S:
             isPseudo = canBePseudo;
@@ -2909,8 +2910,8 @@
       CIPAtom atom1;
       // critical here that we do NOT include the tied branches
       atom1 = (CIPAtom) clone();
-      atom1.atoms[ia] = new CIPAtom().create(null, atom1, false, isAlkene);
-      atom1.atoms[ib] = new CIPAtom().create(null, atom1, false, isAlkene);
+      atom1.atoms[ia] = new CIPAtom().create(null, atom1, false, false);
+      atom1.atoms[ib] = new CIPAtom().create(null, atom1, false, false);
       atom1.addReturnPath(null, this);
       // We are guaranteed that only RULE_1a is necessary, because one of our
       // paths goes all the way back to the root, without a duplicate atom, 
and any
@@ -2966,7 +2967,7 @@
      * Determine the ordered CIP winding of this atom. For this, we just take
      * the directed normal through the plane containing the top three
      * substituent atoms and dot that with the vector from any one of them to
-     * the root atom. If this is positive, we have R.
+     * the fourth ligand (or the root atom if trigonal pyramidal). If this is 
positive, we have R.
      * 
      * @return 1 for "R", 2 for "S"
      */
@@ -2973,9 +2974,12 @@
     int checkHandedness() {
       P3 p1 = atoms[0].atom.getXYZ(), p2 = atoms[1].atom.getXYZ(), p3 = 
atoms[2].atom.getXYZ();
       Measure.getNormalThroughPoints(p1, p2, p3, vNorm, vTemp);
-      vTemp.setT(atom.getXYZ());
+      vTemp.setT((atoms[3].atom == null ? atom : atoms[3].atom).getXYZ());
       vTemp.sub(p1);
-      return (vTemp.dot(vNorm) > 0 ? STEREO_R : STEREO_S);
+      float f = vTemp.dot(vNorm);
+      System.out.println("draw d1 vector " + P3.newP(atom.getXYZ()) + " " + 
vNorm);
+      System.out.println("draw d2 vector " + P3.newP(atom.getXYZ()) + " " + 
vTemp);
+      return (f > 0 ? STEREO_R : STEREO_S);
     }
 
     /**

Modified: trunk/Jmol/src/org/jmol/symmetry/Symmetry.java
===================================================================
--- trunk/Jmol/src/org/jmol/symmetry/Symmetry.java      2017-05-27 17:45:55 UTC 
(rev 21619)
+++ trunk/Jmol/src/org/jmol/symmetry/Symmetry.java      2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -26,6 +26,17 @@
 
 import java.util.Map;
 
+import javajs.util.Lst;
+import javajs.util.M3;
+import javajs.util.M4;
+import javajs.util.Matrix;
+import javajs.util.P3;
+import javajs.util.P3i;
+import javajs.util.Quat;
+import javajs.util.SB;
+import javajs.util.T3;
+import javajs.util.V3;
+
 import org.jmol.api.AtomIndexIterator;
 import org.jmol.api.Interface;
 import org.jmol.api.SymmetryInterface;
@@ -33,28 +44,14 @@
 import org.jmol.bspt.CubeIterator;
 import org.jmol.java.BS;
 import org.jmol.modelset.Atom;
-import org.jmol.modelset.Bond;
 import org.jmol.modelset.ModelSet;
-import javajs.util.Lst;
-
+import org.jmol.util.Escape;
 import org.jmol.util.JmolMolecule;
-import javajs.util.P3;
-
-import org.jmol.util.Escape;
-import org.jmol.util.Tensor;
 import org.jmol.util.Logger;
 import org.jmol.util.SimpleUnitCell;
+import org.jmol.util.Tensor;
 import org.jmol.viewer.Viewer;
 
-import javajs.util.M3;
-import javajs.util.M4;
-import javajs.util.Matrix;
-import javajs.util.P3i;
-import javajs.util.Quat;
-import javajs.util.SB;
-import javajs.util.T3;
-import javajs.util.V3;
-
 public class Symmetry implements SymmetryInterface {
   // NOTE: THIS CLASS IS VERY IMPORTANT.
   // IN ORDER TO MODULARIZE IT, IT IS REFERENCED USING 

Modified: trunk/Jmol/src/org/jmol/util/Edge.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/Edge.java      2017-05-27 17:45:55 UTC (rev 
21619)
+++ trunk/Jmol/src/org/jmol/util/Edge.java      2017-05-27 20:31:36 UTC (rev 
21620)
@@ -25,7 +25,7 @@
 package org.jmol.util;
 
 
-public abstract class Edge {
+public abstract class Edge implements SimpleEdge {
 
   
   /**
@@ -132,10 +132,10 @@
 
   abstract public int getAtomIndex2();
 
+  @Override
   abstract public int getCovalentOrder();
 
-  abstract public Node getOtherAtomNode(Node atom);
-
+  @Override
   abstract public boolean isCovalent();
 
   abstract public boolean isHydrogen();
@@ -224,7 +224,7 @@
 
   public static Node getAtropismNode(int order, Node a1, boolean isFirst) {
     int i1 = (order >> (ATROPISOMER_SHIFT + (isFirst ? 2 : 0))) & 3;
-    return a1.getEdges()[i1 - 1].getOtherAtomNode(a1);
+    return (Node) a1.getEdges()[i1 - 1].getOtherNode(a1);
   }
 
   public static boolean isAtropism(int order) {
@@ -346,10 +346,17 @@
 
   }
 
+  /**
+   * @param c  
+   */
   public void setCIPChirality(int c) {
     // default is no action
   }
 
+  /**
+   * @param doCalculate  
+   * @return CIP chirality label
+   */
   public String getCIPChirality(boolean doCalculate) {
     return "";
   }

Modified: trunk/Jmol/src/org/jmol/util/JmolMolecule.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/JmolMolecule.java      2017-05-27 17:45:55 UTC 
(rev 21619)
+++ trunk/Jmol/src/org/jmol/util/JmolMolecule.java      2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -318,7 +318,7 @@
     for (int i = bonds.length; --i >= 0;) {
       Edge bond = bonds[i];
       if (bond != null && bond.isCovalent()
-          && !getCovalentlyConnectedBitSet(atoms, bond.getOtherAtomNode(atom),
+          && !getCovalentlyConnectedBitSet(atoms, (Node) 
bond.getOtherNode(atom),
               bsToTest, allowCyclic, allowBioResidue, biobranches, bsResult))
         return false;
     }

Modified: trunk/Jmol/src/org/jmol/util/Node.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/Node.java      2017-05-27 17:45:55 UTC (rev 
21619)
+++ trunk/Jmol/src/org/jmol/util/Node.java      2017-05-27 20:31:36 UTC (rev 
21620)
@@ -29,24 +29,32 @@
 
 import org.jmol.java.BS;
 
-public interface Node {
+public interface Node extends SimpleNode {
   
   // abstracts out the essential pieces for SMILES processing
   
   public int getAtomicAndIsotopeNumber();
+  @Override
   public String getAtomName();
   public int getAtomSite();
   public int getBondedAtomIndex(int j);
+  @Override
   public int getCovalentBondCount();
   public int getCovalentHydrogenCount();
+  @Override
   public Edge[] getEdges();
+  @Override
   public int getElementNumber();
   public int getFormalCharge();
+  @Override
   public int getIndex();
+  @Override
   public int getIsotopeNumber();
+  @Override
   public int getValence();
   public void set(float x, float y, float z);
   public int getMoleculeNumber(boolean inModel);
+  @Override
   public int getNominalMass();
 
   
@@ -62,8 +70,6 @@
   public BS findAtomsLike(String substring);
   public String getAtomType();
   public int getModelIndex();
-  // could include hydrogen bonds
-  public int getBondCount();
   public int getAtomNumber();
   /**
    * can be > 0 for PDB model with no H atoms or for SMILES string CCC
@@ -99,7 +105,9 @@
   char getBioSmilesType();
   String getCIPChirality(boolean doCalculate);
   int getCIPChiralityCode();
+  @Override
   void setCIPChirality(int c);
+  @Override
   public P3 getXYZ();
 
 }

Added: trunk/Jmol/src/org/jmol/util/SimpleEdge.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/SimpleEdge.java                                
(rev 0)
+++ trunk/Jmol/src/org/jmol/util/SimpleEdge.java        2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -0,0 +1,12 @@
+package org.jmol.util;
+
+
+public interface SimpleEdge {
+
+  int getCovalentOrder();
+
+  SimpleNode getOtherNode(SimpleNode a);
+
+  boolean isCovalent();
+
+}


Property changes on: trunk/Jmol/src/org/jmol/util/SimpleEdge.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Added: trunk/Jmol/src/org/jmol/util/SimpleNode.java
===================================================================
--- trunk/Jmol/src/org/jmol/util/SimpleNode.java                                
(rev 0)
+++ trunk/Jmol/src/org/jmol/util/SimpleNode.java        2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -0,0 +1,37 @@
+package org.jmol.util;
+
+
+import javajs.util.P3;
+
+/**
+ * Just the bare minimum to accomplish CIP and non-BioSMILES
+ */
+public interface SimpleNode {
+
+  void setCIPChirality(int rs);
+
+  int getIsotopeNumber();
+
+  String getAtomName();
+
+  // could include hydrogen bonds
+  int getBondCount();
+
+  int getCovalentBondCount();
+
+  SimpleEdge[] getEdges();
+
+  int getElementNumber();
+
+  int getFormalCharge();
+
+  int getIndex();
+
+  int getNominalMass();
+
+  int getValence();
+
+  P3 getXYZ();
+
+
+}


Property changes on: trunk/Jmol/src/org/jmol/util/SimpleNode.java
___________________________________________________________________
Added: svn:mime-type
## -0,0 +1 ##
+text/plain
\ No newline at end of property
Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2017-05-27 17:45:55 UTC 
(rev 21619)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2017-05-27 20:31:36 UTC 
(rev 21620)
@@ -56,8 +56,12 @@
 
 # TODO: fix UNDO
 
-Jmol.___JmolVersion="14.17.1"  // 2017.05.27
+Jmol.___JmolVersion="14.17.2"
 
+code: CIPChirality.java fully interfaced using SimpleNode and SimpleEdge
+
+JmolVersion="14.17.1"  // 2017.05.27
+
 new feature: atom property x.cipRule 
  -- CIP sequence rule deciding this center  
  -- one of 1a, 1b, 2, 3, 4a, 4b, 4c, 5, or blank

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