Index: src/Parser/Exceptions.hpp
===================================================================
--- src/Parser/Exceptions.hpp	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
+++ src/Parser/Exceptions.hpp	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
@@ -0,0 +1,36 @@
+/*
+ * Exceptions.hpp
+ *
+ *  Created on: Mar 12, 2012
+ *      Author: heber
+ */
+
+#ifndef EXCEPTIONS_HPP_
+#define EXCEPTIONS_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <exception>
+#include <boost/exception/all.hpp>
+
+/** Base type for all exceptions regarding linear algebra.
+ *
+ */
+struct ParserException : virtual std::exception, virtual boost::exception { };
+
+/** ========================== General error information ================== */
+
+/** Exception information for ParserException: non-present key of an internal map.
+ */
+typedef boost::error_info< struct tag_ParserMapLookup, const std::string > ParserMapLookup;
+
+/** ============================ Specific exceptions ====================== */
+
+/** Exception thrown when a lookup for an internal map fails.
+ */
+struct IllegalParserKeyException : virtual ParserException { };
+
+#endif /* EXCEPTIONS_HPP_ */
Index: src/Parser/Makefile.am
===================================================================
--- src/Parser/Makefile.am	(revision 955b91eef584d31f8d9958b67d1ea39b84eb1fb7)
+++ src/Parser/Makefile.am	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
@@ -20,4 +20,5 @@
   Parser/Psi3Parser_Parameters.cpp \
   Parser/TremoloParser.cpp \
+  Parser/TremoloParser_ElementKeys.cpp \
   Parser/TremoloAtomInfoContainer.cpp \
   Parser/XyzParser.cpp
@@ -26,4 +27,5 @@
   Parser/ChangeTracker.hpp \
   Parser/ConfigFileBuffer.hpp \
+  Parser/Exceptions.hpp \
   Parser/FormatParser.hpp \
   Parser/FormatParser_specializations_header.hpp \
@@ -48,4 +50,5 @@
   Parser/TremoloKey.hpp \
   Parser/TremoloParser.hpp \
+  Parser/TremoloParser_ElementKeys.hpp \
   Parser/TremoloAtomInfoContainer.hpp \
   Parser/XyzParser.hpp
Index: src/Parser/TremoloParser_ElementKeys.cpp
===================================================================
--- src/Parser/TremoloParser_ElementKeys.cpp	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
+++ src/Parser/TremoloParser_ElementKeys.cpp	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
@@ -0,0 +1,143 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2012 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * TremoloParser_ElementKeys.cpp
+ *
+ *  Created on: Mar 12, 2012
+ *      Author: heber
+ */
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "TremoloParser_ElementKeys.hpp"
+
+#include <boost/tokenizer.hpp>
+#include <iostream>
+#include "CodePatterns/Log.hpp"
+
+#include "Element/element.hpp"
+#include "Element/periodentafel.hpp"
+#include "Parser/Exceptions.hpp"
+#include "World.hpp"
+
+/** Parses a .potentials file and creates from it the knownTypes file.
+ *
+ * @param file input stream of .potentials file
+ */
+void ElementKeys::parseKnownTypes(std::istream &file)
+{
+  const periodentafel *periode = World::getInstance().getPeriode();
+  // remove old mapping
+  clear();
+
+//  LOG(3, "INFO: additionalAtomData contains: " << additionalAtomData);
+
+  // parse in file
+  typedef boost::tokenizer<boost::char_separator<char> >
+      tokenizer;
+  boost::char_separator<char> tokensep(":\t ,;");
+  boost::char_separator<char> equalitysep("\t =");
+  std::string line;
+  while (file.good()) {
+    std::getline( file, line );
+    LOG(4, "INFO: full line of parameters is '" << line << "'");
+    if (line.find("particle:") != string::npos) {
+      LOG(3, "INFO: found line '" << line << "' containing keyword 'particle:'.");
+      tokenizer tokens(line, tokensep);
+      ASSERT(tokens.begin() != tokens.end(),
+          "FormatParser< tremolo >::parseKnownTypes() - line with 'particle:' but no particles separated by comma.");
+      // look for particle_type
+      std::string particle_type("NULL");
+      std::string element_type("NULL");
+      for (tokenizer::iterator tok_iter = tokens.begin();
+          tok_iter != tokens.end();
+          ++tok_iter) {
+        if ((*tok_iter).find("particle_type") != string::npos) {
+          LOG(3, "INFO: found token '" << *tok_iter << "' containing keyword 'particle_type'.");
+          tokenizer token((*tok_iter), equalitysep);
+          ASSERT(token.begin() != token.end(),
+                    "FormatParser< tremolo >::parseKnownTypes() - could not split particle_type by equality sign");
+          tokenizer::iterator particle_iter = token.begin();
+          particle_iter++;
+          particle_type = *particle_iter;
+        }
+        if ((*tok_iter).find("element_name") != string::npos) {
+          LOG(3, "INFO: found token '" << *tok_iter << "' containing keyword 'element_name'.");
+          tokenizer token((*tok_iter), equalitysep);
+          ASSERT(token.begin() != token.end(),
+                    "FormatParser< tremolo >::parseKnownTypes() - could not split particle_type by equality sign");
+          tokenizer::iterator element_iter = token.begin();
+          element_iter++;
+          element_type = *element_iter;
+        }
+      }
+      if ((particle_type != "NULL") && (element_type != "NULL")) {
+        if (periode->FindElement(element_type) != NULL) {
+          LOG(1, "INFO: Added Type " << particle_type << " as reference to element " << element_type << ".");
+          setType(particle_type, element_type);
+        } else {
+          ELOG(1, "INFO: Either Type " << particle_type << " or " << element_type << " could not be recognized." );
+        }
+      } else {
+        ELOG(3, "Line does not contain both 'particle_type' and 'element_name' as keys." );
+      }
+    }
+  }
+}
+
+/** Creates knownTypes as the identity, e.g. H -> H, He -> He, ... .
+ *
+ */
+void ElementKeys::createKnownTypesByIdentity()
+{
+  // remove old mapping
+  clear();
+  // make knownTypes the identity mapping
+  const periodentafel *periode = World::getInstance().getPeriode();
+  for (periodentafel::const_iterator iter = periode->begin();
+      iter != periode->end();
+      ++iter) {
+    setType( iter->second->getSymbol(), iter->second->getSymbol());
+  }
+}
+
+/** Getter for value indexed by \a type.
+ *
+ * @param type key for map
+ * @return value stored under \a type
+ */
+const std::string &ElementKeys::getType(const std::string &type) const throw (IllegalParserKeyException)
+{
+  const_iterator iter = find(type);
+  if (iter == end()) {
+    throw IllegalParserKeyException() << ParserMapLookup(type);
+  } else
+    return iter->second;
+}
+
+/** Getter for value indexed by \a type.
+ *
+ * @param type key for map
+ * @return value stored under \a type
+ */
+void ElementKeys::setType(const std::string &type, const std::string &value) throw (IllegalParserKeyException)
+{
+  const_iterator iter = find(type);
+  if (iter != end()) {
+    throw IllegalParserKeyException() << ParserMapLookup(type);
+  } else {
+    insert( make_pair(type,value) );
+    LOG(3, "DEBUG: Key " << type << " refers to element " << at(type) << ".");
+  }
+}
Index: src/Parser/TremoloParser_ElementKeys.hpp
===================================================================
--- src/Parser/TremoloParser_ElementKeys.hpp	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
+++ src/Parser/TremoloParser_ElementKeys.hpp	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
@@ -0,0 +1,33 @@
+/*
+ * TremoloParser_ElementKeys.hpp
+ *
+ *  Created on: Mar 12, 2012
+ *      Author: heber
+ */
+
+#ifndef TREMOLOPARSER_ELEMENTKEYS_HPP_
+#define TREMOLOPARSER_ELEMENTKEYS_HPP_
+
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <iosfwd>
+#include <map>
+#include <string>
+
+#include "Parser/Exceptions.hpp"
+
+struct ElementKeys : private std::map<std::string, std::string>
+{
+  void parseKnownTypes(std::istream &file);
+  void createKnownTypesByIdentity();
+
+  const std::string &getType(const std::string &type) const throw (IllegalParserKeyException);
+  void setType(const std::string &type, const std::string &value) throw (IllegalParserKeyException);
+};
+
+
+#endif /* TREMOLOPARSER_ELEMENTKEYS_HPP_ */
Index: src/Parser/unittests/Makefile.am
===================================================================
--- src/Parser/unittests/Makefile.am	(revision 955b91eef584d31f8d9958b67d1ea39b84eb1fb7)
+++ src/Parser/unittests/Makefile.am	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
@@ -10,4 +10,5 @@
 	../Parser/unittests/ParserPsi3UnitTest.cpp \
 	../Parser/unittests/ParserTremoloUnitTest.cpp \
+	../Parser/unittests/ParserTremolo_ElementKeysUnitTest.cpp \
 	../Parser/unittests/ParserXyzUnitTest.cpp
 
@@ -18,4 +19,5 @@
 	../Parser/unittests/ParserPsi3UnitTest.hpp \
 	../Parser/unittests/ParserTremoloUnitTest.hpp \
+	../Parser/unittests/ParserTremolo_ElementKeysUnitTest.hpp \
 	../Parser/unittests/ParserXyzUnitTest.hpp
 
@@ -26,4 +28,5 @@
   ParserPsi3UnitTest \
   ParserTremoloUnitTest \
+  ParserTremolo_ElementKeysUnitTest \
   ParserXyzUnitTest
 
@@ -64,4 +67,9 @@
 ParserTremoloUnitTest_LDADD = ${PARSERLIBS}
 
+ParserTremolo_ElementKeysUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
+	../Parser/unittests/ParserTremolo_ElementKeysUnitTest.cpp \
+	../Parser/unittests/ParserTremolo_ElementKeysUnitTest.hpp
+ParserTremolo_ElementKeysUnitTest_LDADD = ${PARSERLIBS}
+
 ParserXyzUnitTest_SOURCES = $(top_srcdir)/src/unittests/UnitTestMain.cpp \
 	../Parser/unittests/ParserXyzUnitTest.cpp \
Index: src/Parser/unittests/ParserTremolo_ElementKeysUnitTest.cpp
===================================================================
--- src/Parser/unittests/ParserTremolo_ElementKeysUnitTest.cpp	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
+++ src/Parser/unittests/ParserTremolo_ElementKeysUnitTest.cpp	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
@@ -0,0 +1,69 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2010-2012 University of Bonn. All rights reserved.
+ * Please see the LICENSE file or "Copyright notice" in builder.cpp for details.
+ */
+
+/*
+ * ParserTremolo_ElementKeysUnitTest.cpp
+ *
+ *  Created on: Mar 3, 2010
+ *      Author: metzler
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "ParserTremolo_ElementKeysUnitTest.hpp"
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/ui/text/TestRunner.h>
+
+#include "Atom/atom.hpp"
+#include "Descriptors/AtomTypeDescriptor.hpp"
+#include "Element/element.hpp"
+#include "Element/periodentafel.hpp"
+#include "Parser/TremoloParser.hpp"
+#include "Parser/TremoloParser_ElementKeys.hpp"
+#include "Parser/ChangeTracker.hpp"
+#include "World.hpp"
+#include "WorldTime.hpp"
+
+#ifdef HAVE_TESTRUNNER
+#include "UnitTestMain.hpp"
+#endif /*HAVE_TESTRUNNER*/
+
+using namespace std;
+
+// Registers the fixture into the 'registry'
+CPPUNIT_TEST_SUITE_REGISTRATION( ParserTremolo_ElementKeysUnitTest );
+void ParserTremolo_ElementKeysUnitTest::setUp()
+{
+  knownTypes = new ElementKeys();
+}
+
+void ParserTremolo_ElementKeysUnitTest::tearDown()
+{
+  delete knownTypes;
+}
+
+/************************************ tests ***********************************/
+
+void ParserTremolo_ElementKeysUnitTest::settergetterTest()
+{
+  // install a key
+  CPPUNIT_ASSERT_NO_THROW( knownTypes->setType("H1", "H"));
+
+  // check for excepetion
+  CPPUNIT_ASSERT_THROW( knownTypes->setType("H1", "H"), IllegalParserKeyException);
+
+  // get present key
+  CPPUNIT_ASSERT_NO_THROW( knownTypes->getType("H1"));
+
+  // get non-present key
+  CPPUNIT_ASSERT_THROW( knownTypes->getType("F"), IllegalParserKeyException);
+}
Index: src/Parser/unittests/ParserTremolo_ElementKeysUnitTest.hpp
===================================================================
--- src/Parser/unittests/ParserTremolo_ElementKeysUnitTest.hpp	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
+++ src/Parser/unittests/ParserTremolo_ElementKeysUnitTest.hpp	(revision d9005c16a207bbd7364238aaf6dfaa1afe18b7cb)
@@ -0,0 +1,38 @@
+/*
+ * ParserTremolo_ElementKeysUnitTest.hpp
+ *
+ *  Created on: Mar 12, 2012
+ *      Author: heber
+ */
+#ifndef PARSERTREMOLO_ELEMENTKEYS_UNITTEST_HPP_
+#define PARSERTREMOLO_ELEMENTKEYS_UNITTEST_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Parser/TremoloParser.hpp"
+
+#include <cppunit/extensions/HelperMacros.h>
+#include <string>
+
+struct ElementKeys;
+
+class ParserTremolo_ElementKeysUnitTest :  public CppUnit::TestFixture
+{
+  CPPUNIT_TEST_SUITE( ParserTremolo_ElementKeysUnitTest ) ;
+  CPPUNIT_TEST ( settergetterTest );
+  CPPUNIT_TEST_SUITE_END();
+
+public:
+  void setUp();
+  void tearDown();
+
+  void settergetterTest();
+
+private:
+  ElementKeys *knownTypes;
+};
+
+#endif /* PARSERTREMOLO_ELEMENTKEYS_UNITTEST_HPP_ */
