Index: src/Analysis/unittests/CountBondsUnitTest.cpp
===================================================================
--- src/Analysis/unittests/CountBondsUnitTest.cpp	(revision 44f53e999bbb8a07d6654248774d7a3bb802ecaa)
+++ src/Analysis/unittests/CountBondsUnitTest.cpp	(revision 826e8c4cef286b7e87fd674f1ec0a8776fa20f0f)
@@ -33,4 +33,5 @@
 #include "Atom/atom.hpp"
 #include "Bond/bond.hpp"
+#include "CodePatterns/Log.hpp"
 #include "Element/element.hpp"
 #include "Element/periodentafel.hpp"
@@ -62,7 +63,9 @@
   CPPUNIT_ASSERT(oxygen != NULL && "could not find element oxygen");
 
+  //setVerbosity(3);
+
   // construct molecule (water molecule)
   TestMolecule1 = World::getInstance().createMolecule();
-  CPPUNIT_ASSERT(TestMolecule1 != NULL && "could not create first molecule");
+  CPPUNIT_ASSERT(TestMolecule1 != NULL && "could not create second molecule");
   Walker = World::getInstance().createAtom();
   CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
@@ -81,30 +84,10 @@
   TestMolecule1->AddAtom(Walker);
 
-  TestMolecule2 = World::getInstance().createMolecule();
-  CPPUNIT_ASSERT(TestMolecule2 != NULL && "could not create second molecule");
-  Walker = World::getInstance().createAtom();
-  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->setType(hydrogen);
-  Walker->setPosition(Vector(-0.2418, 0.9350, 0. ));
-  TestMolecule2->AddAtom(Walker);
-  Walker = World::getInstance().createAtom();
-  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->setType(hydrogen);
-  Walker->setPosition(Vector(0.9658, 0., 0. ));
-  TestMolecule2->AddAtom(Walker);
-  Walker = World::getInstance().createAtom();
-  CPPUNIT_ASSERT(Walker != NULL && "could not create atom");
-  Walker->setType(oxygen);
-  Walker->setPosition(Vector(0., 0., 0. ));
-  TestMolecule2->AddAtom(Walker);
-
   molecules = World::getInstance().getMolecules();
   CPPUNIT_ASSERT(molecules != NULL && "could not obtain list of molecules");
   molecules->insert(TestMolecule1);
-  molecules->insert(TestMolecule2);
-
-  // check that TestMolecule was correctly constructed
+
+  // check that TestMolecule1 was correctly constructed
   CPPUNIT_ASSERT_EQUAL( TestMolecule1->getAtomCount(), 3 );
-  CPPUNIT_ASSERT_EQUAL( TestMolecule2->getAtomCount(), 3 );
 
   // create a small file with table
@@ -116,7 +99,4 @@
   BG->CreateAdjacency(Set1);
   CPPUNIT_ASSERT( TestMolecule1->getBondCount() != 0);
-  World::AtomComposite Set2 = TestMolecule2->getAtomSet();
-  BG->CreateAdjacency(Set2);
-  CPPUNIT_ASSERT( TestMolecule2->getBondCount() != 0);
 //  TestMolecule1->Output((ofstream *)&cout);
 //  TestMolecule1->OutputBondsList(std::cout);
@@ -136,5 +116,5 @@
 void CountBondsTest::BondsOfTwoTest()
 {
-  CPPUNIT_ASSERT_EQUAL( 4 , CountBondsOfTwo(molecules, hydrogen, oxygen) );
+  CPPUNIT_ASSERT_EQUAL( 2 , CountBondsOfTwo(molecules, hydrogen, oxygen) );
   CPPUNIT_ASSERT_EQUAL( 0 , CountBondsOfTwo(molecules, hydrogen, hydrogen) );
   CPPUNIT_ASSERT_EQUAL( 0 , CountBondsOfTwo(molecules, oxygen, oxygen) );
@@ -145,9 +125,9 @@
 void CountBondsTest::BondsOfThreeTest()
 {
-  CPPUNIT_ASSERT_EQUAL( 2 , CountBondsOfThree(molecules, hydrogen, oxygen, hydrogen) );
+  CPPUNIT_ASSERT_EQUAL( 1 , CountBondsOfThree(molecules, hydrogen, oxygen, hydrogen) );
   CPPUNIT_ASSERT_EQUAL( 0 , CountBondsOfThree(molecules, oxygen, hydrogen, oxygen) );
 };
 
-void OutputTestMolecule(molecule *mol, const char *name)
+void OutputTestMolecule1(molecule *mol, const char *name)
 {
   ofstream output(name);
@@ -166,78 +146,83 @@
   Vector Translator;
 
-  //OutputTestMolecule(TestMolecule1, "testmolecule1.xyz");
+  //OutputTestMolecule1(TestMolecule1, "testmolecule1.xyz");
+
+  // create TestMolecule2 as copy
+  TestMolecule2 = TestMolecule1->CopyMolecule();
+  molecules->insert(TestMolecule2);
+  CPPUNIT_ASSERT_EQUAL( TestMolecule2->getAtomCount(), 3 );
 
   cout << "Case 1: offset of (3,0,0), hence angles are (104.5, 0, 75.5, 180) < 30." << endl;
   Translator  = Vector(3,0,0);
-  TestMolecule2->Translate(&Translator);
+  TestMolecule1->Translate(&Translator);
   CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
   CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, oxygen, NULL) );
-  //OutputTestMolecule(TestMolecule2, "testmolecule2-1.xyz");
+  //OutputTestMolecule1(TestMolecule1, "testmolecule2-1.xyz");
   Translator = Vector(-3,0,0);
-  TestMolecule2->Translate(&Translator);
+  TestMolecule1->Translate(&Translator);
 
   cout << "Case 2: offset of (0,3,0), hence angle are (14.5, 165.5, 90) < 30 (only three, because other 90 is missing due to first H01 only fulfilling H-bond criteria)." << endl;
   Translator = Vector(0,3,0);
-  TestMolecule2->Translate(&Translator);
+  TestMolecule1->Translate(&Translator);
   CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
-  //OutputTestMolecule(TestMolecule2, "testmolecule2-2.xyz");
+  //OutputTestMolecule1(TestMolecule1, "testmolecule2-2.xyz");
   Translator = Vector(0,-3,0);
-  TestMolecule2->Translate(&Translator);
+  TestMolecule1->Translate(&Translator);
 
   cout << "Case 3: offset of (0,-3,0) and mirror, hence angle are (165.5, 90, 165.5, 90) > 30." << endl;
   Translator = Vector(0,-3,0);
-  TestMolecule2->Scale((const double ** const)&mirror);
-  TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
-  //OutputTestMolecule(TestMolecule2, "testmolecule2-3.xyz");
+  TestMolecule1->Scale((const double ** const)&mirror);
+  TestMolecule1->Translate(&Translator);
+  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
+  //OutputTestMolecule1(TestMolecule1, "testmolecule2-3.xyz");
   Translator = Vector(0,3,0);
-  TestMolecule2->Translate(&Translator);
-  TestMolecule2->Scale((const double ** const)&mirror);
+  TestMolecule1->Translate(&Translator);
+  TestMolecule1->Scale((const double ** const)&mirror);
 
   cout << "Case 4: offset of (2,1,0), hence angle are (78, 26.6, 102, 153.4) < 30." << endl;
   Translator = Vector(2,1,0);
-  TestMolecule2->Translate(&Translator);
+  TestMolecule1->Translate(&Translator);
   CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
-  //OutputTestMolecule(TestMolecule2, "testmolecule2-4.xyz");
+  //OutputTestMolecule1(TestMolecule1, "testmolecule2-4.xyz");
   Translator = Vector(-2,-1,0);
-  TestMolecule2->Translate(&Translator);
+  TestMolecule1->Translate(&Translator);
 
   cout << "Case 5: offset of (0,0,3), hence angle are (90, 90, 90, 90) > 30." << endl;
   Translator = Vector(0,0,3);
-  TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
-  //OutputTestMolecule(TestMolecule2, "testmolecule2-5.xyz");
+  TestMolecule1->Translate(&Translator);
+  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
+  //OutputTestMolecule1(TestMolecule1, "testmolecule2-5.xyz");
   Translator = Vector(0,0,-3);
-  TestMolecule2->Translate(&Translator);
+  TestMolecule1->Translate(&Translator);
 
   cout << "Case 6: offset of (-3,0,0) and mirror, hence angle are (75.5, 180, 104.5, 180) > 30." << endl;
   Translator = Vector(-3,0,0);
-  TestMolecule2->Scale((const double ** const)&mirror);
-  TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
-  //OutputTestMolecule(TestMolecule2, "testmolecule2-6.xyz");
+  TestMolecule1->Scale((const double ** const)&mirror);
+  TestMolecule1->Translate(&Translator);
+  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
+  //OutputTestMolecule1(TestMolecule1, "testmolecule2-6.xyz");
   Translator = Vector(3,0,0);
-  TestMolecule2->Translate(&Translator);
-  TestMolecule2->Scale((const double ** const)&mirror);
+  TestMolecule1->Translate(&Translator);
+  TestMolecule1->Scale((const double ** const)&mirror);
 
   cout << "Case 7: offset of (3,0,0) and mirror, hence angles are (104.5, 0, 104.5, 0) < 30, but interfering hydrogens." << endl;
   Translator = Vector(3,0,0);
-  TestMolecule2->Scale((const double ** const)&mirror);
-  TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
-  //OutputTestMolecule(TestMolecule2, "testmolecule2-7.xyz");
+  TestMolecule1->Scale((const double ** const)&mirror);
+  TestMolecule1->Translate(&Translator);
+  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
+  //OutputTestMolecule1(TestMolecule1, "testmolecule2-7.xyz");
   Translator = Vector(-3,0,0);
-  TestMolecule2->Translate(&Translator);
-  TestMolecule2->Scale((const double ** const)&mirror);
+  TestMolecule1->Translate(&Translator);
+  TestMolecule1->Scale((const double ** const)&mirror);
 
   cout << "Case 8: offset of (0,3,0), hence angle are (14.5, 90, 14.5, 90) < 30, but interfering hydrogens." << endl;
   Translator = Vector(0,3,0);
-  TestMolecule2->Scale((const double ** const)&mirror);
-  TestMolecule2->Translate(&Translator);
-  //OutputTestMolecule(TestMolecule2, "testmolecule2-8.xyz");
+  TestMolecule1->Scale((const double ** const)&mirror);
+  TestMolecule1->Translate(&Translator);
+  //OutputTestMolecule1(TestMolecule1, "testmolecule2-8.xyz");
   CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
   Translator = Vector(0,-3,0);
-  TestMolecule2->Translate(&Translator);
-  TestMolecule2->Scale((const double ** const)&mirror);
+  TestMolecule1->Translate(&Translator);
+  TestMolecule1->Scale((const double ** const)&mirror);
 
   delete[](mirror);
