From: <ha...@us...> - 2010-08-07 23:19:02
|
Revision: 13918 http://jmol.svn.sourceforge.net/jmol/?rev=13918&view=rev Author: hansonr Date: 2010-08-07 23:18:55 +0000 (Sat, 07 Aug 2010) Log Message: ----------- 12.1.2 VERSION # bug fix: SmilesGeneration fails for double bond stereochemistry # bug fix: documented within("SMILES",...) missing and required for SmilesGenerator # bug fix: select within(branch,{},{}) exception # bug fix: "sheet" token missing, so select within(sheet) fails # bug fix: struts not restored from state # bug fix: color STRUTS also colors hbonds # new feature: Application Display menu item "resize" (also added to 12.0) # bug fix: draw CYLINDER n ... where n is an integer does not give flat ends # bug fix: PNG file state for multiple file load cannot be read # bug fix: Jmol application not accepting -g # bug fix: "no atoms found returns wrong error message # bug fix: XYZ reader fails with load "filename" 3 # bug fix: "[1,3,4,5]" can be translated to [1,3,4] # code: Java 1.5 upgrade -- many generics still have warnings # bug fix: slab/depth mouse action does not automatically refresh Modified Paths: -------------- trunk/Jmol/src/org/jmol/api/JmolMolecule.java trunk/Jmol/src/org/jmol/api/JmolNode.java trunk/Jmol/src/org/jmol/modelset/Atom.java trunk/Jmol/src/org/jmol/modelset/ModelCollection.java trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java trunk/Jmol/src/org/jmol/smiles/SmilesAtom.java trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/api/JmolMolecule.java =================================================================== --- trunk/Jmol/src/org/jmol/api/JmolMolecule.java 2010-08-07 22:00:42 UTC (rev 13917) +++ trunk/Jmol/src/org/jmol/api/JmolMolecule.java 2010-08-07 23:18:55 UTC (rev 13918) @@ -88,6 +88,10 @@ bsExclude = new BitSet(); for (int i = 0; i < atoms.length; i++) if (!bsExclude.get(i) && !bsBranch.get(i)) { + if (atoms[i].isDeleted()) { + bsExclude.set(i); + continue; + } int modelIndex = atoms[i].getModelIndex(); if (modelIndex != thisModelIndex) { thisModelIndex = modelIndex; @@ -96,8 +100,9 @@ bsToTest = bsModelAtoms[modelIndex]; } bsBranch = getBranchBitSet(atoms, bsToTest, i, -1, true, true); - molecules = addMolecule(molecules, moleculeCount++, atoms, i, bsBranch, - modelIndex, indexInModel++, bsExclude); + if (bsBranch.nextSetBit(0) >= 0) + molecules = addMolecule(molecules, moleculeCount++, atoms, i, bsBranch, + modelIndex, indexInModel++, bsExclude); } return allocateArray(molecules, moleculeCount); } Modified: trunk/Jmol/src/org/jmol/api/JmolNode.java =================================================================== --- trunk/Jmol/src/org/jmol/api/JmolNode.java 2010-08-07 22:00:42 UTC (rev 13917) +++ trunk/Jmol/src/org/jmol/api/JmolNode.java 2010-08-07 23:18:55 UTC (rev 13918) @@ -66,4 +66,5 @@ public boolean isRna(); public boolean isPurine(); public boolean isPyrimidine(); + public boolean isDeleted(); } Modified: trunk/Jmol/src/org/jmol/modelset/Atom.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/Atom.java 2010-08-07 22:00:42 UTC (rev 13917) +++ trunk/Jmol/src/org/jmol/modelset/Atom.java 2010-08-07 23:18:55 UTC (rev 13918) @@ -882,7 +882,9 @@ public String getGroup3(boolean allowNull) { String group3 = group.getGroup3(); - return (allowNull || group3 != null || group3.length() > 0 ? group3 : "UNK"); + return (allowNull + || group3 != null && group3.length() > 0 + ? group3 : "UNK"); } public String getGroup1(char c0) { Modified: trunk/Jmol/src/org/jmol/modelset/ModelCollection.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2010-08-07 22:00:42 UTC (rev 13917) +++ trunk/Jmol/src/org/jmol/modelset/ModelCollection.java 2010-08-07 23:18:55 UTC (rev 13918) @@ -1861,8 +1861,9 @@ bsBranch = new BitSet(); m.getBioPolymer(j).getRange(bsBranch); int iAtom = bsBranch.nextSetBit(0); - molecules = JmolMolecule.addMolecule(molecules, moleculeCount++, atoms, - iAtom, bsBranch, m.modelIndex, count++, bsExclude); + if (iAtom >= 0) + molecules = JmolMolecule.addMolecule(molecules, moleculeCount++, atoms, + iAtom, bsBranch, m.modelIndex, count++, bsExclude); } } molecules = JmolMolecule.getMolecules(atoms, bsModelAtoms, molecules, Modified: trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2010-08-07 22:00:42 UTC (rev 13917) +++ trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2010-08-07 23:18:55 UTC (rev 13918) @@ -1971,7 +1971,7 @@ x1.value, true, x1.index, asArray)); } - private boolean evaluateWithin(ScriptVariable[] args) { + private boolean evaluateWithin(ScriptVariable[] args) throws ScriptException { if (args.length < 1 || args.length > 5) return false; int i = args.length; @@ -1993,7 +1993,6 @@ return addX(viewer.getBranchBitSet( ((BitSet) args[2].value).nextSetBit(0), ((BitSet) args[1].value) .nextSetBit(0))); - /* unnecessary -- see select smiles(), select smarts() case Token.smiles: case Token.search: // within("smiles", "...", {bitset}) @@ -2014,10 +2013,9 @@ if (!isOK) eval.error(ScriptEvaluator.ERROR_invalidArgument); if (isSyntaxCheck) - return (asBitSet ? addX(new BitSet()) : addX(new Vector())); + return (asBitSet ? addX(new BitSet()) : addX(new ArrayList<Object>())); return addX(eval.getSmilesMatches(ScriptVariable .sValue(args[1]), null, bsSelected, null, tok == Token.search, asBitSet)); - */ } if (withinSpec instanceof String) { if (tok == Token.nada) { Modified: trunk/Jmol/src/org/jmol/smiles/SmilesAtom.java =================================================================== --- trunk/Jmol/src/org/jmol/smiles/SmilesAtom.java 2010-08-07 22:00:42 UTC (rev 13917) +++ trunk/Jmol/src/org/jmol/smiles/SmilesAtom.java 2010-08-07 23:18:55 UTC (rev 13918) @@ -739,4 +739,8 @@ && "CTUI".indexOf(residueChar) >= 0; } + public boolean isDeleted() { + return false; + } + } Modified: trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java =================================================================== --- trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java 2010-08-07 22:00:42 UTC (rev 13917) +++ trunk/Jmol/src/org/jmol/smiles/SmilesGenerator.java 2010-08-07 23:18:55 UTC (rev 13918) @@ -249,7 +249,6 @@ while ((atom = getSmiles(sb, atom, allowConnectionsToOutsideWorld)) != null) { } while (bsToDo.cardinality() > 0 || !htRings.isEmpty()) { - //System.out.println(bsToDo); Iterator<Object[]> e = htRings.values().iterator(); if (e.hasNext()) { atom = atoms[((Integer) e.next()[1]).intValue()]; @@ -481,18 +480,9 @@ if (bondAtoms == null) bondAtoms = new JmolNode[5]; if (bondPrev == null) { - stereoShown = true; + //stereoShown = true; } else { strBond = SmilesBond.getBondOrderString(bondPrev.getCovalentOrder()); - if (stereoFlag < 7) { - if (bondPrev.getCovalentOrder() == 2 && prevBondAtoms != null && prevBondAtoms[1] != null) { - // allene continuation - stereo[stereoFlag++] = prevBondAtoms[0]; - stereo[stereoFlag++] = prevBondAtoms[1]; - } else { - stereo[stereoFlag++] = prevAtom; - } - } if (prevBondAtoms == null) bondAtoms[nBondAtoms++] = prevAtom; else @@ -521,6 +511,17 @@ } JmolNode atomNext = (bond0 == null ? null : bond0.getOtherAtom(atom)); int orderNext = (bond0 == null ? 0 : bond0.getCovalentOrder()); + + if (stereoFlag < 7 && bondPrev != null) { + if (bondPrev.getCovalentOrder() == 2 && orderNext == 2 && prevBondAtoms != null && prevBondAtoms[1] != null) { + // allene continuation + stereo[stereoFlag++] = prevBondAtoms[0]; + stereo[stereoFlag++] = prevBondAtoms[1]; + } else { + stereo[stereoFlag++] = prevAtom; + } + } + boolean deferStereo = (orderNext == 1 && prevBondAtoms == null); char chBond = getBondStereochemistry(bondPrev, prevAtom); @@ -536,11 +537,11 @@ s2.append("("); prevAtom = atom; prevBondAtoms = null; - boolean b = stereoShown; + //boolean b = stereoShown; JmolEdge bond0t = bond0; - stereoShown = true; + //stereoShown = false; getSmiles(s2, a, allowConnectionsToOutsideWorld); - stereoShown = b; + //stereoShown = true; bond0 = bond0t; s2.append(")"); if (sMore.indexOf(s2.toString()) >= 0) @@ -566,19 +567,24 @@ if (nBondAtoms < 0) { bondAtoms = null; } else { - stereoShown = false; +// stereoShown = false; } // output section - if (strBond != null) { + if (strBond != null || !stereoShown && chBond != '\0') { + // stereoShown is never turned TRUE now, because all it does + // is allow for a more concise SMILES string without the + // optional second stereo bond indicator / or \ + // but it is such a headache to get right... if (!stereoShown && chBond != '\0') { strBond = "" + chBond; - stereoShown = true; + //stereoShown = true; } sb.append(strBond); } + // now process any rings for (int i = v.size(); --i >= 0;) { @@ -592,7 +598,7 @@ chBond = getBondStereochemistry(bond, atom); if (chBond != '\0') { strBond = "" + chBond; - stereoShown = true; + //stereoShown = true; } } @@ -645,7 +651,7 @@ if (nBondAtoms != 1 && nBondAtoms != 2) { bondAtoms = null; nBondAtoms = 0; - stereoShown = true; + //stereoShown = true; } else { if (bondAtoms[0] == null) bondAtoms[0] = atom; // CN= , for example. close enough! @@ -653,6 +659,9 @@ bondAtoms[1] = atom; // .C3= stereoShown = false; } + if (orderNext == 2) + stereoShown = false; + prevBondAtoms = bondAtoms; prevAtom = atom; return atomNext; Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2010-08-07 22:00:42 UTC (rev 13917) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2010-08-07 23:18:55 UTC (rev 13918) @@ -1,8 +1,10 @@ # Developers: to add a description of changes you have made, # add it on a line starting with # below the "version=..." line -version=12.1.2_dev +version=12.1.2 +# bug fix: SmilesGeneration fails for double bond stereochemistry +# bug fix: documented within("SMILES",...) missing and required for SmilesGenerator # bug fix: select within(branch,{},{}) exception # bug fix: "sheet" token missing, so select within(sheet) fails # bug fix: struts not restored from state This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |