Revision: 20133
          http://sourceforge.net/p/jmol/code/20133
Author:   hansonr
Date:     2014-11-26 04:04:14 +0000 (Wed, 26 Nov 2014)
Log Message:
-----------
Jmol.___JmolVersion="14.3.10_2014.11.27"

new feature: isosurface LATTICE + x.x .... 
  -- for periodic lattices only
  -- expands one unit cell by x.x in fractional coordinates
  

Modified Paths:
--------------
    trunk/Jmol/src/org/jmol/jvxl/readers/CastepDensityReader.java
    trunk/Jmol/src/org/jmol/jvxl/readers/Parameters.java
    trunk/Jmol/src/org/jmol/jvxl/readers/PeriodicVolumeFileReader.java
    trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java
    trunk/Jmol/src/org/jmol/jvxl/readers/VaspChgcarReader.java
    trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
    trunk/Jmol/src/org/jmol/viewer/Jmol.properties

Modified: trunk/Jmol/src/org/jmol/jvxl/readers/CastepDensityReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/jvxl/readers/CastepDensityReader.java       
2014-11-25 18:53:34 UTC (rev 20132)
+++ trunk/Jmol/src/org/jmol/jvxl/readers/CastepDensityReader.java       
2014-11-26 04:04:14 UTC (rev 20133)
@@ -95,6 +95,14 @@
 
   @Override
   protected void getPeriodicVoxels() throws Exception {
+    rd();
+    String[] tokens = getTokens();
+    if (nSkip > 0 && tokens.length < 3 + nSurfaces) {
+      for (int j = 0; j < nSkip; j++)
+        for (int i = 0; i < nFilePoints; i++)
+          rd();
+      nSkip = 0;
+    }
     int dsf = downsampleFactor;
     if (dsf > 1) {
       for (int i = 0; i < nFilePoints; i++) {
@@ -119,7 +127,6 @@
         rd();
       }
     }
-
   }
 
   private void skipPoints(int n) {
@@ -135,18 +142,5 @@
     next[0] = pt;
   }
   
-
-  @Override
-  protected void readSkip() throws Exception {
-    rd();
-    String[] tokens = getTokens();
-    if (nSkip > 0 && tokens.length < 3 + nSurfaces) {
-      for (int j = 0; j < nSkip; j++)
-        for (int i = 0; i < nFilePoints; i++)
-          rd();
-      nSkip = 0;
-    }
-  }
-
 }
 

Modified: trunk/Jmol/src/org/jmol/jvxl/readers/Parameters.java
===================================================================
--- trunk/Jmol/src/org/jmol/jvxl/readers/Parameters.java        2014-11-25 
18:53:34 UTC (rev 20132)
+++ trunk/Jmol/src/org/jmol/jvxl/readers/Parameters.java        2014-11-26 
04:04:14 UTC (rev 20133)
@@ -226,6 +226,7 @@
     distance = Float.MAX_VALUE;
     doFullMolecular = false;
     envelopeRadius = 10f;
+    extendLattice = 0;
     fileIndex = 1;
     readAllData = true;
     fileName = "";
@@ -246,9 +247,9 @@
     isMapped = false;
     isPeriodic = false;
     isSilent = false;
-    mapLattice = null;
     logCube = logCompression = false;
     logMessages = Logger.debugging;
+    mapLattice = null;
     mappedDataMin = Float.MAX_VALUE;
     mep_calcType = -1;
     minSet = 0;
@@ -821,6 +822,7 @@
   public VolumeData volumeData;
   public ContactPair contactPair;
   public P3 mapLattice;
+  public float extendLattice;
   public boolean isMapped;
   public boolean showTiming;
   public float pointSize;

Modified: trunk/Jmol/src/org/jmol/jvxl/readers/PeriodicVolumeFileReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/jvxl/readers/PeriodicVolumeFileReader.java  
2014-11-25 18:53:34 UTC (rev 20132)
+++ trunk/Jmol/src/org/jmol/jvxl/readers/PeriodicVolumeFileReader.java  
2014-11-26 04:04:14 UTC (rev 20133)
@@ -6,25 +6,51 @@
   protected void readSurfaceData(boolean isMapData) throws Exception {
     initializeSurfaceData();
     voxelData = new float[nPointsX][nPointsY][nPointsZ];
-    readSkip();
     getPeriodicVoxels();
+    if (params.extendLattice > 0) {
+      float f = params.extendLattice;
+      int[] n = new int[3];
+      int nx = nPointsX - 1;
+      int ny = nPointsY - 1;
+      int nz = nPointsZ - 1;
+      for (int i = 0; i < 3; i++) {
+        int vi = voxelCounts[i] - 1;
+        n[i] = (int) (vi * f);
+        volumetricOrigin.scaleAdd2(-n[i], volumetricVectors[i],
+            volumetricOrigin);
+        vi += 2 * n[i];
+        while (n[i] > 0)
+          n[i] -= voxelCounts[i] - 1;
+        voxelCounts[i] = vi + 1;
+      }
+      nPointsX = voxelCounts[0];
+      nPointsY = voxelCounts[1];
+      nPointsZ = voxelCounts[2];
+      float[][][] vd = new float[nPointsX][nPointsY][nPointsZ];
+      for (int i = nPointsX; --i >= 0;)
+        for (int j = nPointsY; --j >= 0;)
+          for (int k = nPointsZ; --k >= 0;) {
+            vd[i][j][k] = voxelData[(i - n[0]) % nx][(j - n[1]) % ny][(k - 
n[2]) % nz];
+          }
+      voxelData = vd;
+    } else {
 
-    // add in periodic face data
+      // add in periodic face data
 
-    int n;
-    n = nPointsX - 1;
-    for (int i = 0; i < nPointsY; ++i)
-      for (int j = 0; j < nPointsZ; ++j)
-        voxelData[n][i][j] = voxelData[0][i][j];
-    n = nPointsY - 1;
-    for (int i = 0; i < nPointsX; ++i)
-      for (int j = 0; j < nPointsZ; ++j)
-        voxelData[i][n][j] = voxelData[i][0][j];
-    n = nPointsZ - 1;
-    for (int i = 0; i < nPointsX; ++i)
-      for (int j = 0; j < nPointsY; ++j)
-        voxelData[i][j][n] = voxelData[i][j][0];
-
+      int n;
+      n = nPointsX - 1;
+      for (int i = 0; i < nPointsY; ++i)
+        for (int j = 0; j < nPointsZ; ++j)
+          voxelData[n][i][j] = voxelData[0][i][j];
+      n = nPointsY - 1;
+      for (int i = 0; i < nPointsX; ++i)
+        for (int j = 0; j < nPointsZ; ++j)
+          voxelData[i][n][j] = voxelData[i][0][j];
+      n = nPointsZ - 1;
+      for (int i = 0; i < nPointsX; ++i)
+        for (int j = 0; j < nPointsY; ++j)
+          voxelData[i][j][n] = voxelData[i][j][0];
+    }
     // for map data, just pick out near points and get rid of voxelData
 
     if (isMapData && volumeData.hasPlane()) {
@@ -41,12 +67,14 @@
       voxelData = null;
     }
     volumeData.setVoxelDataAsArray(voxelData);
-    
+
     if (dataMin > params.cutoff)
       params.cutoff = 2 * dataMin;
   }
 
   protected abstract void getPeriodicVoxels() throws Exception;
-  protected abstract void readSkip() throws Exception;
 
+  static {
+    System.out.println(-5 % 10);
+  }
 }

Modified: trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java
===================================================================
--- trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java  2014-11-25 
18:53:34 UTC (rev 20132)
+++ trunk/Jmol/src/org/jmol/jvxl/readers/SurfaceGenerator.java  2014-11-26 
04:04:14 UTC (rev 20133)
@@ -803,6 +803,11 @@
       return true;
     }
 
+    if ("extendLattice" == propertyName) {
+      params.extendLattice = ((Float) value).floatValue();
+      return true;
+    }
+
     // / final actions ///
 
     if ("property" == propertyName) {

Modified: trunk/Jmol/src/org/jmol/jvxl/readers/VaspChgcarReader.java
===================================================================
--- trunk/Jmol/src/org/jmol/jvxl/readers/VaspChgcarReader.java  2014-11-25 
18:53:34 UTC (rev 20132)
+++ trunk/Jmol/src/org/jmol/jvxl/readers/VaspChgcarReader.java  2014-11-26 
04:04:14 UTC (rev 20133)
@@ -137,13 +137,6 @@
     }
   }
 
-
-  @Override
-  protected void readSkip() throws Exception {
-    // n/a
-  }
-
-
 }
 
 

Modified: trunk/Jmol/src/org/jmol/scriptext/CmdExt.java
===================================================================
--- trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2014-11-25 18:53:34 UTC 
(rev 20132)
+++ trunk/Jmol/src/org/jmol/scriptext/CmdExt.java       2014-11-26 04:04:14 UTC 
(rev 20133)
@@ -4153,7 +4153,8 @@
                   sigma = 3;
                 addShapeProperty(propertyList, "sign", Boolean.TRUE);
               }
-              showString("using cutoff = " + cutoff + (Float.isNaN(sigma) ? "" 
: " sigma=" + sigma));
+              showString("using cutoff = " + cutoff
+                  + (Float.isNaN(sigma) ? "" : " sigma=" + sigma));
               if (!Float.isNaN(sigma)) {
                 cutoff *= sigma;
                 sigma = Float.NaN;
@@ -4271,23 +4272,30 @@
       case T.lattice:
         if (iShape != JC.SHAPE_ISOSURFACE)
           invArg();
-        pt = getPoint3f(eval.iToken + 1, false);
-        i = eval.iToken;
-        if (pt.x <= 0 || pt.y <= 0 || pt.z <= 0)
-          break;
-        pt.x = (int) pt.x;
-        pt.y = (int) pt.y;
-        pt.z = (int) pt.z;
-        sbCommand.append(" lattice ").append(Escape.eP(pt));
-        if (isMapped) {
-          propertyName = "mapLattice";
-          propertyValue = pt;
+        if (tokAt(i + 1) == T.plus) {
+          i += 2;
+          propertyName = "extendLattice";
+          propertyValue = Float.valueOf(floatParameter(i));
+          sbCommand.append(" lattice + " + propertyValue);
         } else {
-          lattice = pt;
-          if (tokAt(i + 1) == T.on) {
-            sbCommand.append(" true");
-            processLattice = true;
-            i++;
+          pt = getPoint3f(i + 1, false);
+          i = eval.iToken;
+          if (pt.x <= 0 || pt.y <= 0 || pt.z <= 0)
+            break;
+          pt.x = (int) pt.x;
+          pt.y = (int) pt.y;
+          pt.z = (int) pt.z;
+          sbCommand.append(" lattice ").append(Escape.eP(pt));
+          if (isMapped) {
+            propertyName = "mapLattice";
+            propertyValue = pt;
+          } else {
+            lattice = pt;
+            if (tokAt(i + 1) == T.on) {
+              sbCommand.append(" true");
+              processLattice = true;
+              i++;
+            }
           }
         }
         break;

Modified: trunk/Jmol/src/org/jmol/viewer/Jmol.properties
===================================================================
--- trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2014-11-25 18:53:34 UTC 
(rev 20132)
+++ trunk/Jmol/src/org/jmol/viewer/Jmol.properties      2014-11-26 04:04:14 UTC 
(rev 20133)
@@ -15,8 +15,14 @@
 TODO: design and implement sidechain mutation -- MUTATE command ?
 TODO: remove HTML5 dependency on synchronous file loading (check SCRIPT 
command for problems)
 
-Jmol.___JmolVersion="14.3.10_2014.11.26"
+Jmol.___JmolVersion="14.3.10_2014.11.27"
 
+new feature: isosurface LATTICE + x.x .... 
+  -- for periodic lattices only
+  -- expands one unit cell by x.x in fractional coordinates
+  
+JmolVersion="14.3.10_2014.11.26"
+
 bug fix: hover OFF disables hover callback, but should not
 bug fix: reading of JVXL file saved with noFill still does fill
 bug fix: CASTEP DENSITY surface file reader does not do downsampling

This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.


------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=157005751&iu=/4140/ostg.clktrk
_______________________________________________
Jmol-commits mailing list
Jmol-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jmol-commits

Reply via email to