Index: src/Actions/AtomAction/RemoveAction.def
===================================================================
--- src/Actions/AtomAction/RemoveAction.def	(revision 1e45f1fb84ae30e44c393f19156012e19f962ac3)
+++ src/Actions/AtomAction/RemoveAction.def	(revision 1a48d2c8c2b6ea08ac53c8fc5998d19145e4eeb8)
@@ -7,7 +7,4 @@
 
 // all includes and forward declarations necessary for non-integral types below
-
-
-#include "Parameters/Validators/DummyValidator.hpp"
 
 // i.e. there is an integer with variable name Z that can be found in
Index: src/Actions/GlobalListOfActions.hpp
===================================================================
--- src/Actions/GlobalListOfActions.hpp	(revision 1e45f1fb84ae30e44c393f19156012e19f962ac3)
+++ src/Actions/GlobalListOfActions.hpp	(revision 1a48d2c8c2b6ea08ac53c8fc5998d19145e4eeb8)
@@ -69,4 +69,5 @@
   (MoleculeFillWithMolecule) \
   (MoleculeFillVoidWithMolecule) \
+  (MoleculeForceAnnealing) \
   (MoleculeLinearInterpolationofTrajectories) \
   (MoleculeLoad) \
Index: src/Actions/Makefile.am
===================================================================
--- src/Actions/Makefile.am	(revision 1e45f1fb84ae30e44c393f19156012e19f962ac3)
+++ src/Actions/Makefile.am	(revision 1a48d2c8c2b6ea08ac53c8fc5998d19145e4eeb8)
@@ -278,4 +278,5 @@
   Actions/MoleculeAction/FillWithMoleculeAction.cpp \
   Actions/MoleculeAction/FillVoidWithMoleculeAction.cpp \
+  Actions/MoleculeAction/ForceAnnealingAction.cpp \
   Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.cpp \
   Actions/MoleculeAction/LoadAction.cpp \
@@ -296,4 +297,5 @@
   Actions/MoleculeAction/FillWithMoleculeAction.hpp \
   Actions/MoleculeAction/FillVoidWithMoleculeAction.hpp \
+  Actions/MoleculeAction/ForceAnnealingAction.hpp \
   Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.hpp \
   Actions/MoleculeAction/LoadAction.hpp \
@@ -314,4 +316,5 @@
   Actions/MoleculeAction/FillWithMoleculeAction.def \
   Actions/MoleculeAction/FillVoidWithMoleculeAction.def \
+  Actions/MoleculeAction/ForceAnnealingAction.def \
   Actions/MoleculeAction/LinearInterpolationofTrajectoriesAction.def \
   Actions/MoleculeAction/LoadAction.def \
Index: src/Actions/MoleculeAction/ForceAnnealingAction.cpp
===================================================================
--- src/Actions/MoleculeAction/ForceAnnealingAction.cpp	(revision 1a48d2c8c2b6ea08ac53c8fc5998d19145e4eeb8)
+++ src/Actions/MoleculeAction/ForceAnnealingAction.cpp	(revision 1a48d2c8c2b6ea08ac53c8fc5998d19145e4eeb8)
@@ -0,0 +1,166 @@
+/*
+ * 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/>.
+ */
+
+/*
+ * ForceAnnealingAction.cpp
+ *
+ *  Created on: Aug 02, 2014
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "Actions/UndoRedoHelpers.hpp"
+#include "Atom/atom.hpp"
+#include "Atom/AtomicInfo.hpp"
+#include "Atom/AtomSet.hpp"
+#include "CodePatterns/Log.hpp"
+#include "CodePatterns/Verbose.hpp"
+#include "Dynamics/ForceAnnealing.hpp"
+#include "molecule.hpp"
+#include "World.hpp"
+#include "WorldTime.hpp"
+
+#include <vector>
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#include "Actions/MoleculeAction/ForceAnnealingAction.hpp"
+
+using namespace MoleCuilder;
+
+enum VectorIndexType {
+  PositionIndex=0,
+  VelocityIndex=1,
+  ForceIndex=2
+};
+
+// and construct the stuff
+#include "ForceAnnealingAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+ActionState::ptr MoleculeForceAnnealingAction::performCall() {
+  AtomSetMixin<std::vector<atom *> > set(World::getInstance().getSelectedAtoms());
+  if (set.empty()) {
+    STATUS("No atoms selected.");
+    return Action::failure;
+  }
+  // we always operate relative to current time step, except on single debug output
+  size_t CurrentStep = WorldTime::getInstance().getTime();
+  if (params.DoOutput.get()) {
+    // copy current time step to new one and and proceed on this one
+    for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection();
+        iter != World::getInstance().endAtomSelection();
+        ++iter) {
+      atom * const Walker = iter->second;
+      Walker->UpdateSteps();
+      Walker->setPositionAtStep(CurrentStep+1,
+          Walker->getPositionAtStep(CurrentStep));
+      Walker->setAtomicVelocityAtStep(CurrentStep+1,
+          Walker->getAtomicVelocityAtStep(CurrentStep));
+      Walker->setAtomicForceAtStep(CurrentStep+1,
+          Walker->getAtomicForceAtStep(CurrentStep));
+    }
+    // increment to next time step: re-creates bond graph
+    ++CurrentStep;
+    World::getInstance().setTime(CurrentStep);
+  }
+  ForceAnnealing<std::vector<atom *> > optimizer(
+      set,
+      params.Deltat.get(),
+      true,
+      params.steps.get());
+  // parse forces into next step
+  if (!params.forcesfile.get().string().empty()) {
+    LOG(1, "Parsing forces file.");
+    if (!optimizer.parseForcesFile(params.forcesfile.get().string().c_str(), CurrentStep))
+      LOG(2, "File " << params.forcesfile.get() << " not found.");
+    else
+      LOG(2, "File " << params.forcesfile.get() << " found and parsed.");
+  }
+
+  // create undo state for all selected atoms (undo info)
+  std::vector<AtomicInfo> UndoInfo;
+  UndoInfo.reserve(set.size());
+  {
+    for (World::AtomSelectionConstIterator iter = World::getInstance().beginAtomSelection();
+        iter != World::getInstance().endAtomSelection();
+        ++iter)
+      UndoInfo.push_back(AtomicInfo(*(iter->second)));
+  }
+
+  // perform optimization step
+  LOG(1, "Structural optimization.");
+  optimizer(CurrentStep, 1);
+  STATUS("Successfully optimized structure by one step.");
+
+//  // increment to next time step
+//  World::getInstance().setTime(CurrentStep+1);
+
+  std::vector<AtomicInfo> RedoInfo;
+  RedoInfo.reserve(set.size());
+  {
+    for (World::AtomSelectionConstIterator iter = World::getInstance().beginAtomSelection();
+        iter != World::getInstance().endAtomSelection();
+        ++iter)
+      RedoInfo.push_back(AtomicInfo(*(iter->second)));
+  }
+  MoleculeForceAnnealingState *UndoState =
+    new MoleculeForceAnnealingState(UndoInfo, RedoInfo, params);
+
+  return ActionState::ptr(UndoState);
+}
+
+ActionState::ptr MoleculeForceAnnealingAction::performUndo(ActionState::ptr _state) {
+  MoleculeForceAnnealingState *state =
+      assert_cast<MoleculeForceAnnealingState*>(_state.get());
+
+  // set stored old state
+  SetAtomsFromAtomicInfo(state->UndoInfo);
+
+  return ActionState::ptr(_state);
+}
+
+ActionState::ptr MoleculeForceAnnealingAction::performRedo(ActionState::ptr _state){
+  MoleculeForceAnnealingState *state =
+      assert_cast<MoleculeForceAnnealingState*>(_state.get());
+
+  // set stored new state
+  SetAtomsFromAtomicInfo(state->RedoInfo);
+
+  return ActionState::ptr(_state);
+}
+
+bool MoleculeForceAnnealingAction::canUndo() {
+  return true;
+}
+
+bool MoleculeForceAnnealingAction::shouldUndo() {
+  return true;
+}
+/** =========== end of function ====================== */
Index: src/Actions/MoleculeAction/ForceAnnealingAction.def
===================================================================
--- src/Actions/MoleculeAction/ForceAnnealingAction.def	(revision 1a48d2c8c2b6ea08ac53c8fc5998d19145e4eeb8)
+++ src/Actions/MoleculeAction/ForceAnnealingAction.def	(revision 1a48d2c8c2b6ea08ac53c8fc5998d19145e4eeb8)
@@ -0,0 +1,40 @@
+/*
+ * ForceAnnealingAction.def
+ *
+ *  Created on: Aug 02, 2014
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "Parameters/Validators/DummyValidator.hpp"
+#include "Parameters/Validators/GenericValidators.hpp"
+#include "Parameters/Validators/Ops_Validator.hpp"
+#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)(double)(unsigned int)(bool)
+#define paramtokens ("forces-file")("deltat")("steps")("output-every-step")
+#define paramdescriptions ("file containing")("time step width")("fixed number of optimization steps to be performed")("whether WorldTime should be increased and output written after every step, useful if optimization might hang")
+#define paramdefaults (PARAM_DEFAULT(""))(PARAM_DEFAULT(0.1))(NOPARAM_DEFAULT)(PARAM_DEFAULT("0"))
+#define paramreferences (forcesfile)(Deltat)(steps)(DoOutput)
+#define paramvalids \
+(DummyValidator< boost::filesystem::path >()) \
+(PositiveValidator< double >()) \
+(NotZeroValidator< unsigned int >()) \
+(DummyValidator<bool>())
+
+#define statetypes (std::vector<AtomicInfo>)(std::vector<AtomicInfo>)
+#define statereferences (UndoInfo)(RedoInfo)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Molecule
+#define MENUNAME "molecule"
+#define MENUPOSITION 12
+#define ACTIONNAME ForceAnnealing
+#define TOKEN "force-annealing"
+
+// finally the information stored in the ActionTrait specialization
+#define DESCRIPTION "perform a single step optimizing the current forces acting on the atoms"
+#undef SHORTFORM
Index: src/Actions/MoleculeAction/ForceAnnealingAction.hpp
===================================================================
--- src/Actions/MoleculeAction/ForceAnnealingAction.hpp	(revision 1a48d2c8c2b6ea08ac53c8fc5998d19145e4eeb8)
+++ src/Actions/MoleculeAction/ForceAnnealingAction.hpp	(revision 1a48d2c8c2b6ea08ac53c8fc5998d19145e4eeb8)
@@ -0,0 +1,22 @@
+/*
+ * ForceAnnealingAction.hpp
+ *
+ *  Created on: Aug 02, 2014
+ *      Author: heber
+ */
+
+#ifndef FORCEANNEALINGACTION_HPP
+#define FORCEANNEALINGACTION_HPP
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "Actions/Action.hpp"
+
+#include "ForceAnnealingAction.def"
+#include "Action_impl_header.hpp"
+
+#endif // FORCEANNEALINGACTION_HPP
Index: src/Actions/MoleculeAction/VerletIntegrationAction.cpp
===================================================================
--- src/Actions/MoleculeAction/VerletIntegrationAction.cpp	(revision 1e45f1fb84ae30e44c393f19156012e19f962ac3)
+++ src/Actions/MoleculeAction/VerletIntegrationAction.cpp	(revision 1a48d2c8c2b6ea08ac53c8fc5998d19145e4eeb8)
@@ -98,5 +98,5 @@
   Verlet(CurrentStep+1, 1, 0, params.FixedCenterOfMass.get());
   LOG(0, "STATUS: Successfully performed updates on velocity and position.");
-  // increment to next time step
+  // increment to next time step: re-creates bond graph
   World::getInstance().setTime(CurrentStep+1);
 
