Index: src/Actions/PotentialAction/FitCompoundPotentialAction.cpp
===================================================================
--- src/Actions/PotentialAction/FitCompoundPotentialAction.cpp	(revision f1eabd03d00ab44fb84ebc758d0ebfc85d6dee6d)
+++ src/Actions/PotentialAction/FitCompoundPotentialAction.cpp	(revision 0ea063beb1f1de6945df69f74ce759aab7643539)
@@ -103,9 +103,4 @@
   }
 
-  // store the potentials
-  if (!params.potential_file.get().string().empty()) {
-    PotentialTrainer::storePotentials(params.potential_file.get());
-  }
-
   return Action::success;
 }
Index: src/Actions/PotentialAction/FitCompoundPotentialAction.def
===================================================================
--- src/Actions/PotentialAction/FitCompoundPotentialAction.def	(revision f1eabd03d00ab44fb84ebc758d0ebfc85d6dee6d)
+++ src/Actions/PotentialAction/FitCompoundPotentialAction.def	(revision 0ea063beb1f1de6945df69f74ce759aab7643539)
@@ -23,12 +23,11 @@
 // 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)(boost::filesystem::path)(std::vector<const element *>)(unsigned int)(double)
-#define paramtokens ("training-file")("potential-file")("fragment-charges")("take-best-of")("set-threshold")
-#define paramdescriptions ("optional file to write training data to")("potential file specifying multiple potentials to fit")("charges specifying the fragment")("take the best among this many approximations")("Require L2 error to be smaller than threshold, overrides number of attempts")
-#define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(3))(PARAM_DEFAULT(1.))
-#define paramreferences (training_file)(potential_file)(fragment)(best_of_howmany)(threshold)
+#define paramtypes (boost::filesystem::path)(std::vector<const element *>)(unsigned int)(double)
+#define paramtokens ("training-file")("fragment-charges")("take-best-of")("set-threshold")
+#define paramdescriptions ("optional file to write training data to")("charges specifying the fragment")("take the best among this many approximations")("Require L2 error to be smaller than threshold, overrides number of attempts")
+#define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(PARAM_DEFAULT(3))(PARAM_DEFAULT(1.))
+#define paramreferences (training_file)(fragment)(best_of_howmany)(threshold)
 #define paramvalids \
 (DummyValidator<boost::filesystem::path>()) \
-(FileSuffixValidator("potentials")) \
 (STLVectorValidator< std::vector<const element *> >(1,99, ElementValidator())) \
 (PositiveValidator<unsigned int>()) \
Index: src/Actions/PotentialAction/FitPotentialAction.cpp
===================================================================
--- src/Actions/PotentialAction/FitPotentialAction.cpp	(revision f1eabd03d00ab44fb84ebc758d0ebfc85d6dee6d)
+++ src/Actions/PotentialAction/FitPotentialAction.cpp	(revision 0ea063beb1f1de6945df69f74ce759aab7643539)
@@ -154,14 +154,4 @@
   }
 
-  // store the potentials
-  // print fitted potentials
-  std::stringstream potentials;
-  PotentialSerializer serialize(potentials);
-  serialize();
-  LOG(1, "STATUS: Resulting parameters are " << std::endl << potentials.str());
-  if (!params.potential_file.get().string().empty()) {
-    PotentialTrainer::storePotentials(params.potential_file.get());
-  }
-
   return Action::success;
 }
Index: src/Actions/PotentialAction/FitPotentialAction.def
===================================================================
--- src/Actions/PotentialAction/FitPotentialAction.def	(revision f1eabd03d00ab44fb84ebc758d0ebfc85d6dee6d)
+++ src/Actions/PotentialAction/FitPotentialAction.def	(revision 0ea063beb1f1de6945df69f74ce759aab7643539)
@@ -18,7 +18,4 @@
 #include "Parameters/Validators/Specific/ElementValidator.hpp"
 #include "Parameters/Validators/Specific/EmptyStringValidator.hpp"
-#include "Parameters/Validators/Specific/FileSuffixValidator.hpp"
-#include "Parameters/Validators/Specific/FilePresentValidator.hpp"
-#include "Parameters/Validators/Specific/FileSuffixValidator.hpp"
 #include "Parameters/Validators/Specific/PotentialTypeValidator.hpp"
 
@@ -26,12 +23,11 @@
 // 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)(boost::filesystem::path)(std::string)(std::vector<const element *>)(std::vector<const element *>)(unsigned int)(double)
-#define paramtokens ("training-file")("potential-file")("potential-type")("potential-charges")("fragment-charges")("take-best-of")("set-threshold")
-#define paramdescriptions ("optional file to write training data to")("optional potential file to wrote resulting potentials to")("potential type to fit")("charges specifying the potential")("charges specifying the fragment")("take the best among this many approximations")("Require L2 error to be smaller than threshold, overrides number of attempts")
-#define paramdefaults (PARAM_DEFAULT(""))(PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(3))(PARAM_DEFAULT(1.))
-#define paramreferences (training_file)(potential_file)(potentialtype)(charges)(fragment)(best_of_howmany)(threshold)
+#define paramtypes (boost::filesystem::path)(std::string)(std::vector<const element *>)(std::vector<const element *>)(unsigned int)(double)
+#define paramtokens ("training-file")("potential-type")("potential-charges")("fragment-charges")("take-best-of")("set-threshold")
+#define paramdescriptions ("optional file to write training data to")("potential type to fit")("charges specifying the potential")("charges specifying the fragment")("take the best among this many approximations")("Require L2 error to be smaller than threshold, overrides number of attempts")
+#define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(3))(PARAM_DEFAULT(1.))
+#define paramreferences (training_file)(potentialtype)(charges)(fragment)(best_of_howmany)(threshold)
 #define paramvalids \
 (DummyValidator<boost::filesystem::path>()) \
-(!FilePresentValidator() || FileSuffixValidator("potentials")) \
 (PotentialTypeValidator()) \
 (STLVectorValidator< std::vector<const element *> >(0,99, ElementValidator())) \
Index: src/Actions/PotentialAction/SavePotentialsAction.cpp
===================================================================
--- src/Actions/PotentialAction/SavePotentialsAction.cpp	(revision 0ea063beb1f1de6945df69f74ce759aab7643539)
+++ src/Actions/PotentialAction/SavePotentialsAction.cpp	(revision 0ea063beb1f1de6945df69f74ce759aab7643539)
@@ -0,0 +1,100 @@
+/*
+ * Project: MoleCuilder
+ * Description: creates and alters molecular systems
+ * Copyright (C)  2014 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/>.
+ */
+
+/*
+ * SavePotentialsAction.cpp
+ *
+ *  Created on: Sep 12, 2014
+ *      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 "Actions/PotentialAction/SavePotentialsAction.hpp"
+
+#include <boost/filesystem.hpp>
+#include <fstream>
+
+#include "CodePatterns/Log.hpp"
+
+#include "Potentials/Exceptions.hpp"
+#include "Potentials/PotentialSerializer.hpp"
+
+using namespace MoleCuilder;
+
+// and construct the stuff
+#include "SavePotentialsAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+
+ActionState::ptr PotentialSavePotentialsAction::performCall()
+{
+  // store the potentials
+  if (!params.potential_file.get().string().empty()) {
+    // print fitted potentials
+    std::stringstream potentials;
+    PotentialSerializer serialize(potentials);
+    serialize();
+    LOG(1, "STATUS: Resulting parameters are " << std::endl << potentials.str());
+    std::ofstream returnstream(params.potential_file.get().string().c_str());
+    if (returnstream.good()) {
+      returnstream << potentials.str();
+    } else {
+      STATUS("Could not open stream to write potentials!");
+      return Action::failure;
+    }
+  } else {
+    STATUS("No existing potential file given!");
+    return Action::failure;
+  }
+
+  return Action::success;
+}
+
+ActionState::ptr PotentialSavePotentialsAction::performUndo(ActionState::ptr _state) {
+  STATUS("Undo of PotentialSavePotentialsAction not implemented.");
+  return Action::failure;
+}
+
+ActionState::ptr PotentialSavePotentialsAction::performRedo(ActionState::ptr _state){
+  STATUS("Redo of PotentialSavePotentialsAction not implemented.");
+  return Action::failure;
+}
+
+bool PotentialSavePotentialsAction::canUndo() {
+  return false;
+}
+
+bool PotentialSavePotentialsAction::shouldUndo() {
+  return false;
+}
+/** =========== end of function ====================== */
Index: src/Actions/PotentialAction/SavePotentialsAction.def
===================================================================
--- src/Actions/PotentialAction/SavePotentialsAction.def	(revision 0ea063beb1f1de6945df69f74ce759aab7643539)
+++ src/Actions/PotentialAction/SavePotentialsAction.def	(revision 0ea063beb1f1de6945df69f74ce759aab7643539)
@@ -0,0 +1,36 @@
+/*
+ * SavePotentialsAction.def
+ *
+ *  Created on: Sep 12, 2014
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "Parameters/Validators/Specific/FilePresentValidator.hpp"
+#include "Parameters/Validators/Specific/FileSuffixValidator.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-potentials")
+#define paramdescriptions ("TREMOLO potentials file to write to")
+#define paramdefaults (NOPARAM_DEFAULT)
+#define paramreferences (potential_file)
+#define paramvalids \
+(FileSuffixValidator("potentials"))
+
+#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 SavePotentials
+#define TOKEN "save-potentials"
+
+
+// finally the information stored in the ActionTrait specialization
+#define DESCRIPTION "parses TREMOLO potentials file and instantiates each potential"
+#undef SHORTFORM
Index: src/Actions/PotentialAction/SavePotentialsAction.hpp
===================================================================
--- src/Actions/PotentialAction/SavePotentialsAction.hpp	(revision 0ea063beb1f1de6945df69f74ce759aab7643539)
+++ src/Actions/PotentialAction/SavePotentialsAction.hpp	(revision 0ea063beb1f1de6945df69f74ce759aab7643539)
@@ -0,0 +1,22 @@
+/*
+ * SavePotentialsAction.hpp
+ *
+ *  Created on: Sep 12, 2014
+ *      Author: heber
+ */
+
+#ifndef SAVEPOTENTIALSACTION_HPP_
+#define SAVEPOTENTIALSACTION_HPP_
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "Actions/Action.hpp"
+
+#include "SavePotentialsAction.def"
+#include "Action_impl_header.hpp"
+
+#endif /* SAVEPOTENTIALSACTION_HPP_ */
