Index: src/Actions/FillAction/FillRegularGridAction.cpp
===================================================================
--- src/Actions/FillAction/FillRegularGridAction.cpp	(revision 345eda8ba424c9dbb13488e397cd25c45027d9bc)
+++ src/Actions/FillAction/FillRegularGridAction.cpp	(revision da1e9282f7aecf587880d71ca5531b04c643fa70)
@@ -66,66 +66,18 @@
   AtomVector presentatoms = World::getInstance().getAllAtoms();
 
-  // get selected atoms and find containing sphere
-  World::AtomComposite atoms = World::getInstance().getSelectedAtoms();
-  if (atoms.size() == 0) {
-    ELOG(2, "No atoms selected, aborting,");
+  // get the filler molecule and move to origin
+  const std::vector< molecule *> molecules = World::getInstance().getSelectedMolecules();
+  if (molecules.size() != 1) {
+    ELOG(1, "No exactly one molecule selected, aborting,");
     return Action::failure;
   }
-
-  Vector center;
-  double radius = 0.;
-  {
-    center.Zero();
-    for(World::AtomComposite::const_iterator iter = atoms.begin();
-        iter != atoms.end(); ++iter)
-      center += (*iter)->getPosition();
-    center *= 1./(double)atoms.size();
-    for(World::AtomComposite::const_iterator iter = atoms.begin();
-        iter != atoms.end(); ++iter) {
-      const Vector &position = (*iter)->getPosition();
-      for (size_t i=0;i<NDIM;++i) {
-        const double temp_distance = fabs(position[i] - center[i]);
-        if (temp_distance > radius)
-          radius = temp_distance;
-      }
-    }
-  }
-  // always move cluster to be centered at origin
-  for(World::AtomComposite::iterator iter = atoms.begin();
-      iter != atoms.end(); ++iter)
-    (*iter)->setPosition((*iter)->getPosition() - center);
-  if (radius == 0.) { // never have zero radius: set to one or less
-    ASSERT( (params.counts[0] != 0.) && (params.counts[1] != 0.) && (params.counts[2] != 0.),
-        "FillRegularGridAction::performCall() - counts must not be zero.");
-    const Vector diag(1./(double)(params.counts[0]+1), 1./(double)(params.counts[1]+1), 1./(double)(params.counts[2]+1));
-    radius = std::min(1.,World::getInstance().getDomain().translateIn(diag).Norm()/2.);
-  }
-  // add some small boundary
-  radius += 1e+6*std::numeric_limits<double>::epsilon();
-  radius = std::max(params.mindistance, radius);
-  LOG(2, "INFO: The " << atoms.size() << " are contained in a sphere at "
-      << center << " with radius " << radius << ".");
-  Shape *s = new Shape(Sphere(zeroVec, radius));
-  LOG(2, "INFO: Created sphere at " << s->getCenter() << " and radius " << s->getRadius() << ".");
-
-  // create set of atomic ids
-  std::vector<atomId_t> atomIds(atoms.size(), (size_t)-1);
-  std::transform(atoms.begin(), atoms.end(), atomIds.begin(),
-      boost::bind(&atom::getId, _1) );
-  Cluster::atomIdSet atomset(atomIds.begin(), atomIds.end());
-  LOG(2, "INFO: Created atomset of size " << atomset.size() << ".");
-
-  // create cluster
-  ClusterInterface::Cluster_impl cluster(new Cluster(atomset, *s));
-  LOG(2, "INFO: Created cluster of size " << atomset.size() << ".");
+  molecule *filler = *(molecules.begin());
+  LOG(1, "INFO: Chosen molecule has " << filler->size() << " atoms.");
 
   // check for selected molecules and create surfaces from them
-  const std::vector<molecule *> molecules = World::getInstance().getSelectedMolecules();
-  typedef std::list<FillPredicate *> predicate_list_t;
-  typedef std::list<LinkedCell_deprecated *> LC_list_t;
-  typedef std::list<Tesselation *> Tesselation_list_t;
-  predicate_list_t surface_predicate_list;
-  LC_list_t LinkedCell_deprecated_list;
-  Tesselation_list_t Tesselation_list;
+  std::vector<atom *> atoms(World::getInstance().getSelectedAtoms());
+  FillPredicate * surface_predicate = NULL;
+  LinkedCell_deprecated * LC = NULL;
+  Tesselation * TesselStruct = NULL;
   if (params.SphereRadius != 0.) {
     if ( molecules.size() == 0) {
@@ -133,54 +85,43 @@
           << " != 0, but have not select any molecules.");
     }
-    for (std::vector<molecule *>::const_iterator iter = molecules.begin();
-        iter != molecules.end(); ++iter) {
-      // create adaptor for the current molecule
-      PointCloudAdaptor< molecule > cloud(*iter, (*iter)->name);
-      LinkedCell_deprecated_list.push_back(
-          new LinkedCell_deprecated(cloud, 2.*params.SphereRadius)
-      );
+    // create adaptor for the selected atoms
+    PointCloudAdaptor< std::vector<atom *> > cloud(&atoms, std::string("Selected atoms"));
 
-      // create tesselation
-      Tesselation_list.push_back(
-          new Tesselation
-      );
-      (*Tesselation_list.back())(cloud, params.SphereRadius);
+    // create tesselation
+    LC = new LinkedCell_deprecated(cloud, 2.*params.SphereRadius);
+    TesselStruct = new Tesselation;
+    (*TesselStruct)(cloud, params.SphereRadius);
 
-      // and create predicate
-      surface_predicate_list.push_back(
-          new FillPredicate( IsInsideSurface_FillPredicate(
-              *Tesselation_list.back(),
-              *LinkedCell_deprecated_list.back()) )
-      );
-    }
+    // and create predicate
+    surface_predicate = new FillPredicate( IsInsideSurface_FillPredicate( *TesselStruct, *LC ) );
   }
 
   // create predicate, mesh, and filler
   {
-    FillPredicate *voidnode_predicate = new FillPredicate( IsVoidNode_FillPredicate(*s) );
+    FillPredicate *voidnode_predicate = new FillPredicate(
+        IsVoidNode_FillPredicate(
+            Sphere(zeroVec, params.mindistance)
+            )
+        );
     FillPredicate Andpredicate = (*voidnode_predicate);
-    for (predicate_list_t::iterator iter = surface_predicate_list.begin();
-        iter != surface_predicate_list.end(); ++iter)
-      Andpredicate = (Andpredicate) && !(**iter);
+    if (surface_predicate != NULL)
+      Andpredicate = (Andpredicate) && !(*surface_predicate);
     Mesh *mesh = new CubeMesh(params.counts, params.offset, World::getInstance().getDomain().getM());
-    Filler *fillerFunction = new Filler(*mesh, Andpredicate);
 
     // fill
-    CopyAtoms_withBonds copyMethod;
-    (*fillerFunction)(copyMethod, cluster);
+    {
+      Filler *fillerFunction = new Filler(*mesh, Andpredicate);
+      ClusterInterface::Cluster_impl cluster( new Cluster( filler->getAtomIds(), filler->getBoundingShape()) );
+      CopyAtoms_withBonds copyMethod;
+      (*fillerFunction)(copyMethod, cluster);
+      delete fillerFunction;
+    }
 
     // remove
-    delete fillerFunction;
     delete mesh;
     delete voidnode_predicate;
-    for (LC_list_t::iterator iter = LinkedCell_deprecated_list.begin();
-            iter != LinkedCell_deprecated_list.end(); ++iter)
-      delete (*iter);
-    LinkedCell_deprecated_list.clear();
-    for (Tesselation_list_t::iterator iter = Tesselation_list.begin();
-            iter != Tesselation_list.end(); ++iter)
-      delete (*iter);
-    Tesselation_list.clear();
-    delete s;
+    delete surface_predicate;
+    delete LC;
+    delete TesselStruct;
   }
 
Index: src/Actions/FillAction/FillRegularGridAction.def
===================================================================
--- src/Actions/FillAction/FillRegularGridAction.def	(revision 345eda8ba424c9dbb13488e397cd25c45027d9bc)
+++ src/Actions/FillAction/FillRegularGridAction.def	(revision da1e9282f7aecf587880d71ca5531b04c643fa70)
@@ -30,4 +30,7 @@
 
 // finally the information stored in the ActionTrait specialization
-#define DESCRIPTION "fill the domain via a regularly sparsed grid of insertion points for a cluster of atoms"
+#define DESCRIPTION "\
+fill the domain via a regularly sparsed grid of insertion points with the \
+currently selected molecule. If atoms are selected, too, they are surrounded by \
+a tesselated surface and only outside of the tesselation is filled."
 #undef SHORTFORM
