Index: src/Filling/Inserter/SurfaceRandomInserter.cpp
===================================================================
--- src/Filling/Inserter/SurfaceRandomInserter.cpp	(revision df9f200764a5636d8eb51224f34c27dbd7463b9a)
+++ src/Filling/Inserter/SurfaceRandomInserter.cpp	(revision df9f200764a5636d8eb51224f34c27dbd7463b9a)
@@ -0,0 +1,100 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 Frederik Heber. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * SurfaceRandomInserter.cpp
+ *
+ *  Created on: Sep 03, 2014
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "SurfaceRandomInserter.hpp"
+
+#include "Atom/atom.hpp"
+#include "CodePatterns/Log.hpp"
+#include "LinearAlgebra/RealSpaceMatrix.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Shapes/Shape.hpp"
+
+/** Constructor for class SurfaceRandomInserter.
+ *
+ * @param _s shape on whose surface the insertion nodes lie
+ * @param _alignedAxis axis along which to be inserted cluster is aligned to
+ * @param _MaxAtomComponent maximum component for random atom translations
+ * @param _MaxMoleculeComponent maximum component for random molecule translations
+ */
+SurfaceRandomInserter::SurfaceRandomInserter(
+    const Shape & _s,
+    const Vector &_alignedAxis,
+    const double _MaxAtomComponent,
+    const double _MaxMoleculeComponent) :
+    RandomInserter(_MaxAtomComponent, _MaxMoleculeComponent, false),
+    shape(_s),
+    alignedAxis(_alignedAxis.getNormalized())
+{}
+
+/** Destructor for class SurfaceRandomInserter.
+ *
+ */
+SurfaceRandomInserter::~SurfaceRandomInserter()
+{}
+
+/** Inserter operator that rotates the cluster to be perpendicular on surface at
+ *  desired \a offset and translates it there.
+ *
+ * \note We assume that cluster is aligned along \a SurfaceRandomInserter::alignedAxis and
+ * the translation is done relative to origin.
+ *
+ * @param offset
+ * @return always true
+ */
+bool SurfaceRandomInserter::operator()(ClusterInterface::Cluster_impl cluster, const Vector &offset) const
+{
+  // create rotation matrix, assuming cluster is aligned along z axis
+  Vector SurfaceNormal = shape.getNormal(offset); // get normal at desired point
+  LOG(3, "DEBUG: Normal vector at " << offset << " is " << SurfaceNormal << ".");
+  const double alpha = - alignedAxis.Angle(SurfaceNormal); // we have to rotate back
+  LOG(4, "DEBUG: Rotation angle is " << alpha << ".");
+  SurfaceNormal.VectorProduct(alignedAxis);  // get the rotation axis as normal direction to both
+  RealSpaceMatrix M;
+  if (!SurfaceNormal.IsZero()) {
+    SurfaceNormal.Normalize();
+    LOG(4, "DEBUG: Rotation axis is " << SurfaceNormal << ".");
+    M.setRotation(SurfaceNormal, alpha);
+  } else {
+    M.setIdentity();
+  }
+
+  // rotate cluster
+  cluster->transform(M);
+
+  // translate
+  return RandomInserter::operator()(cluster, offset);
+}
Index: src/Filling/Inserter/SurfaceRandomInserter.hpp
===================================================================
--- src/Filling/Inserter/SurfaceRandomInserter.hpp	(revision df9f200764a5636d8eb51224f34c27dbd7463b9a)
+++ src/Filling/Inserter/SurfaceRandomInserter.hpp	(revision df9f200764a5636d8eb51224f34c27dbd7463b9a)
@@ -0,0 +1,48 @@
+/*
+ * SurfaceRandomInserter.hpp
+ *
+ *  Created on: Apr 03, 2012
+ *      Author: heber
+ */
+
+#ifndef SURFACERANDOMINSERTER_HPP_
+#define SURFACERANDOMINSERTER_HPP_
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Filling/Inserter/RandomInserter.hpp"
+
+#include "LinearAlgebra/Vector.hpp"
+#include "Shapes/Shape.hpp"
+
+/** SurfaceRandomInserter extends RandomInserter such that the given \a Cluster
+ * is inserted at the given position in such a way as to be aligned perpendicularly
+ * away from the surface (but with the usual random displacements)
+ *
+ * \note We assume that cluster is aligned along the Z axis.
+ *
+ */
+class SurfaceRandomInserter : public RandomInserter
+{
+public:
+  SurfaceRandomInserter(
+      const Shape & _s,
+      const Vector &_alignedAxis,
+      const double _MaxAtomComponent,
+      const double _MaxMoleculeComponent);
+  ~SurfaceRandomInserter();
+
+  bool operator()(ClusterInterface::Cluster_impl cluster, const Vector &offset) const;
+
+private:
+  const Shape shape;
+  const Vector alignedAxis;
+};
+
+
+
+#endif /* SURFACERANDOMINSERTER_HPP_ */
Index: src/Filling/Makefile.am
===================================================================
--- src/Filling/Makefile.am	(revision 6801f4f3b7ed127fa9a9c8afe64f82d34df963d2)
+++ src/Filling/Makefile.am	(revision df9f200764a5636d8eb51224f34c27dbd7463b9a)
@@ -13,4 +13,5 @@
 	Filling/Inserter/SimpleInserter.cpp \
 	Filling/Inserter/SurfaceInserter.cpp \
+	Filling/Inserter/SurfaceRandomInserter.cpp \
 	Filling/Predicates/AnyFillPredicate.cpp \
 	Filling/Predicates/FillPredicate.cpp \
@@ -22,4 +23,5 @@
 	Filling/Preparators/BaseFillerPreparator.cpp \
 	Filling/Preparators/BoxFillerPreparator.cpp \
+	Filling/Preparators/ShapeSurfaceFillerPreparator.cpp \
 	Filling/Preparators/ShapeVolumeFillerPreparator.cpp
 	
@@ -37,4 +39,5 @@
 	Filling/Inserter/SimpleInserter.hpp \
 	Filling/Inserter/SurfaceInserter.hpp \
+	Filling/Inserter/SurfaceRandomInserter.hpp \
 	Filling/NodeTypes.hpp \
 	Filling/Predicates/AnyFillPredicate.hpp \
@@ -50,4 +53,5 @@
 	Filling/Preparators/BaseFillerPreparator.hpp \
 	Filling/Preparators/BoxFillerPreparator.hpp \
+	Filling/Preparators/ShapeSurfaceFillerPreparator.hpp \
 	Filling/Preparators/ShapeVolumeFillerPreparator.hpp
 
Index: src/Filling/Preparators/ShapeSurfaceFillerPreparator.cpp
===================================================================
--- src/Filling/Preparators/ShapeSurfaceFillerPreparator.cpp	(revision df9f200764a5636d8eb51224f34c27dbd7463b9a)
+++ src/Filling/Preparators/ShapeSurfaceFillerPreparator.cpp	(revision df9f200764a5636d8eb51224f34c27dbd7463b9a)
@@ -0,0 +1,96 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 Frederik Heber. All rights reserved.
+ *
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * ShapeSurfaceFillerPreparator.cpp
+ *
+ *  Created on: Sep 3, 2014
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "ShapeSurfaceFillerPreparator.hpp"
+
+#include <boost/bind.hpp>
+#include <boost/function.hpp>
+
+#include "Filling/Mesh/Mesh.hpp"
+#include "Filling/Mesh/MeshAdaptor.hpp"
+#include "Filling/Inserter/Inserter.hpp"
+#include "Filling/Inserter/SurfaceInserter.hpp"
+#include "Filling/Inserter/SurfaceRandomInserter.hpp"
+#include "Shapes/Shape.hpp"
+
+ShapeSurfaceFillerPreparator::ShapeSurfaceFillerPreparator(molecule *_filler) :
+  BaseFillerPreparator(_filler)
+{}
+
+ShapeSurfaceFillerPreparator::~ShapeSurfaceFillerPreparator()
+{}
+
+void ShapeSurfaceFillerPreparator::addShapeMesh(
+    const Shape &_shape,
+    const unsigned int _nodes)
+{
+
+  MeshAdaptor::function_t fct =
+      boost::bind(&Shape::getHomogeneousPointsOnSurface,
+          boost::cref(_shape),
+          _nodes);
+  mesh = new MeshAdaptor(fct);
+}
+
+void ShapeSurfaceFillerPreparator::addSurfaceInserter(
+        const Shape &_shape,
+        const Vector &_alignedaxis
+        )
+{
+  inserter = new Inserter(
+      Inserter::impl_ptr(new SurfaceInserter(
+          _shape,
+          _alignedaxis)
+      )
+  );
+}
+
+void ShapeSurfaceFillerPreparator::addSurfaceRandomInserter(
+        const Shape &_shape,
+        const Vector &_alignedaxis,
+        const double _MaxAtomComponent,
+        const double _MaxMoleculeComponent
+        )
+{
+  inserter = new Inserter(
+      Inserter::impl_ptr(new SurfaceRandomInserter(
+          _shape,
+          _alignedaxis,
+          _MaxAtomComponent,
+          _MaxMoleculeComponent)
+      )
+  );
+}
Index: src/Filling/Preparators/ShapeSurfaceFillerPreparator.hpp
===================================================================
--- src/Filling/Preparators/ShapeSurfaceFillerPreparator.hpp	(revision df9f200764a5636d8eb51224f34c27dbd7463b9a)
+++ src/Filling/Preparators/ShapeSurfaceFillerPreparator.hpp	(revision df9f200764a5636d8eb51224f34c27dbd7463b9a)
@@ -0,0 +1,49 @@
+/*
+ * ShapeSurfaceFillerPreparator.hpp
+ *
+ *  Created on: Sep 3, 2014
+ *      Author: heber
+ */
+
+#ifndef SHAPESURFACEFILLERPREPARATOR_HPP_
+#define SHAPESURFACEFILLERPREPARATOR_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "BaseFillerPreparator.hpp"
+
+class Shape;
+class Vector;
+
+/** ShapeSurfaceFillerPreparator takes a shape and uses Shape::getHomogeneousPointsInVolume()
+ * to create a specific number of nodes inside this Shape for filling.
+ *
+ */
+class ShapeSurfaceFillerPreparator :
+  public BaseFillerPreparator
+{
+public:
+    ShapeSurfaceFillerPreparator(molecule *_filler);
+    ~ShapeSurfaceFillerPreparator();
+
+    void addShapeMesh(
+        const Shape &_shape,
+        const unsigned int _nodes);
+
+    void addSurfaceInserter(
+            const Shape &_shape,
+            const Vector &_alignedaxis
+            );
+
+   void addSurfaceRandomInserter(
+        const Shape &_shape,
+        const Vector &_alignedaxis,
+        const double _MaxAtomComponent,
+        const double _MaxMoleculeComponent
+        );
+};
+
+#endif /* SHAPESURFACEFILLERPREPARATOR_HPP_ */
