From 33ce5f6e9983a18945fb379c5d486cb6d7463fc3 Mon Sep 17 00:00:00 2001
From: Chris Maffeo <cmaffeo2@illinois.edu>
Date: Mon, 30 Sep 2019 16:18:34 -0500
Subject: [PATCH] Fixed sign error in computeTabulatedEnergyKernel

---
 src/ComputeForce.cuh | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/ComputeForce.cuh b/src/ComputeForce.cuh
index d0d1f86..babbe0a 100644
--- a/src/ComputeForce.cuh
+++ b/src/ComputeForce.cuh
@@ -847,11 +847,11 @@ __global__ void computeTabulatedEnergyKernel(Vector3* force, const Vector3* __re
 		
 		if (tablePot[ind] != NULL && d2 <= cutoff2) { 
 			EnergyForce fe = tablePot[ind]->compute(dr,d2);
-			atomicAdd( &force[ai], -fe.f );
-			atomicAdd( &force[aj],  fe.f );
+			atomicAdd( &force[ai],  fe.f );
+			atomicAdd( &force[aj], -fe.f );
 			// RBTODO: reduce energies
-			atomicAdd( &(g_energies[ai]), fe.e );
-			atomicAdd( &(g_energies[aj]), fe.e );
+			atomicAdd( &(g_energies[ai]), fe.e*0.5f );
+			atomicAdd( &(g_energies[aj]), fe.e*0.5f );
 		}
 	}
 }
-- 
GitLab