Index: src/Descriptors/AtomsWithinDistanceOfDescriptor.cpp
===================================================================
--- src/Descriptors/AtomsWithinDistanceOfDescriptor.cpp	(revision 7afb7733a1431bbb839abcfc5b1dd0d143dba39b)
+++ src/Descriptors/AtomsWithinDistanceOfDescriptor.cpp	(revision 7afb7733a1431bbb839abcfc5b1dd0d143dba39b)
@@ -0,0 +1,64 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2011 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * AtomsWithinDistanceOfDescriptor.cpp
+ *
+ *  Created on: Dec 19, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "AtomsWithinDistanceOfDescriptor.hpp"
+#include "AtomsWithinDistanceOfDescriptor_impl.hpp"
+
+#include "Atom/atom.hpp"
+#include "LinkedCell/LinkedCell_View.hpp"
+#include "CodePatterns/Observer/ObservedContainer_impl.hpp"
+
+using namespace std;
+
+
+AtomsWithinDistanceOfDescriptor_impl::AtomsWithinDistanceOfDescriptor_impl(const double _distance, const Vector &_position) :
+    distance(_distance),
+    distanceSquared(distance*distance),
+    position(_position)
+{}
+
+AtomsWithinDistanceOfDescriptor_impl::~AtomsWithinDistanceOfDescriptor_impl()
+{}
+
+bool AtomsWithinDistanceOfDescriptor_impl::predicate(std::pair<atomId_t,atom*> atom)
+{
+  return ((atom.second->getPosition().DistanceSquared(position) - distanceSquared) <= 0);
+}
+
+atom* AtomsWithinDistanceOfDescriptor_impl::find(){
+  LinkedCell::LinkedCell_View view = World::getInstance().getLinkedCell(distance);
+  LinkedCell::LinkedList list = view.getPointsInsideSphere(distance, position);
+  return (list.begin()!=list.end())? static_cast<atom *>(const_cast<TesselPoint *>(*list.begin())):0;
+}
+
+std::vector<atom*> AtomsWithinDistanceOfDescriptor_impl::findAll(){
+  LinkedCell::LinkedCell_View view = World::getInstance().getLinkedCell(distance);
+  LinkedCell::LinkedList list = view.getPointsInsideSphere(distance, position);
+  std::vector<atom*> res;
+  for (LinkedCell::LinkedList::iterator iter = list.begin(); iter != list.end(); ++iter)
+    res.push_back(static_cast<atom *>(const_cast<TesselPoint *>(*iter)));
+  return res;
+}
+
+AtomDescriptor AtomsWithinDistanceOf(const double distance, const Vector &position)
+{
+  return AtomDescriptor(AtomDescriptor::impl_ptr(new AtomsWithinDistanceOfDescriptor_impl(distance, position)));
+}
Index: src/Descriptors/AtomsWithinDistanceOfDescriptor.hpp
===================================================================
--- src/Descriptors/AtomsWithinDistanceOfDescriptor.hpp	(revision 7afb7733a1431bbb839abcfc5b1dd0d143dba39b)
+++ src/Descriptors/AtomsWithinDistanceOfDescriptor.hpp	(revision 7afb7733a1431bbb839abcfc5b1dd0d143dba39b)
@@ -0,0 +1,23 @@
+/*
+ * AtomsWithinDistanceOfDescriptor.hpp
+ *
+ *  Created on: Dec 19, 2011
+ *      Author: heber
+ */
+
+#ifndef ATOMSWITHINDISTANCEOFDESCRIPTOR_HPP_
+#define ATOMSWITHINDISTANCEOFDESCRIPTOR_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+class Vector;
+
+#include "types.hpp"
+#include "Descriptors/AtomDescriptor.hpp"
+
+AtomDescriptor AtomsWithinDistanceOf(double distance, const Vector &position);
+
+#endif /* ATOMSWITHINDISTANCEOFDESCRIPTOR_HPP_ */
Index: src/Descriptors/AtomsWithinDistanceOfDescriptor_impl.hpp
===================================================================
--- src/Descriptors/AtomsWithinDistanceOfDescriptor_impl.hpp	(revision 7afb7733a1431bbb839abcfc5b1dd0d143dba39b)
+++ src/Descriptors/AtomsWithinDistanceOfDescriptor_impl.hpp	(revision 7afb7733a1431bbb839abcfc5b1dd0d143dba39b)
@@ -0,0 +1,32 @@
+#ifndef ATOMSWITHINDISTANCEOFDESCRIPTOR_IMPL_HPP
+#define ATOMSWITHINDISTANCEOFDESCRIPTOR_IMPL_HPP
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "LinearAlgebra/Vector.hpp"
+
+#include "Descriptors/AtomDescriptor_impl.hpp"
+
+class AtomsWithinDistanceOfDescriptor_impl : public AtomDescriptor_impl
+{
+public:
+  AtomsWithinDistanceOfDescriptor_impl(const double _distance, const Vector &_position);
+  virtual ~AtomsWithinDistanceOfDescriptor_impl();
+
+  bool predicate(std::pair<atomId_t,atom*> atom);
+
+protected:
+  // need to overide more than the standard methods to make this fast
+  virtual atom* find();
+  virtual std::vector<atom*> findAll();
+
+private:
+  const double distance;
+  const double distanceSquared;
+  const Vector position;
+};
+
+#endif //ATOMSWITHINDISTANCEOFDESCRIPTOR_IMPL_HPP
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 4834f4bc1360623d2ad20e7dab653447280b63b3)
+++ src/Makefile.am	(revision 7afb7733a1431bbb839abcfc5b1dd0d143dba39b)
@@ -41,4 +41,5 @@
   Descriptors/AtomShapeDescriptor.cpp \
   Descriptors/AtomTypeDescriptor.cpp \
+  Descriptors/AtomsWithinDistanceOfDescriptor.cpp \
   Descriptors/MoleculeDescriptor.cpp \
   Descriptors/MoleculeFormulaDescriptor.cpp \
@@ -59,4 +60,5 @@
   Descriptors/AtomShapeDescriptor.hpp \
   Descriptors/AtomTypeDescriptor.hpp \
+  Descriptors/AtomsWithinDistanceOfDescriptor.hpp \
   Descriptors/DescriptorBase.hpp \
   Descriptors/MoleculeDescriptor.hpp \
@@ -78,4 +80,5 @@
   Descriptors/AtomShapeDescriptor_impl.hpp \
   Descriptors/AtomTypeDescriptor_impl.hpp \
+  Descriptors/AtomsWithinDistanceOfDescriptor_impl.hpp \
   Descriptors/DescriptorBase_impl.hpp \
   Descriptors/MoleculeDescriptor_impl.hpp \
Index: src/documentation/constructs/descriptors.dox
===================================================================
--- src/documentation/constructs/descriptors.dox	(revision 4834f4bc1360623d2ad20e7dab653447280b63b3)
+++ src/documentation/constructs/descriptors.dox	(revision 7afb7733a1431bbb839abcfc5b1dd0d143dba39b)
@@ -59,4 +59,5 @@
  *  - within a Shape: AtomByShape()
  *  - of specific element: AtomByType()
+ *  - within distance to: AtomsWithinDistanceOf() (uses LinkedCell_View)
  *
  * \subsection descriptors-molecule Molecule Descriptors
