Index: src/Jobs/InterfaceVMGJob.cpp
===================================================================
--- src/Jobs/InterfaceVMGJob.cpp	(revision 17fcbe7a4a60ff1616ecb9b7e16b3917a0c70c1e)
+++ src/Jobs/InterfaceVMGJob.cpp	(revision a1436b30558f015098c13d123357549c76c5af31)
@@ -99,4 +99,13 @@
   //grid.ClearBoundary(); // we don't have a boundary under periodic boundary conditions
 
+  // print debugging info on grid size
+  LOG(1, "INFO: Mesh has extent " << grid.Extent().MeshWidth() << ".");
+  const int gridpoints = pow(2, level);
+  LOG(1, "INFO: gridpoints on finest level are " << gridpoints << ".");
+  LOG(1, "INFO: "
+      << "X in [" << grid.Local().Begin().X() << "," << grid.Local().End().X() << "],"
+      << "Y in [" << grid.Local().Begin().Y() << "," << grid.Local().End().Y() << "],"
+      << "Z in [" << grid.Local().Begin().Z() << "," << grid.Local().End().Z() << "].");
+
   /// 1. assign nuclei as smeared-out charges to the grid
 
@@ -124,24 +133,17 @@
   comm.CommFromGhosts(particle_grid);
 
-//  // for normlization sum up charges
-//  double particle_charges = 0.0;
-//  for (std::list<Particle::Particle>::iterator iter=particles.begin(); iter!=particles.end(); ++iter)
-//    particle_charges += iter->Charge();
-//  particle_charges = MG::GetComm()->GlobalSumRoot(particle_charges);
-//  LOG(1, "INFO: Total charge is " << particle_charges << ".");
+  // print nuclei grid to vtk
+  comm.PrintGrid(particle_grid, "Sampled Nuclei Density");
 
   // add sampled electron charge density onto grid
   std::vector<double>::const_iterator sample_iter = sampled_input.begin();
-  for (Grid::iterator iter = particle_grid.Iterators().Local().Begin();
-      iter != particle_grid.Iterators().Local().End();
+  for (Grid::iterator iter = grid.Iterators().Local().Begin();
+      iter != grid.Iterators().Local().End();
       ++iter)
-    particle_grid(*iter) -= (*sample_iter++);
-/*
-  for (i.X()=grid.Local().Begin().X(); i.X()<grid.Local().End().X(); ++i.X())
-    for (i.Y()=grid.Local().Begin().Y(); i.Y()<grid.Local().End().Y(); ++i.Y())
-      for (i.Z()=grid.Local().Begin().Z(); i.Z()<grid.Local().End().Z(); ++i.Z())
-        particle_grid(i) -= (*sample_iter++); //temp_grid(i);
-*/
+    grid(*iter) = -1. * (*sample_iter++);
   assert( sample_iter == sampled_input.end() );
+
+  // print electron grid to vtk
+  comm.PrintGrid(grid, "Sampled Electron Density");
 
   // add particle_grid onto grid
@@ -151,21 +153,11 @@
   grid(grid.Local().Begin().X() + i,
        grid.Local().Begin().Y() + j,
-       grid.Local().Begin().Z() + k) = 4.0 * VMG::Math::pi *
+       grid.Local().Begin().Z() + k) = 4.0 * VMG::Math::pi * (
+           grid(grid.Local().Begin().X() + i,
+                  grid.Local().Begin().Y() + j,
+                  grid.Local().Begin().Z() + k) +
     particle_grid.GetVal(particle_grid.Local().Begin().X() + i,
              particle_grid.Local().Begin().Y() + j,
-             particle_grid.Local().Begin().Z() + k);
-
-  /// 2. add sampled electron density to the grid
-
-  const Index begin_local = grid.Global().LocalBegin() - grid.Local().HaloSize1();
-
-  // print debugging info on grid size
-  LOG(1, "INFO: Mesh has extent " << grid.Extent().MeshWidth() << ".");
-  const int gridpoints = pow(2, level);
-  LOG(1, "INFO: gridpoints on finest level are " << gridpoints << ".");
-  LOG(1, "INFO: "
-      << "X in [" << grid.Local().Begin().X() << "," << grid.Local().End().X() << "],"
-      << "Y in [" << grid.Local().Begin().Y() << "," << grid.Local().End().Y() << "],"
-      << "Z in [" << grid.Local().Begin().Z() << "," << grid.Local().End().Z() << "].");
+             particle_grid.Local().Begin().Z() + k));
 
   // calculate sum over grid times h^3 as check, should be roughly zero
@@ -179,6 +171,6 @@
   comm.PrintStringOnce("Grid charge integral: %e", charge_sum/(4.0 * VMG::Math::pi));
 
-  // print input grid to vtk
-  comm.PrintGrid(grid, "grid after ImportRightHandSide");
+  // print total grid to vtk
+  comm.PrintGrid(grid, "Total Charge Density");
 
 //  delete temp_grid;
@@ -188,5 +180,5 @@
 {
   // grid now contains the sough-for potential
-  VMG::Comm& comm = *VMG::MG::GetComm();
+  Comm& comm = *MG::GetComm();
 
   const Index begin_local = grid.Global().LocalBegin() - grid.Local().HaloSize1();
@@ -194,5 +186,5 @@
 
   // print output grid to vtk
-  comm.PrintGrid(grid, "grid after ExportSolution");
+  comm.PrintGrid(grid, "Potential Solution");
 
   // obtain sampled potential from grid
