Index: configure.ac
===================================================================
--- configure.ac	(revision 8a8c8c804fad49bc435d83757fd9744a46a45bee)
+++ configure.ac	(revision 69c73300e331c0e82ee133aff558328a4ce1705a)
@@ -210,4 +210,5 @@
   AC_SUBST(VMG_CFLAGS)
   AC_SUBST(VMG_LIBS)
+  AC_DEFINE(HAVE_VMG,1, ["use VMG to calculate long-range contributions."])
 
   # check whether to use mpi
Index: src/Actions/FragmentationAction/FragmentationAutomationAction.cpp
===================================================================
--- src/Actions/FragmentationAction/FragmentationAutomationAction.cpp	(revision 8a8c8c804fad49bc435d83757fd9744a46a45bee)
+++ src/Actions/FragmentationAction/FragmentationAutomationAction.cpp	(revision 69c73300e331c0e82ee133aff558328a4ce1705a)
@@ -61,4 +61,7 @@
 #include "Jobs/MPQCData.hpp"
 #include "Jobs/MPQCData_printKeyNames.hpp"
+#ifdef HAVE_VMG
+#include "Jobs/VMGJob.hpp"
+#endif
 #include "molecule.hpp"
 #include "World.hpp"
@@ -448,4 +451,25 @@
 }
 
+#ifdef HAVE_VMG
+bool createLongRangeJobs(
+    FragmentController &controller,
+    const FragmentationFragmentationAutomationAction::FragmentationFragmentationAutomationParameters &params,
+    const size_t NoJobs)
+{
+  const int GRID = pow(2,5);
+  std::vector<FragmentJob::ptr> jobs;
+  std::vector< double > sampled_input (GRID*GRID*GRID, 0.);
+  for (size_t i=0; i< NoJobs; ++i) {
+    const JobId_t next_id = controller.getAvailableId();
+    LOG(1, "INFO: Creating VMGJob.");
+    FragmentJob::ptr testJob( new VMGJob(next_id, sampled_input) );
+    jobs.push_back(testJob);
+  }
+  controller.addJobs(jobs);
+  controller.sendJobs(params.host.get(), params.port.get());
+  return true;
+}
+#endif
+
 void WaitforResults(
     boost::asio::io_service &io_service,
@@ -483,25 +507,42 @@
   RunService(io_service, "Requesting ids");
 
-  // Phase Two: create and add jobs
+  // Phase Two: create and add MPQCJobs
   if (!createJobsFromFiles(controller, params, jobfiles))
     return Action::failure;
-  RunService(io_service, "Adding jobs");
+  RunService(io_service, "Adding MPQCJobs");
 
   // Phase Three: calculate result
   WaitforResults(io_service, controller, params, jobfiles.size());
-
-  // Phase Three: get result
   controller.receiveResults(params.host.get(), params.port.get());
-  RunService(io_service, "Phase Four");
-
-  // Final phase: print result
+  RunService(io_service, "Requesting short-range results");
+
+  // print intermediate short-range results
   {
     LOG(1, "INFO: Parsing fragment files from " << params.path.get() << ".");
-    std::vector<FragmentResult::ptr> results = controller.getReceivedResults();
+    std::vector<FragmentResult::ptr> MPQCresults = controller.getReceivedResults();
     printReceivedMPQCResults(
-        results,
+        MPQCresults,
         params.path.get(),
         getNoAtomsFromAdjacencyFile(params.path.get()));
   }
+
+#ifdef HAVE_VMG
+  if (params.DoLongrange.get()) {
+  // Phase Four: obtain more ids
+  requestIds(controller, params, jobfiles.size()+1); // one more for the big job
+  RunService(io_service, "Requesting ids");
+
+  // Phase Five: create VMGJobs
+  if (!createLongRangeJobs(controller, params, jobfiles.size()+1))
+    return Action::failure;
+  RunService(io_service, "Adding VMGJobs");
+
+  // Phase Six: calculate result
+  WaitforResults(io_service, controller, params, jobfiles.size()+1);
+  controller.receiveResults(params.host.get(), params.port.get());
+  RunService(io_service, "Requesting long-range results");
+  std::vector<FragmentResult::ptr> VMGresults = controller.getReceivedResults();
+  }
+#endif
   size_t Exitflag = controller.getExitflag();
 
Index: src/Actions/FragmentationAction/FragmentationAutomationAction.def
===================================================================
--- src/Actions/FragmentationAction/FragmentationAutomationAction.def	(revision 8a8c8c804fad49bc435d83757fd9744a46a45bee)
+++ src/Actions/FragmentationAction/FragmentationAutomationAction.def	(revision 69c73300e331c0e82ee133aff558328a4ce1705a)
@@ -20,9 +20,9 @@
 // ValueStorage by the token "Z" -> first column: int, Z, "Z"
 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
-#define paramtypes (std::vector< boost::filesystem::path >)(std::string)(std::string)(std::string)(boost::filesystem::path)
-#define paramtokens ("fragment-jobs")("fragment-path")("server-address")("server-port")("fragment-executable")
-#define paramdescriptions ("vector of fragment files")("prefix of each fragment file")("hostname of server")("controller port of server")("executable to launch on clients")
-#define paramdefaults (NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT("127.0.0.1"))(PARAM_DEFAULT("1026"))(NOPARAM_DEFAULT)
-#define paramreferences (jobfiles)(path)(host)(port)(executable)
+#define paramtypes (std::vector< boost::filesystem::path >)(std::string)(std::string)(std::string)(boost::filesystem::path)(bool)
+#define paramtokens ("fragment-jobs")("fragment-path")("server-address")("server-port")("fragment-executable")("DoLongrange")
+#define paramdescriptions ("vector of fragment files")("prefix of each fragment file")("hostname of server")("controller port of server")("executable to launch on clients")("whether to calculate long-range contributions")
+#define paramdefaults (NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT("127.0.0.1"))(PARAM_DEFAULT("1026"))(NOPARAM_DEFAULT)(PARAM_DEFAULT("0"))
+#define paramreferences (jobfiles)(path)(host)(port)(executable)(DoLongrange)
 #define paramvalids \
 (STLVectorValidator< std::vector< boost::filesystem::path > >(ParserFileValidator() && FilePresentValidator())) \
@@ -30,5 +30,6 @@
 (DummyValidator< std::string >()) \
 (DummyValidator< std::string >()) \
-(DummyValidator< boost::filesystem::path >())
+(DummyValidator< boost::filesystem::path >()) \
+(DummyValidator< bool >())
 
 #undef statetypes
Index: tests/Python/AllActions/options.dat
===================================================================
--- tests/Python/AllActions/options.dat	(revision 8a8c8c804fad49bc435d83757fd9744a46a45bee)
+++ tests/Python/AllActions/options.dat	(revision 69c73300e331c0e82ee133aff558328a4ce1705a)
@@ -58,4 +58,5 @@
 domain-position	"0 0 0"
 domain-position	"10. 10. 10."
+DoLongrange	"0"
 DoRotate	"0"
 DoSaturate	"0"
