Index: src/Actions/SelectionAction/AllAtomsInsideCuboidAction.cpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsInsideCuboidAction.cpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
+++ src/Actions/SelectionAction/AllAtomsInsideCuboidAction.cpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
@@ -0,0 +1,114 @@
+/*
+ * AllAtomsInsideCuboidAction.cpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/AtomDescriptor.hpp"
+#include "Descriptors/AtomShapeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Shapes/BaseShapes.hpp"
+#include "Shapes/Shape.hpp"
+#include "Shapes/ShapeOps.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/ValueStorage.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionAllAtomsInsideCuboidState : public ActionState {
+public:
+  SelectionAllAtomsInsideCuboidState(std::vector<atom*> _selectedAtoms, const Vector &_position, const Vector &_extension) :
+    selectedAtoms(_selectedAtoms),
+    position(_position),
+    extension(_extension)
+  {}
+  std::vector<atom*> selectedAtoms;
+  Vector position;
+  Vector extension;
+};
+
+const char SelectionAllAtomsInsideCuboidAction::NAME[] = "select-atoms-inside-cuboid";
+
+SelectionAllAtomsInsideCuboidAction::SelectionAllAtomsInsideCuboidAction() :
+  Action(NAME)
+{}
+
+SelectionAllAtomsInsideCuboidAction::~SelectionAllAtomsInsideCuboidAction()
+{}
+
+void SelectionAllAtomsInsideCuboid(const Vector &position, const Vector &extension) {
+  ValueStorage::getInstance().setCurrentValue(SelectionAllAtomsInsideCuboidAction::NAME, extension);
+  ValueStorage::getInstance().setCurrentValue("position", position);
+  ActionRegistry::getInstance().getActionByName(SelectionAllAtomsInsideCuboidAction::NAME)->call(Action::NonInteractive);
+};
+
+Dialog* SelectionAllAtomsInsideCuboidAction::fillDialog(Dialog *dialog) {
+  ASSERT(dialog,"No Dialog given when filling action dialog");
+
+  dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME));
+  dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionAllAtomsInsideCuboidAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+  Vector position;
+  Vector extension;
+
+  ValueStorage::getInstance().queryCurrentValue("position", position);
+  ValueStorage::getInstance().queryCurrentValue(NAME, extension);
+
+  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms inside a cuboid at " << position << " and extension of " << extension << "." << endl);
+  Shape s = translate(stretch(Cuboid(),extension),position);
+  World::getInstance().selectAllAtoms(AtomByShape(s));
+  return Action::state_ptr(new SelectionAllAtomsInsideCuboidState(selectedAtoms, position, extension));
+}
+
+Action::state_ptr SelectionAllAtomsInsideCuboidAction::performUndo(Action::state_ptr _state) {
+  SelectionAllAtomsInsideCuboidState *state = assert_cast<SelectionAllAtomsInsideCuboidState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(new SelectionAllAtomsInsideCuboidState(state->selectedAtoms, state->position, state->extension));
+}
+
+Action::state_ptr SelectionAllAtomsInsideCuboidAction::performRedo(Action::state_ptr _state){
+  SelectionAllAtomsInsideCuboidState *state = assert_cast<SelectionAllAtomsInsideCuboidState*>(_state.get());
+
+  Shape s = translate(stretch(Cuboid(),state->extension),state->position);
+  World::getInstance().selectAllAtoms(AtomByShape(s));
+
+  return Action::state_ptr(new SelectionAllAtomsInsideCuboidState(state->selectedAtoms, state->position, state->extension));
+}
+
+bool SelectionAllAtomsInsideCuboidAction::canUndo() {
+  return true;
+}
+
+bool SelectionAllAtomsInsideCuboidAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionAllAtomsInsideCuboidAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
+++ src/Actions/SelectionAction/AllAtomsInsideCuboidAction.hpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
@@ -0,0 +1,38 @@
+/*
+ * AllAtomsInsideCuboidAction.hpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#ifndef ALLATOMSINSIDECUBOIDACTION_HPP_
+#define ALLATOMSINSIDECUBOIDACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class Vector;
+
+void SelectionAllAtomsInsideCuboid();
+
+class SelectionAllAtomsInsideCuboidAction : public Action {
+  friend void SelectionAllAtomsInsideCuboid(const Vector &position, const Vector &extension);
+
+public:
+  SelectionAllAtomsInsideCuboidAction();
+  virtual ~SelectionAllAtomsInsideCuboidAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+protected:
+  virtual Dialog * fillDialog(Dialog *dialog);
+private:
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* ALLATOMSINSIDECUBOIDACTION_HPP_ */
Index: src/Actions/SelectionAction/AllAtomsInsideSphereAction.cpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsInsideSphereAction.cpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
+++ src/Actions/SelectionAction/AllAtomsInsideSphereAction.cpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
@@ -0,0 +1,114 @@
+/*
+ * AllAtomsInsideSphereAction.cpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/AllAtomsInsideSphereAction.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/AtomDescriptor.hpp"
+#include "Descriptors/AtomShapeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Shapes/BaseShapes.hpp"
+#include "Shapes/Shape.hpp"
+#include "Shapes/ShapeOps.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/ValueStorage.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionAllAtomsInsideSphereState : public ActionState {
+public:
+  SelectionAllAtomsInsideSphereState(std::vector<atom*> _selectedAtoms, const Vector &_position, const double _radius) :
+    selectedAtoms(_selectedAtoms),
+    position(_position),
+    radius(_radius)
+  {}
+  std::vector<atom*> selectedAtoms;
+  Vector position;
+  double radius;
+};
+
+const char SelectionAllAtomsInsideSphereAction::NAME[] = "select-atoms-inside-sphere";
+
+SelectionAllAtomsInsideSphereAction::SelectionAllAtomsInsideSphereAction() :
+  Action(NAME)
+{}
+
+SelectionAllAtomsInsideSphereAction::~SelectionAllAtomsInsideSphereAction()
+{}
+
+void SelectionAllAtomsInsideSphere(const Vector &position, const double radius) {
+  ValueStorage::getInstance().setCurrentValue(SelectionAllAtomsInsideSphereAction::NAME, radius);
+  ValueStorage::getInstance().setCurrentValue("position", position);
+  ActionRegistry::getInstance().getActionByName(SelectionAllAtomsInsideSphereAction::NAME)->call(Action::NonInteractive);
+};
+
+Dialog* SelectionAllAtomsInsideSphereAction::fillDialog(Dialog *dialog) {
+  ASSERT(dialog,"No Dialog given when filling action dialog");
+
+  dialog->queryDouble(NAME, ValueStorage::getInstance().getDescription(NAME));
+  dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionAllAtomsInsideSphereAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+  double radius = 0.;
+  Vector position;
+
+  ValueStorage::getInstance().queryCurrentValue(NAME, radius);
+  ValueStorage::getInstance().queryCurrentValue("position", position);
+
+  DoLog(1) && (Log() << Verbose(1) << "Selecting all atoms inside a sphere at " << position << " with radius " << radius << "." << endl);
+  Shape s = translate(resize(Sphere(),radius),position);
+  World::getInstance().selectAllAtoms(AtomByShape(s));
+  return Action::state_ptr(new SelectionAllAtomsInsideSphereState(selectedAtoms, position, radius));
+}
+
+Action::state_ptr SelectionAllAtomsInsideSphereAction::performUndo(Action::state_ptr _state) {
+  SelectionAllAtomsInsideSphereState *state = assert_cast<SelectionAllAtomsInsideSphereState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(new SelectionAllAtomsInsideSphereState(state->selectedAtoms, state->position, state->radius));
+}
+
+Action::state_ptr SelectionAllAtomsInsideSphereAction::performRedo(Action::state_ptr _state){
+  SelectionAllAtomsInsideSphereState *state = assert_cast<SelectionAllAtomsInsideSphereState*>(_state.get());
+
+  Shape s = translate(resize(Sphere(),state->radius),state->position);
+  World::getInstance().selectAllAtoms(AtomByShape(s));
+
+  return Action::state_ptr(new SelectionAllAtomsInsideSphereState(state->selectedAtoms, state->position, state->radius));
+}
+
+bool SelectionAllAtomsInsideSphereAction::canUndo() {
+  return true;
+}
+
+bool SelectionAllAtomsInsideSphereAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionAllAtomsInsideSphereAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/AllAtomsInsideSphereAction.hpp
===================================================================
--- src/Actions/SelectionAction/AllAtomsInsideSphereAction.hpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
+++ src/Actions/SelectionAction/AllAtomsInsideSphereAction.hpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
@@ -0,0 +1,38 @@
+/*
+ * AllAtomsInsideSphereAction.hpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#ifndef ALLATOMSINSIDESPHEREACTION_HPP_
+#define ALLATOMSINSIDESPHEREACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class Vector;
+
+void SelectionAllAtomsInsideSphere();
+
+class SelectionAllAtomsInsideSphereAction : public Action {
+  friend void SelectionAllAtomsInsideSphere(const Vector &position, const double radius);
+
+public:
+  SelectionAllAtomsInsideSphereAction();
+  virtual ~SelectionAllAtomsInsideSphereAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+protected:
+  virtual Dialog * fillDialog(Dialog *dialog);
+private:
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* ALLATOMSINSIDESPHEREACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.cpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
+++ src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.cpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
@@ -0,0 +1,114 @@
+/*
+ * NotAllAtomsInsideCuboidAction.cpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/AtomDescriptor.hpp"
+#include "Descriptors/AtomShapeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Shapes/BaseShapes.hpp"
+#include "Shapes/Shape.hpp"
+#include "Shapes/ShapeOps.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/ValueStorage.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionNotAllAtomsInsideCuboidState : public ActionState {
+public:
+  SelectionNotAllAtomsInsideCuboidState(std::vector<atom*> _selectedAtoms, const Vector &_position, const Vector &_extension) :
+    selectedAtoms(_selectedAtoms),
+    position(_position),
+    extension(_extension)
+  {}
+  std::vector<atom*> selectedAtoms;
+  Vector position;
+  Vector extension;
+};
+
+const char SelectionNotAllAtomsInsideCuboidAction::NAME[] = "unselect-atoms-inside-cuboid";
+
+SelectionNotAllAtomsInsideCuboidAction::SelectionNotAllAtomsInsideCuboidAction() :
+  Action(NAME)
+{}
+
+SelectionNotAllAtomsInsideCuboidAction::~SelectionNotAllAtomsInsideCuboidAction()
+{}
+
+void SelectionNotAllAtomsInsideCuboid(const Vector &position, const Vector &extension) {
+  ValueStorage::getInstance().setCurrentValue(SelectionNotAllAtomsInsideCuboidAction::NAME, extension);
+  ValueStorage::getInstance().setCurrentValue("position", position);
+  ActionRegistry::getInstance().getActionByName(SelectionNotAllAtomsInsideCuboidAction::NAME)->call(Action::NonInteractive);
+};
+
+Dialog* SelectionNotAllAtomsInsideCuboidAction::fillDialog(Dialog *dialog) {
+  ASSERT(dialog,"No Dialog given when filling action dialog");
+
+  dialog->queryVector(NAME, false, ValueStorage::getInstance().getDescription(NAME));
+  dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionNotAllAtomsInsideCuboidAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+  Vector position;
+  Vector extension;
+
+  ValueStorage::getInstance().queryCurrentValue("position", position);
+  ValueStorage::getInstance().queryCurrentValue(NAME, extension);
+
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms inside a cuboid at " << position << " and extension of " << extension << "." << endl);
+  Shape s = translate(stretch(Cuboid(),extension),position);
+  World::getInstance().unselectAllAtoms(AtomByShape(s));
+  return Action::state_ptr(new SelectionNotAllAtomsInsideCuboidState(selectedAtoms, position, extension));
+}
+
+Action::state_ptr SelectionNotAllAtomsInsideCuboidAction::performUndo(Action::state_ptr _state) {
+  SelectionNotAllAtomsInsideCuboidState *state = assert_cast<SelectionNotAllAtomsInsideCuboidState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(new SelectionNotAllAtomsInsideCuboidState(state->selectedAtoms, state->position, state->extension));
+}
+
+Action::state_ptr SelectionNotAllAtomsInsideCuboidAction::performRedo(Action::state_ptr _state){
+  SelectionNotAllAtomsInsideCuboidState *state = assert_cast<SelectionNotAllAtomsInsideCuboidState*>(_state.get());
+
+  Shape s = translate(stretch(Cuboid(),state->extension),state->position);
+  World::getInstance().unselectAllAtoms(AtomByShape(s));
+
+  return Action::state_ptr(new SelectionNotAllAtomsInsideCuboidState(state->selectedAtoms, state->position, state->extension));
+}
+
+bool SelectionNotAllAtomsInsideCuboidAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotAllAtomsInsideCuboidAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotAllAtomsInsideCuboidAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
+++ src/Actions/SelectionAction/NotAllAtomsInsideCuboidAction.hpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
@@ -0,0 +1,38 @@
+/*
+ * NotAllAtomsInsideCuboidAction.hpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTALLATOMSINSIDECUBOIDACTION_HPP_
+#define NOTALLATOMSINSIDECUBOIDACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class Vector;
+
+void SelectionNotAllAtomsInsideCuboid();
+
+class SelectionNotAllAtomsInsideCuboidAction : public Action {
+  friend void SelectionNotAllAtomsInsideCuboid(const Vector &position, const Vector &extension);
+
+public:
+  SelectionNotAllAtomsInsideCuboidAction();
+  virtual ~SelectionNotAllAtomsInsideCuboidAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+protected:
+  virtual Dialog * fillDialog(Dialog *dialog);
+private:
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* NOTALLATOMSINSIDECUBOIDACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.cpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
+++ src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.cpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
@@ -0,0 +1,114 @@
+/*
+ * NotAllAtomsInsideSphereAction.cpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/AtomDescriptor.hpp"
+#include "Descriptors/AtomShapeDescriptor.hpp"
+#include "atom.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.hpp"
+#include "LinearAlgebra/Vector.hpp"
+#include "Shapes/BaseShapes.hpp"
+#include "Shapes/Shape.hpp"
+#include "Shapes/ShapeOps.hpp"
+#include "World.hpp"
+
+#include <iostream>
+#include <string>
+
+using namespace std;
+
+#include "UIElements/UIFactory.hpp"
+#include "UIElements/Dialog.hpp"
+#include "Actions/ValueStorage.hpp"
+
+
+// memento to remember the state when undoing
+
+class SelectionNotAllAtomsInsideSphereState : public ActionState {
+public:
+  SelectionNotAllAtomsInsideSphereState(std::vector<atom*> _selectedAtoms, const Vector &_position, const double _radius) :
+    selectedAtoms(_selectedAtoms),
+    position(_position),
+    radius(_radius)
+  {}
+  std::vector<atom*> selectedAtoms;
+  Vector position;
+  double radius;
+};
+
+const char SelectionNotAllAtomsInsideSphereAction::NAME[] = "unselect-atoms-inside-sphere";
+
+SelectionNotAllAtomsInsideSphereAction::SelectionNotAllAtomsInsideSphereAction() :
+  Action(NAME)
+{}
+
+SelectionNotAllAtomsInsideSphereAction::~SelectionNotAllAtomsInsideSphereAction()
+{}
+
+void SelectionNotAllAtomsInsideSphere(const Vector &position, const double radius) {
+  ValueStorage::getInstance().setCurrentValue(SelectionNotAllAtomsInsideSphereAction::NAME, radius);
+  ValueStorage::getInstance().setCurrentValue("position", position);
+  ActionRegistry::getInstance().getActionByName(SelectionNotAllAtomsInsideSphereAction::NAME)->call(Action::NonInteractive);
+};
+
+Dialog* SelectionNotAllAtomsInsideSphereAction::fillDialog(Dialog *dialog) {
+  ASSERT(dialog,"No Dialog given when filling action dialog");
+
+  dialog->queryDouble(NAME, ValueStorage::getInstance().getDescription(NAME));
+  dialog->queryVector("position", false, ValueStorage::getInstance().getDescription("position"));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionNotAllAtomsInsideSphereAction::performCall() {
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+  double radius = 0.;
+  Vector position;
+
+  ValueStorage::getInstance().queryCurrentValue(NAME, radius);
+  ValueStorage::getInstance().queryCurrentValue("position", position);
+
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting all atoms inside a sphere at " << position << " with radius " << radius << "." << endl);
+  Shape s = translate(resize(Sphere(),radius),position);
+  World::getInstance().unselectAllAtoms(AtomByShape(s));
+  return Action::state_ptr(new SelectionNotAllAtomsInsideSphereState(selectedAtoms, position, radius));
+}
+
+Action::state_ptr SelectionNotAllAtomsInsideSphereAction::performUndo(Action::state_ptr _state) {
+  SelectionNotAllAtomsInsideSphereState *state = assert_cast<SelectionNotAllAtomsInsideSphereState*>(_state.get());
+
+  World::getInstance().clearAtomSelection();
+  for(std::vector<atom *>::iterator iter = state->selectedAtoms.begin(); iter != state->selectedAtoms.end(); ++iter)
+    World::getInstance().selectAtom(*iter);
+
+  return Action::state_ptr(new SelectionNotAllAtomsInsideSphereState(state->selectedAtoms, state->position, state->radius));
+}
+
+Action::state_ptr SelectionNotAllAtomsInsideSphereAction::performRedo(Action::state_ptr _state){
+  SelectionNotAllAtomsInsideSphereState *state = assert_cast<SelectionNotAllAtomsInsideSphereState*>(_state.get());
+
+  Shape s = translate(resize(Sphere(),state->radius),state->position);
+  World::getInstance().unselectAllAtoms(AtomByShape(s));
+
+  return Action::state_ptr(new SelectionNotAllAtomsInsideSphereState(state->selectedAtoms, state->position, state->radius));
+}
+
+bool SelectionNotAllAtomsInsideSphereAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotAllAtomsInsideSphereAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotAllAtomsInsideSphereAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
+++ src/Actions/SelectionAction/NotAllAtomsInsideSphereAction.hpp	(revision 1cc87ed369fad8326bd48fd53bf9078b19efe5a9)
@@ -0,0 +1,38 @@
+/*
+ * NotAllAtomsInsideSphereAction.hpp
+ *
+ *  Created on: Aug 9, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTALLATOMSINSIDESPHEREACTION_HPP_
+#define NOTALLATOMSINSIDESPHEREACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class Vector;
+
+void SelectionNotAllAtomsInsideSphere();
+
+class SelectionNotAllAtomsInsideSphereAction : public Action {
+  friend void SelectionNotAllAtomsInsideSphere(const Vector &position, const double radius);
+
+public:
+  SelectionNotAllAtomsInsideSphereAction();
+  virtual ~SelectionNotAllAtomsInsideSphereAction();
+
+  bool canUndo();
+  bool shouldUndo();
+
+  virtual const std::string getName();
+protected:
+  virtual Dialog * fillDialog(Dialog *dialog);
+private:
+  virtual Action::state_ptr performCall();
+  virtual Action::state_ptr performUndo(Action::state_ptr);
+  virtual Action::state_ptr performRedo(Action::state_ptr);
+
+  static const char NAME[];
+};
+
+#endif /* NOTALLATOMSINSIDESPHEREACTION_HPP_ */
