Revision: 20304 http://sourceforge.net/p/jmol/code/20304 Author: hansonr Date: 2015-02-18 22:39:06 +0000 (Wed, 18 Feb 2015) Log Message: ----------- Jmol.___JmolVersion="14.2.12_2015.02.18b"
bug fix: POV-Ray renderer does not show proper backbone bug fix: POV-Ray renderer with a translucent surface shows bonds that should be hidden JmolVersion="14.2.12_2015.02.16" bug fix: write isosurface "./xxx.jvxl" broken -- concatenates "isosurface" with filename bug fix: write ISOSURFACE by itself broken (similarly for write POINTGROUP and others) bug fix: compare({atomA},{atomsB}) should return standard 4x4 matrix, not one involving a rotation about an atom center (follow-up ROTATESELECTED was broken in 14.2.11_2014.12.17) Modified Paths: -------------- branches/v14_2/Jmol/src/javajs/util/A4.java branches/v14_2/Jmol/src/org/jmol/g3d/Graphics3D.java branches/v14_2/Jmol/src/org/jmol/renderbio/BackboneRenderer.java branches/v14_2/Jmol/src/org/jmol/script/ScriptCompiler.java branches/v14_2/Jmol/src/org/jmol/script/ScriptMathProcessor.java branches/v14_2/Jmol/src/org/jmol/scriptext/CmdExt.java branches/v14_2/Jmol/src/org/jmol/scriptext/MathExt.java branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties branches/v14_2/Jmol/src/org/openscience/jmol/app/jmolpanel/console/AppConsole.java Modified: branches/v14_2/Jmol/src/javajs/util/A4.java =================================================================== --- branches/v14_2/Jmol/src/javajs/util/A4.java 2015-02-18 05:14:51 UTC (rev 20303) +++ branches/v14_2/Jmol/src/javajs/util/A4.java 2015-02-18 22:39:06 UTC (rev 20304) @@ -190,12 +190,12 @@ y = (float) (m02 - m20); z = (float) (m10 - m01); double sin = 0.5 * Math.sqrt(x * x + y * y + z * z); - angle = (float) Math.atan2(sin, cos); - - // no need to normalize - // x /= n; - // y /= n; - // z /= n; + if (sin == 0 && cos == 1) { + x = y = 0; + z = 1; + } else { + angle = (float) Math.atan2(sin, cos); + } } /** Modified: branches/v14_2/Jmol/src/org/jmol/g3d/Graphics3D.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/g3d/Graphics3D.java 2015-02-18 05:14:51 UTC (rev 20303) +++ branches/v14_2/Jmol/src/org/jmol/g3d/Graphics3D.java 2015-02-18 22:39:06 UTC (rev 20304) @@ -392,8 +392,7 @@ } platform.setBackgroundColor(bgcolor); platform.notifyEndOfRendering(); - //setWidthHeight(antialiasEnabled); - currentlyRendering = false; + currentlyRendering = isPass2 = false; } public static void mergeBufferPixel(int[] pbuf, int offset, int argbB, Modified: branches/v14_2/Jmol/src/org/jmol/renderbio/BackboneRenderer.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/renderbio/BackboneRenderer.java 2015-02-18 05:14:51 UTC (rev 20303) +++ branches/v14_2/Jmol/src/org/jmol/renderbio/BackboneRenderer.java 2015-02-18 22:39:06 UTC (rev 20304) @@ -64,11 +64,11 @@ } } - private void drawSegment(Atom atomA, Atom atomB, short colixA, short colixB, float max) { - if (atomA.nBackbonesDisplayed == 0 - || atomB.nBackbonesDisplayed == 0 - || ms.isAtomHidden(atomB.i) - || !isDataFrame && atomA.distanceSquared(atomB) > max) + private void drawSegment(Atom atomA, Atom atomB, short colixA, short colixB, + float max) { + if (atomA.nBackbonesDisplayed == 0 || atomB.nBackbonesDisplayed == 0 + || ms.isAtomHidden(atomB.i) || !isDataFrame + && atomA.distanceSquared(atomB) > max) return; colixA = C.getColixInherited(colixA, atomA.colixAtom); colixB = C.getColixInherited(colixB, atomB.colixAtom); @@ -82,8 +82,8 @@ if (mad < 0) { g3d.drawLine(colixA, colixB, xA, yA, zA, xB, yB, zB); } else { - int width = (int) (exportType == GData.EXPORT_CARTESIAN ? mad : vwr - .tm.scaleToScreen((zA + zB) / 2, mad)); + int width = (int) (isExport ? mad : vwr.tm.scaleToScreen((zA + zB) / 2, + mad)); g3d.fillCylinderXYZ(colixA, colixB, GData.ENDCAPS_SPHERICAL, width, xA, yA, zA, xB, yB, zB); } Modified: branches/v14_2/Jmol/src/org/jmol/script/ScriptCompiler.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/script/ScriptCompiler.java 2015-02-18 05:14:51 UTC (rev 20303) +++ branches/v14_2/Jmol/src/org/jmol/script/ScriptCompiler.java 2015-02-18 22:39:06 UTC (rev 20304) @@ -1158,7 +1158,7 @@ if (lookingAtImpliedString(true, true, true)) { int pt = cchToken; String str = script.substring(ichToken, ichToken + cchToken); - if (str.indexOf(" ") < 0) { + if (str.indexOf(" ") < 0 && str.indexOf(".") >= 0) { addTokenToPrefix(T.o(T.string, str)); iHaveQuotedString = true; return CONTINUE; Modified: branches/v14_2/Jmol/src/org/jmol/script/ScriptMathProcessor.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2015-02-18 05:14:51 UTC (rev 20303) +++ branches/v14_2/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2015-02-18 22:39:06 UTC (rev 20304) @@ -1060,6 +1060,7 @@ @SuppressWarnings("unchecked") public boolean binaryOp(T op, SV x1, SV x2) throws ScriptException { + // chk only does not get here P3 pt; P4 pt4; M3 m; @@ -1254,8 +1255,8 @@ addXFloat(x1.asFloat() * x2.asFloat()) : addXInt(x1.asInt() * x2.asInt())); } - pt = (x1.tok == T.matrix3f ? ptValue(x2, false) - : x2.tok == T.matrix3f ? ptValue(x1, false) : null); + pt = (x1.tok == T.matrix3f ? ptValue(x2) + : x2.tok == T.matrix3f ? ptValue(x1) : null); pt4 = (x1.tok == T.matrix4f ? planeValue(x2) : x2.tok == T.matrix4f ? planeValue(x1) : null); // checking here to make sure arrays remain arrays and @@ -1546,7 +1547,7 @@ .lastIndexOf("-") > 0)); } - public P3 ptValue(SV x, boolean allowFloat) throws ScriptException { + public P3 ptValue(SV x) throws ScriptException { Object pt; if (chk) return new P3(); @@ -1554,7 +1555,10 @@ case T.point3f: return (P3) x.value; case T.bitset: - return (P3) eval.getBitsetProperty(SV.bsSelectVar(x), T.xyz, null, null, + BS bs = SV.bsSelectVar(x); + if (bs.nextSetBit(0) < 0) + break; + return (P3) eval.getBitsetProperty(bs, T.xyz, null, null, x.value, null, false, Integer.MAX_VALUE, false); case T.string: pt = Escape.uP(SV.sValue(x)); @@ -1562,19 +1566,15 @@ return (P3) pt; break; case T.varray: - pt = Escape.uP("{" + SV.sValue(x).replace(']',' ').replace('[',' ') + "}"); if (pt instanceof P3) return (P3) pt; break; } - if (!allowFloat) - return null; - float f = SV.fValue(x); - return P3.new3(f, f, f); + return null; } - public P4 planeValue(T x) { + public P4 planeValue(SV x) { if (chk) return new P4(); switch (x.tok) { Modified: branches/v14_2/Jmol/src/org/jmol/scriptext/CmdExt.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/scriptext/CmdExt.java 2015-02-18 05:14:51 UTC (rev 20303) +++ branches/v14_2/Jmol/src/org/jmol/scriptext/CmdExt.java 2015-02-18 22:39:06 UTC (rev 20304) @@ -3168,19 +3168,6 @@ case T.identifier: case T.string: fileName = SV.sValue(tokenAt(pt, args)); - if (pt == argCount - 3 && tokAtArray(pt + 1, args) == T.per) { - // write filename.xxx gets separated as filename .spt - // write isosurface filename.xxx also - fileName += "." + SV.sValue(tokenAt(pt + 2, args)); - } - if (type != "VAR" && pt == pt0 && !isCoord) - type = "IMAGE"; - else if (fileName.length() > 0 && fileName.charAt(0) == '.' - && (pt == pt0 + 1 || pt == pt0 + 2)) { - fileName = SV.sValue(tokenAt(pt - 1, args)) + fileName; - if (type != "VAR" && pt == pt0 + 1) - type = "IMAGE"; - } if (fileName.equalsIgnoreCase("clipboard") || !vwr.haveAccess(ACCESS.ALL)) fileName = null; Modified: branches/v14_2/Jmol/src/org/jmol/scriptext/MathExt.java =================================================================== --- branches/v14_2/Jmol/src/org/jmol/scriptext/MathExt.java 2015-02-18 05:14:51 UTC (rev 20303) +++ branches/v14_2/Jmol/src/org/jmol/scriptext/MathExt.java 2015-02-18 22:39:06 UTC (rev 20304) @@ -138,10 +138,11 @@ return evaluateCross(mp, args); case T.data: return evaluateData(mp, args); + case T.dot: + return evaluateDotDist(mp, args, 0); case T.distance: - case T.dot: if (op.tok == T.propselector) - return evaluateDot(mp, args, tok, op.intValue); + return evaluateDotDist(mp, args, op.intValue); //$FALL-THROUGH$ case T.angle: case T.measure: @@ -401,7 +402,8 @@ } catch (Exception ex) { e.evalError(ex.getMessage(), null); } - float[] data = e.getSmilesExt().getFlexFitList(bs1, bs2, smiles1, !isSmiles); + float[] data = e.getSmilesExt().getFlexFitList(bs1, bs2, smiles1, + !isSmiles); return (data == null ? mp.addXStr("") : mp.addXAF(data)); } try { @@ -411,23 +413,24 @@ if (bs1 == null && bs2 == null) return mp.addXStr(vwr.getSmilesMatcher() .getRelationship(smiles1, smiles2).toUpperCase()); - String mf1 = (bs1 == null ? vwr.getSmilesMatcher() - .getMolecularFormula(smiles1, false) : JmolMolecule - .getMolecularFormula(vwr.ms.at, bs1, false, null, false)); - String mf2 = (bs2 == null ? vwr.getSmilesMatcher() - .getMolecularFormula(smiles2, false) : JmolMolecule - .getMolecularFormula(vwr.ms.at, bs2, false, null, false)); + String mf1 = (bs1 == null ? vwr.getSmilesMatcher().getMolecularFormula( + smiles1, false) : JmolMolecule.getMolecularFormula(vwr.ms.at, bs1, + false, null, false)); + String mf2 = (bs2 == null ? vwr.getSmilesMatcher().getMolecularFormula( + smiles2, false) : JmolMolecule.getMolecularFormula(vwr.ms.at, bs2, + false, null, false)); if (!mf1.equals(mf2)) return mp.addXStr("NONE"); if (bs1 != null) - smiles1 = (String) e.getSmilesExt().getSmilesMatches("", null, bs1, null, false, true); + smiles1 = (String) e.getSmilesExt().getSmilesMatches("", null, bs1, + null, false, true); boolean check; if (bs2 == null) { // note: find smiles1 IN smiles2 here check = (vwr.getSmilesMatcher().areEqual(smiles2, smiles1) > 0); } else { - check = (((BS) e.getSmilesExt().getSmilesMatches(smiles1, null, bs2, null, false, true)) - .nextSetBit(0) >= 0); + check = (((BS) e.getSmilesExt().getSmilesMatches(smiles1, null, bs2, + null, false, true)).nextSetBit(0) >= 0); } if (!check) { // MF matched, but didn't match SMILES @@ -441,19 +444,19 @@ if (bs2 == null) { check = (vwr.getSmilesMatcher().areEqual(smiles1, smiles2) > 0); } else { - check = (((BS) e.getSmilesExt().getSmilesMatches(smiles1, null, bs2, null, - false, true)).nextSetBit(0) >= 0); + check = (((BS) e.getSmilesExt().getSmilesMatches(smiles1, null, + bs2, null, false, true)).nextSetBit(0) >= 0); } if (check) return mp.addXStr("ENANTIOMERS"); } // remove all stereochemistry from SMILES string if (bs2 == null) { - check = (vwr.getSmilesMatcher().areEqual( - "/nostereo/" + smiles2, smiles1) > 0); + check = (vwr.getSmilesMatcher().areEqual("/nostereo/" + smiles2, + smiles1) > 0); } else { - Object ret = e.getSmilesExt().getSmilesMatches("/nostereo/" + smiles1, null, bs2, - null, false, true); + Object ret = e.getSmilesExt().getSmilesMatches( + "/nostereo/" + smiles1, null, bs2, null, false, true); check = (((BS) ret).nextSetBit(0) >= 0); } if (check) @@ -465,8 +468,8 @@ //identical or conformational if (bs1 == null || bs2 == null) return mp.addXStr("IDENTICAL"); - stddev = e.getSmilesExt().getSmilesCorrelation(bs1, bs2, smiles1, null, null, null, - null, false, false, null, null, false, false); + stddev = e.getSmilesExt().getSmilesCorrelation(bs1, bs2, smiles1, null, + null, null, null, false, false, null, null, false, false); return mp.addXStr(stddev < 0.2f ? "IDENTICAL" : "IDENTICAL or CONFORMATIONAL ISOMERS (RMSD=" + stddev + ")"); } else if (isSmiles) { @@ -484,19 +487,18 @@ boolean bestMap = (("best".equals(sOpt) || "bestH".equals(sOpt))); if (sOpt == null || hMaps || allMaps || bestMap) { // with explicitH we set to find only the first match. - if (isMap || isSmiles) { - sOpt = "/noaromatic" - + (allMaps || bestMap ? "/" : " nostereo/") - + e.getSmilesExt().getSmilesMatches((hMaps ? "H" : ""), null, bs1, null, false, - true); - } else { + if (!isMap && !isSmiles) return false; - } + sOpt = "/noaromatic" + + (allMaps || bestMap ? "/" : " nostereo/") + + e.getSmilesExt().getSmilesMatches((hMaps ? "H" : ""), null, + bs1, null, false, true); } else { allMaps = true; } - stddev = e.getSmilesExt().getSmilesCorrelation(bs1, bs2, sOpt, ptsA, ptsB, m, null, - !isSmiles, isMap, null, null, !allMaps && !bestMap, bestMap); + stddev = e.getSmilesExt().getSmilesCorrelation(bs1, bs2, sOpt, ptsA, + ptsB, m, null, !isSmiles, isMap, null, null, !allMaps && !bestMap, + bestMap); if (isMap) { int nAtoms = ptsA.size(); if (nAtoms == 0) @@ -510,9 +512,8 @@ a[j] = new int[] { ((Atom) ptsA.get(j)).i, ((Atom) ptsB.get(pt)).i }; } - if (!allMaps) - return (ret.size() > 0 ? mp.addXAII(ret.get(0)) : mp.addXStr("")); - return mp.addXList(ret); + return (allMaps ? mp.addXList(ret) : ret.size() > 0 ? mp.addXAII(ret + .get(0)) : mp.addXStr("")); } } else { ptsA = e.getPointVector(args[0], 0); @@ -738,25 +739,69 @@ // {selected atoms} XYZ, MOL, PDB file format return mp.addXStr(vwr.getData(selected, type)); } + + + /** + * x = y.distance({atoms}) the average distance from elements of y to the + * CENTER of {atoms} + * + * x = {atomset1}.distance.min({atomset2}, asAtomSet) If asAtomSet is true, + * returns the closest atom in atomset1 to any atom of atomset2; if false or + * omitted, returns an array listing the distance of each atom in atomset1 to + * the closest atom in atomset2. This array can be used to assign properties + * to atomset1: {1.1}.property_d = {1.1}.distance.min({2.1}); color {1.1} + * property_d. + * + * x = {atomset1}.distance.min({point}, asAtomSet) If asAtomSet is true, + * returns the atom in atomset1 closest to the specified point;if false or + * omitted, returns the closest distance to the specified point from any atom + * in atomset1. + * + * x = {atomset1}.distance.min({atomset2}).min returns the shortest distance + * from any atom in atomset1 to any atom in atomset2. + * + * x = {atomset1}.distance.max({atomset2}, asAtomSet) If asAtomSet is true, + * returns the furthest atom in atomset1 to any atom of atomset2; if false or + * omitted, returns an array listing the distance of each atom in atomset1 to + * the furthest atom in atomset2. + * + * x = {atomset1}.distance.max({point}, asAtomSet) If asAtomSet is true, + * returns the atom in atomset1 furthest from the specified point;if false or + * omitted, returns the furthest distance to the specified point from any atom + * in atomset1. + * + * x = {atomset1}.distance.max({atomset2}).max returns the furthest distance + * from any atom in atomset1 to any atom in atomset2. + * + * x = {atomset1}.distance.all({atomset2}) returns an array or array of arrays of values + * + * @param mp + * @param args + * @param intValue optional .min .max + * @return true if successful + * @throws ScriptException + */ - private boolean evaluateDot(ScriptMathProcessor mp, SV[] args, int tok, - int intValue) throws ScriptException { + private boolean evaluateDotDist(ScriptMathProcessor mp, SV[] args, + int intValue) throws ScriptException { // distance and dot + + boolean isDist = (intValue != 0); switch (args.length) { case 1: - if (tok == T.dot) - return false; + break; + case 2: + if (isDist) + break; //$FALL-THROUGH$ - case 2: - break; default: return false; } SV x1 = mp.getX(); SV x2 = args[0]; - P3 pt2 = (x2.tok == T.varray ? null : mp.ptValue(x2, false)); + P3 pt2 = (x2.tok == T.varray ? null : mp.ptValue(x2)); P4 plane2 = mp.planeValue(x2); - if (tok == T.distance) { + if (isDist) { int minMax = intValue & T.minmaxmask; boolean isMinMax = (minMax == T.min || minMax == T.max); boolean isAll = minMax == T.minmaxmask; @@ -808,9 +853,8 @@ float[] data = new float[bs.cardinality()]; for (int i = bs.nextSetBit(0), p = 0; i >= 0; i = bs .nextSetBit(i + 1)) - data[p++] = ((Float) e.getBitsetProperty(bs2, intValue, - atoms[i], plane2, x1.value, null, false, x1.index, false)) - .floatValue(); + data[p++] = ((Float) e.getBitsetProperty(bs2, intValue, atoms[i], + plane2, x1.value, null, false, x1.index, false)).floatValue(); return mp.addXAF(data); } return mp.addXObj(e.getBitsetProperty(bs, intValue, pt2, plane2, @@ -818,7 +862,32 @@ } } } - return mp.addXFloat(getDistance(mp, x1, x2, tok)); + P3 pt1 = mp.ptValue(x1); + P4 plane1 = mp.planeValue(x1); + float f = Float.NaN; + try { + if (isDist) { + f = (plane1 == null ? (plane2 == null ? pt2.distance(pt1) : Measure + .distanceToPlane(plane2, pt1)) : Measure.distanceToPlane(plane1, + pt2)); + } else { + if (plane1 != null && plane2 != null) { + // q1.dot(q2) assume quaternions + f = plane1.x * plane2.x + plane1.y * plane2.y + plane1.z * plane2.z + + plane1.w * plane2.w; + // plane.dot(point) = + } else { + if (plane1 != null) + pt1 = P3.new3(plane1.x, plane1.y, plane1.z); + // point.dot(plane) + else if (plane2 != null) + pt2 = P3.new3(plane2.x, plane2.y, plane2.z); + f = pt1.dot(pt2); + } + } + } catch (Exception e) { + } + return mp.addXFloat(f); } private boolean evaluateHelix(ScriptMathProcessor mp, SV[] args) @@ -836,9 +905,9 @@ int tok = T.getTokFromName(type); if (args.length > 2) { // helix(pt1, pt2, dq ...) - P3 pta = mp.ptValue(args[0], true); - P3 ptb = mp.ptValue(args[1], true); - if (tok == T.nada || args[2].tok != T.point4f) + P3 pta = mp.ptValue(args[0]); + P3 ptb = mp.ptValue(args[1]); + if (tok == T.nada || args[2].tok != T.point4f || pta == null || ptb == null) return false; Quat dq = Quat.newP4((P4) args[2].value); T3[] data = Measure.computeHelicalAxis(pta, ptb, dq); @@ -884,7 +953,8 @@ // {*}.find("CF",true|false) // {*}.find("MF") // {*}.find("MF", "C2H4") - // {*}.find("SEQENCE") + // {*}.find("SEQUENCE") + // "AVA".find("SEQUENCE") // {*}.find("SMARTS", "CCCC") // "CCCC".find("SMARTS", "CC") // "CCCC".find("SMILES", "MF") @@ -1058,6 +1128,7 @@ propertyValue = new BS[] { (BS) propertyValue, SV.bsSelectVar(args[pt]) }; break; + case T.hash: case T.string: if (vwr.checkPropertyParameter(propertyName)) propertyValue = args[pt++].value; @@ -1546,8 +1617,10 @@ return false; } P3[] pts = new P3[nPoints]; - for (int i = 0; i < nPoints; i++) - pts[i] = mp.ptValue(args[i], true); + for (int i = 0; i < nPoints; i++) { + if ((pts[i] = mp.ptValue(args[i])) == null) + return false; + } switch (nPoints) { case 2: return mp.addXFloat(pts[0].distance(pts[1])); @@ -1637,7 +1710,7 @@ return mp.addXStr(""); return mp.addXList(list); } - pt2 = mp.ptValue(args[0], false); + pt2 = mp.ptValue(args[0]); if (pt2 == null) return mp.addXStr(""); return mp.addXPt(Measure.getIntersection(pt2, null, plane, pt3, norm, @@ -1652,8 +1725,8 @@ return mp.addXPt4(e.getHklPlane(P3.new3(SV.fValue(args[0]), SV.fValue(args[1]), SV.fValue(args[2])))); case T.intersection: - pt1 = mp.ptValue(args[0], false); - pt2 = mp.ptValue(args[1], false); + pt1 = mp.ptValue(args[0]); + pt2 = mp.ptValue(args[1]); if (pt1 == null || pt2 == null) return mp.addXStr(""); V3 vLine = V3.newV(pt2); @@ -1669,7 +1742,7 @@ return mp.addXStr(""); return mp.addXPt(pt1); } - pt3 = mp.ptValue(args[2], false); + pt3 = mp.ptValue(args[2]); if (pt3 == null) return mp.addXStr(""); // intersection(ptLine, vLine, pt2); @@ -1704,13 +1777,13 @@ break; case T.bitset: case T.point3f: - pt1 = mp.ptValue(args[0], false); - pt2 = mp.ptValue(args[1], false); + pt1 = mp.ptValue(args[0]); + pt2 = mp.ptValue(args[1]); if (pt2 == null) return false; pt3 = (args.length > 2 && (args[2].tok == T.bitset || args[2].tok == T.point3f) ? mp - .ptValue(args[2], false) : null); + .ptValue(args[2]) : null); norm = V3.newV(pt2); if (pt3 == null) { plane = new P4(); @@ -1737,8 +1810,11 @@ // plane(<point1>,<point2>,<point3>) // plane(<point1>,<point2>,<point3>,<pointref>) V3 vAB = new V3(); + P3 ptref = (args.length == 4 ? mp.ptValue(args[3]) : null); + if (ptref == null) + return false; float nd = Measure.getDirectedNormalThroughPoints(pt1, pt2, pt3, - (args.length == 4 ? mp.ptValue(args[3], true) : null), norm, vAB); + ptref, norm, vAB); return mp.addXPt4(P4.new4(norm.x, norm.y, norm.z, nd)); } } @@ -1858,7 +1934,7 @@ && (args[1].tok == T.integer || args[1].tok == T.bitset)) break; } - if ((pt0 = mp.ptValue(args[0], false)) == null || tok != T.quaternion + if ((pt0 = mp.ptValue(args[0])) == null || tok != T.quaternion && args[1].tok == T.point3f) return false; break; @@ -1930,7 +2006,7 @@ break; } } - P3 pt1 = mp.ptValue(args[1], false); + P3 pt1 = mp.ptValue(args[1]); p4 = mp.planeValue(args[0]); if (pt1 != null) q = Quat.getQuaternionFrame(P3.new3(0, 0, 0), pt0, pt1); @@ -2270,8 +2346,26 @@ private boolean evaluateSymop(ScriptMathProcessor mp, SV[] args, boolean haveBitSet) throws ScriptException { - // {xxx}.symop() - // symop({xxx} + + // x = y.symop(op,atomOrPoint) + // Returns the point that is the result of the transformation of atomOrPoint + // via a crystallographic symmetry operation. The atom set y selects the unit + // cell and spacegroup to be used. If only one model is present, this can simply be all. + // Otherwise, it could be any atom or group of atoms from any model, for example + // {*/1.2} or {atomno=1}. The first parameter, op, is a symmetry operation. + // This can be the 1-based index of a symmetry operation in a file (use show spacegroup to get this listing) + // or a specific Jones-Faithful expression in quotes such as "x,1/2-y,z". + // + // x = y.symop(op,"label") + // This form of the .symop() function returns a set of draw commands that describe + // the symmetry operation in terms of rotation axes, inversion centers, planes, and + // translational vectors. The draw objects will all have IDs starting with whatever + // is given for the label. + // + // x = symop("x,y,-z") + // x = symop(3) + + if (args.length == 0) return false; SV x1 = (haveBitSet ? mp.getX() : null); @@ -2291,14 +2385,14 @@ xyz = null; } int iOp = (xyz == null ? args[0].asInt() : 0); - P3 pt = (args.length > 1 ? mp.ptValue(args[1], true) : null); - if (args.length == 2 && !Float.isNaN(pt.x)) + P3 pt = (args.length > 1 ? mp.ptValue(args[1]) : null); + if (args.length == 2 && pt != null) return mp.addXObj(vwr.ms.getSymTemp(false).getSymmetryInfoAtom(vwr.ms, bs, xyz, iOp, pt, null, null, T.point)); - String desc = (args.length == 1 ? "" : SV.sValue(args[args.length - 1])) + String desc = (args.length == 1 ? "matrix" : SV.sValue(args[args.length - 1])) .toLowerCase(); int tok = T.draw; - if (args.length == 1 || desc.equalsIgnoreCase("matrix")) { + if (desc.equalsIgnoreCase("matrix")) { tok = T.matrix4f; } else if (desc.equalsIgnoreCase("array") || desc.equalsIgnoreCase("list")) { tok = T.list; @@ -2558,7 +2652,7 @@ private BS getAtomsNearSurface(float distance, String surfaceId) { Object[] data = new Object[] { surfaceId, null, null }; if (e.getShapePropertyData(JC.SHAPE_ISOSURFACE, "getVertices", data)) - return vwr.ms.getAtomsNearPts(distance, (T3[]) data[1], (BS) data[2]); + return getAtomsNearPts(distance, (T3[]) data[1], (BS) data[2]); data[1] = Integer.valueOf(0); data[2] = Integer.valueOf(-1); if (e.getShapePropertyData(JC.SHAPE_DRAW, "getCenter", data)) @@ -2566,32 +2660,26 @@ return new BS(); } - private float getDistance(ScriptMathProcessor mp, SV x1, SV x2, int tok) - throws ScriptException { - P3 pt1 = mp.ptValue(x1, true); - P4 plane1 = mp.planeValue(x1); - P3 pt2 = mp.ptValue(x2, true); - P4 plane2 = mp.planeValue(x2); - if (tok == T.dot) { - if (plane1 != null && plane2 != null) - // q1.dot(q2) assume quaternions - return plane1.x * plane2.x + plane1.y * plane2.y + plane1.z * plane2.z - + plane1.w * plane2.w; - // plane.dot(point) = - if (plane1 != null) - pt1 = P3.new3(plane1.x, plane1.y, plane1.z); - // point.dot(plane) - if (plane2 != null) - pt2 = P3.new3(plane2.x, plane2.y, plane2.z); - return pt1.x * pt2.x + pt1.y * pt2.y + pt1.z * pt2.z; + private BS getAtomsNearPts(float distance, T3[] points, BS bsInclude) { + BS bsResult = new BS(); + if (points.length == 0 || bsInclude != null && bsInclude.cardinality() == 0) + return bsResult; + if (bsInclude == null) + bsInclude = BSUtil.setAll(points.length); + Atom[] at = vwr.ms.at; + for (int i = vwr.ms.ac; --i >= 0;) { + Atom atom = at[i]; + for (int j = bsInclude.nextSetBit(0); j >= 0; j = bsInclude + .nextSetBit(j + 1)) + if (atom.distance(points[j]) < distance) { + bsResult.set(i); + break; + } } - - if (plane1 == null) - return (plane2 == null ? pt2.distance(pt1) : Measure.distanceToPlane( - plane2, pt1)); - return Measure.distanceToPlane(plane1, pt2); + return bsResult; } + @Override @SuppressWarnings("unchecked") public Object getMinMax(Object floatOrSVArray, int tok) { Modified: branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties 2015-02-18 05:14:51 UTC (rev 20303) +++ branches/v14_2/Jmol/src/org/jmol/viewer/Jmol.properties 2015-02-18 22:39:06 UTC (rev 20304) @@ -5,8 +5,16 @@ # THIS IS THE RELEASE BRANCH # BUG FIXES ONLY, PLEASE -Jmol.___JmolVersion="14.2.12_2015.02.14" +Jmol.___JmolVersion="14.2.12_2015.02.18b" +bug fix: POV-Ray renderer does not show proper backbone +bug fix: POV-Ray renderer with a translucent surface shows bonds that should be hidden + +JmolVersion="14.2.12_2015.02.16" + +bug fix: write isosurface "./xxx.jvxl" broken -- concatenates "isosurface" with filename +bug fix: write ISOSURFACE by itself broken (similarly for write POINTGROUP and others) + bug fix: compare({atomA},{atomsB}) should return standard 4x4 matrix, not one involving a rotation about an atom center (follow-up ROTATESELECTED was broken in 14.2.11_2014.12.17) Modified: branches/v14_2/Jmol/src/org/openscience/jmol/app/jmolpanel/console/AppConsole.java =================================================================== --- branches/v14_2/Jmol/src/org/openscience/jmol/app/jmolpanel/console/AppConsole.java 2015-02-18 05:14:51 UTC (rev 20303) +++ branches/v14_2/Jmol/src/org/openscience/jmol/app/jmolpanel/console/AppConsole.java 2015-02-18 22:39:06 UTC (rev 20304) @@ -877,7 +877,7 @@ pt = caretPosition.getOffset(); consoleTextPane.setCaretPosition(pt); - vBar.setValue(Integer.MAX_VALUE); + vBar.setValue(vBar.getMaximum()); } catch (Exception e) { e.printStackTrace(); consoleTextPane.setCaretPosition(getLength()); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server from Actuate! Instantly Supercharge Your Business Reports and Dashboards with Interactivity, Sharing, Native Excel Exports, App Integration & more Get technology previously reserved for billion-dollar corporations, FREE http://pubads.g.doubleclick.net/gampad/clk?id=190641631&iu=/4140/ostg.clktrk _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits