Index: src/Patterns/ObservedIterator.hpp
===================================================================
--- src/Patterns/ObservedIterator.hpp	(revision bd58fb2b24b4e60efc12ec92eea4888bf318d98e)
+++ src/Patterns/ObservedIterator.hpp	(revision bd58fb2b24b4e60efc12ec92eea4888bf318d98e)
@@ -0,0 +1,116 @@
+/*
+ * ObservedIterator.hpp
+ *
+ *  Created on: Mar 4, 2010
+ *      Author: crueger
+ */
+
+#ifndef OBSERVEDITERATOR_HPP_
+#define OBSERVEDITERATOR_HPP_
+
+#include "Patterns/Observer.hpp"
+
+#include <iterator>
+
+// we build an iterator that observes traversion of some kind of Data structure conforming to STL
+template<class _Set>
+class ObservedIterator
+    : public std::iterator<typename std::iterator_traits<typename _Set::iterator>::iterator_category,
+                           typename std::iterator_traits<typename _Set::iterator>::value_type,
+                           typename std::iterator_traits<typename _Set::iterator>::difference_type,
+                           typename std::iterator_traits<typename _Set::iterator>::pointer,
+                           typename std::iterator_traits<typename _Set::iterator>::reference>
+{
+public:
+  // Some typedefs to conform to STL-Iterator structure
+  typedef typename _Set::iterator _Iter;
+  typedef typename _Iter::value_type value_type;
+  typedef typename _Iter::difference_type difference_type;
+  typedef typename _Iter::pointer pointer;
+  typedef typename _Iter::reference reference;
+  typedef typename _Iter::iterator_category iterator_category;
+
+  ObservedIterator() :
+    protector(0)
+  {}
+
+  ObservedIterator(_Iter iter,Observable *obs) :
+    iter(iter)
+  {
+    // for this we actually get a lock on the heap,
+    // so we can copy ourselves
+    protector = new Observable::_Observable_protector(obs);
+  }
+
+  ObservedIterator(const ObservedIterator &dest) :
+    iter(dest.iter)
+  {
+    protector = new Observable::_Observable_protector(*dest.protector);
+  }
+
+  ~ObservedIterator(){
+    if(protector)
+      delete protector;
+  }
+
+  // standard Iterator methods
+  ObservedIterator& operator=(const ObservedIterator& dest){
+    if(&dest !=this){
+      // get the new lock first, in case the two locks point to the same observable
+      Observable::_Observable_protector *newLock = new Observable::_Observable_protector(*dest.protector);
+      delete protector;
+      protector = newLock;
+      // After the new lock is aquired we can safely set the iterator
+      iter = dest.iter;
+    }
+    return *this;
+  }
+
+  ObservedIterator& operator++()   // prefix
+  {
+    ++iter;
+  }
+
+  ObservedIterator  operator++(int) // postfix with the dummy int parameter
+  {
+    ObservedIterator ret(*this);
+    ++(*this);
+    return ret;
+  }
+
+  ObservedIterator& operator--()   // prefix
+  {
+    --iter;
+  }
+
+  ObservedIterator  operator--(int) // postfix with the dummy int parameter
+  {
+    ObservedIterator ret(*this);
+    --(*this);
+    return ret;
+  }
+
+  bool operator==(const ObservedIterator &rhs){
+    return iter==rhs.iter;
+  }
+
+  bool operator!=(const ObservedIterator &rhs){
+    return iter!=rhs.iter;
+  }
+
+  value_type operator*(){
+    return (*iter);
+  }
+
+  // when we turn into a const iterator we can loose our lock
+  operator typename _Set::const_iterator() {
+    // typecast will be handled by the typecast method of the original iterator
+    return iter;
+  }
+
+private:
+  _Iter iter;
+  Observable::_Observable_protector *protector;
+};
+
+#endif /* OBSERVEDITERATOR_HPP_ */
Index: src/Patterns/Observer.cpp
===================================================================
--- src/Patterns/Observer.cpp	(revision 57adc722ba6d4dbc04bdd2fa77d696ce701237a7)
+++ src/Patterns/Observer.cpp	(revision bd58fb2b24b4e60efc12ec92eea4888bf318d98e)
@@ -75,4 +75,10 @@
 Observable::_Observable_protector::_Observable_protector(Observable *_protege) :
   protege(_protege)
+{
+  start_observer_internal(protege);
+}
+
+Observable::_Observable_protector::_Observable_protector(const _Observable_protector &dest) :
+    protege(dest.protege)
 {
   start_observer_internal(protege);
Index: src/Patterns/Observer.hpp
===================================================================
--- src/Patterns/Observer.hpp	(revision 57adc722ba6d4dbc04bdd2fa77d696ce701237a7)
+++ src/Patterns/Observer.hpp	(revision bd58fb2b24b4e60efc12ec92eea4888bf318d98e)
@@ -29,4 +29,6 @@
 
 class Observable;
+template<class _Set>
+class ObservedIterator;
 
 /**
@@ -46,4 +48,5 @@
 {
   friend class Observable;
+  template<class> friend class ObservedIterator;
 public:
   Observer();
@@ -129,4 +132,5 @@
   public:
     _Observable_protector(Observable *);
+    _Observable_protector(const _Observable_protector&);
     ~_Observable_protector();
   private:
Index: src/molecule.cpp
===================================================================
--- src/molecule.cpp	(revision 57adc722ba6d4dbc04bdd2fa77d696ce701237a7)
+++ src/molecule.cpp	(revision bd58fb2b24b4e60efc12ec92eea4888bf318d98e)
@@ -31,6 +31,6 @@
  * Initialises molecule list with correctly referenced start and end, and sets molecule::last_atom to zero.
  */
-molecule::molecule(const periodentafel * const teil) : elemente(teil), start(World::get()->createAtom()), end(World::get()->createAtom()),
-  first(new bond(start, end, 1, -1)), last(new bond(start, end, 1, -1)), MDSteps(0), AtomCount(0), 
+molecule::molecule(const periodentafel * const teil) : elemente(teil),start(World::get()->createAtom()),end(World::get()->createAtom()),
+  first(new bond(0, 0, 1, -1)), last(new bond(0, 0, 1, -1)), MDSteps(0), AtomCount(0),
   BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), NoCyclicBonds(0), BondDistance(0.), 
   ActiveFlag(false), IndexNr(-1),
@@ -113,4 +113,22 @@
 }
 
+/************************** Access to the List of Atoms ****************/
+
+
+molecule::iterator molecule::begin(){
+  return molecule::iterator(atoms.begin(),this);
+}
+
+molecule::const_iterator molecule::begin() const{
+  return atoms.begin();
+}
+
+molecule::iterator molecule::ende(){
+  return molecule::iterator(atoms.end(),this);
+}
+
+molecule::const_iterator molecule::ende() const{
+  return atoms.end();
+}
 
 /** Adds given atom \a *pointer from molecule list.
Index: src/molecule.hpp
===================================================================
--- src/molecule.hpp	(revision 57adc722ba6d4dbc04bdd2fa77d696ce701237a7)
+++ src/molecule.hpp	(revision bd58fb2b24b4e60efc12ec92eea4888bf318d98e)
@@ -34,4 +34,5 @@
 #include "tesselation.hpp"
 #include "Patterns/Observer.hpp"
+#include "Patterns/ObservedIterator.hpp"
 #include "Patterns/Cacheable.hpp"
 
@@ -88,7 +89,13 @@
   friend molecule *NewMolecule();
   friend void DeleteMolecule(molecule *);
+
   public:
+
+    typedef std::set<atom*> atomSet;
+    typedef ObservedIterator<atomSet> iterator;
+    typedef atomSet::const_iterator const_iterator;
     double cell_size[6];//!< cell size
     const periodentafel * const elemente; //!< periodic table with each element
+    // old deprecated atom handling
     atom *start;        //!< start of atom list
     atom *end;          //!< end of atom list
@@ -112,4 +119,5 @@
     Cacheable<string> formula;
     moleculeId_t id;
+    atomSet atoms; //<!set of atoms
   protected:
     molecule(const periodentafel * const teil);
@@ -125,4 +133,9 @@
   const std::string getFormula();
   std::string calcFormula();
+
+  iterator begin();
+  const_iterator begin() const;
+  iterator ende();
+  const_iterator ende() const;
 
 
Index: src/unittests/ObserverTest.cpp
===================================================================
--- src/unittests/ObserverTest.cpp	(revision 57adc722ba6d4dbc04bdd2fa77d696ce701237a7)
+++ src/unittests/ObserverTest.cpp	(revision bd58fb2b24b4e60efc12ec92eea4888bf318d98e)
@@ -11,6 +11,8 @@
 #include <cppunit/extensions/TestFactoryRegistry.h>
 #include <cppunit/ui/text/TestRunner.h>
+#include <set>
 
 #include "Patterns/Observer.hpp"
+#include "Patterns/ObservedIterator.hpp"
 
 #include <iostream>
@@ -83,4 +85,36 @@
 };
 
+class ObservableCollection : public Observable {
+public:
+  typedef std::set<SimpleObservable*> set;
+  typedef ObservedIterator<set> iterator;
+
+  ObservableCollection(int num){
+    for(int i=0; i<num; ++i){
+      SimpleObservable *content = new SimpleObservable();
+      content->signOn(this);
+      theSet.insert(content);
+    }
+  }
+
+  ~ObservableCollection(){
+    set::iterator iter;
+    for(iter=theSet.begin(); iter!=theSet.end(); ++iter ){
+      delete (*iter);
+    }
+  }
+
+  iterator begin(){
+    return iterator(theSet.begin(),this);
+  }
+
+  iterator end(){
+    return iterator(theSet.end(),this);
+  }
+
+private:
+  set theSet;
+};
+
 /******************* actuall tests ***************/
 
@@ -95,4 +129,6 @@
   observer3 = new UpdateCountObserver();
   observer4 = new UpdateCountObserver();
+
+  collection = new ObservableCollection(5);
 }
 
@@ -107,4 +143,6 @@
   delete observer3;
   delete observer4;
+
+  delete collection;
 }
 
@@ -163,4 +201,19 @@
 }
 
+void ObserverTest::iteratorTest(){
+  collection->signOn(observer1);
+  {
+    ObservableCollection::iterator iter;
+    for(iter=collection->begin(); iter!=collection->end(); ++iter){
+      (*iter)->changeMethod();
+    }
+    // At this point no change should have been propagated
+    CPPUNIT_ASSERT_EQUAL( 0, observer1->updates);
+  }
+  // After the Iterator has died the propagation should take place
+  CPPUNIT_ASSERT_EQUAL( 1, observer1->updates);
+  collection->signOff(observer1);
+}
+
 
 void ObserverTest::CircleDetectionTest() {
Index: src/unittests/ObserverTest.hpp
===================================================================
--- src/unittests/ObserverTest.hpp	(revision 57adc722ba6d4dbc04bdd2fa77d696ce701237a7)
+++ src/unittests/ObserverTest.hpp	(revision bd58fb2b24b4e60efc12ec92eea4888bf318d98e)
@@ -16,4 +16,5 @@
 class CallObservable;
 class SuperObservable;
+class ObservableCollection;
 
 
@@ -24,4 +25,5 @@
   CPPUNIT_TEST ( doesBlockUpdateTest );
   CPPUNIT_TEST ( doesSubObservableTest );
+  CPPUNIT_TEST ( iteratorTest );
   CPPUNIT_TEST ( CircleDetectionTest );
   CPPUNIT_TEST_SUITE_END();
@@ -34,4 +36,5 @@
   void doesBlockUpdateTest();
   void doesSubObservableTest();
+  void iteratorTest();
   void CircleDetectionTest();
 
@@ -46,4 +49,6 @@
   CallObservable *callObservable;
   SuperObservable *superObservable;
+
+  ObservableCollection *collection;
 };
 
