Commits

Rio Yokota committed 8f0275c

Added dipole correction to wrappers.

  • Participants
  • Parent commits 90a1214

Comments (0)

Files changed (3)

File Makefile.include

 VTK_LIBRARY_PATH = /usr/lib/vtk-5.8
 
 ### choose CPU or GPU
-#DEVICE  = CPU
-DEVICE  = GPU
+DEVICE  = CPU
+#DEVICE  = GPU
 
 ### choose Cartesian or spherical expansion
 #EXPAND  = Cartesian

File wrapper/parallel_coulombVdW.cxx

     }
   }
 #endif
+  double fc[3];
+  for( int d=0; d!=3; ++d ) fc[d]=0;
+  for( int i=0; i!=ni; ++i ) {
+    for( int d=0; d!=3; ++d ) {
+      fc[d] += qi[i] * xi[3*i+d];
+    }
+  }
+  if( tblno == 0 ) {
+    for( int i=0; i!=ni; ++i ) {
+      for( int d=0; d!=3; ++d ) {
+        fi[3*i+d] -= 4.0 * M_PI * qi[i] * fc[d] / (3.0 * size * size * size);
+      }
+    }
+  } else {
+    for( int i=0; i!=ni; ++i ) {
+      fi[3*i+0] += M_PI / (3.0 * size * size * size)
+                * (fc[0] * fc[0] + fc[1] * fc[1] + fc[2] * fc[2]) / ni;
+    }
+  }
 }
 
 extern "C" void FMMcalcvdw_ij(int ni, double* xi, int* atypei, double* fi,

File wrapper/serial_coulombVdW.cxx

     break;
   }
 #endif
+  double fc[3];
+  for( int d=0; d!=3; ++d ) fc[d]=0;
+  for( int i=0; i!=ni; ++i ) { 
+    for( int d=0; d!=3; ++d ) { 
+      fc[d] += qi[i] * xi[3*i+d];
+    }   
+  }
+  if( tblno == 0 ) { 
+    for( int i=0; i!=ni; ++i ) { 
+      for( int d=0; d!=3; ++d ) {
+        fi[3*i+d] -= 4.0 * M_PI * qi[i] * fc[d] / (3.0 * size * size * size);
+      }
+    }   
+  } else {
+    for( int i=0; i!=ni; ++i ) { 
+      fi[3*i+0] += M_PI / (3.0 * size * size * size)
+                * (fc[0] * fc[0] + fc[1] * fc[1] + fc[2] * fc[2]) / ni;
+    }   
+  }
 }
 
 extern "C" void FMMcalcvdw_ij(int ni, double* xi, int* atypei, double* fi,