Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision f721c640ec1d531c6aabbc1c140b99499b4a3ebf)
+++ src/Makefile.am	(revision 9ad39100c520f261ac05516e4832db65f031d140)
@@ -32,8 +32,10 @@
 bin_PROGRAMS = molecuilder joiner analyzer
 molecuilderdir = ${bindir}
+#libmolecuilder_a_CXXFLAGS = -DNO_CACHING
 libmolecuilder_a_SOURCES = ${SOURCE} ${HEADER}
 libgslwrapper_a_SOURCES = ${LINALGSOURCE} ${LINALGHEADER}
 molecuilder_DATA = elements.db valence.db orbitals.db Hbonddistance.db Hbondangle.db
 molecuilder_LDFLAGS = $(BOOST_LIB)
+#molecuilder_CXXFLAGS = -DNO_CACHING
 molecuilder_SOURCES = builder.cpp
 molecuilder_LDADD = libmolecuilder.a libgslwrapper.a
Index: src/Patterns/Cacheable.hpp
===================================================================
--- src/Patterns/Cacheable.hpp	(revision f721c640ec1d531c6aabbc1c140b99499b4a3ebf)
+++ src/Patterns/Cacheable.hpp	(revision 9ad39100c520f261ac05516e4832db65f031d140)
@@ -12,86 +12,149 @@
 #include <boost/function.hpp>
 
-template<typename T>
-class Cacheable : public Observer
-{
-public:
-  Cacheable(Observable *_owner, boost::function<T()> _recalcMethod);
-  virtual ~Cacheable();
+#ifndef NO_CACHING
 
-  const bool isValid();
-  const T& operator*();
-  const bool operator==(const T&);
-  const bool operator!=(const T&);
+  template<typename T>
+  class Cacheable : public Observer
+  {
+  public:
+    Cacheable(Observable *_owner, boost::function<T()> _recalcMethod);
+    virtual ~Cacheable();
 
-  // methods implemented for base-class Observer
-  void update(Observable *subject);
-  void subjectKilled(Observable *subject);
-private:
-  void checkValid();
+    const bool isValid();
+    const T& operator*();
+    const bool operator==(const T&);
+    const bool operator!=(const T&);
 
-  T content;
-  Observable *owner;
-  bool valid;
-  bool canBeUsed;
-  boost::function<T()> recalcMethod;
-};
+    // methods implemented for base-class Observer
+    void update(Observable *subject);
+    void subjectKilled(Observable *subject);
+  private:
+    void checkValid();
 
-template<typename T>
-Cacheable<T>::Cacheable(Observable *_owner, boost::function<T()> _recalcMethod) :
-  owner(_owner),
-  recalcMethod(_recalcMethod),
-  valid(false),
-  canBeUsed(true)
-{
-  owner->signOn(this);
-}
+    T content;
+    Observable *owner;
+    bool valid;
+    bool canBeUsed;
+    boost::function<T()> recalcMethod;
+  };
 
-template<typename T>
-const T& Cacheable<T>::operator*(){
-  checkValid();
-  return content;
-}
 
-template<typename T>
-const bool Cacheable<T>::operator==(const T& rval){
-  checkValid();
-  return (content == rval);
-}
+  template<typename T>
+  Cacheable<T>::Cacheable(Observable *_owner, boost::function<T()> _recalcMethod) :
+    owner(_owner),
+    recalcMethod(_recalcMethod),
+    valid(false),
+    canBeUsed(true)
+  {
+    owner->signOn(this);
+  }
 
-template<typename T>
-const bool Cacheable<T>::operator!=(const T& rval){
-  checkValid();
-  return (content != rval);
-}
+  template<typename T>
+  const T& Cacheable<T>::operator*(){
+    checkValid();
+    return content;
+  }
 
-template<typename T>
-Cacheable<T>::~Cacheable()
-{
-  owner->signOff(this);
-}
+  template<typename T>
+  const bool Cacheable<T>::operator==(const T& rval){
+    checkValid();
+    return (content == rval);
+  }
 
-template<typename T>
-const bool Cacheable<T>::isValid(){
-  return valid;
-}
+  template<typename T>
+  const bool Cacheable<T>::operator!=(const T& rval){
+    checkValid();
+    return (content != rval);
+  }
 
-template<typename T>
-void Cacheable<T>::update(Observable *subject) {
-  valid = false;
-}
+  template<typename T>
+  Cacheable<T>::~Cacheable()
+  {
+    owner->signOff(this);
+  }
 
-template<typename T>
-void Cacheable<T>::subjectKilled(Observable *subject) {
-  valid = false;
-  canBeUsed = false;
-}
+  template<typename T>
+  const bool Cacheable<T>::isValid(){
+    return valid;
+  }
 
-template<typename T>
-void Cacheable<T>::checkValid(){
-  assert(canBeUsed && "Cacheable used after owner was deleted");
-  if(!isValid()){
-    content = recalcMethod();
+  template<typename T>
+  void Cacheable<T>::update(Observable *subject) {
+    valid = false;
   }
-}
+
+  template<typename T>
+  void Cacheable<T>::subjectKilled(Observable *subject) {
+    valid = false;
+    canBeUsed = false;
+  }
+
+  template<typename T>
+  void Cacheable<T>::checkValid(){
+    assert(canBeUsed && "Cacheable used after owner was deleted");
+    if(!isValid()){
+      content = recalcMethod();
+    }
+  }
+#else
+  template<typename T>
+  class Cacheable : public Observer
+  {
+  public:
+    Cacheable(Observable *_owner, boost::function<T()> _recalcMethod);
+    virtual ~Cacheable();
+
+    const bool isValid();
+    const T& operator*();
+    const bool operator==(const T&);
+    const bool operator!=(const T&);
+
+    // methods implemented for base-class Observer
+    void update(Observable *subject);
+    void subjectKilled(Observable *subject);
+  private:
+
+    boost::function<T()> recalcMethod;
+  };
+
+  template<typename T>
+  Cacheable<T>::Cacheable(Observable *_owner, boost::function<T()> _recalcMethod) :
+    recalcMethod(_recalcMethod)
+  {}
+
+  template<typename T>
+  const T& Cacheable<T>::operator*(){
+    return recalcMethod();
+  }
+
+  template<typename T>
+  const bool Cacheable<T>::operator==(const T& rval){
+    return (recalcMethod() == rval);
+  }
+
+  template<typename T>
+  const bool Cacheable<T>::operator!=(const T& rval){
+    return (recalcMethod() != rval);
+  }
+
+  template<typename T>
+  Cacheable<T>::~Cacheable()
+  {}
+
+  template<typename T>
+  const bool Cacheable<T>::isValid(){
+    return true;
+  }
+
+  template<typename T>
+  void Cacheable<T>::update(Observable *subject) {
+    assert(0 && "Cacheable::update should never be called when caching is disabled");
+  }
+
+  template<typename T>
+  void Cacheable<T>::subjectKilled(Observable *subject) {
+    assert(0 && "Cacheable::subjectKilled should never be called when caching is disabled");
+  }
+#endif
 
 #endif /* CACHEABLE_HPP_ */
