Revision: 20583 http://sourceforge.net/p/jmol/code/20583 Author: hansonr Date: 2015-06-17 00:42:50 +0000 (Wed, 17 Jun 2015) Log Message: ----------- Jmol.___JmolVersion="14.3.15_2015.06.16b"
bug fix: ++x and x++ do not increment properly when in expressions // no problem here because it is compiled as "x = x + 1" x = 0 x++ print "x should be 1 " + x // x does not increment, but the test passes x = 0 if (++x) { print "good" } print "x should be 1 " + x // x does not increment, but the test passes ("bad" is not printed) x = 0 if (x++) { print "bad" } print "x should be 1 " + x x = 0 // works x++ // y is OK, but x does not increment y = x++ print "x should be 2 " + x x = 0 // z is OK, but x does not increment z = ++x print "x should be 1 " + x // result: x should be 1 1 good x should be 1 0 x should be 1 0 x should be 2 1 x should be 1 0 Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/aflow/AFLOWReader.java trunk/Jmol/src/org/jmol/script/SV.java trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/adapter/readers/aflow/AFLOWReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/aflow/AFLOWReader.java 2015-06-16 22:16:37 UTC (rev 20582) +++ trunk/Jmol/src/org/jmol/adapter/readers/aflow/AFLOWReader.java 2015-06-17 00:42:50 UTC (rev 20583) @@ -113,7 +113,7 @@ protected void initializeReader() throws Exception { readPRE = checkFilterKey("PRE"); // readPOST = !checkFilterKey("NOPOST"); - forcePacked = !checkFilterKey("NOPACK"); +// forcePacked = !checkFilterKey("NOPACK"); String s; Modified: trunk/Jmol/src/org/jmol/script/SV.java =================================================================== --- trunk/Jmol/src/org/jmol/script/SV.java 2015-06-16 22:16:37 UTC (rev 20582) +++ trunk/Jmol/src/org/jmol/script/SV.java 2015-06-17 00:42:50 UTC (rev 20583) @@ -70,10 +70,9 @@ public int index = Integer.MAX_VALUE; - private final static int FLAG_CANINCREMENT = 1; private final static int FLAG_MODIFIED = 2; - private int flags = ~FLAG_CANINCREMENT & FLAG_MODIFIED; + private int flags = FLAG_MODIFIED; public String myName; public static SV newV(int tok, Object value) { @@ -405,7 +404,6 @@ public SV setName(String name) { this.myName = name; - flags |= FLAG_CANINCREMENT; //System.out.println("Variable: " + name + " " + intValue + " " + value); return this; } @@ -422,23 +420,26 @@ } boolean canIncrement() { - return true;//tokAttr(flags, FLAG_CANINCREMENT); + switch (tok) { + case integer: + case decimal: + return true;//tokAttr(flags, FLAG_CANINCREMENT); + default: + return false; + } } boolean increment(int n) { - if (!canIncrement()) - return false; switch (tok) { case integer: intValue += n; - break; + return true; case decimal: value = Float.valueOf(((Float) value).floatValue() + n); - break; + return true; default: return false; } - return true; } public boolean asBoolean() { Modified: trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2015-06-16 22:16:37 UTC (rev 20582) +++ trunk/Jmol/src/org/jmol/script/ScriptMathProcessor.java 2015-06-17 00:42:50 UTC (rev 20583) @@ -881,7 +881,20 @@ && oStack[oPt] == null)) return true; - SV x2 = getX(); + SV x2; + switch (op.tok) { + case T.minusMinus: + case T.plusPlus: + if (xPt >= 0 && xStack[xPt].canIncrement()) { + x2 = xStack[xPt--]; + wasX = false; + break; + } + //$FALL-THROUGH$ + default: + x2 = getX(); + break; + } if (x2 == T.tokenArrayOpen) return false; @@ -892,6 +905,7 @@ switch (op.tok) { case T.minusMinus: case T.plusPlus: + // we are looking out for an array selection here x1 = x2; if (!chk) { //System.out.println("ptx="+ ptx + " " + pto); Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-06-16 22:16:37 UTC (rev 20582) +++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedra.java 2015-06-17 00:42:50 UTC (rev 20583) @@ -509,10 +509,11 @@ int nother1 = iCenter - 1; int nother2 = iCenter - 2; + boolean isComplex = (nother1 > 6); // for many-vertex polygons we reduce the distance allowed to avoid through-polyhedron faces float factor = (!Float.isNaN(distanceFactor) ? distanceFactor - : nother1 <= 6 ? DEFAULT_DISTANCE_FACTOR - : DEFAULT_MANY_VERTEX_DISTANCE_FACTOR); + //: isComplex ? DEFAULT_MANY_VERTEX_DISTANCE_FACTOR + : DEFAULT_DISTANCE_FACTOR); BS bs = BS.newN(iCenter); boolean isOK = (dAverage == 0); @@ -543,7 +544,7 @@ if (Logger.debugging) { Logger.debug("Polyhedra distanceFactor for " + iCenter + " atoms increased to " + factor + " in order to include " - + ((Atom) otherAtoms[i]).getInfo()); + + otherAtoms[i] ); } break; } @@ -592,7 +593,7 @@ BS bsTemp = Normix.newVertexBitSet(); short[] n = normixesT; Map<Integer,String> htNormMap = new Hashtable<Integer, String>(); - boolean doCheckPlane = (nother1 > 5); + boolean doCheckPlane = isComplex; for (int i = 0; i < nother2; i++) for (int j = i + 1; j < nother1; j++) { if (points[i].distance(points[j]) > distMax) @@ -678,6 +679,7 @@ } } nPoints--; + if (Logger.debugging) { Logger .info("Polyhedron planeCount=" + planeCount + " nPoints=" + nPoints); @@ -728,7 +730,28 @@ private boolean checkPlane(P3[] points, int ptCenter, int[][] planes, short[] normals, int index, P4 plane, V3 vNorm, Map<Integer, String> htNormMap) { + int[] p1 = planes[index]; + + + // Check here for a 3D convex hull: + plane = Measure.getPlaneThroughPoints(points[p1[0]], points[p1[1]], + points[p1[2]], vNorm, vAB, plane); +// P3 ptest = P3.newP(points[p1[0]]); +// ptest.add(points[p1[1]]); +// ptest.add(points[p1[2]]); +// ptest.scale(1/3f); +// System.out.println("$draw ID p" + index +" vector " + ptest + vNorm); + + // See if all vertices are OUTSIDE the the plane we are considering. + for (int j = 0; j < ptCenter; j++) { + vAB.sub2(points[p1[0]], points[j]); + if (vAB.dot(vNorm) < -0.1) { + //System.out.println("$draw ID p" + index + "_" + j + points[j]); + return false; + } + } + Integer normix = Integer.valueOf(normals[index]); String list = htNormMap.get(normix); if (list == null) { @@ -783,9 +806,8 @@ } htNormMap.put(normix, list + match); } - plane = Measure.getPlaneThroughPoints(points[p1[0]], points[p1[1]], - points[p1[2]], vNorm, vAB, plane); - float d = Measure.distanceToPlane(plane, points[ptCenter]); + + //float d = Measure.distanceToPlane(plane, points[ptCenter]); //System.out.println("" + normix + " " + Normix.getVertexVectors()[normix] + " " + getKey(p1, index) + " " + d); return true; } @@ -833,7 +855,7 @@ @Override public void setModelVisibilityFlags(BS bsModels) { - /* + /* * set all fixed objects visible; others based on model being displayed note * that this is NOT done with atoms and bonds, because they have mads. When * you say "frame 0" it is just turning on all the mads. Modified: trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java =================================================================== --- trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java 2015-06-16 22:16:37 UTC (rev 20582) +++ trunk/Jmol/src/org/jmol/shapespecial/Polyhedron.java 2015-06-17 00:42:50 UTC (rev 20583) @@ -34,9 +34,11 @@ Map<String, Object> getInfo() { Map<String, Object> info = new Hashtable<String, Object>(); info.put("vertexCount", Integer.valueOf(nVertices)); + info.put("modelNumber", Integer.valueOf(centralAtom.getModelNumber())); info.put("modelIndex", Integer.valueOf(centralAtom.mi)); info.put("planeCount", Integer.valueOf(planes.length)); - info.put("_ipt", Integer.valueOf(centralAtom.i)); + info.put("centerAtomIndex", Integer.valueOf(centralAtom.i)); + info.put("centerAtomNumber", Integer.valueOf(centralAtom.getAtomNumber())); info.put("center", P3.newP(centralAtom)); info.put("vertices", AU.arrayCopyPt(points, nVertices)); info.put("polygons", AU.arrayCopyII(planes, planes.length)); Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-06-16 22:16:37 UTC (rev 20582) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2015-06-17 00:42:50 UTC (rev 20583) @@ -14,7 +14,48 @@ TODO: remove HTML5 dependency on synchronous file loading (check SCRIPT command for problems) -Jmol.___JmolVersion="14.3.15_2015.06.16" +Jmol.___JmolVersion="14.3.15_2015.06.16b" + +bug fix: ++x and x++ do not increment properly when in expressions + // no problem here because it is compiled as "x = x + 1" + x = 0 + x++ + print "x should be 1 " + x + + // x does not increment, but the test passes + x = 0 + if (++x) { + print "good" + } + print "x should be 1 " + x + + // x does not increment, but the test passes ("bad" is not printed) + x = 0 + if (x++) { + print "bad" + } + print "x should be 1 " + x + x = 0 + // works + x++ + // y is OK, but x does not increment + y = x++ + print "x should be 2 " + x + x = 0 + // z is OK, but x does not increment + z = ++x + print "x should be 1 " + x + + // result: + + x should be 1 1 + good + x should be 1 0 + x should be 1 0 + x should be 2 1 + x should be 1 0 + +JmolVersion="14.3.15_2015.06.16" bug fix: msCIF reader failing for Legendre polynomials of order greater than 4 -- JavaScript fix for new double[m + 1][] -- must use AU.newDouble2(m + 1); 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