From: <ha...@us...> - 2011-06-14 17:22:01
|
Revision: 15586 http://jmol.svn.sourceforge.net/jmol/?rev=15586&view=rev Author: hansonr Date: 2011-06-14 17:21:54 +0000 (Tue, 14 Jun 2011) Log Message: ----------- version=12.1.50_dev # bug fix: isosurface slab within 5.0 {3} -- should be ALL those atoms, not just center # -- as opposed to the CENTER using isosurface slab within 5.0 @{{3}.xyz} # new feature: isosurface slab [point array] # -- for example: isosurface slab within 5.0 {3} # bug fix: PQR reader allowing < 0.9 radius for H Modified Paths: -------------- trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/PdbReader.java trunk/Jmol/src/org/jmol/adapter/readers/more/PqrReader.java trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java trunk/Jmol/src/org/jmol/slicer/SliceBox.java trunk/Jmol/src/org/jmol/slicer/Slicer.java trunk/Jmol/src/org/jmol/util/MeshSurface.java trunk/Jmol/src/org/jmol/viewer/Jmol.properties trunk/Jmol/src/org/jmol/viewer/Viewer.java Modified: trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/PdbReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/PdbReader.java 2011-06-14 14:45:57 UTC (rev 15585) +++ trunk/Jmol/src/org/jmol/adapter/readers/cifpdb/PdbReader.java 2011-06-14 17:21:54 UTC (rev 15586) @@ -687,18 +687,21 @@ } char ch12 = line.charAt(12); char ch13 = line.charAt(13); + // PDB atom symbols are supposed to be in these two characters + // But they could be right-aligned or left-aligned if ((htElementsInCurrentGroup == null || htElementsInCurrentGroup.get(line.substring(12, 14)) != null) && Atom.isValidElementSymbolNoCaseSecondChar(ch12, ch13)) return (isHetero || ch12 != 'H' ? "" + ch12 + ch13 : "H"); // not a known two-letter code - if (ch12 == 'H') // added check for PQR files " HD3" for example + if (ch12 == 'H') // added check for PQR files "HD22" for example return "H"; - // check for " NH2" for example + // check for " NZ" for example if ((htElementsInCurrentGroup == null || htElementsInCurrentGroup.get("" + ch13) != null) && Atom.isValidElementSymbol(ch13)) return "" + ch13; + // check for misplaced "O " for example if ((htElementsInCurrentGroup == null || htElementsInCurrentGroup.get("" + ch12) != null) && Atom.isValidElementSymbol(ch12)) Modified: trunk/Jmol/src/org/jmol/adapter/readers/more/PqrReader.java =================================================================== --- trunk/Jmol/src/org/jmol/adapter/readers/more/PqrReader.java 2011-06-14 14:45:57 UTC (rev 15585) +++ trunk/Jmol/src/org/jmol/adapter/readers/more/PqrReader.java 2011-06-14 17:21:54 UTC (rev 15586) @@ -62,6 +62,15 @@ String[] tokens = getTokens(); atom.radius = parseFloat(tokens[tokens.length - 1]); + if (atom.radius < 0.9f) + atom.radius = 1; + // based on parameters in http://pdb2pqr.svn.sourceforge.net/viewvc/pdb2pqr/trunk/pdb2pqr/dat/ + // AMBER forcefield, H atoms may be given 0 (on O) or 0.6 (on N) for radius + // PARSE forcefield, lots of H atoms may be given 0 radius + // CHARMM forcefield, HN atoms may be given 0.2245 radius + // PEOEPB forcefield, no atoms given 0 radius + // SWANSON forcefield, HW (on water) will be given 0 radius, and H on oxygen given 0.9170 + atom.partialCharge = parseFloat(tokens[tokens.length - 2]); } Modified: trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java =================================================================== --- trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2011-06-14 14:45:57 UTC (rev 15585) +++ trunk/Jmol/src/org/jmol/script/ScriptEvaluator.java 2011-06-14 17:21:54 UTC (rev 15586) @@ -14732,10 +14732,14 @@ case Token.perpendicular: propertyName = "perp"; break; + case Token.radius: case Token.diameter: + boolean isRadius = (theTok == Token.radius); float f = floatParameter(++i); + if (isRadius) + f *= 2; propertyValue = Float.valueOf(f); - propertyName = (tokAt(i) == Token.decimal ? "width" : "diameter"); + propertyName = (isRadius || tokAt(i) == Token.decimal ? "width" : "diameter"); swidth = propertyName + (tokAt(i) == Token.decimal ? " " + f : " " + ((int) f)); break; @@ -15158,15 +15162,36 @@ int tok = tokAt(i + 1); Point4f plane = null; float d = 0; - Point3f pt = null; + Point3f[] pts = null; + BitSet bs = null; switch (tok) { case Token.none: iToken = i + 1; break; case Token.within: i++; - if (isFloatParameter(++i)) - data = new Object[] { Float.valueOf(d = floatParameter(i)), pt = centerParameter(++i) }; + if (isFloatParameter(++i)) { + d = floatParameter(i); + if (isCenterParameter(++i)) { + Point3f pt = centerParameter(i); + if (isSyntaxCheck || !(expressionResult instanceof BitSet)) { + pts = new Point3f[] { pt }; + } else { + Atom[] atoms = viewer.getModelSet().atoms; + bs = (BitSet) expressionResult; + pts = new Point3f[bs.cardinality()]; + for (int k = 0, j = bs.nextSetBit(0); j >= 0; j = bs.nextSetBit(j + 1), k++) + pts[k] = atoms[j]; + } + } else { + pts = getPointArray(i, -1); + } + if (pts.length == 0) { + iToken = i; + error(ERROR_invalidArgument); + } + data = new Object[] { Float.valueOf(d), pts }; + } else data = getPointArray(i, 4); break; @@ -15182,7 +15207,7 @@ SymmetryInterface unitCell = viewer.getCurrentUnitCell(); if (unitCell == null) error(ERROR_invalidArgument); - Point3f[] pts = BoxInfo.getCriticalPoints(unitCell.getUnitCellVertices(), + pts = BoxInfo.getCriticalPoints(unitCell.getUnitCellVertices(), unitCell.getCartesianOffset()); int iType = (int) unitCell.getUnitCellInfo(JmolConstants.INFO_DIMENSIONS); Vector3f v1 = null; @@ -15209,6 +15234,7 @@ break; } data = pts; + pts = null; iToken = i + 1; break; default: @@ -15228,8 +15254,10 @@ sb2.append(" ").append(Token.nameOf(tok0)).append(" "); if (plane != null) sb2.append(Escape.escape(plane)); - else if (pt != null) - sb2.append("within ").append(d).append(" ").append(Escape.escape(pt)); + else if (bs != null) + sb2.append("within ").append(d).append(" ").append(Escape.escape(bs)); + else if (pts != null) + sb2.append("within ").append(d).append(" ").append(Escape.escape(pts)); else if (data == null) sb2.append("none"); else Modified: trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java =================================================================== --- trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java 2011-06-14 14:45:57 UTC (rev 15585) +++ trunk/Jmol/src/org/jmol/shapesurface/Isosurface.java 2011-06-14 17:21:54 UTC (rev 15586) @@ -395,6 +395,10 @@ if (thisMesh != null && thisMesh.polygonCount != 0) { thisMesh.slabPolygons((Object[]) value); thisMesh.initialize(thisMesh.lighting, null, null); + if (thisMesh.colorEncoder != null) { + thisMesh.vertexColixes = null; + remapColors(thisMesh.colorEncoder); + } return; } } Modified: trunk/Jmol/src/org/jmol/slicer/SliceBox.java =================================================================== --- trunk/Jmol/src/org/jmol/slicer/SliceBox.java 2011-06-14 14:45:57 UTC (rev 15585) +++ trunk/Jmol/src/org/jmol/slicer/SliceBox.java 2011-06-14 17:21:54 UTC (rev 15586) @@ -25,8 +25,8 @@ package org.jmol.slicer; +/* import javax.vecmath.*; -/* public class SliceBox { Point3f[] vertices = new Point3f[8]; //8 vertices (ordered to match boundbox) Modified: trunk/Jmol/src/org/jmol/slicer/Slicer.java =================================================================== --- trunk/Jmol/src/org/jmol/slicer/Slicer.java 2011-06-14 14:45:57 UTC (rev 15585) +++ trunk/Jmol/src/org/jmol/slicer/Slicer.java 2011-06-14 17:21:54 UTC (rev 15586) @@ -26,6 +26,8 @@ package org.jmol.slicer; +/* + import javax.vecmath.Point3f; import javax.vecmath.Vector3f; @@ -37,7 +39,6 @@ import org.jmol.viewer.Viewer; import org.jmol.util.*; -/* *//** * *//* Modified: trunk/Jmol/src/org/jmol/util/MeshSurface.java =================================================================== --- trunk/Jmol/src/org/jmol/util/MeshSurface.java 2011-06-14 14:45:57 UTC (rev 15585) +++ trunk/Jmol/src/org/jmol/util/MeshSurface.java 2011-06-14 17:21:54 UTC (rev 15586) @@ -201,6 +201,7 @@ if (bsValid != null) { polygonCount = polygonCount0; vertexCount = vertexCount0; + polygonCount0 = vertexCount0 = 0; bsValid.set(0, polygonCount); slabOptions = new StringBuffer(" slab none"); } @@ -232,16 +233,16 @@ if (slabbingObject instanceof Object[]) { Object[] o = (Object[]) slabbingObject; float distance = ((Float) o[0]).floatValue(); - Point3f center = (Point3f) o[1]; - getIntersection(null, center, distance, null, andCap, false); + Point3f[] centers = (Point3f[]) o[1]; + getIntersection(null, centers, distance, null, andCap, false); } } - public boolean getIntersection(Point4f plane, Point3f ptCenter, + public boolean getIntersection(Point4f plane, Point3f[] ptCenters, float distance, List<Point3f[]> vData, boolean andCap, boolean doClean) { boolean isSlab = (vData == null); - if (ptCenter != null) + if (ptCenters != null) andCap = false; // can only cap faces Point3f[] pts; int iD, iE; @@ -256,18 +257,18 @@ Point3f vB = vertices[iB]; Point3f vC = vertices[iC]; float d1, d2, d3; - if (ptCenter == null) { + if (ptCenters == null) { d1 = Measure.distanceToPlane(plane, vA); d2 = Measure.distanceToPlane(plane, vB); d3 = Measure.distanceToPlane(plane, vC); } else if (distance < 0) { - d1 = -vA.distance(ptCenter) - distance; - d2 = -vB.distance(ptCenter) - distance; - d3 = -vC.distance(ptCenter) - distance; + d1 = -minDist(vA, ptCenters) - distance; + d2 = -minDist(vB, ptCenters) - distance; + d3 = -minDist(vC, ptCenters) - distance; } else { - d1 = vA.distance(ptCenter) - distance; - d2 = vB.distance(ptCenter) - distance; - d3 = vC.distance(ptCenter) - distance; + d1 = minDist(vA, ptCenters) - distance; + d2 = minDist(vB, ptCenters) - distance; + d3 = minDist(vC, ptCenters) - distance; } int test1 = (d1 < 0 ? 1 : 0) + (d2 < 0 ? 2 : 0) + (d3 < 0 ? 4 : 0); int test2 = (d1 >= 0 ? 1 : 0) + (d2 >= 0 ? 2 : 0) + (d3 >= 0 ? 4 : 0); @@ -287,7 +288,7 @@ case 1: case 6: // BC on same side - if (ptCenter == null) + if (ptCenters == null) pts = new Point3f[] { interpolatePoint(vA, vB, -d1, d2), interpolatePoint(vA, vC, -d1, d3) }; else @@ -297,7 +298,7 @@ case 2: case 5: //AC on same side - if (ptCenter == null) + if (ptCenters == null) pts = new Point3f[] { interpolatePoint(vB, vA, -d2, d1), interpolatePoint(vB, vC, -d2, d3) }; else @@ -307,7 +308,7 @@ case 3: case 4: //AB on same side need A-C, B-C - if (ptCenter == null) + if (ptCenters == null) pts = new Point3f[] { interpolatePoint(vC, vA, -d3, d1), interpolatePoint(vC, vB, -d3, d2) }; else @@ -489,6 +490,16 @@ return false; } + private static float minDist(Point3f pt, Point3f[] ptCenters) { + float dmin = Integer.MAX_VALUE; + for (int i = ptCenters.length; --i >= 0;) { + float d = ptCenters[i].distance(pt); + if (d < dmin) + dmin = d; + } + return dmin; + } + private Point3f interpolateSphere(Point3f v1, Point3f v2, float d1, float d2, double absD) { return interpolateFraction(v1, v2, getSphericalInterpolationFraction(absD, d1, Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2011-06-14 14:45:57 UTC (rev 15585) +++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties 2011-06-14 17:21:54 UTC (rev 15586) @@ -3,6 +3,11 @@ version=12.1.50_dev +# bug fix: isosurface slab within 5.0 {3} -- should be ALL those atoms, not just center +# -- as opposed to the CENTER using isosurface slab within 5.0 @{{3}.xyz} +# new feature: isosurface slab [point array] +# -- for example: isosurface slab within 5.0 {3} +# bug fix: PQR reader allowing < 0.9 radius for H # bug fix: PQR reader mistaking " HD3" as deuterium # bug fix: pointilist isosurfaces do not respond to "color isosurface red" # bug fix: isosurface select {x} only VDW MAP select {!x} VDW Modified: trunk/Jmol/src/org/jmol/viewer/Viewer.java =================================================================== --- trunk/Jmol/src/org/jmol/viewer/Viewer.java 2011-06-14 14:45:57 UTC (rev 15585) +++ trunk/Jmol/src/org/jmol/viewer/Viewer.java 2011-06-14 17:21:54 UTC (rev 15586) @@ -2714,6 +2714,7 @@ modelSet.setBoundBox(pt1, pt2, byCorner, scale); } + @Override public Point3f getBoundBoxCenter() { return modelSet.getBoundBoxCenter(animationManager.currentModelIndex); } @@ -2740,6 +2741,7 @@ return modelSet.calcRotationRadius(bs); } + @Override public Vector3f getBoundBoxCornerVector() { return modelSet.getBoundBoxCornerVector(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |