Index: src/Legacy/oldmenu.cpp
===================================================================
--- src/Legacy/oldmenu.cpp	(revision f2f4ae653593ee7da86b543fbbb0de89955e6797)
+++ src/Legacy/oldmenu.cpp	(revision bfd839afaa19cf687475c7163024108135b3d1ce)
@@ -8,4 +8,5 @@
 
 #include "Legacy/oldmenu.hpp"
+#include "analysis_bonds.hpp"
 #include "analysis_correlation.hpp"
 #include "World.hpp"
@@ -501,4 +502,5 @@
   Log() << Verbose(0) << " f - calculate temperature from current velocity" << endl;
   Log() << Verbose(0) << " g - output all temperatures per step from velocities" << endl;
+  Log() << Verbose(0) << " h - count the number of hydrogen bonds" << endl;
   Log() << Verbose(0) << "all else - go back" << endl;
   Log() << Verbose(0) << "===============================================" << endl;
@@ -591,4 +593,17 @@
         output->close();
         delete(output);
+      }
+      break;
+    case 'h':
+      {
+        int Z1;
+        cout << "Please enter first interface element: ";
+        cin >> Z1;
+        const element * InterfaceElement = World::getInstance().getPeriode()->FindElement(Z1);
+        int Z2;
+        cout << "Please enter second interface element: ";
+        cin >> Z2;
+        const element * InterfaceElement2 = World::getInstance().getPeriode()->FindElement(Z2);
+        cout << endl << "There are " << CountHydrogenBridgeBonds(World::getInstance().getMolecules(), InterfaceElement, InterfaceElement2) << " hydrogen bridges with connections to " << (InterfaceElement != 0 ? InterfaceElement->name : "None") << " and " << (InterfaceElement2 != 0 ? InterfaceElement2->name : "None") << "." << endl;
       }
       break;
Index: src/analysis_bonds.cpp
===================================================================
--- src/analysis_bonds.cpp	(revision f2f4ae653593ee7da86b543fbbb0de89955e6797)
+++ src/analysis_bonds.cpp	(revision bfd839afaa19cf687475c7163024108135b3d1ce)
@@ -123,6 +123,7 @@
  * \param *molecules molecules to count bonds
  * \param *InterfaceElement or NULL
- */
-int CountHydrogenBridgeBonds(MoleculeListClass *molecules, element * InterfaceElement = NULL)
+ * \param *Interface2Element or NULL
+ */
+int CountHydrogenBridgeBonds(MoleculeListClass *molecules, const element * InterfaceElement = NULL, const element * Interface2Element = NULL)
 {
   atom *Walker = NULL;
@@ -132,4 +133,5 @@
   double Otherangle = 0.;
   bool InterfaceFlag = false;
+  bool Interface2Flag = false;
   bool OtherHydrogenFlag = true;
   for (MoleculeList::const_iterator MolWalker = molecules->ListOfMolecules.begin();MolWalker != molecules->ListOfMolecules.end(); MolWalker++) {
@@ -151,4 +153,5 @@
               OtherHydrogens = 0;
               InterfaceFlag = (InterfaceElement == NULL);
+              Interface2Flag = (Interface2Element == NULL);
               for (BondList::const_iterator BondRunner = Runner->ListOfBonds.begin(); BondRunner != Runner->ListOfBonds.end(); BondRunner++) {
                 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(Runner);
@@ -161,4 +164,5 @@
                 }
                 InterfaceFlag = InterfaceFlag || (OtherAtom->type == InterfaceElement);
+                Interface2Flag = Interface2Flag || (OtherAtom->type == Interface2Element);
               }
               DoLog(1) && (Log() << Verbose(1) << "Otherangle is " << Otherangle << " for " << OtherHydrogens << " hydrogens." << endl);
@@ -174,5 +178,5 @@
                   break;
               }
-              if (InterfaceFlag && OtherHydrogenFlag) {
+              if (InterfaceFlag && Interface2Flag && OtherHydrogenFlag) {
                 // on this element (Walker) we check for bond to hydrogen, i.e. part of water molecule
                 for (BondList::const_iterator BondRunner = Walker->ListOfBonds.begin(); BondRunner != Walker->ListOfBonds.end(); BondRunner++) {
Index: src/analysis_bonds.hpp
===================================================================
--- src/analysis_bonds.hpp	(revision f2f4ae653593ee7da86b543fbbb0de89955e6797)
+++ src/analysis_bonds.hpp	(revision bfd839afaa19cf687475c7163024108135b3d1ce)
@@ -33,5 +33,5 @@
 void MinMeanMaxBondDistanceBetweenElements(const molecule *mol, element *type1, element *type2, double &Min, double &Mean, double &Max);
 
-int CountHydrogenBridgeBonds(MoleculeListClass * const molecules, element * InterfaceElement);
+int CountHydrogenBridgeBonds(MoleculeListClass * const molecules, const element * InterfaceElement, const element * Interface2Element);
 int CountBondsOfTwo(MoleculeListClass * const molecules, const element * const first, const element * const second);
 int CountBondsOfThree(MoleculeListClass * const molecules, const element * const first, const element * const second, const element * const third);
Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision f2f4ae653593ee7da86b543fbbb0de89955e6797)
+++ src/builder.cpp	(revision bfd839afaa19cf687475c7163024108135b3d1ce)
@@ -70,4 +70,5 @@
 #include "molecule.hpp"
 #include "periodentafel.hpp"
+#include "tesselationhelpers.hpp"
 #include "UIElements/UIFactory.hpp"
 #include "UIElements/MainWindow.hpp"
@@ -1519,5 +1520,4 @@
         switch(argv[argptr-1][1]) {
           case 'h':
-          case 'H':
           case '?':
             DoLog(0) && (Log() << Verbose(0) << "MoleCuilder suite" << endl << "==================" << endl << endl);
@@ -1538,5 +1538,6 @@
             DoLog(0) && (Log() << Verbose(0) << "\t-FF <MaxDistance> <xyz of filler> <dist_x> <dist_y> <dist_z> <epsilon> <randatom> <randmol> <DoRotate>\tFilling Box with water molecules." << endl);
             DoLog(0) && (Log() << Verbose(0) << "\t-g <file>\tParses a bond length table from the given file." << endl);
-            DoLog(0) && (Log() << Verbose(0) << "\t-h/-H/-?\tGive this help screen." << endl);
+            DoLog(0) && (Log() << Verbose(0) << "\t-h/-?\tGive this help screen." << endl);
+            DoLog(0) && (Log() << Verbose(0) << "\t-H\tCount Hydrogen bridge bonds." << endl);
             DoLog(0) && (Log() << Verbose(0) << "\t-I\t Dissect current system of molecules into a set of disconnected (subgraphs of) molecules." << endl);
             DoLog(0) && (Log() << Verbose(0) << "\t-j\t<path> Store all bonds to file." << endl);
@@ -1817,4 +1818,17 @@
                 if (mol != NULL)
                   mol->ActiveFlag = true;
+              }
+              break;
+            case 'H':
+              if ((argptr+1 >= argc) || (argv[argptr][0] == '-') || (argv[argptr+1][0] == '-')) {
+                ExitFlag = 255;
+                DoeLog(0) && (eLog()<< Verbose(0) << "Not enough or invalid arguments given for calculating hydrogen bridge bonds: -H <Z1> <Z2>" << endl);
+                performCriticalExit();
+              } else {
+                if (ExitFlag == 0) ExitFlag = 1;
+                const element *elemental = periode->FindElement((const int) atoi(argv[argptr]));
+                const element *elemental2 = periode->FindElement((const int) atoi(argv[argptr+1]));
+                cout << endl << "There are " << CountHydrogenBridgeBonds(molecules, elemental, elemental2) << " hydrogen bridges with connections to " << (elemental != 0 ? elemental->name : "None") << " and " << (elemental2 != 0 ? elemental2->name : "None") << "." << endl;
+                argptr+=1;
               }
               break;
Index: src/unittests/CountBondsUnitTest.cpp
===================================================================
--- src/unittests/CountBondsUnitTest.cpp	(revision f2f4ae653593ee7da86b543fbbb0de89955e6797)
+++ src/unittests/CountBondsUnitTest.cpp	(revision bfd839afaa19cf687475c7163024108135b3d1ce)
@@ -167,6 +167,6 @@
   Translator  = Vector(3,0,0);
   TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL) );
-  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, oxygen) );
+  CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
+  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, oxygen, NULL) );
   //OutputTestMolecule(TestMolecule2, "testmolecule2-1.xyz");
   Translator = Vector(-3,0,0);
@@ -176,5 +176,5 @@
   Translator = Vector(0,3,0);
   TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL) );
+  CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
   //OutputTestMolecule(TestMolecule2, "testmolecule2-2.xyz");
   Translator = Vector(0,-3,0);
@@ -185,5 +185,5 @@
   TestMolecule2->Scale((const double ** const)&mirror);
   TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL) );
+  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
   //OutputTestMolecule(TestMolecule2, "testmolecule2-3.xyz");
   Translator = Vector(0,3,0);
@@ -194,5 +194,5 @@
   Translator = Vector(2,1,0);
   TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL) );
+  CPPUNIT_ASSERT_EQUAL( 1 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
   //OutputTestMolecule(TestMolecule2, "testmolecule2-4.xyz");
   Translator = Vector(-2,-1,0);
@@ -202,5 +202,5 @@
   Translator = Vector(0,0,3);
   TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL) );
+  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
   //OutputTestMolecule(TestMolecule2, "testmolecule2-5.xyz");
   Translator = Vector(0,0,-3);
@@ -211,5 +211,5 @@
   TestMolecule2->Scale((const double ** const)&mirror);
   TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL) );
+  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
   //OutputTestMolecule(TestMolecule2, "testmolecule2-6.xyz");
   Translator = Vector(3,0,0);
@@ -221,5 +221,5 @@
   TestMolecule2->Scale((const double ** const)&mirror);
   TestMolecule2->Translate(&Translator);
-  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL) );
+  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
   //OutputTestMolecule(TestMolecule2, "testmolecule2-7.xyz");
   Translator = Vector(-3,0,0);
@@ -232,5 +232,5 @@
   TestMolecule2->Translate(&Translator);
   //OutputTestMolecule(TestMolecule2, "testmolecule2-8.xyz");
-  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL) );
+  CPPUNIT_ASSERT_EQUAL( 0 , CountHydrogenBridgeBonds(molecules, NULL, NULL) );
   Translator = Vector(0,-3,0);
   TestMolecule2->Translate(&Translator);
