Index: src/Hbondangle.db
===================================================================
--- src/Hbondangle.db	(revision ad2b411bce1e0560ebf2e3ba6134e4b38b4681ea)
+++ src/Hbondangle.db	(revision 274d45ac1a71ab65f0579050d6a972f174caf5e2)
@@ -1,2 +1,3 @@
+# atomicnumber angles for single, double and triple bond (-1 no angle)
 1	180	-1	-1
 5	180	131.0	109.2
Index: src/Hbonddistance.db
===================================================================
--- src/Hbonddistance.db	(revision ad2b411bce1e0560ebf2e3ba6134e4b38b4681ea)
+++ src/Hbonddistance.db	(revision 274d45ac1a71ab65f0579050d6a972f174caf5e2)
@@ -1,2 +1,3 @@
+#atomic number bond distances for single, double and triple bond (-1 no bond)
 1	0.74	-1	-1
 2	0.77429209	-1	-1
Index: src/config.cpp
===================================================================
--- src/config.cpp	(revision ad2b411bce1e0560ebf2e3ba6134e4b38b4681ea)
+++ src/config.cpp	(revision 274d45ac1a71ab65f0579050d6a972f174caf5e2)
@@ -1784,6 +1784,5 @@
   char filename[MAXSTRINGSIZE];
   ofstream output;
-  molecule *mol = World::getInstance().createMolecule();
-  mol->SetNameFromFilename(ConfigFileName);
+  molecule *mol = NULL;
 
   if (!strcmp(configpath, GetDefaultPath())) {
@@ -1816,24 +1815,30 @@
   // translate each to its center and merge all molecules in MoleculeListClass into this molecule
   int N = molecules->ListOfMolecules.size();
-  int *src = new int[N];
-  N=0;
-  for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
-    src[N++] = (*ListRunner)->IndexNr;
-    (*ListRunner)->Translate(&(*ListRunner)->Center);
-  }
-  molecules->SimpleMultiAdd(mol, src, N);
-  delete[](src);
-
-  // ... and translate back
-  for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
-    (*ListRunner)->Center.Scale(-1.);
-    (*ListRunner)->Translate(&(*ListRunner)->Center);
-    (*ListRunner)->Center.Scale(-1.);
+  if (N != 1) { // don't do anything in case of only one molecule (shifts mol ids otherwise)
+    int *src = new int[N];
+    N=0;
+    for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) {
+      src[N++] = (*ListRunner)->IndexNr;
+      (*ListRunner)->Translate(&(*ListRunner)->Center);
+    }
+    mol = World::getInstance().createMolecule();
+    mol->SetNameFromFilename(ConfigFileName);
+    molecules->SimpleMultiMerge(mol, src, N);
+    mol->doCountAtoms();
+    mol->CountElements();
+    mol->CalculateOrbitals(*this);
+    delete[](src);
+  } else {
+    if (!molecules->ListOfMolecules.empty()) {
+      mol = *(molecules->ListOfMolecules.begin());
+      mol->doCountAtoms();
+      mol->CalculateOrbitals(*this);
+    } else {
+      DoeLog(1) && (eLog() << Verbose(1) << "There are no molecules to save!" << endl);
+    }
   }
 
   Log() << Verbose(0) << "Storing configuration ... " << endl;
   // get correct valence orbitals
-  mol->CalculateOrbitals(*this);
-  InitMaxMinStopStep = MaxMinStopStep = MaxPsiDouble;
   if (ConfigFileName != NULL) { // test the file name
     strcpy(filename, ConfigFileName);
@@ -1895,5 +1900,6 @@
   }
 
-  World::getInstance().destroyMolecule(mol);
+  // don't destroy molecule as it contains all our atoms
+  //World::getInstance().destroyMolecule(mol);
 };
 
Index: src/molecule.cpp
===================================================================
--- src/molecule.cpp	(revision ad2b411bce1e0560ebf2e3ba6134e4b38b4681ea)
+++ src/molecule.cpp	(revision 274d45ac1a71ab65f0579050d6a972f174caf5e2)
@@ -42,5 +42,5 @@
   NoCyclicBonds(0), BondDistance(0.),  ActiveFlag(false), IndexNr(-1),
   formula(this,boost::bind(&molecule::calcFormula,this),"formula"),
-  AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), last_atom(0),  InternalPointer(begin())
+  AtomCount(this,boost::bind(&molecule::doCountAtoms,this),"AtomCount"), last_atom(0),  InternalPointer(atoms.begin())
 {
 
@@ -146,5 +146,6 @@
   iter--;
   atom* atom = *loc;
-  atoms.erase( loc );
+  atomIds.erase( atom->getId() );
+  atoms.remove( atom );
   atom->removeFromMolecule();
   return iter;
@@ -156,5 +157,6 @@
   molecule::const_iterator iter = find(key);
   if (iter != end()){
-    atoms.erase( iter++ );
+    atomIds.erase( key->getId() );
+    atoms.remove( key );
     key->removeFromMolecule();
   }
@@ -164,15 +166,25 @@
 molecule::const_iterator molecule::find ( atom * key ) const
 {
-  return atoms.find( key );
+  molecule::const_iterator iter;
+  for (molecule::const_iterator Runner = begin(); Runner != end(); ++Runner) {
+    if (*Runner == key)
+      return molecule::const_iterator(Runner);
+  }
+  return molecule::const_iterator(atoms.end());
 }
 
 pair<molecule::iterator,bool> molecule::insert ( atom * const key )
 {
-  pair<atomSet::iterator,bool> res = atoms.insert(key);
-  return pair<iterator,bool>(iterator(res.first,this),res.second);
+  pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId());
+  if (res.second) { // push atom if went well
+    atoms.push_back(key);
+    return pair<iterator,bool>(molecule::iterator(--end()),res.second);
+  } else {
+    return pair<iterator,bool>(molecule::iterator(end()),res.second);
+  }
 }
 
 bool molecule::containsAtom(atom* key){
-  return atoms.count(key);
+  return (find(key) != end());
 }
 
@@ -790,4 +802,5 @@
   for (molecule::iterator iter = begin(); !empty(); iter = begin())
       erase(iter);
+  return empty();
 };
 
@@ -1010,5 +1023,5 @@
   configuration.MaxPsiDouble /= 2;
   configuration.PsiType = (configuration.PsiMaxNoDown == configuration.PsiMaxNoUp) ? 0 : 1;
-  if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2)) {
+  if ((configuration.PsiType == 1) && (configuration.ProcPEPsi < 2) && ((configuration.PsiMaxNoDown != 1) || (configuration.PsiMaxNoUp != 0))) {
     configuration.ProcPEGamma /= 2;
     configuration.ProcPEPsi *= 2;
@@ -1017,5 +1030,12 @@
     configuration.ProcPEPsi = 1;
   }
-  configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.MaxPsiDouble;
+  cout << configuration.PsiMaxNoDown << ">" << configuration.PsiMaxNoUp << endl;
+  if (configuration.PsiMaxNoDown > configuration.PsiMaxNoUp) {
+    configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.PsiMaxNoDown;
+    cout << configuration.PsiMaxNoDown << " " << configuration.InitMaxMinStopStep << endl;
+  } else {
+    configuration.InitMaxMinStopStep = configuration.MaxMinStopStep = configuration.PsiMaxNoUp;
+    cout << configuration.PsiMaxNoUp << " " << configuration.InitMaxMinStopStep << endl;
+  }
 };
 
Index: src/molecule.hpp
===================================================================
--- src/molecule.hpp	(revision ad2b411bce1e0560ebf2e3ba6134e4b38b4681ea)
+++ src/molecule.hpp	(revision 274d45ac1a71ab65f0579050d6a972f174caf5e2)
@@ -93,5 +93,6 @@
 
   public:
-    typedef std::set<atom*> atomSet;
+    typedef std::list<atom*> atomSet;
+    typedef std::set<atomId_t> atomIdSet;
     typedef ObservedIterator<atomSet> iterator;
     typedef atomSet::const_iterator const_iterator;
@@ -121,5 +122,6 @@
     Cacheable<int>    AtomCount;
     moleculeId_t id;
-    atomSet atoms; //<!set of atoms
+    atomSet atoms; //<!list of atoms
+    atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms
   protected:
     //void CountAtoms();
Index: src/molecule_pointcloud.cpp
===================================================================
--- src/molecule_pointcloud.cpp	(revision ad2b411bce1e0560ebf2e3ba6134e4b38b4681ea)
+++ src/molecule_pointcloud.cpp	(revision 274d45ac1a71ab65f0579050d6a972f174caf5e2)
@@ -57,5 +57,10 @@
 void molecule::GoToFirst() const
 {
-  InternalPointer = atoms.begin();
+  // evil hack necessary because
+  // -# although InternalPointer is mutable
+  // -# only const_iterator begin() is called due to const in the function declaration above
+  // -# and there is no cast from const_iterator to const iterator
+  atomSet::const_iterator test = begin();
+  InternalPointer = *(reinterpret_cast<atomSet::iterator *>(&test));
 };
 
Index: src/moleculelist.cpp
===================================================================
--- src/moleculelist.cpp	(revision ad2b411bce1e0560ebf2e3ba6134e4b38b4681ea)
+++ src/moleculelist.cpp	(revision 274d45ac1a71ab65f0579050d6a972f174caf5e2)
@@ -212,9 +212,8 @@
 
   // put all molecules of src into mol
-  molecule::iterator runner;
-  for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
-    runner = iter++;
-    srcmol->UnlinkAtom((*runner));
-    mol->AddAtom((*runner));
+  for (molecule::iterator iter = srcmol->begin(); !srcmol->empty(); iter=srcmol->begin()) {
+    atom * const Walker = *iter;
+    srcmol->UnlinkAtom(Walker);
+    mol->AddAtom(Walker);
   }
 
@@ -259,4 +258,5 @@
     status = status && SimpleMerge(mol, srcmol);
   }
+  insert(mol);
   return status;
 };
Index: src/orbitals.db
===================================================================
--- src/orbitals.db	(revision ad2b411bce1e0560ebf2e3ba6134e4b38b4681ea)
+++ src/orbitals.db	(revision 274d45ac1a71ab65f0579050d6a972f174caf5e2)
@@ -1,2 +1,3 @@
+# atomicnumber numberoforbitals
 1	1
 2	0
Index: src/periodentafel.cpp
===================================================================
--- src/periodentafel.cpp	(revision ad2b411bce1e0560ebf2e3ba6134e4b38b4681ea)
+++ src/periodentafel.cpp	(revision 274d45ac1a71ab65f0579050d6a972f174caf5e2)
@@ -373,5 +373,5 @@
       (*input) >> elements[Z]->Valence;
       (*input) >> ws;
-      //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->Valence << " valence electrons." << endl;
+      //Log() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->Valence << " valence electrons." << endl;
     }
     return true;
@@ -396,5 +396,5 @@
       (*input) >> elements[Z]->NoValenceOrbitals;
       (*input) >> ws;
-      //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
+      //Log() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;
     }
     return true;
Index: src/valence.db
===================================================================
--- src/valence.db	(revision ad2b411bce1e0560ebf2e3ba6134e4b38b4681ea)
+++ src/valence.db	(revision 274d45ac1a71ab65f0579050d6a972f174caf5e2)
@@ -1,2 +1,3 @@
+#atomicnumber numberofvalenceorbitals
 1	0.10000000000000E+01
 2	0.20000000000000E+01
