Index: src/Actions/PotentialAction/ParseAtomFragmentsAction.cpp
===================================================================
--- src/Actions/PotentialAction/ParseAtomFragmentsAction.cpp	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
+++ src/Actions/PotentialAction/ParseAtomFragmentsAction.cpp	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
@@ -0,0 +1,127 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2016 Frederik Heber. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * ParseAtomFragmentsAction.cpp
+ *
+ *  Created on: Mar 07, 2016
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// include headers that implement a archive in simple text format
+// and before MemDebug due to placement new
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <iostream>
+
+#include "CodePatterns/Log.hpp"
+#include "CodePatterns/toString.hpp"
+
+#include "Fragmentation/Homology/AtomFragmentsMap.hpp"
+#include "Fragmentation/KeySet.hpp"
+#include "World.hpp"
+
+#include "Actions/PotentialAction/ParseAtomFragmentsAction.hpp"
+
+using namespace MoleCuilder;
+
+// and construct the stuff
+#include "ParseAtomFragmentsAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+
+void parseAtomFragmentsFromFile(
+    const boost::filesystem::path &atomfragments_file
+    )
+{
+  AtomFragmentsMap &atomfragments_container = AtomFragmentsMap::getInstance();
+  if (boost::filesystem::exists(atomfragments_file)) {
+    std::ifstream returnstream(atomfragments_file.string().c_str());
+    if (returnstream.good()) {
+      boost::archive::text_iarchive ia(returnstream);
+      ia >> atomfragments_container;
+    } else {
+      ELOG(2, "Failed to parse from " << atomfragments_file.string() << ".");
+    }
+    returnstream.close();
+    // for debugging, list homologies
+    if (DoLog(3)) {
+      typedef AtomFragmentsMap::AtomFragmentsMap_t::const_iterator citer;
+      AtomFragmentsMap::AtomFragmentsMap_t atommap = atomfragments_container.getMap();
+      citer olditer = atommap.end();
+      for (citer iter = atommap.begin();
+          iter != atommap.end();
+          ++iter) {
+        // if it's the same as the old one, skip it
+        if (olditer == iter)
+          continue;
+        else
+          olditer = iter;
+        LOG(3, "DEBUG:  atom #" << iter->first << " with " << toString(iter->second));
+      }
+    }
+  } else {
+    LOG(2, "Could not open " << atomfragments_file.string()
+        << ", creating empty container.");
+  }
+}
+
+ActionState::ptr PotentialParseAtomFragmentsAction::performCall()
+{
+  // append all keysets to atomfragments file
+  if (!params.atomfragments_file.get().empty()) {
+    const boost::filesystem::path &atomfragments_file = params.atomfragments_file.get();
+    LOG(1, "INFO: Parsing AtomFragmentsGraphs from file " << atomfragments_file.string() << ".");
+    parseAtomFragmentsFromFile(atomfragments_file);
+    return Action::success;
+  } else {
+    STATUS("AtomFragments file name is empty.");
+    return Action::failure;
+  }
+}
+
+ActionState::ptr PotentialParseAtomFragmentsAction::performUndo(ActionState::ptr _state) {
+  STATUS("Undo of PotentialParseAtomFragmentsAction not implemented.");
+  return Action::failure;
+}
+
+ActionState::ptr PotentialParseAtomFragmentsAction::performRedo(ActionState::ptr _state){
+  STATUS("Redo of PotentialParseAtomFragmentsAction not implemented.");
+  return Action::failure;
+}
+
+bool PotentialParseAtomFragmentsAction::canUndo() {
+  return false;
+}
+
+bool PotentialParseAtomFragmentsAction::shouldUndo() {
+  return false;
+}
+/** =========== end of function ====================== */
Index: src/Actions/PotentialAction/ParseAtomFragmentsAction.def
===================================================================
--- src/Actions/PotentialAction/ParseAtomFragmentsAction.def	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
+++ src/Actions/PotentialAction/ParseAtomFragmentsAction.def	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
@@ -0,0 +1,35 @@
+/*
+ * ParseAtomFragmentsAction.def
+ *
+ *  Created on: Mar 07, 2016
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "Parameters/Validators/Specific/FilePresentValidator.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
+#define paramtypes (boost::filesystem::path)
+#define paramtokens ("parse-atom-fragments")
+#define paramdescriptions ("path to file containing atom fragments association container to parse")
+#define paramdefaults (NOPARAM_DEFAULT)
+#define paramreferences (atomfragments_file)
+#define paramvalids \
+(FilePresentValidator())
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Potential
+#define MENUNAME "potential"
+#define MENUPOSITION 1
+#define ACTIONNAME ParseAtomFragments
+#define TOKEN "parse-atom-fragments"
+
+
+// finally the information stored in the ActionTrait specialization
+#define DESCRIPTION "parses atom fragments association present in a file into World's container"
+#undef SHORTFORM
Index: src/Actions/PotentialAction/ParseAtomFragmentsAction.hpp
===================================================================
--- src/Actions/PotentialAction/ParseAtomFragmentsAction.hpp	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
+++ src/Actions/PotentialAction/ParseAtomFragmentsAction.hpp	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
@@ -0,0 +1,22 @@
+/*
+ * ParseAtomFragmentsAction.hpp
+ *
+ *  Created on: Mar 07, 2016
+ *      Author: heber
+ */
+
+#ifndef PARSEATOMFRAGMENTSACTION_HPP_
+#define PARSEATOMFRAGMENTSACTION_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "Actions/Action.hpp"
+
+#include "ParseAtomFragmentsAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* PARSEATOMFRAGMENTSACTION_HPP_ */
Index: src/Actions/PotentialAction/SaveAtomFragmentsAction.cpp
===================================================================
--- src/Actions/PotentialAction/SaveAtomFragmentsAction.cpp	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
+++ src/Actions/PotentialAction/SaveAtomFragmentsAction.cpp	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
@@ -0,0 +1,112 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2016 Frederik Heber. All rights reserved.
+ * 
+ *
+ *   This file is part of MoleCuilder.
+ *
+ *    MoleCuilder is free software: you can redistribute it and/or modify
+ *    it under the terms of the GNU General Public License as published by
+ *    the Free Software Foundation, either version 2 of the License, or
+ *    (at your option) any later version.
+ *
+ *    MoleCuilder is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *    GNU General Public License for more details.
+ *
+ *    You should have received a copy of the GNU General Public License
+ *    along with MoleCuilder.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+/*
+ * SaveAtomFragmentsAction.cpp
+ *
+ *  Created on: Mar 07, 2016
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+// include headers that implement a archive in simple text format
+// and before MemDebug due to placement new
+#include <boost/archive/text_oarchive.hpp>
+#include <boost/archive/text_iarchive.hpp>
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include <iostream>
+
+#include "CodePatterns/Log.hpp"
+
+#include "Fragmentation/Homology/AtomFragmentsMap.hpp"
+#include "Fragmentation/KeySet.hpp"
+
+#include "Actions/PotentialAction/SaveAtomFragmentsAction.hpp"
+
+using namespace MoleCuilder;
+
+// and construct the stuff
+#include "SaveAtomFragmentsAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+
+bool writeAtomFragmentsToFile(
+    const boost::filesystem::path &atomfragments_file
+    )
+{
+  /// store homology container again
+  AtomFragmentsMap &atomfragments_container = AtomFragmentsMap::getInstance();
+  std::ofstream outputstream(atomfragments_file.string().c_str());
+  if (outputstream.good()) { // check if opened
+    boost::archive::text_oarchive oa(outputstream);
+    oa << atomfragments_container;
+    if (outputstream.fail()) { // check if correctly written
+      LOG(1, "Failed to write to file " << atomfragments_file.string() << ".");
+      return false;
+    } else
+      outputstream.close();
+  } else {
+    LOG(1, "Failed to open file " << atomfragments_file.string()
+        << " for writing.");
+    return false;
+  }
+  return true;
+}
+
+ActionState::ptr PotentialSaveAtomFragmentsAction::performCall()
+{
+  if (!params.atomfragments_file.get().empty()) {
+    const boost::filesystem::path &atomfragments_file = params.atomfragments_file.get();
+    LOG(1, "INFO: Appending AtomFragment associations to file " << atomfragments_file.string() << ".");
+    if (!writeAtomFragmentsToFile(atomfragments_file)) {
+      STATUS("Failed to write atomfragments file.");
+      return Action::failure;
+    }
+    return Action::success;
+  } else {
+    STATUS("Homology file name empty.");
+    return Action::failure;
+  }
+}
+
+ActionState::ptr PotentialSaveAtomFragmentsAction::performUndo(ActionState::ptr _state) {
+  return Action::success;
+}
+
+ActionState::ptr PotentialSaveAtomFragmentsAction::performRedo(ActionState::ptr _state){
+  return Action::success;
+}
+
+bool PotentialSaveAtomFragmentsAction::canUndo() {
+  return false;
+}
+
+bool PotentialSaveAtomFragmentsAction::shouldUndo() {
+  return false;
+}
+/** =========== end of function ====================== */
Index: src/Actions/PotentialAction/SaveAtomFragmentsAction.def
===================================================================
--- src/Actions/PotentialAction/SaveAtomFragmentsAction.def	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
+++ src/Actions/PotentialAction/SaveAtomFragmentsAction.def	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
@@ -0,0 +1,37 @@
+/*
+ * SaveAtomFragmentsAction.def
+ *
+ *  Created on: Mar 07, 2016
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include <boost/filesystem/path.hpp>
+
+#include "Parameters/Validators/DummyValidator.hpp"
+
+// i.e. there is an integer with variable name Z that can be found in
+// ValueStorage by the token "Z" -> first column: int, Z, "Z"
+// "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value
+#define paramtypes (boost::filesystem::path)
+#define paramtokens ("save-atom-fragments")
+#define paramdescriptions ("path to file containing atom fragment association container to parse")
+#define paramdefaults (PARAM_DEFAULT(""))
+#define paramreferences (atomfragments_file)
+#define paramvalids \
+(DummyValidator< boost::filesystem::path >())
+
+#undef statetypes
+#undef statereferences
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Potential
+#define MENUNAME "potential"
+#define MENUPOSITION 2
+#define ACTIONNAME SaveAtomFragments
+#define TOKEN "save-atom-fragments"
+
+
+// finally the information stored in the ActionTrait specialization
+#define DESCRIPTION "saves atom fragment associations present in World's container to file"
+#undef SHORTFORM
Index: src/Actions/PotentialAction/SaveAtomFragmentsAction.hpp
===================================================================
--- src/Actions/PotentialAction/SaveAtomFragmentsAction.hpp	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
+++ src/Actions/PotentialAction/SaveAtomFragmentsAction.hpp	(revision 78202bb746daf78c7efca90c8f594001d926da2c)
@@ -0,0 +1,22 @@
+/*
+ * SaveAtomFragmentsAction.hpp
+ *
+ *  Created on: Mar 07, 2016
+ *      Author: heber
+ */
+
+#ifndef SAVEATOMFRAGMENTSACTION_HPP_
+#define SAVEATOMFRAGMENTSACTION_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "Actions/Action.hpp"
+
+#include "SaveAtomFragmentsAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* SAVEATOMFRAGMENTSACTION_HPP_ */
