Revision: 20858 http://sourceforge.net/p/jmol/code/20858 Author: hansonr Date: 2015-11-03 13:43:26 +0000 (Tue, 03 Nov 2015) Log Message: ----------- Jmol.___JmolVersion="14.5.0_2015.11.03"
new feature: x = pointgroup([array of points],center) -- center is optional, defaulting to average of the points -- returns a map: print pointgroup(pts,{1 0 0}) { "C2" : [ {-1.0 -2.647229E-6 0.0} ] "C4" : [ {-1.0 -2.647229E-6 0.0} ] "Cs" : [ {5.9132327E-7 0.70710725 0.70710635} {2.1809963E-7 1.0 7.2699876E-8} {-1.960397E-7 -0.7071069 0.70710665} {7.269983E-8 1.4539965E-7 -1.0} ] "center" : {1.0 0.0 0.0} "detail" : "# 14 atoms;" "distanceTolerance" : 0.2 "linearTolerance" : 8.0 "nAtoms" : 14 "nC2" : 1 "nC4" : 1 "nCi" : 0 "nCn" : 2 "nCs" : 4 "nSn" : 0 "nTotal" : 8 "name" : "C4v" "principalAxis" : {-1.0 -2.647229E-6 0.0} } bug fix: FOR without {} but with ";" after sole statement followed immediately by second FOR improperly loops for (var i from [1,5]) print i; for (var i from [1,5]) print i bug fix: OXT missing from BACKBONE selection bug fix: (JSmol) CIF parser fails to read CIF files containing only a single (non-loop) _struct_ref_seq_dif.align_id new feature: polyhedra ID xxx SCALE x.x -- ID named polyhedra only -- x.x is the scaling factor, initially 1 -- x.x > 0 does normal scaling -- x.x < 0 does "explode" from {0 0 0} (for higher-order Brillouin zones, for instance) bug fix: slabbing should reset area and volume of isosurface bug fix: meshSlicer may fail to add edge to sliced pmesh FEATURE CHANGE: (Application only for now) PDB default for =xxxx -- changed to "pdb", "http://ftp.wwpdb.org/pub/pdb/data/structures/divided/pdb/%c2%c3/pdb%file.ent.gz" -- will be complemented with file.ent for non-binary transfer, but that is not implemented yet at RCSB -- mmCIF counterpart not implemented yet. -- not HTML5 because for that we need the option to remove .gz new feature: set testflag3 TRUE gives random triangle effect to polyhedra new feature: POLYHEDRON ID "xxx" OFFSET {3 3 3} -- allows cartesian offset of named polyhedra bug fix: bug fix: empty format crashes Jmol -- print "testing".format("") bug fix: polyhedron volume will be incorrect if there is a face triangle that has no edges visible (requires a six or more sided face) bug fix: nested if...{...if... } else {...} gives compiler syntax error: if (i=1) { print "i=1" if (j=1) print "j != 1" } else { // } closes if (j=1) instead of if (i=1) { print "i != 1" } Modified Paths: -------------- trunk/Jmol/src/org/jmol/api/SymmetryInterface.java trunk/Jmol/src/org/jmol/modelset/ModelSet.java trunk/Jmol/src/org/jmol/script/T.java trunk/Jmol/src/org/jmol/scriptext/MathExt.java trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java trunk/Jmol/src/org/jmol/symmetry/PointGroup.java trunk/Jmol/src/org/jmol/symmetry/Symmetry.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/api/SymmetryInterface.java =================================================================== --- trunk/Jmol/src/org/jmol/api/SymmetryInterface.java 2015-11-03 12:36:49 UTC (rev 20857) +++ trunk/Jmol/src/org/jmol/api/SymmetryInterface.java 2015-11-03 13:43:26 UTC (rev 20858) @@ -156,10 +156,10 @@ public SymmetryInterface setPointGroup( SymmetryInterface pointGroupPrevious, - T3[] atomset, BS bsAtoms, + T3 center, T3[] atomset, + BS bsAtoms, boolean haveVibration, - float distanceTolerance, - float linearTolerance, boolean localEnvOnly); + float distanceTolerance, float linearTolerance, boolean localEnvOnly); public void setSpaceGroup(boolean doNormalize); Modified: trunk/Jmol/src/org/jmol/modelset/ModelSet.java =================================================================== --- trunk/Jmol/src/org/jmol/modelset/ModelSet.java 2015-11-03 12:36:49 UTC (rev 20857) +++ trunk/Jmol/src/org/jmol/modelset/ModelSet.java 2015-11-03 13:43:26 UTC (rev 20858) @@ -542,9 +542,9 @@ } if (type != null && type.indexOf(":") >= 0) type = type.substring(0, type.indexOf(":")); - pointGroup = symmetry.setPointGroup(pointGroup, pts, bs, haveVibration, - vwr.getFloat(T.pointgroupdistancetolerance), - vwr.getFloat(T.pointgrouplineartolerance), localEnvOnly); + pointGroup = symmetry.setPointGroup(pointGroup, null, pts, bs, + haveVibration, + vwr.getFloat(T.pointgroupdistancetolerance), vwr.getFloat(T.pointgrouplineartolerance), localEnvOnly); if (!isPolyhedron) this.pointGroup = pointGroup; if (!doAll && !asInfo) Modified: trunk/Jmol/src/org/jmol/script/T.java =================================================================== --- trunk/Jmol/src/org/jmol/script/T.java 2015-11-03 12:36:49 UTC (rev 20857) +++ trunk/Jmol/src/org/jmol/script/T.java 2015-11-03 13:43:26 UTC (rev 20858) @@ -702,6 +702,7 @@ public final static int within = 31 | 0 << 9 | mathfunc; public final static int write = 32 | 0 << 9 | mathfunc | scriptCommand; public final static int _ = 33 | 0 << 9 | mathfunc | mathproperty; // same as getProperty + public final static int pointgroup = 34 | 0 << 9 | mathfunc; // xxx(a) @@ -1267,7 +1268,6 @@ public final static int playrev = misc | 274; public final static int planarparam = misc | 275; public final static int pocket = misc | 276; - public final static int pointgroup = misc | 278; public final static int pointsperangstrom = misc | 280; public final static int polygon = misc | 282; public final static int prev = misc | 284; Modified: trunk/Jmol/src/org/jmol/scriptext/MathExt.java =================================================================== --- trunk/Jmol/src/org/jmol/scriptext/MathExt.java 2015-11-03 12:36:49 UTC (rev 20857) +++ trunk/Jmol/src/org/jmol/scriptext/MathExt.java 2015-11-03 13:43:26 UTC (rev 20858) @@ -190,6 +190,8 @@ return evaluateString(mp, op.intValue, args); case T.point: return evaluatePoint(mp, args); + case T.pointgroup: + return evaluatePointGroup(mp, args); case T.prompt: return evaluatePrompt(mp, args); case T.random: @@ -221,6 +223,31 @@ return false; } + @SuppressWarnings("unchecked") + private boolean evaluatePointGroup(ScriptMathProcessor mp, SV[] args) { + // pointGroup(points) + // pointGroup(points, center) + P3 center = null; + T3[] pts; + switch (args.length) { + case 2: + center = SV.ptValue(args[1]); + //$FALL-THROUGH$ + case 1: + Lst<SV> points = args[0].getList(); + pts = new T3[points.size()]; + for (int i = pts.length; --i >= 0;) + pts[i] = SV.ptValue(points.get(i)); + break; + default: + return false; + } + SymmetryInterface pointGroup = vwr.ms.getSymTemp(true).setPointGroup(null, center, pts, + null, false, + vwr.getFloat(T.pointgroupdistancetolerance), vwr.getFloat(T.pointgrouplineartolerance), true); + return mp.addXMap((Map<String, ?>) pointGroup.getPointGroupInfo(-1, false, true, null, 0, 1)); + } + private boolean evaluateUnitCell(ScriptMathProcessor mp, SV[] args) { // optional last parameter: scale // unitcell() Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java 2015-11-03 12:36:49 UTC (rev 20857) +++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java 2015-11-03 13:43:26 UTC (rev 20858) @@ -283,15 +283,15 @@ // first time through includes all atoms as atoms for (int i = pts.length; --i >= 0;) pts[i] = vertices[i]; - pointGroup = vwr.ms.getSymTemp(true).setPointGroup(null, pts, null, - false, vwr.getFloat(T.pointgroupdistancetolerance), - vwr.getFloat(T.pointgrouplineartolerance), true); + pointGroup = vwr.ms.getSymTemp(true).setPointGroup(null, null, pts, + null, false, + vwr.getFloat(T.pointgroupdistancetolerance), vwr.getFloat(T.pointgrouplineartolerance), true); // second time through includes all atoms as points only for (int i = pts.length; --i >= 0;) pts[i] = P3.newP(vertices[i]); - pointGroupFamily = vwr.ms.getSymTemp(true).setPointGroup(null, pts, null, - false, vwr.getFloat(T.pointgroupdistancetolerance), - vwr.getFloat(T.pointgrouplineartolerance), true); + pointGroupFamily = vwr.ms.getSymTemp(true).setPointGroup(null, null, pts, + null, false, + vwr.getFloat(T.pointgroupdistancetolerance), vwr.getFloat(T.pointgrouplineartolerance), true); } return (center == null ? centralAtom : center) + " " + pointGroup.getPointGroupName() + " " + "("+pointGroupFamily.getPointGroupName()+")"; Modified: trunk/Jmol/src/org/jmol/symmetry/PointGroup.java =================================================================== --- trunk/Jmol/src/org/jmol/symmetry/PointGroup.java 2015-11-03 12:36:49 UTC (rev 20857) +++ trunk/Jmol/src/org/jmol/symmetry/PointGroup.java 2015-11-03 13:43:26 UTC (rev 20858) @@ -125,6 +125,7 @@ private final static int c8 = firstProper + 8; private final static int maxAxis = axesMaxN.length; + private boolean isAtoms; String drawInfo; Map<String, Object> info; String textInfo; @@ -143,6 +144,7 @@ private Operation principalAxis; private Operation principalPlane; + String getName() { return name; } @@ -151,7 +153,7 @@ private int centerAtomIndex = -1; private boolean haveInversionCenter; - final private P3 center = new P3(); + private T3 center; private T3[] points; private int[] elements; @@ -166,6 +168,7 @@ /** * * @param pgLast + * @param center TODO * @param atomset * @param bsAtoms * @param haveVibration @@ -175,15 +178,17 @@ * @return a PointGroup */ - static PointGroup getPointGroup(PointGroup pgLast, T3[] atomset, - BS bsAtoms, boolean haveVibration, - float distanceTolerance, - float linearTolerance, boolean localEnvOnly) { + static PointGroup getPointGroup(PointGroup pgLast, T3 center, + T3[] atomset, BS bsAtoms, + boolean haveVibration, + float distanceTolerance, float linearTolerance, boolean localEnvOnly) { PointGroup pg = new PointGroup(); pg.distanceTolerance = distanceTolerance; pg.linearTolerance = linearTolerance; + pg.isAtoms = (bsAtoms != null); pg.bsAtoms = (bsAtoms == null ? BSUtil.newBitSet2(0, atomset.length) : bsAtoms); pg.haveVibration = haveVibration; + pg.center = center; pg.localEnvOnly = localEnvOnly; return (pg.set(pgLast, atomset) ? pg : pgLast); } @@ -388,13 +393,16 @@ private boolean getPointsAndElements(T3[] atomset) { int ac = BSUtil.cardinalityOf(bsAtoms); - if (ac > ATOM_COUNT_MAX) + if (isAtoms && ac > ATOM_COUNT_MAX) return false; points = new P3[ac]; elements = new int[ac]; if (ac == 0) return true; nAtoms = 0; + boolean needCenter = (center == null); + if (needCenter) + center = new P3(); // we optionally include bonding information for (int i = bsAtoms.nextSetBit(0); i >= 0; i = bsAtoms.nextSetBit(i + 1), nAtoms++) { T3 p = points[nAtoms] = atomset[i]; @@ -403,9 +411,11 @@ ((Node) p).getCovalentBondCount())); elements[nAtoms] = ((Node) p).getElementNumber() * bondIndex; } - center.add(points[nAtoms]); + if (needCenter) + center.add(points[nAtoms]); } - center.scale(1f / nAtoms); + if (needCenter) + center.scale(1f / nAtoms); for (int i = nAtoms; --i >= 0;) { float r = center.distance(points[i]); if (r < distanceTolerance) @@ -423,7 +433,7 @@ } } - private boolean checkOperation(Quat q, P3 center, int iOrder) { + private boolean checkOperation(Quat q, T3 center, int iOrder) { P3 pt = new P3(); int nFound = 0; boolean isInversion = (iOrder < firstProper); @@ -682,7 +692,7 @@ return n; } - private boolean checkAxisOrder(int iOrder, V3 v, P3 center) { + private boolean checkAxisOrder(int iOrder, V3 v, T3 center) { switch (iOrder) { case c8: if (nAxes[c3] > 0) Modified: trunk/Jmol/src/org/jmol/symmetry/Symmetry.java =================================================================== --- trunk/Jmol/src/org/jmol/symmetry/Symmetry.java 2015-11-03 12:36:49 UTC (rev 20857) +++ trunk/Jmol/src/org/jmol/symmetry/Symmetry.java 2015-11-03 13:43:26 UTC (rev 20858) @@ -96,14 +96,14 @@ @Override public SymmetryInterface setPointGroup(SymmetryInterface siLast, - T3[] atomset, BS bsAtoms, + T3 center, T3[] atomset, + BS bsAtoms, boolean haveVibration, float distanceTolerance, - float linearTolerance, - boolean localEnvOnly) { + float linearTolerance, boolean localEnvOnly) { pointGroup = PointGroup.getPointGroup(siLast == null ? null - : ((Symmetry) siLast).pointGroup, atomset, bsAtoms, haveVibration, - distanceTolerance, linearTolerance, localEnvOnly); + : ((Symmetry) siLast).pointGroup, center, atomset, bsAtoms, + haveVibration, distanceTolerance, linearTolerance, localEnvOnly); return this; } Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-11-03 12:36:49 UTC (rev 20857) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-11-03 13:43:26 UTC (rev 20858) @@ -64,6 +64,43 @@ Jmol.___JmolVersion="14.5.0_2015.11.03" +new feature: x = pointgroup([array of points],center) + -- center is optional, defaulting to average of the points + -- returns a map: + + print pointgroup(pts,{1 0 0}) + { + "C2" : + [ + {-1.0 -2.647229E-6 0.0} + ] + "C4" : + [ + {-1.0 -2.647229E-6 0.0} + ] + "Cs" : + [ + {5.9132327E-7 0.70710725 0.70710635} + {2.1809963E-7 1.0 7.2699876E-8} + {-1.960397E-7 -0.7071069 0.70710665} + {7.269983E-8 1.4539965E-7 -1.0} + ] + "center" : {1.0 0.0 0.0} + "detail" : "# 14 atoms;" + "distanceTolerance" : 0.2 + "linearTolerance" : 8.0 + "nAtoms" : 14 + "nC2" : 1 + "nC4" : 1 + "nCi" : 0 + "nCn" : 2 + "nCs" : 4 + "nSn" : 0 + "nTotal" : 8 + "name" : "C4v" + "principalAxis" : {-1.0 -2.647229E-6 0.0} + } + bug fix: FOR without {} but with ";" after sole statement followed immediately by second FOR improperly loops for (var i from [1,5]) Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2015-11-03 12:36:49 UTC (rev 20857) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2015-11-03 13:43:26 UTC (rev 20858) @@ -3893,7 +3893,7 @@ * @return String or String[] */ public Object setLoadFormat(String name, char type, boolean withPrefix) { - String format; + String format = null; String f = name.substring(1); switch (type) { case '=': @@ -3910,16 +3910,19 @@ } catch (Exception e) { return name; } + } else { + format = ( + // following is temporary, until issues are resolved for AJAX asych + isJS && g.loadFormat.equals(g.pdbLoadFormat) ? g.pdbLoadFormat0 + : g.loadFormat); } //$FALL-THROUGH$ case '#': // ligand - String s = (type != '=' ? g.pdbLoadLigandFormat - // following is temporary, until issues are resolved for AJAX asych - : isJS && g.loadFormat.equals(g.pdbLoadFormat) ? g.pdbLoadFormat0 - : g.loadFormat); - if (f.indexOf(".") >= 0 && s.equals(g.pdbLoadFormat)) - s = g.pdbLoadFormat0; // older version for =1crn.cif or =1crn.pdb - return g.resolveDataBase(null, f, s); + if (format == null) + format = g.pdbLoadLigandFormat; + if (f.indexOf(".") >= 0 && format.equals(g.pdbLoadFormat)) + format = g.pdbLoadFormat0; // older version for =1crn.cif or =1crn.pdb + return g.resolveDataBase(null, f, format); case '*': // European Bioinformatics Institute int pt = name.lastIndexOf("/"); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits