From: <ha...@us...> - 2006-06-14 03:19:29
|
Revision: 5222 Author: hansonr Date: 2006-06-13 20:19:21 -0700 (Tue, 13 Jun 2006) ViewCVS: http://svn.sourceforge.net/jmol/?rev=5222&view=rev Log Message: ----------- bob200603 isosurface adds anisotropy Modified Paths: -------------- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-06-14 02:25:31 UTC (rev 5221) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Eval.java 2006-06-14 03:19:21 UTC (rev 5222) @@ -4021,21 +4021,21 @@ switch (statement[++i].tok) { case Token.dollarsign: String id = objectNameParameter(++i); - propertyValue = viewer.getDrawObjectCenter(id); - if (propertyValue == null) - drawObjectNotDefined(id); + propertyValue = viewer.getDrawObjectCenter(id); + if (propertyValue == null) + drawObjectNotDefined(id); break; case Token.expressionBegin: - propertyValue = viewer.getAtomSetCenter(expression(statement, i + 1)); - i = pcLastExpressionInstruction; + propertyValue = viewer.getAtomSetCenter(expression(statement, i + 1)); + i = pcLastExpressionInstruction; break; case Token.leftbrace: - propertyValue = getCoordinate(i, true); - i = pcLastExpressionInstruction; - break; + propertyValue = getCoordinate(i, true); + i = pcLastExpressionInstruction; + break; default: coordinateOrNameOrExpressionRequired(); - } + } break; case Token.leftbrace: // {X, Y, Z, W} @@ -4062,6 +4062,12 @@ break; case Token.identifier: String str = (String) token.value; + if (str.equalsIgnoreCase("ANISOTROPY")) { + propertyName = "anisotropy"; + propertyValue = getCoordinate(i + 1, false); + i = pcLastExpressionInstruction; + break; + } if (str.equalsIgnoreCase("FIXED")) { propertyName = "fixed"; propertyValue = Boolean.TRUE; @@ -4072,7 +4078,7 @@ propertyValue = Boolean.FALSE; break; } - + if (str.equalsIgnoreCase("sign")) { signPt = i + 1; propertyName = "sign"; @@ -4116,9 +4122,9 @@ nlmZR[0] = intParameter(++i); nlmZR[1] = intParameter(++i); nlmZR[2] = intParameter(++i); - nlmZR[3] = (statement[i + 1].tok == Token.integer ? floatParameter(++i) + nlmZR[3] = (statement.length > i + 1 && statement[i + 1].tok == Token.integer ? floatParameter(++i) : 6f); - nlmZR[4] = (statement[i + 1].tok == Token.integer ? floatParameter(++i) + nlmZR[4] = (statement.length > i + 1 && statement[i + 1].tok == Token.integer ? floatParameter(++i) : 10f); propertyName = "orbital"; propertyValue = nlmZR; Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java =================================================================== --- branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-06-14 02:25:31 UTC (rev 5221) +++ branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-06-14 03:19:21 UTC (rev 5222) @@ -120,6 +120,8 @@ boolean isOrbital; boolean isSolvent; boolean isFunctionXY; + float[] anisotropy = new float[3]; + float solventRadius; int edgeFractionBase; @@ -163,7 +165,7 @@ int nContours; int thisContour; boolean dotsOnly; - boolean isFixed; + boolean isFixed; BufferedReader br; @@ -197,11 +199,20 @@ isFunctionXY = false; isCalculation = false; center.set(Float.MAX_VALUE, Float.MAX_VALUE, Float.MAX_VALUE); + anisotropy[0] = anisotropy[1] = anisotropy[2] = 1f; cutoff = Float.MAX_VALUE; super.setProperty("meshID", null, null); return; } + if ("anisotropy" == propertyName) { + Point3f pt = (Point3f) value; + anisotropy[0] = pt.x; + anisotropy[1] = pt.y; + anisotropy[2] = pt.z; + return; + } + if ("center" == propertyName) { center.set((Point3f) value); return; @@ -715,7 +726,7 @@ isJvxlColorMapped = false; isJvxlColorPrecision = false; thisInside = (!isJvxl || thePlane == null); - if(insideOut) + if (insideOut) thisInside = !thisInside; nDataPoints = 0; voxelData = new float[nPointsX][][]; @@ -2834,9 +2845,9 @@ ptXyz.scaleAdd((voxelCounts[0] - 1) / 2f, volumetricVectors[0], ptXyz); ptXyz.scaleAdd((voxelCounts[1] - 1) / 2f, volumetricVectors[1], ptXyz); ptXyz.scaleAdd((voxelCounts[2] - 1) / 2f, volumetricVectors[2], ptXyz); - System.out.println("teset1 "+volumetricOrigin); + System.out.println("teset1 " + volumetricOrigin); volumetricOrigin.sub(center, ptXyz); - System.out.println("teset2 "+volumetricOrigin); + System.out.println("teset2 " + volumetricOrigin); } Point3f pixelPtToXYZ(int x, int y) { @@ -2961,16 +2972,17 @@ void setupOrbital() { psi_radiusAngstroms = autoScaleOrbital(); if (center.x == Float.MAX_VALUE) - psiOrigin.set(0,0,0); + psiOrigin.set(0, 0, 0); else psiOrigin.set(center); for (int i = 0; i < 3; i++) - setVoxelRange(i, -psi_radiusAngstroms, psi_radiusAngstroms, - psi_ptsPerAngstrom, psi_gridMax); + setVoxelRange(i, -psi_radiusAngstroms * anisotropy[i], + psi_radiusAngstroms * anisotropy[i], psi_ptsPerAngstrom, psi_gridMax); jvxlFileHeader = "orbital psi squared\nn=" + psi_n + ", l=" + psi_l + ", m=" + psi_m + " Znuc=" + psi_Znuc + " res=" + psi_ptsPerAngstrom - + " rad=" + psi_radiusAngstroms + "\n"; + + " rad=" + psi_radiusAngstroms + " anisotropy=(" + anisotropy[0] + "," + + anisotropy[1] + "," + anisotropy[2] + ")\n"; jvxlFileHeader += jvxlGetVolumeHeader(); atomCount = 0; @@ -3017,9 +3029,9 @@ double hydrogenAtomPsiAt(Point3f pt, int n, int el, int m) { // ref: http://www.stolaf.edu/people/hansonr/imt/concept/schroed.pdf int abm = Math.abs(m); - float x = pt.x - psiOrigin.x; - float y = pt.y - psiOrigin.y; - float z = pt.z - psiOrigin.z; + float x = (pt.x - psiOrigin.x) / anisotropy[0]; + float y = (pt.y - psiOrigin.y) / anisotropy[1]; + float z = (pt.z - psiOrigin.z) / anisotropy[2]; double x2y2 = x * x + y * y; double r2 = x2y2 + z * z; double r = Math.sqrt(r2); @@ -3263,7 +3275,7 @@ System.out.println(x + " " + y + " " + zValue + " " + (z - zValue)); return z - zValue; } - + void setModelIndex() { if (currentMesh == null) return; @@ -3275,9 +3287,9 @@ currentMesh.modelIndex = -1; } else { currentMesh.modelIndex = viewer.getDisplayModelIndex(); - } + } } - + void setVisibilityFlags(BitSet bs) { /* * set all fixed objects visible; others based on model being displayed @@ -3285,10 +3297,10 @@ */ for (int i = meshCount; --i >= 0;) { Mesh mesh = meshes[i]; - mesh.visibilityFlags = - (mesh.visible && (mesh.modelIndex < 0 || bs.get(mesh.modelIndex)) ? myVisibilityFlag : 0); + mesh.visibilityFlags = (mesh.visible + && (mesh.modelIndex < 0 || bs.get(mesh.modelIndex)) ? myVisibilityFlag + : 0); } } - } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |