Index: src/Actions/FragmentationAction/FitParticleChargesAction.cpp
===================================================================
--- src/Actions/FragmentationAction/FitParticleChargesAction.cpp	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,172 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2013 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/>.
- */
-
-/*
- * FitParticleChargesAction.cpp
- *
- *  Created on: Jul 03, 2013
- *      Author: heber
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// needs to come before MemDebug due to placement new
-#include <boost/archive/text_iarchive.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include "Atom/atom.hpp"
-#include "CodePatterns/Log.hpp"
-#include "Fragmentation/Exporters/ExportGraph_ToFiles.hpp"
-#include "Fragmentation/Graph.hpp"
-#include "World.hpp"
-
-#include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
-#include <algorithm>
-#include <iostream>
-#include <string>
-
-#include "Actions/FragmentationAction/FitParticleChargesAction.hpp"
-
-#include "Potentials/PartialNucleiChargeFitter.hpp"
-
-#include "Element/element.hpp"
-#include "Fragmentation/Homology/HomologyContainer.hpp"
-#include "Fragmentation/Homology/HomologyGraph.hpp"
-#include "Fragmentation/Summation/SetValues/SamplingGrid.hpp"
-#include "FunctionApproximation/Extractors.hpp"
-#include "Potentials/PartialNucleiChargeFitter.hpp"
-#include "Potentials/SerializablePotential.hpp"
-#include "World.hpp"
-
-using namespace MoleCuilder;
-
-// and construct the stuff
-#include "FitParticleChargesAction.def"
-#include "Action_impl_pre.hpp"
-/** =========== define the function ====================== */
-
-inline
-HomologyGraph getFirstGraphwithSpecifiedElements(
-    const HomologyContainer &homologies,
-    const SerializablePotential::ParticleTypes_t &types)
-{
-  ASSERT( !types.empty(),
-      "getFirstGraphwithSpecifiedElements() - charges is empty?");
-  // create charges
-  Fragment::charges_t charges;
-  charges.resize(types.size());
-  std::transform(types.begin(), types.end(),
-      charges.begin(), boost::lambda::_1);
-  // convert into count map
-  Extractors::elementcounts_t counts_per_charge =
-      Extractors::_detail::getElementCounts(charges);
-  ASSERT( !counts_per_charge.empty(),
-      "getFirstGraphwithSpecifiedElements() - charge counts are empty?");
-  LOG(2, "DEBUG: counts_per_charge is " << counts_per_charge << ".");
-  // we want to check each (unique) key only once
-  HomologyContainer::const_key_iterator olditer = homologies.key_end();
-  for (HomologyContainer::const_key_iterator iter =
-      homologies.key_begin(); iter != homologies.key_end(); olditer = iter++) {
-    // if it's the same as the old one, skip it
-    if (*olditer == *iter)
-      continue;
-    // if it's a new key, check if every element has the right number of counts
-    Extractors::elementcounts_t::const_iterator countiter = counts_per_charge.begin();
-    for (; countiter != counts_per_charge.end(); ++countiter)
-      if (!(*iter).hasTimesAtomicNumber(
-          static_cast<size_t>(countiter->first),
-          static_cast<size_t>(countiter->second))
-          )
-        break;
-    if( countiter == counts_per_charge.end())
-      return *iter;
-  }
-  return HomologyGraph();
-}
-
-Action::state_ptr FragmentationFitParticleChargesAction::performCall() {
-
-  // fragment specifies the homology fragment to use
-  SerializablePotential::ParticleTypes_t fragmentnumbers;
-  {
-    const std::vector<const element *> &fragment = params.fragment.get();
-    std::transform(fragment.begin(), fragment.end(), std::back_inserter(fragmentnumbers),
-        boost::bind(&element::getAtomicNumber, _1));
-  }
-
-  // parse homologies into container
-  HomologyContainer &homologies = World::getInstance().getHomologies();
-  const HomologyGraph graph = getFirstGraphwithSpecifiedElements(homologies,fragmentnumbers);
-  HomologyContainer::range_t range = homologies.getHomologousGraphs(graph);
-  // for the moment just use the very first fragment
-  if (range.first == range.second) {
-    ELOG(1, "HomologyContainer does not contain specified fragment.");
-    return Action::failure;
-  }
-  HomologyContainer::const_iterator iter = range.first;
-  if (!iter->second.containsGrids) {
-    ELOG(2, "This HomologyGraph does not contain sampled grids.");
-    return Action::failure;
-  }
-  const Fragment &fragment = iter->second.fragment;
-//  const double &energy = iter->second.energy;
-//  const SamplingGrid &charge = iter->second.charge_distribution;
-  const SamplingGrid &potential = iter->second.potential_distribution;
-
-  // then we extract positions from fragment
-  PartialNucleiChargeFitter::positions_t positions;
-  Fragment::positions_t fragmentpositions = fragment.getPositions();
-  positions.reserve(fragmentpositions.size());
-  BOOST_FOREACH( Fragment::position_t pos, fragmentpositions) {
-    positions.push_back( Vector(pos[0], pos[1], pos[2]) );
-  }
-  PartialNucleiChargeFitter fitter(potential, positions, params.radius.get());
-  fitter();
-  PartialNucleiChargeFitter::charges_t return_charges = fitter.getSolutionAsCharges_t();
-
-  // output fitted charges
-  LOG(0, "STATUS: We have fitted the following charges " << return_charges << ".");
-
-  return Action::success;
-}
-
-Action::state_ptr FragmentationFitParticleChargesAction::performUndo(Action::state_ptr _state) {
-  return Action::success;
-}
-
-Action::state_ptr FragmentationFitParticleChargesAction::performRedo(Action::state_ptr _state){
-  return Action::success;
-}
-
-bool FragmentationFitParticleChargesAction::canUndo() {
-  return false;
-}
-
-bool FragmentationFitParticleChargesAction::shouldUndo() {
-  return false;
-}
-/** =========== end of function ====================== */
Index: src/Actions/FragmentationAction/FitParticleChargesAction.def
===================================================================
--- src/Actions/FragmentationAction/FitParticleChargesAction.def	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,44 +1,0 @@
-/*
- * FitParticleChargesAction.def
- *
- *  Created on: Jul 03, 2013
- *      Author: heber
- */
-
-// all includes and forward declarations necessary for non-integral types below
-#include <boost/filesystem/path.hpp>
-#include "Element/element.hpp"
-#include <vector>
-
-#include "Parameters/Validators/DummyValidator.hpp"
-#include "Parameters/Validators/GenericValidators.hpp"
-#include "Parameters/Validators/STLVectorValidator.hpp"
-#include "Parameters/Validators/Specific/ElementValidator.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)(std::vector<const element *>)(double)
-#define paramtokens ("potential-file")("fragment-charges")("radius")
-#define paramdescriptions ("potential file specifying multiple potentials to fit")("charges specifying the fragment")("radius of sphere around nuclei where potential does not need to match")
-#define paramdefaults (NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(0))
-#define paramreferences (potential_file)(fragment)(radius)
-#define paramvalids \
-(DummyValidator<boost::filesystem::path>()) \
-(STLVectorValidator< std::vector<const element *> >(1,99, ElementValidator())) \
-(NonNegativeValidator<double>())
-
-#undef statetypes
-#undef statereferences
-
-// some defines for all the names, you may use ACTION, STATE and PARAMS
-#define CATEGORY Fragmentation
-#define MENUNAME "fragmentation"
-#define MENUPOSITION 9
-#define ACTIONNAME FitParticleCharges
-#define TOKEN "fit-particle-charges"
-
-
-// finally the information stored in the ActionTrait specialization
-#define DESCRIPTION "fits partial nuclear charges to present particle types from long-range fragmentation results"
-#undef SHORTFORM
Index: src/Actions/FragmentationAction/FitParticleChargesAction.hpp
===================================================================
--- src/Actions/FragmentationAction/FitParticleChargesAction.hpp	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,22 +1,0 @@
-/*
- * FitParticleChargesAction.hpp
- *
- *  Created on: Jul 03, 2013
- *      Author: heber
- */
-
-#ifndef FITPARTICLECHARGESACTION_HPP_
-#define FITPARTICLECHARGESACTION_HPP_
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "Actions/Action.hpp"
-
-#include "FitParticleChargesAction.def"
-#include "Action_impl_header.hpp"
-
-#endif /* FITPARTICLECHARGESACTION_HPP_ */
Index: src/Actions/FragmentationAction/FitPotentialAction.cpp
===================================================================
--- src/Actions/FragmentationAction/FitPotentialAction.cpp	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,356 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2013 University of Bonn. All rights reserved.
- * Copyright (C)  2013 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/>.
- */
-
-/*
- * FitPotentialAction.cpp
- *
- *  Created on: Apr 09, 2013
- *      Author: heber
- */
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-// needs to come before MemDebug due to placement new
-#include <boost/archive/text_iarchive.hpp>
-
-#include "CodePatterns/MemDebug.hpp"
-
-#include <algorithm>
-#include <boost/bind.hpp>
-#include <boost/filesystem.hpp>
-#include <boost/foreach.hpp>
-#include <map>
-#include <string>
-#include <sstream>
-
-#include "Actions/FragmentationAction/FitPotentialAction.hpp"
-
-#include "CodePatterns/Log.hpp"
-
-#include "Element/element.hpp"
-#include "Fragmentation/Homology/HomologyContainer.hpp"
-#include "Fragmentation/Homology/HomologyGraph.hpp"
-#include "Fragmentation/Summation/SetValues/Fragment.hpp"
-#include "FunctionApproximation/Extractors.hpp"
-#include "FunctionApproximation/FunctionApproximation.hpp"
-#include "FunctionApproximation/FunctionModel.hpp"
-#include "FunctionApproximation/TrainingData.hpp"
-#include "FunctionApproximation/writeDistanceEnergyTable.hpp"
-#include "Potentials/CompoundPotential.hpp"
-#include "Potentials/Exceptions.hpp"
-#include "Potentials/PotentialDeserializer.hpp"
-#include "Potentials/PotentialFactory.hpp"
-#include "Potentials/PotentialRegistry.hpp"
-#include "Potentials/PotentialSerializer.hpp"
-#include "Potentials/SerializablePotential.hpp"
-
-using namespace MoleCuilder;
-
-// and construct the stuff
-#include "FitPotentialAction.def"
-#include "Action_impl_pre.hpp"
-/** =========== define the function ====================== */
-
-HomologyGraph getFirstGraphwithSpecifiedElements(
-    const HomologyContainer &homologies,
-    const SerializablePotential::ParticleTypes_t &types)
-{
-  ASSERT( !types.empty(),
-      "getFirstGraphwithSpecifiedElements() - charges is empty?");
-  // create charges
-  Fragment::charges_t charges;
-  charges.resize(types.size());
-  std::transform(types.begin(), types.end(),
-      charges.begin(), boost::lambda::_1);
-  // convert into count map
-  Extractors::elementcounts_t counts_per_charge =
-      Extractors::_detail::getElementCounts(charges);
-  ASSERT( !counts_per_charge.empty(),
-      "getFirstGraphwithSpecifiedElements() - charge counts are empty?");
-  LOG(2, "DEBUG: counts_per_charge is " << counts_per_charge << ".");
-  // we want to check each (unique) key only once
-  HomologyContainer::const_key_iterator olditer = homologies.key_end();
-  for (HomologyContainer::const_key_iterator iter =
-      homologies.key_begin(); iter != homologies.key_end(); olditer = iter++) {
-    // if it's the same as the old one, skip it
-    if (*olditer == *iter)
-      continue;
-    // if it's a new key, check if every element has the right number of counts
-    Extractors::elementcounts_t::const_iterator countiter = counts_per_charge.begin();
-    for (; countiter != counts_per_charge.end(); ++countiter)
-      if (!(*iter).hasTimesAtomicNumber(
-          static_cast<size_t>(countiter->first),
-          static_cast<size_t>(countiter->second))
-          )
-        break;
-    if( countiter == counts_per_charge.end())
-      return *iter;
-  }
-  return HomologyGraph();
-}
-
-Action::state_ptr FragmentationFitPotentialAction::performCall() {
-  // fragment specifies the homology fragment to use
-  SerializablePotential::ParticleTypes_t fragmentnumbers;
-  {
-    const std::vector<const element *> &fragment = params.fragment.get();
-    std::transform(fragment.begin(), fragment.end(), std::back_inserter(fragmentnumbers),
-        boost::bind(&element::getAtomicNumber, _1));
-  }
-
-  // either charges and a potential is specified or a file
-  if (boost::filesystem::exists(params.potential_file.get())) {
-    std::ifstream returnstream(params.potential_file.get().string().c_str());
-    if (returnstream.good()) {
-      try {
-        PotentialDeserializer deserialize(returnstream);
-        deserialize();
-      } catch (SerializablePotentialMissingValueException &e) {
-        if (const std::string *key = boost::get_error_info<SerializablePotentialKey>(e))
-          ELOG(1, "Missing value when parsing information for potential "
-              << *key << ".");
-        else
-          ELOG(1, "Missing value parsing information for potential with unknown key.");
-        return Action::failure;
-      } catch (SerializablePotentialIllegalKeyException &e) {
-        if (const std::string *key = boost::get_error_info<SerializablePotentialKey>(e))
-          ELOG(1, "Illegal key parsing information for potential "
-              << *key << ".");
-        else
-          ELOG(1, "Illegal key parsing information for potential with unknown key.");
-        return Action::failure;
-      }
-    } else {
-      ELOG(0, "Failed to parse from " << params.potential_file.get().string() << ".");
-      return Action::failure;
-    }
-    returnstream.close();
-
-    LOG(0, "STATUS: I'm training now a set of potentials parsed from "
-        << params.potential_file.get().string() << " on a fragment "
-        << fragmentnumbers << " on data from World's homologies.");
-
-  } else {
-    if (params.charges.get().empty()) {
-      ELOG(1, "Neither charges nor potential file given!");
-      return Action::failure;
-    } else {
-      // charges specify the potential type
-      SerializablePotential::ParticleTypes_t chargenumbers;
-      {
-        const std::vector<const element *> &charges = params.charges.get();
-        std::transform(charges.begin(), charges.end(), std::back_inserter(chargenumbers),
-            boost::bind(&element::getAtomicNumber, _1));
-      }
-
-      LOG(0, "STATUS: I'm training now a " << params.potentialtype.get()
-          << " potential on charges " << chargenumbers << " on data from World's homologies.");
-
-      // register desired potential and an additional constant one
-      EmpiricalPotential *potential =
-          PotentialFactory::getInstance().createInstance(
-              params.potentialtype.get(),
-              chargenumbers);
-      PotentialRegistry::getInstance().registerInstance(potential);
-      EmpiricalPotential *constant =
-          PotentialFactory::getInstance().createInstance(
-              std::string("constant"),
-              SerializablePotential::ParticleTypes_t());
-      PotentialRegistry::getInstance().registerInstance(constant);
-    }
-  }
-
-  // parse homologies into container
-  HomologyContainer &homologies = World::getInstance().getHomologies();
-
-  // first we try to look into the HomologyContainer
-  LOG(1, "INFO: Listing all present homologies ...");
-  for (HomologyContainer::container_t::const_iterator iter =
-      homologies.begin(); iter != homologies.end(); ++iter) {
-    LOG(1, "INFO: graph " << iter->first
-        << " has Fragment " << iter->second.fragment
-        << ", associated energy " << iter->second.energy
-        << ", and sampled grid integral " << iter->second.charge_distribution.integral()
-        << ".");
-  }
-
-  // then we ought to pick the right HomologyGraph ...
-  const HomologyGraph graph = getFirstGraphwithSpecifiedElements(homologies,fragmentnumbers);
-  if (graph != HomologyGraph()) {
-    LOG(1, "First representative graph containing fragment "
-        << fragmentnumbers << " is " << graph << ".");
-  } else {
-    ELOG(1, "Specific fragment " << fragmentnumbers << " not found in homologies!");
-    return Action::failure;
-  }
-
-  // fit potential
-  FunctionModel *model = new CompoundPotential(graph);
-  ASSERT( model != NULL,
-      "FragmentationFitPotentialAction::performCall() - model is NULL.");
-
-  /******************** TRAINING ********************/
-  // fit potential
-  FunctionModel::parameters_t bestparams(model->getParameterDimension(), 0.);
-  {
-    // Afterwards we go through all of this type and gather the distance and the energy value
-    TrainingData data(model->getSpecificFilter());
-    data(homologies.getHomologousGraphs(graph));
-
-    // print distances and energies if desired for debugging
-    if (!data.getTrainingInputs().empty()) {
-      // print which distance is which
-      size_t counter=1;
-      if (DoLog(3)) {
-        const FunctionModel::arguments_t &inputs = data.getTrainingInputs()[0];
-        for (FunctionModel::arguments_t::const_iterator iter = inputs.begin();
-            iter != inputs.end(); ++iter) {
-          const argument_t &arg = *iter;
-          LOG(3, "DEBUG: distance " << counter++ << " is between (#"
-              << arg.indices.first << "c" << arg.types.first << ","
-              << arg.indices.second << "c" << arg.types.second << ").");
-        }
-      }
-
-      // print table
-      if (params.training_file.get().string().empty()) {
-        LOG(3, "DEBUG: I gathered the following training data:\n" <<
-            _detail::writeDistanceEnergyTable(data.getDistanceEnergyTable()));
-      } else {
-        std::ofstream trainingstream(params.training_file.get().string().c_str());
-        if (trainingstream.good()) {
-          LOG(3, "DEBUG: Writing training data to file " <<
-              params.training_file.get().string() << ".");
-          trainingstream << _detail::writeDistanceEnergyTable(data.getDistanceEnergyTable());
-        }
-        trainingstream.close();
-      }
-    }
-
-    // now perform the function approximation by optimizing the model function
-    FunctionApproximation approximator(data, *model);
-    if (model->isBoxConstraint() && approximator.checkParameterDerivatives()) {
-      double l2error = std::numeric_limits<double>::max();
-      // seed with current time
-      srand((unsigned)time(0));
-      unsigned int runs=0;
-      // threshold overrules max_runs
-      const double threshold = params.threshold.get();
-      const unsigned int max_runs = (threshold >= 1.) ?
-          (params.best_of_howmany.isSet() ? params.best_of_howmany.get() : 1) : 0;
-      LOG(1, "INFO: Maximum runs is " << max_runs << " and threshold set to " << threshold << ".");
-      do {
-        // generate new random initial parameter values
-        model->setParametersToRandomInitialValues(data);
-        LOG(1, "INFO: Initial parameters of run " << runs << " are "
-            << model->getParameters() << ".");
-        approximator(FunctionApproximation::ParameterDerivative);
-        LOG(1, "INFO: Final parameters of run " << runs << " are "
-            << model->getParameters() << ".");
-        const double new_l2error = data.getL2Error(*model);
-        if (new_l2error < l2error) {
-          // store currently best parameters
-          l2error = new_l2error;
-          bestparams = model->getParameters();
-          LOG(1, "STATUS: New fit from run " << runs
-              << " has better error of " << l2error << ".");
-        }
-      } while (( ++runs < max_runs) || (l2error > threshold));
-      // reset parameters from best fit
-      model->setParameters(bestparams);
-      LOG(1, "INFO: Best parameters with L2 error of "
-          << l2error << " are " << model->getParameters() << ".");
-    } else {
-      ELOG(0, "We require parameter derivatives for a box constraint minimization.");
-      return Action::failure;
-    }
-
-    // create a map of each fragment with error.
-    typedef std::multimap< double, size_t > WorseFragmentMap_t;
-    WorseFragmentMap_t WorseFragmentMap;
-    HomologyContainer::range_t fragmentrange = homologies.getHomologousGraphs(graph);
-    // fragments make it into the container in reversed order, hence count from top down
-    size_t index= std::distance(fragmentrange.first, fragmentrange.second)-1;
-    for (HomologyContainer::const_iterator iter = fragmentrange.first;
-        iter != fragmentrange.second;
-        ++iter) {
-      const Fragment& fragment = iter->second.fragment;
-      const double &energy = iter->second.energy;
-
-      // create arguments from the fragment
-      FunctionModel::extractor_t extractor = model->getSpecificExtractor();
-      FunctionModel::arguments_t args = extractor(fragment, 1);
-
-      // calculate value from potential
-      const double fitvalue = (*model)(args)[0];
-
-      // insert difference into map
-      const double error = fabs(energy - fitvalue);
-      WorseFragmentMap.insert( std::make_pair( error, index-- ) );
-
-      {
-        // give only the distances in the debugging text
-        std::stringstream streamargs;
-        BOOST_FOREACH (argument_t arg, args) {
-          streamargs << " " << arg.distance*AtomicLengthToAngstroem;
-        }
-        LOG(2, "DEBUG: frag.#" << index+1 << "'s error is |" << energy << " - " << fitvalue
-            << "| = " << error << " for args " << streamargs.str() << ".");
-      }
-    }
-    LOG(0, "RESULT: WorstFragmentMap " << WorseFragmentMap << ".");
-
-    // 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();
-    }
-  }
-  delete model;
-
-  return Action::success;
-}
-
-Action::state_ptr FragmentationFitPotentialAction::performUndo(Action::state_ptr _state) {
-  return Action::success;
-}
-
-Action::state_ptr FragmentationFitPotentialAction::performRedo(Action::state_ptr _state){
-  return Action::success;
-}
-
-bool FragmentationFitPotentialAction::canUndo() {
-  return false;
-}
-
-bool FragmentationFitPotentialAction::shouldUndo() {
-  return false;
-}
-/** =========== end of function ====================== */
Index: src/Actions/FragmentationAction/FitPotentialAction.def
===================================================================
--- src/Actions/FragmentationAction/FitPotentialAction.def	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,53 +1,0 @@
-/*
- * FitPotentialAction.def
- *
- *  Created on: Apr 08, 2013
- *      Author: heber
- */
-
-// all includes and forward declarations necessary for non-integral types below
-#include <boost/filesystem/path.hpp>
-#include <string>
-#include <vector>
-
-#include "Parameters/Validators/DummyValidator.hpp"
-#include "Parameters/Validators/GenericValidators.hpp"
-#include "Parameters/Validators/Ops_Validator.hpp"
-#include "Parameters/Validators/RangeValidator.hpp"
-#include "Parameters/Validators/STLVectorValidator.hpp"
-#include "Parameters/Validators/Specific/ElementValidator.hpp"
-#include "Parameters/Validators/Specific/EmptyStringValidator.hpp"
-#include "Parameters/Validators/Specific/FilePresentValidator.hpp"
-#include "Parameters/Validators/Specific/PotentialTypeValidator.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)(std::string)(boost::filesystem::path)(std::vector<const element *>)(std::vector<const element *>)(unsigned int)(double)
-#define paramtokens ("training-file")("potential-type")("potential-file")("potential-charges")("fragment-charges")("take-best-of")("set-threshold")
-#define paramdescriptions ("optional file to write training data to")("potential type to fit")("potential file specifying multiple potentials 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")
-#define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(NOPARAM_DEFAULT)(PARAM_DEFAULT(3))(PARAM_DEFAULT(1.))
-#define paramreferences (training_file)(potentialtype)(potential_file)(charges)(fragment)(best_of_howmany)(threshold)
-#define paramvalids \
-(DummyValidator<boost::filesystem::path>()) \
-(EmptyStringValidator() || PotentialTypeValidator()) \
-(DummyValidator<boost::filesystem::path>()) \
-(STLVectorValidator< std::vector<const element *> >(0,99, ElementValidator())) \
-(STLVectorValidator< std::vector<const element *> >(1,99, ElementValidator())) \
-(PositiveValidator<unsigned int>()) \
-(PositiveValidator<double>())
-
-#undef statetypes
-#undef statereferences
-
-// some defines for all the names, you may use ACTION, STATE and PARAMS
-#define CATEGORY Fragmentation
-#define MENUNAME "fragmentation"
-#define MENUPOSITION 6
-#define ACTIONNAME FitPotential
-#define TOKEN "fit-potential"
-
-
-// finally the information stored in the ActionTrait specialization
-#define DESCRIPTION "fit an empirical potential to the given part of a specified fragment"
-#undef SHORTFORM
Index: src/Actions/FragmentationAction/FitPotentialAction.hpp
===================================================================
--- src/Actions/FragmentationAction/FitPotentialAction.hpp	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,22 +1,0 @@
-/*
- * FitPotentialAction.hpp
- *
- *  Created on: Apr 09, 2013
- *      Author: heber
- */
-
-#ifndef FITPOTENTIALACTION_HPP_
-#define FITPOTENTIALACTION_HPP_
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "Actions/Action.hpp"
-
-#include "FitPotentialAction.def"
-#include "Action_impl_header.hpp"
-
-#endif /* FITPOTENTIALACTION_HPP_ */
Index: src/Actions/FragmentationAction/ParseHomologiesAction.cpp
===================================================================
--- src/Actions/FragmentationAction/ParseHomologiesAction.cpp	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,108 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2013 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/>.
- */
-
-/*
- * ParseHomologiesAction.cpp
- *
- *  Created on: Jun 24, 2013
- *      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/HomologyContainer.hpp"
-#include "World.hpp"
-
-#include "Actions/FragmentationAction/ParseHomologiesAction.hpp"
-
-using namespace MoleCuilder;
-
-// and construct the stuff
-#include "ParseHomologiesAction.def"
-#include "Action_impl_pre.hpp"
-/** =========== define the function ====================== */
-
-void parseHomologiesFromFile(
-    const boost::filesystem::path &homology_file
-    )
-{
-  HomologyContainer &homology_container = World::getInstance().getHomologies();
-  if (boost::filesystem::exists(homology_file)) {
-    std::ifstream returnstream(homology_file.string().c_str());
-    if (returnstream.good()) {
-      boost::archive::text_iarchive ia(returnstream);
-      ia >> homology_container;
-    } else {
-      ELOG(2, "Failed to parse from " << homology_file.string() << ".");
-    }
-    returnstream.close();
-  } else {
-    LOG(2, "Could not open " << homology_file.string()
-        << ", creating empty container.");
-  }
-}
-
-Action::state_ptr FragmentationParseHomologiesAction::performCall()
-{
-  // append all keysets to homology file
-  if (!params.homology_file.get().empty()) {
-    const boost::filesystem::path &homology_file = params.homology_file.get();
-    if (homology_file.string() != "") {
-      LOG(1, "INFO: Parsing HomologyGraphs from file " << homology_file.string() << ".");
-      parseHomologiesFromFile(homology_file);
-      return Action::success;
-    }
-  }
-
-  return Action::failure;
-}
-
-Action::state_ptr FragmentationParseHomologiesAction::performUndo(Action::state_ptr _state) {
-  return Action::success;
-}
-
-Action::state_ptr FragmentationParseHomologiesAction::performRedo(Action::state_ptr _state){
-  return Action::success;
-}
-
-bool FragmentationParseHomologiesAction::canUndo() {
-  return false;
-}
-
-bool FragmentationParseHomologiesAction::shouldUndo() {
-  return false;
-}
-/** =========== end of function ====================== */
Index: src/Actions/FragmentationAction/ParseHomologiesAction.def
===================================================================
--- src/Actions/FragmentationAction/ParseHomologiesAction.def	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,35 +1,0 @@
-/*
- * ParseHomologiesAction.def
- *
- *  Created on: Jun 24, 2013
- *      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-homologies")
-#define paramdescriptions ("path to file containing homology container to parse")
-#define paramdefaults (NOPARAM_DEFAULT)
-#define paramreferences (homology_file)
-#define paramvalids \
-(FilePresentValidator())
-
-#undef statetypes
-#undef statereferences
-
-// some defines for all the names, you may use ACTION, STATE and PARAMS
-#define CATEGORY Fragmentation
-#define MENUNAME "fragmentation"
-#define MENUPOSITION 7
-#define ACTIONNAME ParseHomologies
-#define TOKEN "parse-homologies"
-
-
-// finally the information stored in the ActionTrait specialization
-#define DESCRIPTION "parses homologies present in a file into World's container"
-#undef SHORTFORM
Index: src/Actions/FragmentationAction/ParseHomologiesAction.hpp
===================================================================
--- src/Actions/FragmentationAction/ParseHomologiesAction.hpp	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,22 +1,0 @@
-/*
- * ParseHomologiesAction.hpp
- *
- *  Created on: Jun 24, 2013
- *      Author: heber
- */
-
-#ifndef PARSEHOMOLOGIESACTION_HPP_
-#define PARSEHOMOLOGIESACTION_HPP_
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "Actions/Action.hpp"
-
-#include "ParseHomologiesAction.def"
-#include "Action_impl_header.hpp"
-
-#endif /* PARSEHOMOLOGIESACTION_HPP_ */
Index: src/Actions/FragmentationAction/SaveHomologiesAction.cpp
===================================================================
--- src/Actions/FragmentationAction/SaveHomologiesAction.cpp	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,110 +1,0 @@
-/*
- * Project: MoleCuilder
- * Description: creates and alters molecular systems
- * Copyright (C)  2013 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/>.
- */
-
-/*
- * SaveHomologiesAction.cpp
- *
- *  Created on: Jun 24, 2013
- *      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/HomologyContainer.hpp"
-#include "World.hpp"
-
-#include "Actions/FragmentationAction/SaveHomologiesAction.hpp"
-
-using namespace MoleCuilder;
-
-// and construct the stuff
-#include "SaveHomologiesAction.def"
-#include "Action_impl_pre.hpp"
-/** =========== define the function ====================== */
-
-bool writeHomologiesToFile(
-    const boost::filesystem::path &homology_file
-    )
-{
-  /// store homology container again
-  HomologyContainer &homology_container = World::getInstance().getHomologies();
-  std::ofstream outputstream(homology_file.string().c_str());
-  if (outputstream.good()) { // check if opened
-    boost::archive::text_oarchive oa(outputstream);
-    oa << homology_container;
-    if (outputstream.fail()) { // check if correctly written
-      LOG(1, "Failed to write to file " << homology_file.string() << ".");
-      return false;
-    } else
-      outputstream.close();
-  } else {
-    LOG(1, "Failed to open file " << homology_file.string()
-        << " for writing.");
-    return false;
-  }
-  return true;
-}
-
-Action::state_ptr FragmentationSaveHomologiesAction::performCall()
-{
-  if (!params.homology_file.get().empty()) {
-    const boost::filesystem::path &homology_file = params.homology_file.get();
-    if (homology_file.string() != "") {
-      LOG(1, "INFO: Appending HomologyGraphs to file " << homology_file.string() << ".");
-      if (!writeHomologiesToFile(homology_file))
-        return Action::failure;
-    }
-  }
-
-  return Action::success;
-}
-
-Action::state_ptr FragmentationSaveHomologiesAction::performUndo(Action::state_ptr _state) {
-  return Action::success;
-}
-
-Action::state_ptr FragmentationSaveHomologiesAction::performRedo(Action::state_ptr _state){
-  return Action::success;
-}
-
-bool FragmentationSaveHomologiesAction::canUndo() {
-  return false;
-}
-
-bool FragmentationSaveHomologiesAction::shouldUndo() {
-  return false;
-}
-/** =========== end of function ====================== */
Index: src/Actions/FragmentationAction/SaveHomologiesAction.def
===================================================================
--- src/Actions/FragmentationAction/SaveHomologiesAction.def	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,37 +1,0 @@
-/*
- * SaveHomologiesAction.def
- *
- *  Created on: Jun 24, 2013
- *      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-homologies")
-#define paramdescriptions ("path to file containing homology container to parse")
-#define paramdefaults (PARAM_DEFAULT(""))
-#define paramreferences (homology_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 Fragmentation
-#define MENUNAME "fragmentation"
-#define MENUPOSITION 8
-#define ACTIONNAME SaveHomologies
-#define TOKEN "save-homologies"
-
-
-// finally the information stored in the ActionTrait specialization
-#define DESCRIPTION "saves homologies present in World's container to file"
-#undef SHORTFORM
Index: src/Actions/FragmentationAction/SaveHomologiesAction.hpp
===================================================================
--- src/Actions/FragmentationAction/SaveHomologiesAction.hpp	(revision 474c62deebfabdc712380d9ca33ebb5282cd5906)
+++ 	(revision )
@@ -1,22 +1,0 @@
-/*
- * SaveHomologiesAction.hpp
- *
- *  Created on: Jun 24, 2013
- *      Author: heber
- */
-
-#ifndef SAVEHOMOLOGIESACTION_HPP_
-#define SAVEHOMOLOGIESACTION_HPP_
-
-// include config.h
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-
-#include "Actions/Action.hpp"
-
-#include "SaveHomologiesAction.def"
-#include "Action_impl_header.hpp"
-
-#endif /* SAVEHOMOLOGIESACTION_HPP_ */
