From: <ha...@us...> - 2012-09-08 15:49:23
|
Revision: 17525 http://jmol.svn.sourceforge.net/jmol/?rev=17525&view=rev Author: hansonr Date: 2012-09-08 15:49:14 +0000 (Sat, 08 Sep 2012) Log Message: ----------- ___version=13.1.4 CRITICAL RELEASE bug fix: ISOSURFACE saving in state broken 7/30/12 in 13.0.RC3 bug fix: simple isosurface PLANE not saved in state bug fix: isosurface command with MAP from state when saved to state may fail new feature: ISOSURFACE PLANE ... MAP ... LATTICE {i j k} [volume data] -- allows periodic volume data to be mapped to a plane based on a specified translational lattice -- for example: isosurface plane x=2 map LATTICE {1 2 2} "data.dat" new feature: POLYHEDRA {atom1} to {atoms_including_atom1} -- polyhedra with or without central atom, but with a reference atom bug fix: 13.1.2 offsets label positions incorrectly Modified Paths: -------------- trunk/Jmol/src/org/jmol/jvxl/calc/MarchingCubes.java trunk/Jmol/src/org/jmol/jvxl/data/JvxlCoder.java trunk/Jmol/src/org/jmol/jvxl/data/JvxlData.java trunk/Jmol/src/org/jmol/jvxl/data/VolumeData.java trunk/Jmol/src/org/jmol/jvxl/readers/JvxlXmlReader.java trunk/Jmol/src/org/jmol/jvxl/readers/Parameters.java trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceReader.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties Modified: trunk/Jmol/src/org/jmol/jvxl/calc/MarchingCubes.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/calc/MarchingCubes.java 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/jvxl/calc/MarchingCubes.java 2012-09-08 15:49:14 UTC (rev 17525) @@ -138,9 +138,18 @@ isXLowToHigh = params.isXLowToHigh; cubeCountX = volumeData.voxelCounts[0] - 1; - cubeCountY = (nY = volumeData.voxelCounts[1]) - 1; - cubeCountZ = (nZ = volumeData.voxelCounts[2]) - 1; - yzCount = volumeData.getYzCount(); + cubeCountY = volumeData.voxelCounts[1] - 1; + cubeCountZ = volumeData.voxelCounts[2] - 1; + volumeData.getYzCount(); + if (params.mapLattice != null) { + // extend plane out to full lattice, if specified + cubeCountX *= Math.abs(params.mapLattice.x); + cubeCountY *= Math.abs(params.mapLattice.y); + cubeCountZ *= Math.abs(params.mapLattice.z); + } + nY = cubeCountY + 1; + nZ = cubeCountZ + 1; + yzCount = nY * nZ; if (bsVoxels == null) bsVoxels = new BitSet(); edgeVertexPointers = (isXLowToHigh ? edgeVertexPointersLowToHigh : edgeVertexPointersHighToLow); Modified: trunk/Jmol/src/org/jmol/jvxl/data/JvxlCoder.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/data/JvxlCoder.java 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/jvxl/data/JvxlCoder.java 2012-09-08 15:49:14 UTC (rev 17525) @@ -133,7 +133,8 @@ sb = new StringBuffer(); XmlUtil.openTag(sb, "jvxlSurfaceData", (vertexDataOnly || jvxlData.jvxlPlane == null ? null : - new String[] { "plane", Escape.escape(jvxlData.jvxlPlane) })); + jvxlData.mapLattice == null ? new String[] { "plane", Escape.escape(jvxlData.jvxlPlane) } + : new String[] { "plane", Escape.escape(jvxlData.jvxlPlane), "maplattice", Escape.escape(jvxlData.mapLattice) })); if (vertexDataOnly) { appendXmlVertexOnlyData(sb, jvxlData, meshData, true); } else if (jvxlData.jvxlPlane == null) { @@ -309,6 +310,8 @@ if (jvxlData.vContours != null && jvxlData.vContours.length > 0) addAttrib(attribs, "\n nContourData", "" + jvxlData.vContours.length); } else { + if (jvxlData.mapLattice != null) + addAttrib(attribs, "\n mapLattice", "" + jvxlData.mapLattice); if (jvxlData.scale3d != 0) addAttrib(attribs, "\n scale3d", "" + jvxlData.scale3d); if (nColorData > 0) Modified: trunk/Jmol/src/org/jmol/jvxl/data/JvxlData.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/data/JvxlData.java 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/jvxl/data/JvxlData.java 2012-09-08 15:49:14 UTC (rev 17525) @@ -164,6 +164,7 @@ public String slabInfo; public boolean allowVolumeRender; public float voxelVolume; + public Point3f mapLattice; public void clear() { allowVolumeRender = true; @@ -179,6 +180,7 @@ contourColixes = null; contourColors = null; isSlabbable = false; + mapLattice = null; meshColor = null; nPointsX = 0; nVertexColors = 0; @@ -192,19 +194,23 @@ voxelVolume = 0; } - public void setSurfaceInfo(Point4f thePlane, int nSurfaceInts, String surfaceData) { + public void setSurfaceInfo(Point4f thePlane, Point3f mapLattice, int nSurfaceInts, String surfaceData) { jvxlSurfaceData = surfaceData; if (jvxlSurfaceData.indexOf("--") == 0) jvxlSurfaceData = jvxlSurfaceData.substring(2); jvxlPlane = thePlane; + this.mapLattice = mapLattice; this.nSurfaceInts = nSurfaceInts; } public void setSurfaceInfoFromBitSet(BitSet bs, Point4f thePlane) { + setSurfaceInfoFromBitSet(bs, thePlane, null); + } + public void setSurfaceInfoFromBitSet(BitSet bs, Point4f thePlane, Point3f mapLattice) { StringBuffer sb = new StringBuffer(); - int nPoints = nPointsX * nPointsY * nPointsZ; - int nSurfaceInts = (thePlane != null ? 0 : JvxlCoder.jvxlEncodeBitSet(bs, nPoints, sb)); - setSurfaceInfo(thePlane, nSurfaceInts, sb.toString()); + int nSurfaceInts = (thePlane != null ? 0 : JvxlCoder.jvxlEncodeBitSet(bs, + nPointsX * nPointsY * nPointsZ, sb)); + setSurfaceInfo(thePlane, mapLattice, nSurfaceInts, sb.toString()); } public void jvxlUpdateInfo(String[] title, long nBytes) { Modified: trunk/Jmol/src/org/jmol/jvxl/data/VolumeData.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/data/VolumeData.java 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/jvxl/data/VolumeData.java 2012-09-08 15:49:14 UTC (rev 17525) @@ -376,15 +376,19 @@ int yUpper = indexUpper(ptXyzTemp.y, yLower, iMax); int zLower = indexLower(ptXyzTemp.z, iMax = voxelCounts[2] - 1); int zUpper = indexUpper(ptXyzTemp.z, zLower, iMax); - float v1 = getFractional2DValue(ptXyzTemp.x - xLower, ptXyzTemp.y - yLower, + float v1 = getFractional2DValue(mantissa(ptXyzTemp.x - xLower), mantissa(ptXyzTemp.y - yLower), getVoxelValue(xLower, yLower, zLower), getVoxelValue(xUpper, yLower, zLower), getVoxelValue(xLower, yUpper, zLower), getVoxelValue(xUpper, yUpper, zLower)); - float v2 = getFractional2DValue(ptXyzTemp.x - xLower, ptXyzTemp.y - yLower, + float v2 = getFractional2DValue(mantissa(ptXyzTemp.x - xLower), mantissa(ptXyzTemp.y - yLower), getVoxelValue(xLower, yLower, zUpper), getVoxelValue(xUpper, yLower, zUpper), getVoxelValue(xLower, yUpper, zUpper), getVoxelValue(xUpper, yUpper, zUpper)); - return v1 + (ptXyzTemp.z - zLower) * (v2 - v1); + return v1 + mantissa(ptXyzTemp.z - zLower) * (v2 - v1); } + private float mantissa(float f) { + return (isPeriodic ? f - (float) Math.floor(f) : f); + } + public float getVoxelValue(int x, int y, int z) { if (voxelMap == null) return voxelData[x][y][z]; @@ -426,7 +430,7 @@ } private int indexUpper(float x, int xLower, int xMax) { - return xLower + (!isPeriodic && x < 0 || xLower == xMax ? 0 : 1); + return (!isPeriodic && x < 0 || xLower == xMax ? xLower : xLower + 1); } void offsetCenter(Point3f center) { Modified: trunk/Jmol/src/org/jmol/jvxl/readers/JvxlXmlReader.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/readers/JvxlXmlReader.java 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/jvxl/readers/JvxlXmlReader.java 2012-09-08 15:49:14 UTC (rev 17525) @@ -245,17 +245,29 @@ jvxlData.allowVolumeRender = params.allowVolumeRender = (s.length() == 0 || s.equalsIgnoreCase("true")); s = XmlReader.getXmlAttrib(data, "plane"); if (s.indexOf("{") >= 0) { + params.thePlane = null; + params.mapLattice = null; try { params.thePlane = (Point4f) Escape.unescapePoint(s); + s = XmlReader.getXmlAttrib(data, "maplattice"); Logger.info("JVXL read: plane " + params.thePlane); + if (s.indexOf("{") >= 0) { + params.mapLattice = (Point3f) Escape.unescapePoint(s); + Logger.info("JVXL read: mapLattice " + params.mapLattice); + } if (params.scale3d == 0) params.scale3d = parseFloat(XmlReader.getXmlAttrib(data, "scale3d")); if (Float.isNaN(params.scale3d)) params.scale3d = 0; } catch (Exception e) { - Logger - .error("Error reading 4 floats for PLANE definition -- setting to 0 0 1 0 (z=0)"); - params.thePlane = new Point4f(0, 0, 1, 0); + if (params.thePlane == null) { + Logger + .error("JVXL Error reading plane definition -- setting to 0 0 1 0 (z=0)"); + params.thePlane = new Point4f(0, 0, 1, 0); + } else { + Logger + .error("JVXL Error reading mapLattice definition -- ignored"); + } } surfaceDataCount = 0; edgeDataCount = 0; @@ -390,7 +402,7 @@ volumeData.setDataDistanceToPlane(params.thePlane); setVolumeData(volumeData); params.cutoff = 0f; - jvxlData.setSurfaceInfo(params.thePlane, 0, ""); + jvxlData.setSurfaceInfo(params.thePlane, params.mapLattice, 0, ""); jvxlData.scale3d = params.scale3d; return true; } Modified: trunk/Jmol/src/org/jmol/jvxl/readers/Parameters.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/readers/Parameters.java 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/jvxl/readers/Parameters.java 2012-09-08 15:49:14 UTC (rev 17525) @@ -239,8 +239,10 @@ isSquared = false; isContoured = false; isEccentric = isAnisotropic = false; + isMapped = false; isPeriodic = false; isSilent = false; + mapLattice = null; logCube = logCompression = false; logMessages = Logger.debugging; mappedDataMin = Float.MAX_VALUE; @@ -811,6 +813,8 @@ public Point3f points; public VolumeData volumeData; public ContactPair contactPair; + public Point3f mapLattice; + public boolean isMapped; void setMapRanges(SurfaceReader surfaceReader, boolean haveData) { if (!colorDensity) @@ -844,6 +848,7 @@ public void resetForMapping(boolean haveSurface) { if (!haveSurface) state = Parameters.STATE_DATA_READ; + isMapped = true; qmOrbitalType = QM_TYPE_UNKNOWN; parameters = null; colorDensity = false; Modified: trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java 2012-09-08 15:49:14 UTC (rev 17525) @@ -798,6 +798,12 @@ params.contourFromZero = !((Boolean) value).booleanValue(); return true; } + + if ("mapLattice" == propertyName) { + params.mapLattice = (Point3f) value; + return true; + } + // / final actions /// if ("property" == propertyName) { @@ -1166,6 +1172,8 @@ params.isSquared = isSquared; params.mappedDataMin = Float.MAX_VALUE; surfaceReader.readVolumeData(true); + if (params.mapLattice != null) + volumeData.isPeriodic = true; } else if (!params.colorBySets && !params.colorDensity) { surfaceReader.readAndSetVolumeParameters(true); params.mappedDataMin = Float.MAX_VALUE; Modified: trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceReader.java =================================================================== --- trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceReader.java 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceReader.java 2012-09-08 15:49:14 UTC (rev 17525) @@ -566,7 +566,7 @@ if (params.thePlane == null) edgeData = data; jvxlData.setSurfaceInfoFromBitSet(marchingCubes.getBsVoxels(), - params.thePlane); + params.thePlane, params.mapLattice); jvxlData.jvxlExcluded = params.bsExcluded; if (isJvxl) edgeData = jvxlEdgeDataRead; Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2012-09-08 15:49:14 UTC (rev 17525) @@ -16747,6 +16747,7 @@ BitSet bsIgnore = null; StringBuffer sbCommand = new StringBuffer(); Point3f pt; + Point4f plane = null; Point3f lattice = null; Point3f[] pts; String str = null; @@ -16963,7 +16964,7 @@ if (mepOrMlp == null) { // not mlp or mep if (!surfaceObjectSeen && !isMapped && !planeSeen) { addShapeProperty(propertyList, "sasurface", Float.valueOf(0)); - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" vdw"); surfaceObjectSeen = true; } @@ -16986,7 +16987,7 @@ propertyName = mepOrMlp; } str = parameterAsString(i); - if (surfaceObjectSeen) +// if (surfaceObjectSeen) sbCommand.append(" ").append(str); if (str.toLowerCase().indexOf("property_") == 0) { @@ -17013,7 +17014,7 @@ Parser.parseStringInfestedFloatArray("" + getParameter(vname, Token.string), null, data); } - if (!isSyntaxCheck && (surfaceObjectSeen)) + if (!isSyntaxCheck/* && (surfaceObjectSeen)*/) sbCommand.append(" \"\" ").append(Escape.escape(data)); } else { int tokProperty = getToken(++i).tok; @@ -17187,10 +17188,10 @@ continue; case Token.ionic: case Token.vanderwaals: - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" ").append(theToken.value); RadiusData rd = encodeRadiusParameter(i, false, true); - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" ").append(rd); if (Float.isNaN(rd.value)) rd.value = 100; @@ -17207,7 +17208,7 @@ propertyName = "plane"; propertyValue = planeParameter(++i); i = iToken; - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" plane ").append(Escape.escape(propertyValue)); break; case Token.scale: @@ -17312,17 +17313,17 @@ offset = moOffset(i); moNumber = 0; i = iToken; - if (surfaceObjectSeen) { + //if (surfaceObjectSeen) { sbCommand.append(" mo " + (isNegOffset ? "-" : "") + "HOMO "); if (offset > 0) sbCommand.append("+"); if (offset != 0) sbCommand.append(offset); - } + //} break; case Token.integer: moNumber = intParameter(i); - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" mo ").append(moNumber); break; default: @@ -17348,7 +17349,7 @@ continue; case Token.nci: propertyName = "nci"; - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" " + propertyName); int tok = tokAt(i + 1); boolean isPromolecular = (tok != Token.file && tok != Token.string && tok != Token.mrc); @@ -17360,7 +17361,7 @@ case Token.mlp: boolean isMep = (theTok == Token.mep); propertyName = (isMep ? "mep" : "mlp"); - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" " + propertyName); String fname = null; int calcType = -1; @@ -17373,7 +17374,7 @@ } if (tokAt(i + 1) == Token.string) { fname = stringParameter(++i); - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" /*file*/" + Escape.escape(fname)); } else if (tokAt(i + 1) == Token.property) { mepOrMlp = propertyName; @@ -17445,7 +17446,7 @@ nlmZprs[1] = intParameter(++i); nlmZprs[2] = intParameter(++i); nlmZprs[3] = (isFloatParameter(i + 1) ? floatParameter(++i) : 6f); - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" atomicOrbital ").append((int) nlmZprs[0]).append( " ").append((int) nlmZprs[1]).append(" ") .append((int) nlmZprs[2]).append(" ").append(nlmZprs[3]); @@ -17455,7 +17456,7 @@ nlmZprs[5] = (tokAt(i + 1) == Token.decimal ? floatParameter(++i) : 0); nlmZprs[6] = (tokAt(i + 1) == Token.integer ? intParameter(++i) : ((int) -System.currentTimeMillis()) % 10000); - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" points ").append((int) nlmZprs[4]).append(' ') .append(nlmZprs[5]).append(' ').append((int) nlmZprs[6]); } @@ -17551,13 +17552,13 @@ case Token.downsample: propertyName = "downsample"; propertyValue = Integer.valueOf(intParameter(++i)); - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" downsample ").append(propertyValue); break; case Token.eccentricity: propertyName = "eccentricity"; propertyValue = getPoint4f(++i); - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" eccentricity ").append( Escape.escape(propertyValue)); i = iToken; @@ -17595,21 +17596,21 @@ propertyName = "" + theToken.value; List<Object> vxy = new ArrayList<Object>(); propertyValue = vxy; - isFxy = true; - if (surfaceObjectSeen) + isFxy = surfaceObjectSeen = true; + //if (surfaceObjectSeen) sbCommand.append(" ").append(propertyName); String name = parameterAsString(++i); if (name.equals("=")) { - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" ="); name = parameterAsString(++i); - if (surfaceObjectSeen) + //if (surfaceObjectSeen) sbCommand.append(" ").append(Escape.escape(name)); vxy.add(name); if (!isSyntaxCheck) addShapeProperty(propertyList, "func", createFunction("__iso__", "x,y,z", name)); - surfaceObjectSeen = true; + //surfaceObjectSeen = true; break; } // override of function or data name when saved as a state @@ -17622,26 +17623,26 @@ boolean isXYZ = (name.indexOf("data2d_") == 0); boolean isXYZV = (name.indexOf("data3d_") == 0); isInline = name.equals("inline"); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" inline"); vxy.add(name); // (0) = name Point3f pt3 = getPoint3f(++i, false); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" ").append(Escape.escape(pt3)); vxy.add(pt3); // (1) = {origin} Point4f pt4; ptX = ++iToken; vxy.add(pt4 = getPoint4f(ptX)); // (2) = {ni ix iy iz} - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" ").append(Escape.escape(pt4)); nX = (int) pt4.x; ptY = ++iToken; vxy.add(pt4 = getPoint4f(ptY)); // (3) = {nj jx jy jz} - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" ").append(Escape.escape(pt4)); nY = (int) pt4.x; vxy.add(pt4 = getPoint4f(++iToken)); // (4) = {nk kx ky kz} - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" ").append(Escape.escape(pt4)); nZ = (int) pt4.x; @@ -17676,7 +17677,7 @@ + "] is not of size [" + nX + "][" + nY + "][" + nZ + "]"); } vxy.add(xyzdata); // (5) = float[][][] data - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" ").append(Escape.escape(xyzdata)); } else { if (isInline) { @@ -17713,7 +17714,7 @@ } } vxy.add(fdata); // (5) = float[][] data - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" ").append(Escape.escape(fdata)); } } @@ -17736,7 +17737,7 @@ case Token.internal: case Token.interior: case Token.pocket: - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" ").append(theToken.value); propertyName = "pocket"; propertyValue = (theTok == Token.pocket ? Boolean.TRUE : Boolean.FALSE); @@ -17746,7 +17747,7 @@ propertyName = "lobe"; propertyValue = getPoint4f(++i); i = iToken; - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" lobe ").append(Escape.escape(propertyValue)); surfaceObjectSeen = true; break; @@ -17756,7 +17757,7 @@ propertyName = "lp"; propertyValue = getPoint4f(++i); i = iToken; - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" lp ").append(Escape.escape(propertyValue)); surfaceObjectSeen = true; break; @@ -17772,7 +17773,7 @@ addShapeProperty(propertyList, "sasurface", Float.valueOf(0)); } if (sbCommand.length() == 0) { - Object plane = getShapeProperty(JmolConstants.SHAPE_ISOSURFACE, + plane = (Point4f) getShapeProperty(JmolConstants.SHAPE_ISOSURFACE, "plane"); if (plane == null) { if (getShapeProperty(JmolConstants.SHAPE_ISOSURFACE, "contours") != null) { @@ -17782,19 +17783,14 @@ addShapeProperty(propertyList, "plane", plane); sbCommand.append("plane ").append(Escape.escape(plane)); planeSeen = true; + plane = null; } } else if (!surfaceObjectSeen && !planeSeen) { error(ERROR_invalidArgument); } - //surfaceObjectSeen = !isCavity; sbCommand.append("; isosurface map"); addShapeProperty(propertyList, "map", (surfaceObjectSeen ? Boolean.TRUE : Boolean.FALSE)); - if (planeSeen && lattice != null) { - propertyName = "lattice"; - propertyValue = lattice; - } - lattice = null; break; case Token.maxset: propertyName = "maxset"; @@ -17812,7 +17808,7 @@ propertyName = "rad"; propertyValue = getPoint4f(++i); i = iToken; - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" radical ").append(Escape.escape(propertyValue)); break; case Token.modelbased: @@ -17827,24 +17823,24 @@ float radius; if (theTok == Token.molecular) { propertyName = "molecular"; - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" molecular"); radius = 1.4f; } else { addShapeProperty(propertyList, "bsSolvent", lookupIdentifierValue("solvent")); propertyName = (theTok == Token.sasurface ? "sasurface" : "solvent"); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" ").append(theToken.value); radius = (isFloatParameter(i + 1) ? floatParameter(++i) : viewer .getSolventProbeRadius()); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" ").append(radius); } propertyValue = Float.valueOf(radius); if (tokAt(i + 1) == Token.full) { addShapeProperty(propertyList, "doFullMolecular", null); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" full"); i++; } @@ -17852,22 +17848,22 @@ break; case Token.mrc: addShapeProperty(propertyList, "fileType", "MRC"); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" mrc"); continue; case Token.object: case Token.obj: addShapeProperty(propertyList, "fileType", "Obj"); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" obj"); continue; case Token.msms: addShapeProperty(propertyList, "fileType", "Msms"); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" msms"); continue; case Token.phase: - if (surfaceObjectSeen) + //if (surfaceObjectSeen) error(ERROR_invalidArgument); propertyName = "phase"; isPhased = true; @@ -17895,7 +17891,7 @@ // sphere [radius] propertyName = "sphere"; propertyValue = Float.valueOf(floatParameter(++i)); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" sphere ").append(propertyValue); surfaceObjectSeen = true; break; @@ -17926,7 +17922,7 @@ Logger.debug("pmesh inline data:\n" + sType); propertyValue = (isSyntaxCheck ? null : sType); addShapeProperty(propertyList, "fileName", ""); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" INLINE"); surfaceObjectSeen = true; } else { @@ -17947,7 +17943,7 @@ addShapeProperty(propertyList, "sigma", Float.valueOf(sigma)); } addShapeProperty(propertyList, "cutoff", Float.valueOf(cutoff)); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" cutoff ").append(cutoff); } } @@ -17957,7 +17953,7 @@ modelIndex = viewer.getCurrentModelIndex(); bs = viewer.getModelUndeletedAtomsBitSet(modelIndex); getWithinDistanceVector(propertyList, 2.0f, null, bs, false); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" within 2.0 ").append(Escape.escape(bs)); } if (firstPass) @@ -17967,7 +17963,7 @@ && Float.isNaN(sigma) && Float.isNaN(cutoff)) { // negative sigma just indicates that addShapeProperty(propertyList, "sigma", Float.valueOf(-1)); - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" sigma -1.0"); } /* @@ -18043,15 +18039,15 @@ addShapeProperty(propertyList, "fileName", filename); if (localName != null) filename = localName; - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" /*file*/").append(Escape.escape(filename)); // null propertyValue indicates that we need a reader based on the fileName } - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) if (fileIndex >= 0) sbCommand.append(" ").append(fileIndex); } - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) if (sType != null) sbCommand.append(" ").append(Escape.escape(sType)); surfaceObjectSeen = true; @@ -18071,25 +18067,25 @@ break; case Token.link: propertyName = "link"; - if (!surfaceObjectSeen) + //if (!surfaceObjectSeen) sbCommand.append(" link"); break; case Token.lattice: if (iShape != JmolConstants.SHAPE_ISOSURFACE) error(ERROR_invalidArgument); - lattice = getPoint3f(iToken + 1, false); + pt = getPoint3f(iToken + 1, false); i = iToken; - if (lattice.x <= 0 || lattice.y <= 0 || lattice.z <= 0) { - lattice = null; + if (pt.x <= 0 || pt.y <= 0 || pt.z <= 0) break; - } - lattice.x = (int) lattice.x; - lattice.y = (int) lattice.y; - lattice.z = (int) lattice.z; - sbCommand.append("lattice ").append(Escape.escape(lattice)); + pt.x = (int) pt.x; + pt.y = (int) pt.y; + pt.z = (int) pt.z; + sbCommand.append(" lattice ").append(Escape.escape(pt)); if (isMapped) { - propertyName = "lattice"; - propertyValue = lattice; + propertyName = "mapLattice"; + propertyValue = pt; + } else { + lattice = pt; } break; default: @@ -18195,7 +18191,7 @@ sbCommand.append(" mesh nofill frontOnly"); } } - if (lattice != null && !isMapped) + if (lattice != null) // before MAP, this is a display option setShapeProperty(JmolConstants.SHAPE_ISOSURFACE, "lattice", lattice); if (iptDisplayProperty > 0) { if (!setMeshDisplayProperty(iShape, iptDisplayProperty, 0)) @@ -18228,10 +18224,10 @@ setShapeProperty(iShape, "finalize", sbCommand.toString()); } else if (surfaceObjectSeen) { cmd = sbCommand.toString(); - setShapeProperty(iShape, "finalize", + setShapeProperty(iShape, "finalize", (cmd.indexOf("; isosurface map") == 0 ? "" : " select " - + Escape.escape(bsSelect) + " ") - + cmd); + + Escape.escape(bsSelect) + " ") + + cmd); String s = (String) getShapeProperty(iShape, "ID"); if (s != null && !tQuiet) { cutoff = ((Float) getShapeProperty(iShape, "cutoff")).floatValue(); Modified: trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java =================================================================== --- trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java 2012-09-08 15:49:14 UTC (rev 17525) @@ -482,6 +482,8 @@ } } if ("map" == propertyName) { + if (sg != null) + sg.getParams().isMapped = true; setProperty("squareData", Boolean.FALSE, null); if (thisMesh == null || thisMesh.vertexCount == 0) return; @@ -869,6 +871,7 @@ int modelCount = viewer.getModelCount(); if (modelCount > 1) appendCmd(sb, "frame " + viewer.getModelNumberDotted(imesh.modelIndex)); + cmd = TextFormat.simpleReplace(cmd, ";; isosurface map"," map"); cmd = TextFormat.simpleReplace(cmd, "; isosurface map", " map"); cmd = cmd.replace('\t', ' '); cmd = TextFormat.simpleReplace(cmd, ";#", "; #"); Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2012-09-07 18:33:15 UTC (rev 17524) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2012-09-08 15:49:14 UTC (rev 17525) @@ -7,8 +7,17 @@ # Don't use ___ in your text, as that is the key for stripping out # the information saved in the JAR version of this file. -___version=13.1.4_dev +___version=13.1.4 +bug fix: ISOSURFACE saving in state broken 7/30/12 in 13.0.RC3 +bug fix: simple isosurface PLANE not saved in state +bug fix: isosurface command with MAP from state when saved to state may fail + +new feature: ISOSURFACE PLANE ... MAP ... LATTICE {i j k} [volume data] + -- allows periodic volume data to be mapped to a plane + based on a specified translational lattice + -- for example: isosurface plane x=2 map LATTICE {1 2 2} "data.dat" + new feature: POLYHEDRA {atom1} to {atoms_including_atom1} -- polyhedra with or without central atom, but with a reference atom bug fix: 13.1.2 offsets label positions incorrectly This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |