Index: src/Parser/MpqcParser.cpp
===================================================================
--- src/Parser/MpqcParser.cpp	(revision 963321a9c39219a067721dc5f8f1bf433d2e0e92)
+++ src/Parser/MpqcParser.cpp	(revision 4cbca0e8710efb136e5936feefe9dd2e7a865873)
@@ -55,8 +55,14 @@
 void MpqcParser::load(istream *file)
 {
-  bool GeometryFollows = false;
+  bool MpqcSection = false;
+  bool MoleculeSection = false;
+  bool GeometrySection = false;
+  bool BasisSection = false;
+  bool AuxBasisSection = false;
   char line[MAXSTRINGSIZE];
   typedef boost::tokenizer<boost::char_separator<char> > tokenizer;
   boost::char_separator<char> sep("[]");
+  boost::char_separator<char> angularsep("<>");
+  boost::char_separator<char> equalitysep("=");
   boost::char_separator<char> whitesep(" \t");
   ConvertTo<double> toDouble;
@@ -64,37 +70,107 @@
   molecule *newmol = World::getInstance().createMolecule();
   newmol->ActiveFlag = true;
+  // TODO: Remove the insertion into molecule when saving does not depend on them anymore. Also, remove molecule.hpp include
+  World::getInstance().getMolecules()->insert(newmol);
   while (file->good()) {
     file->getline(line, MAXSTRINGSIZE-1);
     std::string linestring(line);
     if ((linestring.find("atoms geometry") == string::npos) && (linestring.find("}") != string::npos)) {
-      GeometryFollows = false;
-    }
-    if (GeometryFollows) { // we have an atom
-      tokenizer tokens(linestring, sep);
-//      if (tokens.size() != 2)
-//        throw MpqcParseException;
+      GeometrySection = false;
+    }
+    if ((linestring.find(")") != string::npos)) { // ends a section which do not overlap
+      MpqcSection = false;
+      MoleculeSection = false;
+      BasisSection = false;
+      AuxBasisSection = false;
+    }
+    if (MoleculeSection) {
+      if (GeometrySection) { // we have an atom
+        tokenizer tokens(linestring, sep);
+  //      if (tokens.size() != 2)
+  //        throw MpqcParseException;
+        tokenizer::iterator tok_iter = tokens.begin();
+        std::stringstream whitespacefilter(*tok_iter++);
+        std::string element;
+        whitespacefilter >> element;
+        std::string vector = *tok_iter;
+        tokenizer vectorcomponents(vector, whitesep);
+        Vector X;
+  //      if (vectorcomponents.size() != NDIM)
+  //        throw MpqcParseException;
+        tok_iter = vectorcomponents.begin();
+        for (int i=0; i<NDIM; ++i) {
+          X[i] = toDouble(*tok_iter++);
+        }
+        // create atom
+        atom *newAtom = World::getInstance().createAtom();
+        newAtom->setType(World::getInstance().getPeriode()->FindElement(element));
+        newAtom->setPosition(X);
+        newmol->AddAtom(newAtom);
+        DoLog(1) && (Log() << Verbose(1) << "Adding atom " << *newAtom << std::endl);
+      }
+    }
+    if (MpqcSection) {
+      tokenizer tokens(linestring, equalitysep);
       tokenizer::iterator tok_iter = tokens.begin();
       std::stringstream whitespacefilter(*tok_iter++);
-      std::string element;
-      whitespacefilter >> element;
-      std::string vector = *tok_iter;
-      tokenizer vectorcomponents(vector, whitesep);
-      Vector X;
-//      if (vectorcomponents.size() != NDIM)
-//        throw MpqcParseException;
-      tok_iter = vectorcomponents.begin();
-      for (int i=0; i<NDIM; ++i) {
-        X[i] = toDouble(*tok_iter++);
-      }
-      // create atom
-      atom *newAtom = World::getInstance().createAtom();
-      newAtom->setType(World::getInstance().getPeriode()->FindElement(element));
-      newAtom->setPosition(X);
-      newmol->AddAtom(newAtom);
-      DoLog(1) && (Log() << Verbose(1) << "Adding atom " << *newAtom << std::endl);
+      std::string key(*tok_iter++);
+      if (params.haveParam(key)) {
+        std::stringstream linestream(linestring);
+        linestream >> params;
+      } else if (linestring.find("mole<") != string::npos) { // get theory
+        tokenizer tokens(linestring, angularsep);
+        tokenizer::iterator tok_iter = tokens.begin();
+        std::string value(*(++tok_iter));
+        std::stringstream linestream("theory = "+value);
+        linestream >> params;
+      } else if (linestring.find("integrals<") != string::npos) { // get theory
+        tokenizer tokens(linestring, angularsep);
+        tokenizer::iterator tok_iter = tokens.begin();
+        std::string value(*(++tok_iter));
+        std::stringstream linestream("integration = "+value);
+        linestream >> params;
+      }
+    }
+    if (BasisSection) {
+      tokenizer tokens(linestring, equalitysep);
+      tokenizer::iterator tok_iter = tokens.begin();
+      std::string key(*tok_iter++);
+      std::string value(*tok_iter);
+      // TODO: use exception instead of ASSERT
+      ASSERT(tok_iter == tokens.end(),
+          "MpqcParser::load() - more than (key = value) on line "+linestring+".");
+      if (key == "name") {
+        std::stringstream linestream("basis = "+value);
+        linestream >> params;
+      }
+    }
+    if (AuxBasisSection) {
+      tokenizer tokens(linestring, equalitysep);
+      tokenizer::iterator tok_iter = tokens.begin();
+      std::string key(*tok_iter++);
+      std::string value(*tok_iter);
+      // TODO: use exception instead of ASSERT
+      ASSERT(tok_iter == tokens.end(),
+          "MpqcParser::load() - more than (key = value) on line "+linestring+".");
+      if (key == "name") {
+        std::stringstream linestream("aux_basis = "+value);
+        linestream >> params;
+      }
     }
     // set some scan flags
+    if (linestring.find("mpqc:") != string::npos) {
+      MpqcSection = true;
+    }
+    if (linestring.find("molecule<Molecule>:") != string::npos) {
+      MoleculeSection = true;
+    }
     if (linestring.find("atoms geometry") != string::npos) {
-      GeometryFollows = true;
+      GeometrySection = true;
+    }
+    if ((linestring.find("basis<GaussianBasisSet>:") != string::npos) && ((linestring.find("abasis<") == string::npos))) {
+      BasisSection = true;
+    }
+    if (linestring.find("abasis<") != string::npos) {
+      AuxBasisSection = true;
     }
   }
