Revision: 21641 http://sourceforge.net/p/jmol/code/21641 Author: hansonr Date: 2017-06-25 23:19:27 +0000 (Sun, 25 Jun 2017) Log Message: ----------- Jmol.___JmolVersion="14.19.2"
bug fix: SMILES generator can show wrong @/@@ or stereochemical type for some allenes and cumulenes Modified Paths: -------------- trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java =================================================================== --- trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java 2017-06-25 20:37:45 UTC (rev 21640) +++ trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java 2017-06-25 23:19:27 UTC (rev 21641) @@ -547,6 +547,8 @@ } } + private int ptAtom, ptSp2Atom0; + private Node getSmilesAt(SB sb, SimpleNode atom, boolean allowConnectionsToOutsideWorld, boolean allowBranches, boolean forceBrackets) { @@ -553,6 +555,7 @@ int atomIndex = atom.getIndex(); if (!bsToDo.get(atomIndex)) return null; + ptAtom++; bsToDo.clear(atomIndex); boolean includeHs = (atomIndex == iHypervalent || explicitH); boolean isExtension = (!bsSelected.get(atomIndex)); @@ -565,7 +568,7 @@ Lst<Edge> v = new Lst<Edge>(); Edge bondNext = null; Edge bondPrev = null; - Edge[] bonds = (Edge[])atom.getEdges(); + Edge[] bonds = (Edge[]) atom.getEdges(); if (polySmilesCenter != null) { allowBranches = false; sortBonds(atom, prevAtom, polySmilesCenter); @@ -617,7 +620,7 @@ // 5) branches // add the bond from the previous atom and carry over the prev atom in case it is sp2 - + SimpleNode[] sp2Atoms = prevSp2Atoms; int nSp2Atoms = (sp2Atoms == null ? 1 : 2); if (sp2Atoms == null) @@ -625,8 +628,10 @@ String strPrev = null; if (bondPrev != null) { strPrev = getBondOrder(bondPrev, atomIndex, prevIndex, isAromatic); - if (!havePreviousSp2Atoms) + if (!havePreviousSp2Atoms) { + ptSp2Atom0 = ptAtom; sp2Atoms[0] = prevAtom; + } } nSp2Atoms += nH; @@ -650,11 +655,16 @@ bondNext = bond; } } - Node atomNext = (bondNext == null ? null : (Node) bondNext.getOtherNode(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 - && SmilesSearch.isRingBond(ringSets, null, atomIndex, atomNext.getIndex())) { + if (isAromatic + || orderNext == 2 + && nH > 1 + || atomNext != null + && SmilesSearch.isRingBond(ringSets, null, atomIndex, + atomNext.getIndex())) { sp2Atoms = null; } @@ -662,8 +672,8 @@ SimpleNode[] stereo = new Node[7]; if (stereoFlag < 7 && bondPrev != null) { - if (havePreviousSp2Atoms && bondPrev.getCovalentOrder() == 2 && orderNext == 2 - && prevSp2Atoms[1] != null) { + if (havePreviousSp2Atoms && bondPrev.getCovalentOrder() == 2 + && orderNext == 2 && prevSp2Atoms[1] != null) { // allene continuation stereo[stereoFlag++] = prevSp2Atoms[0]; stereo[stereoFlag++] = prevSp2Atoms[1]; @@ -767,10 +777,20 @@ && atomNext.getCovalentBondCount() == 3) { // this is for allenes only, not cumulenes bonds = atomNext.getEdges(); - for (int k = 0; k < bonds.length; k++) { - if (bonds[k].isCovalent() - && atomNext.getBondedAtomIndex(k) != atomIndex) - stereo[stereoFlag++] = atoms[atomNext.getBondedAtomIndex(k)]; + if ((ptAtom - ptSp2Atom0) % 2 == 0) + stereoFlag = 8; // no @/@@ for even cumulenes + else + for (int k = 0; k < bonds.length; k++) { + if (bonds[k].isCovalent() + && atomNext.getBondedAtomIndex(k) != atomIndex) + stereo[stereoFlag++] = atoms[atomNext.getBondedAtomIndex(k)]; + } + if (stereoFlag == 4 + && ((Node) stereo[3]).getAtomicAndIsotopeNumber() == 1) { + // if last atom is H, we swap. + SimpleNode n = stereo[3]; + stereo[3] = stereo[2]; + stereo[2] = n; } nSp2Atoms = 0; } else if (atomNext != null && stereoFlag < 7) { @@ -779,10 +799,10 @@ int charge = atom.getFormalCharge(); int isotope = atom.getIsotopeNumber(); int valence = atom.getValence(); - float osclass = (openSMILES ? ((Node)atom).getFloatProperty("property_atomclass") - : Float.NaN); + float osclass = (openSMILES ? ((Node) atom) + .getFloatProperty("property_atomclass") : Float.NaN); String atomName = atom.getAtomName(); - String groupType = ((Node)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 @@ -791,7 +811,7 @@ if (topologyOnly) sb.append("*"); else if (isExtension && groupType.length() != 0 && atomName.length() != 0) - addBracketedBioName(sb, (Node)atom, "." + atomName, false); + addBracketedBioName(sb, (Node) atom, "." + atomName, false); else sb.append(SmilesAtom.getAtomLabel( atomicNumber, @@ -808,9 +828,8 @@ sb.appendSB(sbRings); + // ...then add the branches - // ...then add the branches - if (bondNext != null) { // not the end - all branches get parentheses sb.appendSB(sbBranches); Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2017-06-25 20:37:45 UTC (rev 21640) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2017-06-25 23:19:27 UTC (rev 21641) @@ -56,16 +56,12 @@ # TODO: fix UNDO -Jmol.___JmolVersion="14.19.1" +Jmol.___JmolVersion="14.19.2" -bug fix: CIPChirality: minor fixes for Rule 4b and 5 for BH64_012-015; better atropisomer check -bug fix; SPIN QUATERNION -bug fix: CENTERAT ABSOLUTE broken (since forever?) -bug fix: SPIN QUATERNION {0 0 -1 0} still does a positive, not negative, rotation - (solution is to apply a miniscule rotation of 1e-10 degrees) - -bug fix: script array context [3 -0] becomes [3], as in [3 - 0] +bug fix: SMILES generator can show wrong @/@@ or stereochemical type for some allenes and cumulenes +JmolVersion="14.19.1" // 2017.06.25 + new feature: WRITE "SDF" implements atom value V nnn ... information -- requires assigning the data property name "atom_values" in the model's molData property -- for example: @@ -73,7 +69,7 @@ $ load $2,3-dichlorobutane $ molData = {"atom_values":"chirality"} $ model properties "molData" molData - $ write diol.sdf + $ write dcb.sdf -- note that if the model already has a molData property, then use the following to append to it: @@ -81,11 +77,17 @@ $ molData.atom_values = "chirality" $ model properties "molData" molData - - new feature: x = load("filename","JSON") -- loads JSON data into variable +bug fix: CIPChirality: minor fixes for Rule 4b and 5 for BH64_012-015; better atropisomer check +bug fix; SPIN QUATERNION +bug fix: CENTERAT ABSOLUTE broken (since forever?) +bug fix: SPIN QUATERNION {0 0 -1 0} still does a positive, not negative, rotation + (solution is to apply a miniscule rotation of 1e-10 degrees) + +bug fix: script array context [3 -0] becomes [3], as in [3 - 0] + bug fix: SET ANTIALIASDISPLAY requires click [via resizeImage()] bug fix: CIP gives wrong alkene root distance for cyclopropene bug fix: WRITE of structure file does not report number of atoms and warn if selected is different from this molecule 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