Index: src/molecules.cpp
===================================================================
--- src/molecules.cpp	(revision 4885953476621842a73cecc5177c8cd1f40a0ac5)
+++ src/molecules.cpp	(revision 451148c889a1e260d1c4a7372972a3c1e05c9c64)
@@ -1942,5 +1942,5 @@
  * \return true - file written successfully, false - writing failed
  */
-bool molecule::StoreAdjacencyToFile(ofstream *out, char *path)
+bool molecule::StoreAdjacencyToFile(ofstream *out, char *path, int bondorder)
 {
   ofstream AdjacencyFile;
@@ -1953,4 +1953,5 @@
   cout << Verbose(1) << "Saving adjacency list ... ";
   if (AdjacencyFile != NULL) {
+    AdjacencyFile << "Order\t" << bondorder << endl;
     Walker = start;
     while(Walker->next != end) {
@@ -1976,7 +1977,8 @@
  * \param *path path to file
  * \param **ListOfAtoms allocated (molecule::AtomCount) and filled lookup table for ids (Atom::nr) to *Atom
+ * \param bondorder check whether files matches desired bond order
  * \return true - structure is equal, false - not equivalence
  */ 
-bool molecule::CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms)
+bool molecule::CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms, int bondorder)
 {
   char *filename = (char *) Malloc(sizeof(char)*255, "molecule::CheckAdjacencyFileAgainstMolecule - filename");
@@ -1992,46 +1994,54 @@
     int *CurrentBonds = (int *) Malloc(sizeof(int)*8, "molecule::CheckAdjacencyFileAgainstMolecule - CurrentBonds"); // contains parsed bonds of current atom
     int CurrentBondsOfAtom;
-    // Parse the file line by line and count the bonds
-    while (!File.eof()) {
-      File.getline(filename, 255);
-      stringstream line;
-      line.str(filename);
-      int AtomNr = -1;
-      line >> AtomNr;
-      CurrentBondsOfAtom = -1; // we count one too far due to line end
-      // parse into structure
-      if ((AtomNr >= 0) && (AtomNr < AtomCount)) {
-        while (!line.eof())
-          line >> CurrentBonds[ ++CurrentBondsOfAtom ];
-        // compare against present bonds
-        //cout << Verbose(2) << "Walker is " << *Walker << ", bond partners: ";
-        if (CurrentBondsOfAtom == NumberOfBondsPerAtom[AtomNr]) {
-          for(int i=0;i<NumberOfBondsPerAtom[AtomNr];i++) {
-            int id = ListOfBondsPerAtom[AtomNr][i]->GetOtherAtom(ListOfAtoms[AtomNr])->nr;
-            int j = 0;
-            for (;(j<CurrentBondsOfAtom) && (CurrentBonds[j++] != id);); // check against all parsed bonds
-            if (CurrentBonds[j-1] != id) { // no match ? Then mark in ListOfAtoms
-              ListOfAtoms[AtomNr] = NULL;
-              NonMatchNumber++;
-              status = false;
-              //out << "[" << id << "]\t";
-            } else {
-              //out << id << "\t";
+
+    // determine order from file
+    File.getline(filename, 255);    
+    if (bondorder != atoi(&filename[5])) {
+      *out << "Bond order desired is " << bondorder << " and does not match one in file " << filename[6] << "." << endl;
+      status = false;
+    } else {
+      // Parse the file line by line and count the bonds
+      while (!File.eof()) {
+        File.getline(filename, 255);
+        stringstream line;
+        line.str(filename);
+        int AtomNr = -1;
+        line >> AtomNr;
+        CurrentBondsOfAtom = -1; // we count one too far due to line end
+        // parse into structure
+        if ((AtomNr >= 0) && (AtomNr < AtomCount)) {
+          while (!line.eof())
+            line >> CurrentBonds[ ++CurrentBondsOfAtom ];
+          // compare against present bonds
+          //cout << Verbose(2) << "Walker is " << *Walker << ", bond partners: ";
+          if (CurrentBondsOfAtom == NumberOfBondsPerAtom[AtomNr]) {
+            for(int i=0;i<NumberOfBondsPerAtom[AtomNr];i++) {
+              int id = ListOfBondsPerAtom[AtomNr][i]->GetOtherAtom(ListOfAtoms[AtomNr])->nr;
+              int j = 0;
+              for (;(j<CurrentBondsOfAtom) && (CurrentBonds[j++] != id);); // check against all parsed bonds
+              if (CurrentBonds[j-1] != id) { // no match ? Then mark in ListOfAtoms
+                ListOfAtoms[AtomNr] = NULL;
+                NonMatchNumber++;
+                status = false;
+                //out << "[" << id << "]\t";
+              } else {
+                //out << id << "\t";
+              }
             }
+            //out << endl;
+          } else {
+            *out << "Number of bonds for Atom " << *ListOfAtoms[AtomNr] << " does not match, parsed " << CurrentBondsOfAtom << " against " << NumberOfBondsPerAtom[AtomNr] << "." << endl;
+            status = false;
           }
-          //out << endl;
-        } else {
-          *out << "Number of bonds for Atom " << *ListOfAtoms[AtomNr] << " does not match, parsed " << CurrentBondsOfAtom << " against " << NumberOfBondsPerAtom[AtomNr] << "." << endl;
-          status = false;
         }
       }
-    }
-    File.close();
-    File.clear();
-    if (status) { // if equal we parse the KeySetFile
-      *out << " done: Equal." << endl;
-      status = true;
-    } else
-      *out << " done: Not equal by " << NonMatchNumber << " atoms." << endl;
+      File.close();
+      File.clear();
+      if (status) { // if equal we parse the KeySetFile
+        *out << " done: Equal." << endl;
+        status = true;
+      } else
+        *out << " done: Not equal by " << NonMatchNumber << " atoms." << endl;
+    }
     Free((void **)&CurrentBonds, "molecule::CheckAdjacencyFileAgainstMolecule - **CurrentBonds");
   } else {
@@ -2093,5 +2103,5 @@
     status = false;
   }
-  status = status && CheckAdjacencyFileAgainstMolecule(out, configuration->configpath, ListOfAtoms); 
+  status = status && CheckAdjacencyFileAgainstMolecule(out, configuration->configpath, ListOfAtoms, BottomUpOrder); 
   if (status) {  // NULL entries in ListOfAtoms contain NonMatches
     status = status && ParseKeySetFile(out, configuration->configpath, ListOfAtoms, FragmentList, configuration->GetIsAngstroem());
@@ -2102,5 +2112,5 @@
   if (!status) {
     // === store Adjacency file ===
-    StoreAdjacencyToFile(out, configuration->configpath);
+    StoreAdjacencyToFile(out, configuration->configpath, BottomUpOrder);
 
     // === first perform a DFS analysis to gather info on cyclic structure and a list of disconnected subgraphs ===
Index: src/molecules.hpp
===================================================================
--- src/molecules.hpp	(revision 4885953476621842a73cecc5177c8cd1f40a0ac5)
+++ src/molecules.hpp	(revision 451148c889a1e260d1c4a7372972a3c1e05c9c64)
@@ -520,6 +520,6 @@
   /// Fragment molecule by two different approaches:
   void FragmentMolecule(ofstream *out, int BottomUpOrder, int TopDownOrder, enum BondOrderScheme Scheme, config *configuration, enum CutCyclicBond CutCyclic);
-  bool StoreAdjacencyToFile(ofstream *out, char *path);
-  bool CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms);
+  bool StoreAdjacencyToFile(ofstream *out, char *path, int bondorder);
+  bool CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms, int bondorder);
   bool ParseKeySetFile(ofstream *out, char *filename, atom **ListOfAtoms, MoleculeListClass *&FragmentList, bool IsAngstroem);
   bool ScanBufferIntoKeySet(ofstream *out, char *buffer, KeySet &CurrentSet);
