Index: src/bondgraph.cpp
===================================================================
--- src/bondgraph.cpp	(revision b21a64f827e177ed45bda0d871259b15127ce530)
+++ src/bondgraph.cpp	(revision 34e0013c3d36c570e3d7cccf0314b9998c524fbc)
@@ -32,5 +32,6 @@
 
 /** Parses the bond lengths in a given file and puts them int a matrix form.
- * Allocates \a MatrixContainer and uses MatrixContainer::ParseMatrix().
+ * Allocates \a MatrixContainer for BondGraph::BondLengthMatrix, using MatrixContainer::ParseMatrix(),
+ * but only if parsing is successfull. Otherwise variable is left as NULL.
  * \param *out output stream for debugging
  * \param filename file with bond lengths to parse
@@ -40,4 +41,5 @@
 {
   bool status = true;
+  MatrixContainer *TempContainer = NULL;
 
   // allocate MatrixContainer
@@ -46,16 +48,24 @@
     delete(BondLengthMatrix);
   }
-  BondLengthMatrix = new MatrixContainer;
+  TempContainer = new MatrixContainer;
 
   // parse in matrix
-  BondLengthMatrix->ParseMatrix(filename.c_str(), 0, 1, 0);
+  status = TempContainer->ParseMatrix(filename.c_str(), 0, 1, 0);
 
   // find greatest distance
   max_distance=0;
-  for(int i=0;i<BondLengthMatrix->RowCounter[0];i++)
-    for(int j=i;j<BondLengthMatrix->ColumnCounter[0];j++)
-      if (BondLengthMatrix->Matrix[0][i][j] > max_distance)
-        max_distance = BondLengthMatrix->Matrix[0][i][j];
+  if (status) {
+    for(int i=0;i<TempContainer->RowCounter[0];i++)
+      for(int j=i;j<TempContainer->ColumnCounter[0];j++)
+        if (TempContainer->Matrix[0][i][j] > max_distance)
+          max_distance = TempContainer->Matrix[0][i][j];
+  }
 
+  if (status) // set to not NULL only if matrix was parsed
+    BondLengthMatrix = TempContainer;
+  else {
+    BondLengthMatrix = NULL;
+    delete(TempContainer);
+  }
   return status;
 };
@@ -70,7 +80,11 @@
   bool status = true;
 
-  if (BondLengthMatrix == NULL)
-   return false;
-  mol->CreateAdjacencyList(out, max_distance, IsAngstroem, &BondGraph::BondLengthMatrixMinMaxDistance, this);
+  if (mol->start->next == mol->end) // only construct if molecule is not empty
+    return false;
+
+  if (BondLengthMatrix == NULL) // no bond length matrix parsed?
+    mol->CreateAdjacencyList(out, max_distance, IsAngstroem, &BondGraph::CovalentMinMaxDistance, this);
+  else
+    mol->CreateAdjacencyList(out, max_distance, IsAngstroem, &BondGraph::BondLengthMatrixMinMaxDistance, this);
 
   return status;
@@ -84,5 +98,8 @@
 double BondGraph::GetBondLength(int firstZ, int secondZ)
 {
-  return (BondLengthMatrix->Matrix[0][firstZ][secondZ]);
+  if (BondLengthMatrix == NULL)
+    return( -1. );
+  else
+    return (BondLengthMatrix->Matrix[0][firstZ][secondZ]);
 };
 
@@ -113,5 +130,5 @@
 void BondGraph::BondLengthMatrixMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem)
 {
-  if (BondLengthMatrix->Matrix == NULL) {// safety measure if no matrix has been parsed yet
+  if (BondLengthMatrix == NULL) {// safety measure if no matrix has been parsed yet
     cerr << Verbose(1) << "WARNING:  BondLengthMatrixMinMaxDistance() called without having parsed the bond length matrix yet!" << endl;
     CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem);
Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision b21a64f827e177ed45bda0d871259b15127ce530)
+++ src/builder.cpp	(revision 34e0013c3d36c570e3d7cccf0314b9998c524fbc)
@@ -1451,5 +1451,5 @@
       return 1;
     }
-    // 3b. Find config file name and parse if possible
+    // 3b. Find config file name and parse if possible, also BondGraphFileName
     if (argv[1][0] != '-') {
       // simply create a new molecule, wherein the config file is loaded and the manipulation takes place
@@ -1479,10 +1479,10 @@
           case 1:
             cout << "new syntax." << endl;
-            configuration.Load(ConfigFileName, periode, mol);
+            configuration.Load(ConfigFileName, BondGraphFileName, periode, mol);
             configPresent = present;
             break;
           case 0:
             cout << "old syntax." << endl;
-            configuration.LoadOld(ConfigFileName, periode, mol);
+            configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, mol);
             configPresent = present;
             break;
@@ -1494,12 +1494,4 @@
     } else
       configPresent = absent;
-    // 3c. parse the bond graph file if given
-    configuration.BG = new BondGraph(configuration.GetIsAngstroem());
-    if (configuration.BG->LoadBondLengthTable((ofstream *)&cout, BondGraphFileName)) {
-      cout << Verbose(0) << "Bond length table loaded successfully." << endl;
-    } else {
-      cout << Verbose(0) << "Bond length table loading failed." << endl;
-      return 1;
-    }
     // 4. parse again through options, now for those depending on elements db and config presence
     argptr = 1;
Index: src/config.cpp
===================================================================
--- src/config.cpp	(revision b21a64f827e177ed45bda0d871259b15127ce530)
+++ src/config.cpp	(revision 34e0013c3d36c570e3d7cccf0314b9998c524fbc)
@@ -831,8 +831,9 @@
 /** Initializes config file structure by loading elements from a give file.
  * \param *file input file stream being the opened config file
+ * \param BondGraphFileName file name of the bond length table file, if string is left blank, no table is parsed.
  * \param *periode pointer to a periodentafel class with all elements
  * \param *mol pointer to molecule containing all atoms of the molecule
  */
-void config::Load(const char * const filename, const periodentafel * const periode, molecule * const &mol)
+void config::Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, molecule * const &mol)
 {
   ifstream *file = new ifstream(filename);
@@ -860,4 +861,5 @@
   /* Namen einlesen */
 
+  // 1. parse in options
   ParseForParameter(verbose,FileBuffer, "mainname", 0, 1, 1, string_type, (config::mainname), 1, critical);
   ParseForParameter(verbose,FileBuffer, "defaultpath", 0, 1, 1, string_type, (config::defaultpath), 1, critical);
@@ -1040,5 +1042,17 @@
     config::StructOpt = 0;
 
+  // 2. parse the bond graph file if given
+  BG = new BondGraph(IsAngstroem);
+  if (BG->LoadBondLengthTable((ofstream *)&cout, BondGraphFileName)) {
+    cout << Verbose(0) << "Bond length table loaded successfully." << endl;
+  } else {
+    cout << Verbose(0) << "Bond length table loading failed." << endl;
+  }
+
+  // 3. parse the molecule in
   LoadMolecule(mol, FileBuffer, periode, FastParsing);
+
+  // 4. dissect the molecule into connected subgraphs
+  BG->ConstructBondGraph((ofstream *)&cout, mol);
 
   delete(FileBuffer);
@@ -1047,8 +1061,9 @@
 /** Initializes config file structure by loading elements from a give file with old pcp syntax.
  * \param *file input file stream being the opened config file with old pcp syntax
+ * \param BondGraphFileName file name of the bond length table file, if string is left blank, no table is parsed.
  * \param *periode pointer to a periodentafel class with all elements
  * \param *mol pointer to molecule containing all atoms of the molecule
  */
-void config::LoadOld(const char * const filename, const periodentafel * const periode, molecule * const &mol)
+void config::LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, molecule * const &mol)
 {
   ifstream *file = new ifstream(filename);
@@ -1207,6 +1222,14 @@
   config::StructOpt = 0;
 
+
+  // 2. parse the bond graph file if given
+  BG = new BondGraph(IsAngstroem);
+  if (BG->LoadBondLengthTable((ofstream *)&cout, BondGraphFileName)) {
+    cout << Verbose(0) << "Bond length table loaded successfully." << endl;
+  } else {
+    cout << Verbose(0) << "Bond length table loading failed." << endl;
+  }
+
   // Routine from builder.cpp
-
 
   for (i=MAX_ELEMENTS;i--;)
Index: src/config.hpp
===================================================================
--- src/config.hpp	(revision b21a64f827e177ed45bda0d871259b15127ce530)
+++ src/config.hpp	(revision 34e0013c3d36c570e3d7cccf0314b9998c524fbc)
@@ -135,6 +135,6 @@
 
   int TestSyntax(const char * const filename, const periodentafel * const periode, const molecule * const mol) const;
-  void Load(const char * const filename, const periodentafel * const periode, molecule * const &mol);
-  void LoadOld(const char * const filename, const periodentafel * const periode, molecule * const &mol);
+  void Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, molecule * const &mol);
+  void LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, molecule * const &mol);
   void RetrieveConfigPathAndName(const string filename);
   bool Save(const char * const filename, const periodentafel * const periode, molecule * const mol) const;
Index: src/molecule_graph.cpp
===================================================================
--- src/molecule_graph.cpp	(revision b21a64f827e177ed45bda0d871259b15127ce530)
+++ src/molecule_graph.cpp	(revision 34e0013c3d36c570e3d7cccf0314b9998c524fbc)
@@ -122,5 +122,5 @@
   *out << Verbose(1) << "AtomCount " << AtomCount << "." << endl;
 
-  if (AtomCount != 0) {
+  if ((AtomCount > 1) && (bonddistance > 1.)) {
     LC = new LinkedCell(this, bonddistance);
 
