From 17976d984aaeda5fe97bf2cc79c5570fc04fdaec Mon Sep 17 00:00:00 2001
From: Chris Maffeo <cmaffeo2@illinois.edu>
Date: Thu, 24 Mar 2016 18:49:48 -0500
Subject: [PATCH] made grids in updatekernel use linear interpolation

---
 GrandBrownTown.cuh | 15 ++++++++-------
 notes.org          | 11 ++++++++---
 2 files changed, 16 insertions(+), 10 deletions(-)

diff --git a/GrandBrownTown.cuh b/GrandBrownTown.cuh
index fb70114..e30079f 100644
--- a/GrandBrownTown.cuh
+++ b/GrandBrownTown.cuh
@@ -34,13 +34,13 @@ void updateKernel(Vector3 pos[], Vector3 forceInternal[],
 		Vector3 forceExternal = Vector3(0.0f, 0.0f, pt.charge * electricField);
 
 		// Compute PMF
-		ForceEnergy fe = pt.pmf->interpolateForceD(p);
+		ForceEnergy fe = pt.pmf->interpolateForceDLinearly(p);
 
 #ifndef FORCEGRIDOFF
 		// Add a force defined via 3D FORCE maps (not 3D potential maps)
-		if (pt.forceXGrid != NULL) fe.f.x += pt.forceXGrid->interpolatePotential(p);
-		if (pt.forceYGrid != NULL) fe.f.y += pt.forceYGrid->interpolatePotential(p);
-		if (pt.forceZGrid != NULL) fe.f.z += pt.forceZGrid->interpolatePotential(p);		
+		if (pt.forceXGrid != NULL) fe.f.x += pt.forceXGrid->interpolatePotentialLinearly(p);
+		if (pt.forceYGrid != NULL) fe.f.y += pt.forceYGrid->interpolatePotentialLinearly(p);
+		if (pt.forceZGrid != NULL) fe.f.z += pt.forceZGrid->interpolatePotentialLinearly(p);		
 #endif
 
 		// Compute total force:
@@ -53,14 +53,15 @@ void updateKernel(Vector3 pos[], Vector3 forceInternal[],
 			forceInternal[idx] = force; // write it back out for force0 in run()
 
 		// Get local kT value
-		float kTlocal = (tGridLength == 0) ? kT : kTGrid->interpolatePotential(p);
+		float kTlocal = (tGridLength == 0) ? kT : kTGrid->interpolatePotentialLinearly(p);
 
 		// Update the particle's position using the calculated values for time, force, etc.
 		if (pt.diffusionGrid == NULL) {
 			p = step(p, kTlocal, force, pt.diffusion, timestep, sys, randoGen, num);
 		} else {
-			float diffusion = pt.diffusionGrid->interpolatePotential(p);
-			Vector3 diffGrad = (pt.diffusionGrid->interpolateForceD(p)).f;
+			ForceEnergy diff = pt.diffusionGrid->interpolateForceDLinearly(p);
+			float& diffusion = diff.e;
+			Vector3& diffGrad = diff.f;
 			p = step(p, kTlocal, force, diffusion, -diffGrad, timestep, sys, randoGen, num);
 		}
 	}
diff --git a/notes.org b/notes.org
index d145483..6feeb1a 100644
--- a/notes.org
+++ b/notes.org
@@ -1,11 +1,16 @@
 
 
-
-
 * TODO active
+** fix segfaults
+** move to efficient linear interpolation everywhere
+** update pairlists
+** statistical tests of results
 
 * TODO eventually
-** 
+** increase cells/cutoff
+
+** improve pairlist algorithm
+http://arxiv.org/pdf/1306.1737.pdf
 ** RB periodic boundaries?
 ** RB read restart file
 ** RB throw exception if an RB type uses a grid key multiple times
-- 
GitLab