Revision: 5165
Author: hansonr
Date: 2006-05-24 11:05:46 -0700 (Wed, 24 May 2006)
ViewCVS: http://svn.sourceforge.net/jmol/?rev=5165&view=rev
Log Message:
-----------
bob200603 isosurface allowance for cube files with no atoms (in terms of
creating JVXL file data only).
Modified Paths:
--------------
branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java
Modified: branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java
===================================================================
--- branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-05-24
03:57:59 UTC (rev 5164)
+++ branches/bob200603/Jmol/src/org/jmol/viewer/Isosurface.java 2006-05-24
18:05:46 UTC (rev 5165)
@@ -254,11 +254,14 @@
int atomCount;
boolean negativeAtomCount;
-
+
void readAtomCountAndOrigin() throws Exception {
- line = br.readLine();
- jvxlHeader += line + "\n";
+ String atomLine = line = br.readLine();
atomCount = parseInt(line);
+ if (atomCount == 0) {
+ atomLine = "-1 " + line.substring(ichNextParse);
+ }
+ jvxlHeader += atomLine + "\n";
volumetricOrigin.x = parseFloat(line, ichNextParse);
volumetricOrigin.y = parseFloat(line, ichNextParse);
volumetricOrigin.z = parseFloat(line, ichNextParse);
@@ -290,7 +293,6 @@
void readAtoms() throws Exception {
for (int i = 0; i < atomCount; ++i) {
jvxlHeader += br.readLine() + "\n";
-
/*
Atom atom = atomSetCollection.addNewAtom();
atom.elementNumber = (byte)parseInt(line);
@@ -300,24 +302,29 @@
atom.z = parseFloat(line, ichNextParse) * ANGSTROMS_PER_BOHR;
*/
}
+ if (atomCount == 0)
+ jvxlHeader += "1 1.0 0.0 0.0 0.0 //BOGUS H ATOM ADDED FOR JVXL FORMAT\n";
}
boolean isJvxl = false;
int readExtraLine() throws Exception {
- if (!negativeAtomCount)
- return 1;
- int nSurfaces = parseInt(line = br.readLine());
+ int nSurfaces;
jvxlFileData = jvxlHeader;
- isJvxl = (nSurfaces < 0);
- if (isJvxl) {
- nSurfaces = -nSurfaces;
- edgeFractionBase = (char) parseInt(line, ichNextParse);
- edgeFractionRange = parseFloat(line, ichNextParse);
- System.out.println("JVXL reading base: " + edgeFractionBase + " range: "
- + edgeFractionRange);
+ if (negativeAtomCount) {
+ nSurfaces = parseInt(line = br.readLine());
+ isJvxl = (nSurfaces < 0);
+ if (isJvxl) {
+ nSurfaces = -nSurfaces;
+ edgeFractionBase = (char) parseInt(line, ichNextParse);
+ edgeFractionRange = parseFloat(line, ichNextParse);
+ System.out.println("JVXL reading base: " + edgeFractionBase
+ + " range: " + edgeFractionRange);
+ }
+ } else {
+ nSurfaces = 1;
}
jvxlFileData += "-1 " + (int) edgeFractionBase + " "
- + (int) edgeFractionRange + " Jmol voxel format version 0.9a" + "\n";
+ + (int) edgeFractionRange + " Jmol voxel format version 0.9a" + "\n";
return nSurfaces;
}
@@ -328,7 +335,6 @@
String edgeData;
void readVoxelData() throws Exception {
- System.out.println("entering readVoxelData for fileIndex = " + fileIndex);
ichNextParse = 0;
thisValue = Integer.MIN_VALUE;
nThisValue = 0;
@@ -338,16 +344,18 @@
edgeData = "";
nBytes = 0;
thisInside = true;
- nDataPoints = 1;
+ nDataPoints = 0;
int voxelCountX = voxelCounts[0];
int voxelCountY = voxelCounts[1];
int voxelCountZ = voxelCounts[2];
+ System.out.println("entering readVoxelData for fileIndex = " + fileIndex
+ + "; " + (voxelCountX * voxelCountY * voxelCountZ) + " voxels");
voxelData = new float[voxelCountX][][];
skipData(fileIndex - 1);
if (isJvxl) {
- br.readLine(); //skip definition line for now
+ br.readLine(); // skip definition line for now
System.out.println("jvxl data set: " + line);
- cutoff = 0.5f; //just 0s and 1s here. detail is in the edgeFractions
+ cutoff = 0.5f; // just 0s and 1s here. detail is in the edgeFractions
}
line = "";
for (int x = 0; x < voxelCountX; ++x) {
@@ -359,21 +367,21 @@
for (int z = 0; z < voxelCountZ; ++z) {
float voxelValue = getNextVoxelValue();
strip[z] = voxelValue;
- if (! isJvxl) {
+ ++nDataPoints;
+ if (!isJvxl) {
boolean isInside = ((cutoff > 0 && voxelValue >= cutoff) ||
(cutoff < 0 && voxelValue <= cutoff));
if (inside == isInside) {
dataCount++;
} else {
surfaceData += " " + dataCount;
- ++nDataPoints;
- dataCount = 1;
+ dataCount = 1;
inside = !inside;
}
}
}
}
}
- if (! isJvxl) {
+ if (!isJvxl) {
surfaceData += " " + dataCount + "\n";
}
System.out.println("Successfully read " + voxelCountX + " x " + voxelCountY
@@ -405,7 +413,7 @@
if (Float.isNaN(voxelValue)) {
line = br.readLine();
if (line == null || Float.isNaN(voxelValue = parseFloat(line))) {
- System.out.println("end of file in CubeReader? (line):" + line);
+ System.out.println("end of file in CubeReader? nDataPoints="+
nDataPoints + " (line):" + line);
throw new NullPointerException();
}
nBytes += line.length() + 1;
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
-------------------------------------------------------
All the advantages of Linux Managed Hosting--Without the Cost and Risk!
Fully trained technicians. The highest number of Red Hat certifications in
the hosting industry. Fanatical Support. Click to learn more
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=107521&bid=248729&dat=121642
_______________________________________________
Jmol-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jmol-commits