Index: src/Actions/SelectionAction/AtomByElementAction.cpp
===================================================================
--- src/Actions/SelectionAction/AtomByElementAction.cpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
+++ src/Actions/SelectionAction/AtomByElementAction.cpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
@@ -0,0 +1,107 @@
+/*
+ * AtomByElementAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/AtomByElementAction.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/AtomTypeDescriptor.hpp"
+#include "atom.hpp"
+#include "element.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.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 SelectionAtomByElementState : public ActionState {
+public:
+  SelectionAtomByElementState(std::vector<atom*> _selectedAtoms, const element *_elemental) :
+    selectedAtoms(_selectedAtoms),
+    elemental(_elemental)
+  {}
+  std::vector<atom*> selectedAtoms;
+  const element *elemental;
+};
+
+const char SelectionAtomByElementAction::NAME[] = "select-atom-by-element";
+
+SelectionAtomByElementAction::SelectionAtomByElementAction() :
+  Action(NAME)
+{}
+
+SelectionAtomByElementAction::~SelectionAtomByElementAction()
+{}
+
+void SelectionAtomByElement(const element &_element) {
+  ValueStorage::getInstance().setCurrentValue(SelectionAtomByElementAction::NAME, _element);
+  ActionRegistry::getInstance().getActionByName(SelectionAtomByElementAction::NAME)->call(Action::NonInteractive);
+};
+
+Dialog* SelectionAtomByElementAction::fillDialog(Dialog *dialog) {
+  ASSERT(dialog,"No Dialog given when filling action dialog");
+
+  dialog->queryElement(NAME, ValueStorage::getInstance().getDescription(NAME));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionAtomByElementAction::performCall() {
+  const element *elemental;
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+
+  ValueStorage::getInstance().queryCurrentValue(NAME, elemental);
+
+  DoLog(1) && (Log() << Verbose(1) << "Selecting atoms of type " << *elemental << endl);
+  World::getInstance().selectAllAtoms(AtomByType(elemental));
+  return Action::state_ptr(new SelectionAtomByElementState(selectedAtoms,elemental));
+}
+
+Action::state_ptr SelectionAtomByElementAction::performUndo(Action::state_ptr _state) {
+  SelectionAtomByElementState *state = assert_cast<SelectionAtomByElementState*>(_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(_state);
+}
+
+Action::state_ptr SelectionAtomByElementAction::performRedo(Action::state_ptr _state){
+  SelectionAtomByElementState *state = assert_cast<SelectionAtomByElementState*>(_state.get());
+
+  World::getInstance().selectAllAtoms(AtomByType(state->elemental));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionAtomByElementAction::canUndo() {
+  return true;
+}
+
+bool SelectionAtomByElementAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionAtomByElementAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/AtomByElementAction.hpp
===================================================================
--- src/Actions/SelectionAction/AtomByElementAction.hpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
+++ src/Actions/SelectionAction/AtomByElementAction.hpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
@@ -0,0 +1,38 @@
+/*
+ * AtomByElementAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef ATOMBYELEMENTACTION_HPP_
+#define ATOMBYELEMENTACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class element;
+
+void SelectionAtomByElement(const element &_element);
+
+class SelectionAtomByElementAction : public Action {
+  friend void SelectionAtomByElement(const element &_element);
+
+public:
+  SelectionAtomByElementAction();
+  virtual ~SelectionAtomByElementAction();
+
+  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 /* ATOMBYELEMENTACTION_HPP_ */
Index: src/Actions/SelectionAction/MoleculeByFormulaAction.cpp
===================================================================
--- src/Actions/SelectionAction/MoleculeByFormulaAction.cpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
+++ src/Actions/SelectionAction/MoleculeByFormulaAction.cpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
@@ -0,0 +1,110 @@
+/*
+ * MoleculeByFormulaAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/MoleculeByFormulaAction.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/MoleculeFormulaDescriptor.hpp"
+#include "molecule.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.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 SelectionMoleculeByFormulaState : public ActionState {
+public:
+  SelectionMoleculeByFormulaState(std::vector<molecule*> selectedMolecules, const std::string &_formula) :
+    selectedMolecules(selectedMolecules),
+    formula(_formula)
+  {}
+  std::vector<molecule*> selectedMolecules;
+  std::string formula;
+};
+
+const char SelectionMoleculeByFormulaAction::NAME[] = "select-molecule-by-formula";
+
+SelectionMoleculeByFormulaAction::SelectionMoleculeByFormulaAction() :
+  Action(NAME)
+{}
+
+SelectionMoleculeByFormulaAction::~SelectionMoleculeByFormulaAction()
+{}
+
+void SelectionMoleculeByFormula(const std::string &_formula) {
+  ValueStorage::getInstance().setCurrentValue(SelectionMoleculeByFormulaAction::NAME, _formula);
+  ActionRegistry::getInstance().getActionByName(SelectionMoleculeByFormulaAction::NAME)->call(Action::NonInteractive);
+};
+
+Dialog* SelectionMoleculeByFormulaAction::fillDialog(Dialog *dialog) {
+  ASSERT(dialog,"No Dialog given when filling action dialog");
+
+  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionMoleculeByFormulaAction::performCall() {
+  std::string formula;
+  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+
+  ValueStorage::getInstance().queryCurrentValue(NAME, formula);
+
+  DoLog(1) && (Log() << Verbose(1) << "Selecting molecules with chemical formula " << formula << ":" << endl);
+  std::vector<molecule *> matchingMolecules = World::getInstance().getAllMolecules(MoleculeByFormula(formula));
+  for (std::vector<molecule *>::const_iterator iter = matchingMolecules.begin(); iter != matchingMolecules.end(); ++iter) {
+    DoLog(1) && (Log() << Verbose(1) << "\t" << (*iter)->getId() << ", " << (*iter)->getName() << "." << endl);
+  }
+  World::getInstance().selectAllMolecules(MoleculeByFormula(formula));
+  return Action::state_ptr(new SelectionMoleculeByFormulaState(selectedMolecules,formula));
+}
+
+Action::state_ptr SelectionMoleculeByFormulaAction::performUndo(Action::state_ptr _state) {
+  SelectionMoleculeByFormulaState *state = assert_cast<SelectionMoleculeByFormulaState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+  for(std::vector<molecule *>::iterator iter = state->selectedMolecules.begin(); iter != state->selectedMolecules.end(); ++iter)
+    World::getInstance().selectMolecule(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionMoleculeByFormulaAction::performRedo(Action::state_ptr _state){
+  SelectionMoleculeByFormulaState *state = assert_cast<SelectionMoleculeByFormulaState*>(_state.get());
+
+  World::getInstance().selectAllMolecules(MoleculeByFormula(state->formula));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionMoleculeByFormulaAction::canUndo() {
+  return true;
+}
+
+bool SelectionMoleculeByFormulaAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionMoleculeByFormulaAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/MoleculeByFormulaAction.hpp
===================================================================
--- src/Actions/SelectionAction/MoleculeByFormulaAction.hpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
+++ src/Actions/SelectionAction/MoleculeByFormulaAction.hpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
@@ -0,0 +1,38 @@
+/*
+ * MoleculeByFormulaAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef MOLECULEBYFORMULAACTION_HPP_
+#define MOLECULEBYFORMULAACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class molecule;
+
+void SelectionMoleculeByFormula(molecule *_mol);
+
+class SelectionMoleculeByFormulaAction : public Action {
+  friend void SelectionMoleculeByFormula(const std::string &_formula);
+
+public:
+  SelectionMoleculeByFormulaAction();
+  virtual ~SelectionMoleculeByFormulaAction();
+
+  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 /* MOLECULEBYFORMULAACTION_HPP_ */
Index: src/Actions/SelectionAction/NotAtomByElementAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotAtomByElementAction.cpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
+++ src/Actions/SelectionAction/NotAtomByElementAction.cpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
@@ -0,0 +1,107 @@
+/*
+ * NotAtomByElementAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/NotAtomByElementAction.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/AtomTypeDescriptor.hpp"
+#include "atom.hpp"
+#include "element.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.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 SelectionNotAtomByElementState : public ActionState {
+public:
+  SelectionNotAtomByElementState(std::vector<atom*> _selectedAtoms, const element *_elemental) :
+    selectedAtoms(_selectedAtoms),
+    elemental(_elemental)
+  {}
+  std::vector<atom*> selectedAtoms;
+  const element *elemental;
+};
+
+const char SelectionNotAtomByElementAction::NAME[] = "unselect-atom-by-element";
+
+SelectionNotAtomByElementAction::SelectionNotAtomByElementAction() :
+  Action(NAME)
+{}
+
+SelectionNotAtomByElementAction::~SelectionNotAtomByElementAction()
+{}
+
+void SelectionNotAtomByElement(const element &_element) {
+  ValueStorage::getInstance().setCurrentValue(SelectionNotAtomByElementAction::NAME, _element);
+  ActionRegistry::getInstance().getActionByName(SelectionNotAtomByElementAction::NAME)->call(Action::NonInteractive);
+};
+
+Dialog* SelectionNotAtomByElementAction::fillDialog(Dialog *dialog) {
+  ASSERT(dialog,"No Dialog given when filling action dialog");
+
+  dialog->queryElement(NAME, ValueStorage::getInstance().getDescription(NAME));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionNotAtomByElementAction::performCall() {
+  const element *elemental;
+  std::vector<atom *> selectedAtoms = World::getInstance().getSelectedAtoms();
+
+  ValueStorage::getInstance().queryCurrentValue(NAME, elemental);
+
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting atoms of type " << *elemental << endl);
+  World::getInstance().unselectAllAtoms(AtomByType(elemental));
+  return Action::state_ptr(new SelectionNotAtomByElementState(selectedAtoms,elemental));
+}
+
+Action::state_ptr SelectionNotAtomByElementAction::performUndo(Action::state_ptr _state) {
+  SelectionNotAtomByElementState *state = assert_cast<SelectionNotAtomByElementState*>(_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(_state);
+}
+
+Action::state_ptr SelectionNotAtomByElementAction::performRedo(Action::state_ptr _state){
+  SelectionNotAtomByElementState *state = assert_cast<SelectionNotAtomByElementState*>(_state.get());
+
+  World::getInstance().unselectAllAtoms(AtomByType(state->elemental));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionNotAtomByElementAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotAtomByElementAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotAtomByElementAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/NotAtomByElementAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotAtomByElementAction.hpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
+++ src/Actions/SelectionAction/NotAtomByElementAction.hpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
@@ -0,0 +1,38 @@
+/*
+ * NotAtomByElementAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTATOMBYELEMENTACTION_HPP_
+#define NOTATOMBYELEMENTACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class element;
+
+void SelectionNotAtomByElement(const element &_element);
+
+class SelectionNotAtomByElementAction : public Action {
+  friend void SelectionNotAtomByElement(const element &_element);
+
+public:
+  SelectionNotAtomByElementAction();
+  virtual ~SelectionNotAtomByElementAction();
+
+  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 /* NOTATOMBYELEMENTACTION_HPP_ */
Index: src/Actions/SelectionAction/NotMoleculeByFormulaAction.cpp
===================================================================
--- src/Actions/SelectionAction/NotMoleculeByFormulaAction.cpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
+++ src/Actions/SelectionAction/NotMoleculeByFormulaAction.cpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
@@ -0,0 +1,110 @@
+/*
+ * NotMoleculeByFormulaAction.cpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+// include config.h
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "Helpers/MemDebug.hpp"
+
+#include "Actions/SelectionAction/NotMoleculeByFormulaAction.hpp"
+#include "Actions/ActionRegistry.hpp"
+#include "Descriptors/MoleculeFormulaDescriptor.hpp"
+#include "molecule.hpp"
+#include "Helpers/Log.hpp"
+#include "Helpers/Verbose.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 SelectionNotMoleculeByFormulaState : public ActionState {
+public:
+  SelectionNotMoleculeByFormulaState(std::vector<molecule*> selectedMolecules, const std::string &_formula) :
+    selectedMolecules(selectedMolecules),
+    formula(_formula)
+  {}
+  std::vector<molecule*> selectedMolecules;
+  std::string formula;
+};
+
+const char SelectionNotMoleculeByFormulaAction::NAME[] = "unselect-molecule-by-formula";
+
+SelectionNotMoleculeByFormulaAction::SelectionNotMoleculeByFormulaAction() :
+  Action(NAME)
+{}
+
+SelectionNotMoleculeByFormulaAction::~SelectionNotMoleculeByFormulaAction()
+{}
+
+void SelectionNotMoleculeByFormula(const std::string &_formula) {
+  ValueStorage::getInstance().setCurrentValue(SelectionNotMoleculeByFormulaAction::NAME, _formula);
+  ActionRegistry::getInstance().getActionByName(SelectionNotMoleculeByFormulaAction::NAME)->call(Action::NonInteractive);
+};
+
+Dialog* SelectionNotMoleculeByFormulaAction::fillDialog(Dialog *dialog) {
+  ASSERT(dialog,"No Dialog given when filling action dialog");
+
+  dialog->queryString(NAME, ValueStorage::getInstance().getDescription(NAME));
+
+  return dialog;
+}
+
+Action::state_ptr SelectionNotMoleculeByFormulaAction::performCall() {
+  std::string formula;
+  std::vector<molecule *> selectedMolecules = World::getInstance().getSelectedMolecules();
+
+  ValueStorage::getInstance().queryCurrentValue(NAME, formula);
+
+  DoLog(1) && (Log() << Verbose(1) << "Unselecting molecules with chemical formula " << formula << ":" << endl);
+  std::vector<molecule *> matchingMolecules = World::getInstance().getAllMolecules(MoleculeByFormula(formula));
+  for (std::vector<molecule *>::const_iterator iter = matchingMolecules.begin(); iter != matchingMolecules.end(); ++iter) {
+    DoLog(1) && (Log() << Verbose(1) << "\t" << (*iter)->getId() << ", " << (*iter)->getName() << "." << endl);
+  }
+  World::getInstance().unselectAllMolecules(MoleculeByFormula(formula));
+  return Action::state_ptr(new SelectionNotMoleculeByFormulaState(selectedMolecules,formula));
+}
+
+Action::state_ptr SelectionNotMoleculeByFormulaAction::performUndo(Action::state_ptr _state) {
+  SelectionNotMoleculeByFormulaState *state = assert_cast<SelectionNotMoleculeByFormulaState*>(_state.get());
+
+  World::getInstance().clearMoleculeSelection();
+  for(std::vector<molecule *>::iterator iter = state->selectedMolecules.begin(); iter != state->selectedMolecules.end(); ++iter)
+    World::getInstance().selectMolecule(*iter);
+
+  return Action::state_ptr(_state);
+}
+
+Action::state_ptr SelectionNotMoleculeByFormulaAction::performRedo(Action::state_ptr _state){
+  SelectionNotMoleculeByFormulaState *state = assert_cast<SelectionNotMoleculeByFormulaState*>(_state.get());
+
+  World::getInstance().unselectAllMolecules(MoleculeByFormula(state->formula));
+
+  return Action::state_ptr(_state);
+}
+
+bool SelectionNotMoleculeByFormulaAction::canUndo() {
+  return true;
+}
+
+bool SelectionNotMoleculeByFormulaAction::shouldUndo() {
+  return true;
+}
+
+const string SelectionNotMoleculeByFormulaAction::getName() {
+  return NAME;
+}
Index: src/Actions/SelectionAction/NotMoleculeByFormulaAction.hpp
===================================================================
--- src/Actions/SelectionAction/NotMoleculeByFormulaAction.hpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
+++ src/Actions/SelectionAction/NotMoleculeByFormulaAction.hpp	(revision 51769f1ad434c697ff72558611b3163dbe892aa8)
@@ -0,0 +1,38 @@
+/*
+ * NotMoleculeByFormulaAction.hpp
+ *
+ *  Created on: May 12, 2010
+ *      Author: heber
+ */
+
+#ifndef NOTMOLECULEBYFORMULAACTION_HPP_
+#define NOTMOLECULEBYFORMULAACTION_HPP_
+
+#include "Actions/Action.hpp"
+
+class molecule;
+
+void SelectionNotMoleculeByFormula(molecule *_mol);
+
+class SelectionNotMoleculeByFormulaAction : public Action {
+  friend void SelectionNotMoleculeByFormula(const std::string &_formula);
+
+public:
+  SelectionNotMoleculeByFormulaAction();
+  virtual ~SelectionNotMoleculeByFormulaAction();
+
+  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 /* NOTMOLECULEBYFORMULAACTION_HPP_ */
