Index: src/Actions/AtomAction/TranslateToOriginAction.cpp
===================================================================
--- src/Actions/AtomAction/TranslateToOriginAction.cpp	(revision 3b179825d4e6f17bd22fbd7f880f59cc7fd8924e)
+++ src/Actions/AtomAction/TranslateToOriginAction.cpp	(revision 3b179825d4e6f17bd22fbd7f880f59cc7fd8924e)
@@ -0,0 +1,108 @@
+/*
+ * 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/>.
+ */
+
+/*
+ * TranslateToOriginAction.cpp
+ *
+ *  Created on: Aug 14, 2014
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "CodePatterns/MemDebug.hpp"
+
+#include "CodePatterns/Assert.hpp"
+#include "CodePatterns/Log.hpp"
+#include "Atom/atom.hpp"
+#include "Atom/AtomSet.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <fstream>
+#include <string>
+
+#include "Actions/AtomAction/TranslateToOriginAction.hpp"
+
+using namespace MoleCuilder;
+
+// and construct the stuff
+#include "TranslateToOriginAction.def"
+#include "Action_impl_pre.hpp"
+/** =========== define the function ====================== */
+ActionState::ptr AtomTranslateToOriginAction::performCall() {
+
+  if (World::getInstance().beginAtomSelection() == World::getInstance().endAtomSelection()) {
+    STATUS("No atoms selected.");
+    return Action::failure;
+  }
+
+  // calculate center of selected atoms
+  Vector Translation;
+  size_t No = 0;
+  for (World::AtomSelectionIterator iter = World::getInstance().beginAtomSelection();
+      iter != World::getInstance().endAtomSelection();
+      ++iter, ++No) {
+    Translation += (iter->second)->getPosition();
+  }
+  ASSERT( No != 0, "AtomTranslateToOriginAction::performCall() - No is nonetheless zero?");
+  Translation *= -1./(double)No;
+
+  World::AtomComposite atoms = World::getInstance().getAllAtoms();
+  atoms.translate(Translation);
+  STATUS("Atoms translated by "+toString(Translation));
+
+  return ActionState::ptr(new AtomTranslateToOriginState(Translation, params));
+}
+
+ActionState::ptr AtomTranslateToOriginAction::performUndo(ActionState::ptr _state) {
+  AtomTranslateToOriginState *state = assert_cast<AtomTranslateToOriginState*>(_state.get());
+
+  World::AtomComposite atoms = World::getInstance().getAllAtoms();
+  atoms.translate(-1.*state->Translation);
+  STATUS("Undid translation by "+toString(state->Translation));
+
+  return ActionState::ptr(_state);
+}
+
+ActionState::ptr AtomTranslateToOriginAction::performRedo(ActionState::ptr _state){
+  AtomTranslateToOriginState *state = assert_cast<AtomTranslateToOriginState*>(_state.get());
+
+  World::AtomComposite atoms = World::getInstance().getAllAtoms();
+  atoms.translate(state->Translation);
+  STATUS("Redid translation by "+toString(state->Translation));
+
+  return ActionState::ptr(_state);
+}
+
+bool AtomTranslateToOriginAction::canUndo() {
+  return true;
+}
+
+bool AtomTranslateToOriginAction::shouldUndo() {
+  return true;
+}
+/** =========== end of function ====================== */
Index: src/Actions/AtomAction/TranslateToOriginAction.def
===================================================================
--- src/Actions/AtomAction/TranslateToOriginAction.def	(revision 3b179825d4e6f17bd22fbd7f880f59cc7fd8924e)
+++ src/Actions/AtomAction/TranslateToOriginAction.def	(revision 3b179825d4e6f17bd22fbd7f880f59cc7fd8924e)
@@ -0,0 +1,34 @@
+/*
+ * TranslateToOriginAction.def
+ *
+ *  Created on: Aug 14, 2014
+ *      Author: heber
+ */
+
+// all includes and forward declarations necessary for non-integral types below
+#include "LinearAlgebra/Vector.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
+#undef paramtypes
+#undef paramtokens
+#undef paramdescriptions
+#undef paramreferences
+#undef paramdefaults
+#undef paramvalids
+
+#define statetypes (Vector)
+#define statereferences (Translation)
+
+// some defines for all the names, you may use ACTION, STATE and PARAMS
+#define CATEGORY Atom
+#define MENUNAME "atom"
+#define MENUPOSITION 5
+#define ACTIONNAME TranslateToOrigin
+#define TOKEN "translate-to-origin"
+
+
+// finally the information stored in the ActionTrait specialization
+#define DESCRIPTION "translate origin of domain to weighted center of all selected atoms"
+#undef SHORTFORM
Index: src/Actions/AtomAction/TranslateToOriginAction.hpp
===================================================================
--- src/Actions/AtomAction/TranslateToOriginAction.hpp	(revision 3b179825d4e6f17bd22fbd7f880f59cc7fd8924e)
+++ src/Actions/AtomAction/TranslateToOriginAction.hpp	(revision 3b179825d4e6f17bd22fbd7f880f59cc7fd8924e)
@@ -0,0 +1,22 @@
+/*
+ * TranslateToOriginAction.hpp
+ *
+ *  Created on: Aug 14, 2014
+ *      Author: heber
+ */
+
+#ifndef TRANSLATETOORIGINACTION_HPP
+#define TRANSLATETOORIGINACTION_HPP
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+
+#include "Actions/Action.hpp"
+
+#include "TranslateToOriginAction.def"
+#include "Action_impl_header.hpp"
+
+#endif // TRANSLATETOORIGINACTION_HPP
