Index: src/Actions/PotentialAction/FitParticleChargesAction.cpp
===================================================================
--- src/Actions/PotentialAction/FitParticleChargesAction.cpp	(revision 550f2a98ea5244ef1fc747f6debbc4635e941f7c)
+++ src/Actions/PotentialAction/FitParticleChargesAction.cpp	(revision 9b68fc02f36ed091c9bb88104aedd4c88c66f0dd)
@@ -47,4 +47,5 @@
 #include <boost/foreach.hpp>
 #include <algorithm>
+#include <functional>
 #include <iostream>
 #include <string>
@@ -128,34 +129,53 @@
     return Action::failure;
   }
+
+  // average partial charges over all fragments
   HomologyContainer::const_iterator iter = range.first;
-  if (!iter->second.containsGrids) {
-    ELOG(2, "This HomologyGraph does not contain sampled grids,\ndid you forget to add '--store-grids 1' to AnalyseFragmentResults.");
-    return Action::failure;
+  PartialNucleiChargeFitter::charges_t averaged_charges;
+  averaged_charges.resize(iter->second.fragment.getCharges().size(), 0.);
+  size_t NoFragments = 0;
+  for (;
+      iter != range.second; ++iter, ++NoFragments) {
+    if (!iter->second.containsGrids) {
+      ELOG(2, "This HomologyGraph does not contain sampled grids,\ndid you forget to add '--store-grids 1' to AnalyseFragmentResults.");
+      return Action::failure;
+    }
+    const Fragment &fragment = iter->second.fragment;
+  //  const double &energy = iter->second.energy;
+  //  const SamplingGrid &charge = iter->second.charge_distribution;
+    const SamplingGrid &potential = iter->second.potential_distribution;
+    if ((potential.level == 0)
+        || ((potential.begin[0] == potential.end[0])
+            && (potential.begin[1] == potential.end[1])
+            && (potential.begin[2] == potential.end[2]))) {
+      ELOG(1, "Sampled grid contains grid made of zero points.");
+      return Action::failure;
+    }
+
+    // then we extract positions from fragment
+    PartialNucleiChargeFitter::positions_t positions;
+    Fragment::positions_t fragmentpositions = fragment.getPositions();
+    positions.reserve(fragmentpositions.size());
+    BOOST_FOREACH( Fragment::position_t pos, fragmentpositions) {
+      positions.push_back( Vector(pos[0], pos[1], pos[2]) );
+    }
+    PartialNucleiChargeFitter fitter(potential, positions, params.radius.get());
+    fitter();
+    PartialNucleiChargeFitter::charges_t return_charges = fitter.getSolutionAsCharges_t();
+    std::transform(
+        return_charges.begin(), return_charges.end(),
+        averaged_charges.begin(),
+        averaged_charges.begin(),
+        std::plus<PartialNucleiChargeFitter::charge_t>());
   }
-  const Fragment &fragment = iter->second.fragment;
-//  const double &energy = iter->second.energy;
-//  const SamplingGrid &charge = iter->second.charge_distribution;
-  const SamplingGrid &potential = iter->second.potential_distribution;
-  if ((potential.level == 0)
-      || ((potential.begin[0] == potential.end[0])
-          && (potential.begin[1] == potential.end[1])
-          && (potential.begin[2] == potential.end[2]))) {
-    ELOG(1, "Sampled grid contains grid made of zero points.");
-    return Action::failure;
-  }
+  std::transform(averaged_charges.begin(),averaged_charges.end(),
+      averaged_charges.begin(),
+      std::bind1st(std::multiplies<PartialNucleiChargeFitter::charge_t>(),1./NoFragments)
+  );
 
-  // then we extract positions from fragment
-  PartialNucleiChargeFitter::positions_t positions;
-  Fragment::positions_t fragmentpositions = fragment.getPositions();
-  positions.reserve(fragmentpositions.size());
-  BOOST_FOREACH( Fragment::position_t pos, fragmentpositions) {
-    positions.push_back( Vector(pos[0], pos[1], pos[2]) );
-  }
-  PartialNucleiChargeFitter fitter(potential, positions, params.radius.get());
-  fitter();
-  PartialNucleiChargeFitter::charges_t return_charges = fitter.getSolutionAsCharges_t();
 
   // output fitted charges
-  LOG(0, "STATUS: We have fitted the following charges " << return_charges << ".");
+  LOG(0, "STATUS: We have fitted the following charges " << averaged_charges
+      << ", averaged over " << NoFragments << " fragments.");
 
   return Action::success;
