Index: src/Bond/GraphEdge.cpp
===================================================================
--- src/Bond/GraphEdge.cpp	(revision 12920404e7a45c1ac4fe563b7c5a29891f5e662a)
+++ src/Bond/GraphEdge.cpp	(revision 12920404e7a45c1ac4fe563b7c5a29891f5e662a)
@@ -0,0 +1,75 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * GraphEdge.cpp
+ *
+ *  Created on: Feb 25, 2011
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "Bond/GraphEdge.hpp"
+#include "CodePatterns/Log.hpp"
+#include "CodePatterns/Verbose.hpp"
+
+GraphEdge::GraphEdge() :
+  Cyclic(false),
+  Type(Undetermined),
+  Used(white)
+{}
+
+GraphEdge::~GraphEdge()
+{}
+
+enum GraphEdge::Shading GraphEdge::IsUsed()
+{
+  return Used;
+};
+
+bool GraphEdge::MarkUsed(const enum GraphEdge::Shading color)
+{
+  if (Used == black) {
+    DoeLog(1) && (eLog()<< Verbose(1) << "GraphEdge " << this << " was already marked black!." << endl);
+    return false;
+  } else {
+    Used = color;
+    return true;
+  }
+};
+
+void GraphEdge::ResetUsed()
+{
+  Used = white;
+};
+
+string GraphEdge::getColorName(enum Shading color)
+{
+  switch (color) {
+    case white:
+      return "white";
+      break;
+    case lightgray:
+      return "lightgray";
+      break;
+    case darkgray:
+      return "darkgray";
+      break;
+    case black:
+      return "black";
+      break;
+    default:
+      return "uncolored";
+      break;
+  };
+}
Index: src/Bond/GraphEdge.hpp
===================================================================
--- src/Bond/GraphEdge.hpp	(revision 12920404e7a45c1ac4fe563b7c5a29891f5e662a)
+++ src/Bond/GraphEdge.hpp	(revision 12920404e7a45c1ac4fe563b7c5a29891f5e662a)
@@ -0,0 +1,62 @@
+/*
+ * GraphEdge.hpp
+ *
+ *  Created on: Feb 25, 2011
+ *      Author: heber
+ */
+
+#ifndef GRAPHEDGE_HPP_
+#define GRAPHEDGE_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+/** This class represents all features of a bond as used within graph
+ * algorithms.
+ */
+class GraphEdge
+{
+public:
+  /** Constructor.
+   */
+  GraphEdge();
+  /** Destructor.
+   */
+  virtual ~GraphEdge();
+
+  enum EdgeType { Undetermined, TreeEdge, BackEdge }; //!< edge type in a graph after Depth-First-Search analysis.
+  enum Shading { white, lightgray, darkgray, black };  //!< color in Breadth-First-Search analysis
+
+  bool Cyclic;      //!< flag whether bond is part of a cycle or not, given in DepthFirstSearchAnalysis()
+  enum EdgeType Type;//!< whether this is a tree or back edge
+
+  /** Marks vertex as used in DFS.
+   * \param color color to mark bond with
+   * \return bond::Used, false if bond was already marked used
+   */
+  bool MarkUsed(const enum Shading color);
+
+  /** Returns whether vertex was used in DFS.
+   * \return bond::Used
+   */
+  enum Shading IsUsed();
+
+  /** Resets used flag in DFS.
+   * \return bond::Used
+   */
+  void ResetUsed();
+
+  /** Returns Shading as a char string.
+   * \param color the Shading
+   * \return string of the flag
+   */
+  static std::string getColorName(enum Shading color);
+
+private:
+    enum Shading Used;        //!< marker in depth-first search, DepthFirstSearchAnalysis()
+
+};
+
+#endif /* GRAPHEDGE_HPP_ */
Index: src/Bond/bond.cpp
===================================================================
--- src/Bond/bond.cpp	(revision 12920404e7a45c1ac4fe563b7c5a29891f5e662a)
+++ src/Bond/bond.cpp	(revision 12920404e7a45c1ac4fe563b7c5a29891f5e662a)
@@ -0,0 +1,125 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/** \file Bond.cpp
+ * 
+ * Function implementations for the classes BondLeaf, BondTree and bond.
+ * 
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "CodePatterns/Log.hpp"
+#include "CodePatterns/Verbose.hpp"
+#include "atom.hpp"
+#include "Bond/bond.hpp"
+#include "element.hpp"
+
+
+/***************************************** Functions for class bond ********************************/
+
+/** Empty Constructor for class bond.
+ */
+bond::bond() :
+  leftatom(NULL),
+  rightatom(NULL),
+  HydrogenBond(0),
+  BondDegree(0),
+  nr(-1)
+{};
+
+/** Constructor for class bond, taking right and left bond partner
+ * \param *left left atom
+ * \param *right right atom
+ * \param degree bond degree
+ * \param number increasing index
+ */
+bond::bond(atom *left, atom *right, const int degree, const int number) :
+  leftatom(left),
+  rightatom(right),
+  HydrogenBond(0),
+  BondDegree(degree),
+  nr(number)
+{
+  if ((left != NULL) && (right != NULL)) {
+    if ((left->getType() != NULL) && (left->getType()->getAtomicNumber() == 1))
+      HydrogenBond++;
+    if ((right->getType() != NULL) && (right->getType()->getAtomicNumber() == 1))
+      HydrogenBond++;
+  }
+};
+
+/** Empty Destructor for class bond.
+ */
+bond::~bond()
+{
+  // remove this node from the list structure
+  if (leftatom != NULL)
+    leftatom->UnregisterBond(this);
+  if (rightatom != NULL)
+    rightatom->UnregisterBond(this);
+};
+
+ostream & operator << (ostream &ost, const bond &b)
+{
+  ost << "[" << b.leftatom->getName() << " <" << b.BondDegree << "(H" << b.HydrogenBond << ")>" << b.rightatom->getName() << "]";
+  return ost;
+};
+
+/** Get the other atom in a bond if one is specified.
+ * \param *Atom the pointer to the one atom
+ * \return pointer to the other atom in the bond, NULL if no match (indicates something's wrong with the bond) 
+ */
+atom * bond::GetOtherAtom(const ParticleInfo * const Atom) const
+{
+  if(leftatom == Atom) 
+    return rightatom;
+  if(rightatom == Atom) 
+    return leftatom;
+  DoeLog(1) && (eLog()<< Verbose(1) << "Bond " << *this << " does not contain atom " << *Atom << "!" << endl);
+  return NULL;
+};
+
+
+/** Checks if an atom exists in a bond.
+ * \param *ptr pointer to atom
+ * \return true if it is either bond::leftatom or bond::rightatom, false otherwise
+ */
+bool bond::Contains(const ParticleInfo * const ptr)
+{
+  return ((leftatom == ptr) || (rightatom == ptr));
+};
+
+/** Checks if an atom exists in a bond.
+ * \param Nr index of atom
+ * \return true if it is either bond::leftatom or bond::rightatom, false otherwise
+ */
+bool bond::Contains(const int number)
+{
+  return ((leftatom->getNr() == number) || (rightatom->getNr() == number));
+};
+
+/** Calculates the bond length.
+ * \return |a - b| with a = bond::leftatom and b = bond::rightatom.
+ */
+double bond::GetDistance() const
+{
+  return (leftatom->distance(*rightatom));
+};
+
+/** Calculates the bond length.
+ * \return |a - b|^2 with a = bond::leftatom and b = bond::rightatom.
+ */
+double bond::GetDistanceSquared() const
+{
+  return (leftatom->DistanceSquared(*rightatom));
+};
Index: src/Bond/bond.hpp
===================================================================
--- src/Bond/bond.hpp	(revision 12920404e7a45c1ac4fe563b7c5a29891f5e662a)
+++ src/Bond/bond.hpp	(revision 12920404e7a45c1ac4fe563b7c5a29891f5e662a)
@@ -0,0 +1,60 @@
+/*
+ * Bond.hpp
+ *
+ *  Created on: Aug 3, 2009
+ *      Author: heber
+ */
+
+#ifndef BOND_HPP_
+#define BOND_HPP_
+
+using namespace std;
+
+/*********************************************** includes ***********************************/
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Bond/GraphEdge.hpp"
+
+/****************************************** forward declarations *****************************/
+
+class atom;
+class ParticleInfo;
+
+/********************************************** declarations *******************************/
+
+/** Bonds between atoms.
+ * Class incorporates bonds between atoms in a molecule.
+ * Note that we regard bond always as something in a molecule,
+ * as it is the glue making up the connected subgraph and
+ * hence the molecule. Thus, bonds belong globally to the molecule
+ * (and are free'd there) and only locally to the atom class.
+ */
+class bond : public GraphEdge
+{
+  public:
+  atom *leftatom;    //!< first bond partner
+  atom *rightatom;  //!< second bond partner
+  int HydrogenBond;  //!< Number of hydrogen atoms in the bond
+  int BondDegree;    //!< single, double, triple, ... bond
+  int nr;           //!< unique number in a molecule, updated by BondGraph::CreateAdjacencyForList()
+
+  atom * GetOtherAtom(const ParticleInfo * const Atom) const;
+
+  bool Contains(const ParticleInfo * const ptr);
+  bool Contains(const int nr);
+  double GetDistance() const;
+  double GetDistanceSquared() const;
+
+  bond();
+  bond(atom *left, atom *right, const int degree=1, const int number=0);
+  ~bond();
+
+};
+
+ostream & operator << (ostream &ost, const bond &b);
+
+#endif /* BOND_HPP_ */
