From: <ha...@us...> - 2017-03-25 16:28:17
|
Revision: 21449 http://sourceforge.net/p/jmol/code/21449 Author: hansonr Date: 2017-03-25 16:28:14 +0000 (Sat, 25 Mar 2017) Log Message: ----------- Jmol.___JmolVersion="14.10.0-beta-2017-3-25" new feature: x = {*}.find(smartsString,"map") -- returns an array of arrays of atom indices (0-based) -- indicates exact correlation between atoms in {*} and atoms of smartsString -- only unique sets of atoms are found, not every possibility -- for example: load $caffeine print {*}.find("*1*****1", "map").format("JSON") [ [ 0,2,4,6,11,12 ] ] new feature: SELECT @x where x is an array of integers or array of array of integers -- selects atoms from array rather than from a bitset -- note that variable must be used, as SELECT [1,2,3] would look for PDB group "1,2,3" -- for example: load $caffeine x = {*}.find("*1*****1", "map")[0] select @x 6 atoms selected new feature: DRAW polyhedron @x where x is an array of array of integers -- draws sets of polygons based on arrays of atom indices -- for example: load $caffeine draw polyhedra @{{*}.find("*1****1||*1*****1","map")} new feature: 4-order bond in MOL file using 14 for bond order -- Jmol extension for MOL file format to allow 4-bond -- example: [Re2Cl8](2-) -- see https://en.wikipedia.org/wiki/Quadruple_bond new feature: 5-order bond in MOL file using 15 for bond order -- Jmol extension for MOL file format to allow 5-bond -- example: [Mo2Cl8](4-) -- see https://en.wikipedia.org/wiki/Quintuple_bond new feature: 6-order bond in MOL file using 16 for bond order -- Jmol extension for MOL file format to allow 6-bond -- example: Mo2 -- see https://en.wikipedia.org/wiki/Sextuple_bond bug fix: DSSR fix for multi-model PDB file bug fix: EXIT command with -n command line flag does not exit Jmol bug fix: echo renderer may not show correct font size bug fix: POLYHEDRA ID id OFFSET {x y z} broken bug fix: ScriptManager debug output being sent even if -i (silent) command line option set. Modified Paths: -------------- trunk/Jmol/src/org/jmol/dssx/DSSR1.java trunk/Jmol/src/org/jmol/render/EchoRenderer.java trunk/Jmol/src/org/jmol/script/SV.java trunk/Jmol/src/org/jmol/script/ScriptEval.java trunk/Jmol/src/org/jmol/script/ScriptExpr.java trunk/Jmol/src/org/jmol/scriptext/IsoExt.java trunk/Jmol/src/org/jmol/scriptext/MathExt.java trunk/Jmol/src/org/jmol/smiles/SmilesMatcher.java trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java trunk/Jmol/src/org/jmol/util/MeshCapper.java trunk/Jmol/src/org/jmol/viewer/JC.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/dssx/DSSR1.java =================================================================== --- trunk/Jmol/src/org/jmol/dssx/DSSR1.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/dssx/DSSR1.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -132,6 +132,9 @@ name = PT.rep(name, "%20", " "); Logger.info("fetching " + name + "[pdb data]"); String data = vwr.getPdbAtomData(bs, null, false, false); + int modelNumber = vwr.getModelNumber(vwr.ms.getModelBS(bs,false).nextSetBit(0)); + String s = " " + modelNumber; + data = "MODEL" + s.substring(s.length() - 9) + "\n" + data + "ENDMDL\n"; data = vwr.getFileAsString3(name + data, false, null); Map<String, Object> x = vwr.parseJSON(data); if (x != null) { Modified: trunk/Jmol/src/org/jmol/render/EchoRenderer.java =================================================================== --- trunk/Jmol/src/org/jmol/render/EchoRenderer.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/render/EchoRenderer.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -40,6 +40,7 @@ Echo echo = (Echo) shape; sppm = (vwr.getBoolean(T.fontscaling) ? vwr .getScalePixelsPerAngstrom(true) * 10000 : 0); + imageFontScaling = vwr.imageFontScaling; boolean haveTranslucent = false; for (Text t : echo.objects.values()) { if (!t.visible || t.hidden) { Modified: trunk/Jmol/src/org/jmol/script/SV.java =================================================================== --- trunk/Jmol/src/org/jmol/script/SV.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/script/SV.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -1374,11 +1374,29 @@ } } + /** + * Turn an array of strings in the form of "{n,n,n:n...} or an array of + * integers into a bitset. + * + * @param x + * @param allowNull + * @return bitset (or null if fails and allowNull is false) + */ static BS unEscapeBitSetArray(Lst<SV> x, boolean allowNull) { BS bs = new BS(); - for (int i = 0; i < x.size(); i++) - if (!unEscapeBitSet(x.get(i), bs)) - return (allowNull ? null : bs); + for (int i = 0; i < x.size(); i++) { + SV v = x.get(i); + if (v.tok == T.integer && v.intValue >= 0) { + bs.set(v.intValue); + } else if (v.tok == T.varray) { + BS bs2 = unEscapeBitSetArray(v.getList(), true); + if (bs2 == null) + return (allowNull ? null : new BS()); + bs.or(bs2); + } else if (!unEscapeBitSet(v, bs)) { + return (allowNull ? null : new BS()); + } + } return bs; } Modified: trunk/Jmol/src/org/jmol/script/ScriptEval.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEval.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/script/ScriptEval.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -2319,8 +2319,9 @@ case T.quit: // quit this only if it isn't the first command if (chk) break; - if (pc > 0 && theToken.tok == T.exit) + if (pc > 0 && theToken.tok == T.exit && !vwr.autoExit) { vwr.clearScriptQueue(); + } executionStopped = (pc > 0 || !vwr.g.useScriptQueue); break; case T.exitjmol: Modified: trunk/Jmol/src/org/jmol/script/ScriptExpr.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptExpr.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/script/ScriptExpr.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -714,6 +714,7 @@ iToken = 1000; boolean ignoreSubset = (pcStart < 0); boolean isInMath = false; + BS bs; int nExpress = 0; int ac = vwr.ms.ac; int ptWithin = -10; @@ -768,8 +769,13 @@ case T.define: rpn.addXBs(getAtomBitSet(value)); break; + case T.varray: + bs = SV.getBitSet((SV)instruction, false); + if (bs != null) { + rpn.addXBs(bs); + break; + } case T.hash: - case T.varray: // unit ids rpn.addXBs(vwr.ms.getAtoms(T.sequence, ((SV) instruction).asString())); break; @@ -791,7 +797,7 @@ case T.string: String s = (String) value; if (s.indexOf("({") == 0) { - BS bs = BS.unescape(s); + bs = BS.unescape(s); if (bs != null) { rpn.addXBs(bs); break; @@ -871,7 +877,7 @@ // old Chime scripts use *.C for _C int atomID = instruction.intValue; if (atomID > 0) { - BS bs = compareInt(T.atomid, T.opEQ, atomID); + bs = compareInt(T.atomid, T.opEQ, atomID); if (atomID == 2) // *.CA (alpha carbon only) bs.or(compareInt(T.element, T.opEQ, 20)); // CA.CA rpn.addXBs(bs); @@ -1046,7 +1052,7 @@ ret[0] = exp; return null; } - BS bs = (exp instanceof BS ? (BS) exp : new BS()); + bs = (exp instanceof BS ? (BS) exp : new BS()); isBondSet = (exp instanceof BondSet); if (!isBondSet && (bs = vwr.slm.excludeAtoms(bs, ignoreSubset)).length() > vwr.ms.ac) Modified: trunk/Jmol/src/org/jmol/scriptext/IsoExt.java =================================================================== --- trunk/Jmol/src/org/jmol/scriptext/IsoExt.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/scriptext/IsoExt.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -310,8 +310,8 @@ } } String type; - switch(tokAt(i)) { - case T.scale: + switch (tokAt(i)) { + case T.scale: type = ""; break; case T.chemicalshift: @@ -435,6 +435,7 @@ invArg(); } break; + case T.polyhedra: case T.point: case T.polygon: boolean isPoints = (eval.theTok == T.point); @@ -445,10 +446,34 @@ int nTriangles = 0; P3[] points = null; Lst<SV> vpolygons = null; + int[][] polygons = null; if (eval.isArrayParameter(++i)) { - points = eval.getPointArray(i, -1, false); + // draw POLYGON [points] + // draw POLYGON @x where x is [[0,3,4][4,5,6] ...] where numbers are atom indices + points = eval.getPointArray(i, -1, true); + if (points.length > 0 && points[0] == null && eval.tokAt(i) == T.varray) { + Lst<SV> list = vwr.evaluateExpressionAsVariable("{*}.xyz.all") + .getList(); + points = new P3[list.size()]; + for (int vi = points.length; --vi >= 0;) + points[vi] = SV.ptValue(list.get(vi)); + list = ((SV) eval.getToken(i)).getList(); + int[][] faces = AU.newInt2(list.size()); + for (int vi = faces.length; --vi >= 0;) { + Lst<SV> face = list.get(vi).getList(); + if (face != null) { + faces[vi] = new int[face.size()]; + for (int vii = faces[vi].length; --vii >= 0;) + faces[vi][vii] = face.get(vii).intValue; + } + } + polygons = ((MeshCapper) Interface.getInterface( + "org.jmol.util.MeshCapper", vwr, "script")).set(null) + .triangulateFaces(faces, points, null); + } nVertices = points.length; } else { + // draw POLYGON nPoints pt1 pt2 pt3... nVertices = Math.max(0, intParameter(i)); points = new P3[nVertices]; for (int j = 0; j < nVertices; j++) @@ -455,29 +480,33 @@ points[j] = centerParameter(++eval.iToken); } i = eval.iToken; - int[][] polygons = null; switch (tokAt(i + 1)) { case T.matrix3f: case T.matrix4f: + // draw POLYGON <points> [[0,1,2],[1,2,3]...] vpolygons = SV.newT(getToken(++i)).toArray().getList(); nTriangles = vpolygons.size(); break; case T.varray: + // draw POLYGON <points> [[0,1,2],[1,2,3]...] vpolygons = ((SV) getToken(++i)).getList(); nTriangles = vpolygons.size(); break; case T.integer: + // draw POLYGON <points> nTriangles nTriangles = intParameter(++i); if (nTriangles < 0) isPoints = true; break; default: - if (!isPoints && !chk) + // get triangles from a list of points + if (polygons == null && !isPoints && !chk) polygons = ((MeshCapper) Interface.getInterface( "org.jmol.util.MeshCapper", vwr, "script")).set(null) .triangulatePolygon(points, -1); } if (polygons == null && !isPoints) { + // read array of arrays of triangle vertex pointers polygons = AU.newInt2(nTriangles); for (int j = 0; j < nTriangles; j++) { float[] f = (vpolygons == null ? eval.floatParameterSet( Modified: trunk/Jmol/src/org/jmol/scriptext/MathExt.java =================================================================== --- trunk/Jmol/src/org/jmol/scriptext/MathExt.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/scriptext/MathExt.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -1466,6 +1466,15 @@ (isSmiles ? JC.SMILES_TYPE_SMILES : JC.SMILES_TYPE_SMARTS) | JC.SMILES_FIRST_MATCH_ONLY); ret = (map.length > 0 ? vwr.ms.getDihedralMap(map[0]) : new int[0]); + } else if (flags.equalsIgnoreCase("map")) { + int[][] map = vwr.getSmilesMatcher().getCorrelationMaps( + sFind, + vwr.ms.at, + vwr.ms.ac, + bs, + (isSmiles ? JC.SMILES_TYPE_SMILES : JC.SMILES_TYPE_SMARTS) + | JC.SMILES_MAP_UNIQUE); + ret = map; } else if (sFind.equalsIgnoreCase("crystalClass")) { // {*}.find("crystalClass") // {*}.find("crystalClass", pt) Modified: trunk/Jmol/src/org/jmol/smiles/SmilesMatcher.java =================================================================== --- trunk/Jmol/src/org/jmol/smiles/SmilesMatcher.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/smiles/SmilesMatcher.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -482,6 +482,7 @@ search.bsAromatic = bsAromatic; search.setRingData(null, null, is3D || doTestAromatic); search.exitFirstMatch = ((flags & JC.SMILES_FIRST_MATCH_ONLY) == JC.SMILES_FIRST_MATCH_ONLY); + search.mapUnique = ((flags & JC.SMILES_MAP_UNIQUE) == JC.SMILES_MAP_UNIQUE); } switch (mode) { case MODE_BITSET: Modified: trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java =================================================================== --- trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/smiles/SmilesSearch.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -140,10 +140,13 @@ private SmilesBond nestedBond; private Lst<Object> vReturn; + private Lst<BS> uniqueList; private BS bsReturn = new BS(); private BS bsCheck; + public boolean mapUnique; + static final int addFlags(int flags, String strFlags) { if (strFlags.indexOf("OPEN") >= 0) flags |= JC.SMILES_TYPE_OPENSMILES; @@ -484,6 +487,7 @@ */ Object subsearch(SmilesSearch search, int submode) throws InvalidSmilesException { search.ringSets = ringSets; + search.mapUnique = mapUnique; search.targetAtoms = targetAtoms; search.targetAtomCount = targetAtomCount; search.bsSelected = bsSelected; @@ -817,6 +821,15 @@ bsReturn.or(bs); if (getMaps) { + if (mapUnique) { + if (uniqueList == null) + uniqueList = new Lst<BS>(); + for (int j = uniqueList.size(); --j >= 0;) + if (uniqueList.get(j).equals(bs)) + return true; + uniqueList.addLast(bs); + } + // every map is important always -- why?? int[] map = new int[nMatch]; for (int j = 0, nn = 0; j < ac; j++) { Modified: trunk/Jmol/src/org/jmol/util/MeshCapper.java =================================================================== --- trunk/Jmol/src/org/jmol/util/MeshCapper.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/util/MeshCapper.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -111,10 +111,11 @@ * @param faces * array of pointers into points * @param vertices - * @param faceTriangles + * @param faceTriangles optional return list by face * @return array of triangles [a b c mask] */ - public int[][] triangulateFaces(int[][] faces, P3[] vertices, int[][] faceTriangles) { + public int[][] triangulateFaces(int[][] faces, P3[] vertices, + int[][] faceTriangles) { lstTriangles = new Lst<int[]>(); P3[] points = new P3[10]; for (int f = 0, n = faces.length; f < n; f++) { @@ -127,14 +128,16 @@ points[i] = vertices[face[i]]; triangulatePolygon(points, npts); int n1 = lstTriangles.size(); - int[] ft = faceTriangles[f] = new int[n1 - n0]; - for (int i = n0; i < n1; i++) { - int[] t = lstTriangles.get(i); - ft[i - n0] = i; - for (int j = 3; --j >= 0;) - t[j] = face[t[j]]; - t[3] = -t[3]; - } + int[] ft = new int[n1 - n0]; + if (faceTriangles != null) + faceTriangles[f] = ft; + for (int i = n0; i < n1; i++) { + int[] t = lstTriangles.get(i); + ft[i - n0] = i; + for (int j = 3; --j >= 0;) + t[j] = face[t[j]]; + t[3] = -t[3]; + } } int[][] triangles = AU.newInt2(lstTriangles.size()); lstTriangles.toArray(triangles); @@ -158,6 +161,8 @@ nPoints = this.nPoints = (haveList ? nPoints : points.length); CapVertex v0 = null; for (int i = 0; i < nPoints; i++) { + if (points[i] == null) + return null; CapVertex v = new CapVertex(points[i], i); vertices.addLast(v); if (v0 != null) { @@ -875,7 +880,6 @@ while (ok == 0) { ok = 1; Arrays.sort(vs, this); - System.out.println(ok); } for (int i = n; --i >= 0;) { if (vs[i].x == Float.MAX_VALUE) Modified: trunk/Jmol/src/org/jmol/viewer/JC.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/JC.java 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/viewer/JC.java 2017-03-25 16:28:14 UTC (rev 21449) @@ -1113,6 +1113,9 @@ public final static int SMILES_INVERT_STEREOCHEMISTRY = 0x040; //SmilesParser -> SmilesSearch + public static final int SMILES_MAP_UNIQUE = 0x080; //SmilesMatcher return only unique mappings + + /** * AROMATIC_DEFINED draws all aromatic bonds from connection definitions * It is deprecated, because a=a will set it by itself. Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2017-03-10 00:31:44 UTC (rev 21448) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2017-03-25 16:28:14 UTC (rev 21449) @@ -49,14 +49,58 @@ # 10. Run jmol/tools build-release.xml # -Jmol.___JmolVersion="14.10.0-beta-2017-3-8" +Jmol.___JmolVersion="14.10.0-beta-2017-3-25" -bug fix: Polyhedra ID id OFFSET {x y z} broken +new feature: x = {*}.find(smartsString,"map") + -- returns an array of arrays of atom indices (0-based) + -- indicates exact correlation between atoms in {*} and atoms of smartsString + -- only unique sets of atoms are found, not every possibility + -- for example: + + load $caffeine + print {*}.find("*1*****1", "map").format("JSON") -bug fix: ScriptManager debug output being sent even if -i (silent) command line option set. + [ [ 0,2,4,6,11,12 ] ] +new feature: SELECT @x where x is an array of integers or array of array of integers + -- selects atoms from array rather than from a bitset + -- note that variable must be used, as SELECT [1,2,3] would look for PDB group "1,2,3" + -- for example: + + load $caffeine + x = {*}.find("*1*****1", "map")[0] + select @x + + 6 atoms selected + +new feature: DRAW polyhedron @x where x is an array of array of integers + -- draws sets of polygons based on arrays of atom indices + -- for example: + + load $caffeine + draw polyhedra @{{*}.find("*1****1||*1*****1","map")} + new feature: 4-order bond in MOL file using 14 for bond order + -- Jmol extension for MOL file format to allow 4-bond + -- example: [Re2Cl8](2-) + -- see https://en.wikipedia.org/wiki/Quadruple_bond + +new feature: 5-order bond in MOL file using 15 for bond order + -- Jmol extension for MOL file format to allow 5-bond + -- example: [Mo2Cl8](4-) + -- see https://en.wikipedia.org/wiki/Quintuple_bond +new feature: 6-order bond in MOL file using 16 for bond order + -- Jmol extension for MOL file format to allow 6-bond + -- example: Mo2 + -- see https://en.wikipedia.org/wiki/Sextuple_bond + +bug fix: DSSR fix for multi-model PDB file +bug fix: EXIT command with -n command line flag does not exit Jmol +bug fix: echo renderer may not show correct font size +bug fix: POLYHEDRA ID id OFFSET {x y z} broken +bug fix: ScriptManager debug output being sent even if -i (silent) command line option set. + JmolVersion="14.9.1" released 2/19/2017 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |