Index: src/Actions/MapOfActions.cpp
===================================================================
--- src/Actions/MapOfActions.cpp	(revision 584a2a322e04645b47cee8b1353d66e700542023)
+++ src/Actions/MapOfActions.cpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
@@ -153,5 +153,5 @@
   TypeMap["remove-atom"] = Atom;
   TypeMap["remove-sphere"] = Atom;
-  TypeMap["repeat-box"] = ListOfInts;
+  TypeMap["repeat-box"] = Vector;
   TypeMap["rotate-to-pas"] = Molecule;
   TypeMap["save-adjacency"] = String;
@@ -165,4 +165,5 @@
   TypeMap["verlet-integrate"] = String;
   TypeMap["verbose"] = Integer;
+
   // value types for the values
   TypeMap["bin-output-file"] = String;
@@ -180,4 +181,8 @@
   TypeMap["periodic"] = Boolean;
   TypeMap["position"] = Vector;
+
+  // default values for any action that needs one (always string!)
+  DefaultValue["molecule-by-id"] = "-1";
+
 
   // list of generic actions
@@ -210,4 +215,5 @@
 //  generic.insert("remove-atom");
 //  generic.insert("remove-sphere");
+    generic.insert("repeat-box");
 //  generic.insert("rotate-to-pas");
 //	generic.insert("save-adjacency");
@@ -271,75 +277,121 @@
           case Boolean:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< bool >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< bool >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< bool >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Integer:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< int >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case ListOfInts:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >()->multitoken(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<int> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Double:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< double >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< double >()->default_value(atof(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< double >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case ListOfDoubles:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<double> >()->multitoken(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<double> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case String:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< std::string >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< std::string >()->default_value(DefaultValue[*OptionRunner]) :
+                        po::value< std::string >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Axis:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< int >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Vector:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<double> >()->multitoken(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<double> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Box:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<double> >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<double> >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Molecule:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< int >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case ListOfMolecules:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >()->multitoken(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<int> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Atom:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< int >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case ListOfAtoms:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >()->multitoken(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<int> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case Element:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< int >(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  DefaultValue.find(*OptionRunner) != DefaultValue.end() ?
+                        po::value< int >()->default_value(atoi(DefaultValue[*OptionRunner].c_str())) :
+                        po::value< int >(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
           case ListOfElements:
             ListRunner->second->add_options()
-              (getKeyAndShortForm(*OptionRunner).c_str(), po::value< vector<int> >()->multitoken(), getDescription(*OptionRunner).c_str())
+              (getKeyAndShortForm(*OptionRunner).c_str(),
+                  po::value< vector<int> >()->multitoken(),
+                  getDescription(*OptionRunner).c_str())
               ;
             break;
Index: src/Actions/MapOfActions.hpp
===================================================================
--- src/Actions/MapOfActions.hpp	(revision 584a2a322e04645b47cee8b1353d66e700542023)
+++ src/Actions/MapOfActions.hpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
@@ -53,4 +53,5 @@
 
   // map of the action names and their description
+  map<std::string, std::string> DefaultValue;
   map<std::string, std::string> DescriptionMap;
   map<std::string, std::string> ShortFormMap;
Index: src/Actions/WorldAction/RepeatBoxAction.cpp
===================================================================
--- src/Actions/WorldAction/RepeatBoxAction.cpp	(revision 584a2a322e04645b47cee8b1353d66e700542023)
+++ src/Actions/WorldAction/RepeatBoxAction.cpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
@@ -23,4 +23,6 @@
 #include "UIElements/Dialog.hpp"
 #include "Actions/MapOfActions.hpp"
+#include "Descriptors/MoleculeDescriptor.hpp"
+#include "Descriptors/MoleculePtrDescriptor.hpp"
 
 const char WorldRepeatBoxAction::NAME[] = "repeat-box";
@@ -41,13 +43,24 @@
   int j = 0;
   atom *Walker = NULL;
+  MoleculeListClass *molecules = World::getInstance().getMolecules();
 
   dialog->queryVector(NAME, &Repeater, World::getInstance().getDomain(), false, MapOfActions::getInstance().getDescription(NAME));
-  dialog->queryMolecule("molecule-by-id", &mol,MapOfActions::getInstance().getDescription("molecule-by-id"));
+  //dialog->queryMolecule("molecule-by-id", &mol,MapOfActions::getInstance().getDescription("molecule-by-id"));
+  vector<molecule *> AllMolecules;
+  if (mol != NULL) {
+    DoLog(0) && (Log() << Verbose(0) << "Using molecule " << mol->name << "." << endl);
+    AllMolecules = World::getInstance().getAllMolecules(MoleculeByPtr(mol));
+  } else {
+    DoLog(0) && (Log() << Verbose(0) << "Using all molecules." << endl);
+    AllMolecules = World::getInstance().getAllMolecules();
+  }
 
   if(dialog->display()) {
+    (cout << "Repeating box " << Repeater << " times for (x,y,z) axis." << endl);
     double * const cell_size = World::getInstance().getDomain();
+    double *M = ReturnFullMatrixforSymmetric(cell_size);
     Vector x,y;
-    for (int axis = 1; axis <= NDIM; axis++) {
-      Vector ** vectors;
+    int n[NDIM];
+    for (int axis = 0; axis < NDIM; axis++) {
       Repeater[axis] = floor(Repeater[axis]);
       if (Repeater[axis] < 1) {
@@ -55,39 +68,54 @@
         Repeater[axis] = 1;
       }
-      if (mol->getAtomCount() != 0) {  // if there is more than none
-        count = mol->getAtomCount();   // is changed becausing of adding, thus has to be stored away beforehand
-        Elements = new const element *[count];
-        vectors = new Vector *[count];
-        j = 0;
-        for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {
-          Elements[j] = (*AtomRunner)->type;
-          vectors[j] = &(*AtomRunner)->x;
-          j++;
-        }
-        if (count != j)
-          DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
-        x.Zero();
-        y.Zero();
-        y[abs(axis)-1] = cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
-        for (int i=1;i<Repeater[axis];i++) {  // then add this list with respective translation factor times
-          x += y; // per factor one cell width further
-          for (int k=count;k--;) { // go through every atom of the original cell
-            Walker = World::getInstance().createAtom(); // create a new body
-            Walker->x = (*vectors[k]) + x;
-            Walker->type = Elements[k];  // insert original element
-            mol->AddAtom(Walker);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
+      cell_size[(abs(axis+1) == 2) ? 2 : ((abs(axis+2) == 3) ? 5 : 0)] *= Repeater[axis];
+    }
+
+    molecule *newmol = NULL;
+    Vector ** vectors = NULL;
+    for (n[0] = 0; n[0] < Repeater[0]; n[0]++) {
+      y[0] = n[0];
+      for (n[1] = 0; n[1] < Repeater[1]; n[1]++) {
+        y[1] = n[1];
+        for (n[2] = 0; n[2] < Repeater[2]; n[2]++) {
+          y[2] = n[2];
+          if (n[0] == n[1] == n[2] == 0)
+            continue;
+          for (vector<molecule *>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
+            mol = *MolRunner;
+            DoLog(1) && (Log() << Verbose(1) << "Current mol is " << mol->name << "." << endl);
+            count = mol->getAtomCount();   // is changed becausing of adding, thus has to be stored away beforehand
+            if (count != 0) {  // if there is more than none
+              Elements = new const element *[count];
+              vectors = new Vector *[count];
+              j = 0;
+              for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {
+                Elements[j] = (*AtomRunner)->type;
+                vectors[j] = &(*AtomRunner)->x;
+                j++;
+              }
+              if (count != j)
+                DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
+              x = y;
+              x.MatrixMultiplication(M);
+              newmol = World::getInstance().createMolecule();
+              molecules->insert(newmol);
+              for (int k=count;k--;) { // go through every atom of the original cell
+                Walker = World::getInstance().createAtom(); // create a new body
+                Walker->x = (*vectors[k]) + x;
+                Walker->type = Elements[k];  // insert original element
+                cout << "new atom is " << *Walker << endl;
+                newmol->AddAtom(Walker);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
+              }
+              // free memory
+              delete[](Elements);
+              delete[](vectors);
+            } else {
+              DoLog(1) && (Log() << Verbose(1) << "\t ... is empty." << endl);
+            }
           }
         }
-        // free memory
-        delete[](Elements);
-        delete[](vectors);
-        // correct cell size
-        if (axis < 0) { // if sign was negative, we have to translate everything
-          x =(-(Repeater[axis]-1)) * y;
-          mol->Translate(&x);
-        }
-        cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= Repeater[axis];
       }
     }
+    delete(M);
     delete dialog;
     return Action::success;
Index: src/Descriptors/MoleculePtrDescriptor.cpp
===================================================================
--- src/Descriptors/MoleculePtrDescriptor.cpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
+++ src/Descriptors/MoleculePtrDescriptor.cpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
@@ -0,0 +1,40 @@
+/*
+ * MoleculePtrDescriptor.cpp
+ *
+ *  Created on: Feb 5, 2010
+ *      Author: crueger
+ */
+
+#include "MoleculePtrDescriptor.hpp"
+#include "MoleculePtrDescriptor_impl.hpp"
+
+#include "molecule.hpp"
+
+using namespace std;
+
+
+MoleculePtrDescriptor_impl::MoleculePtrDescriptor_impl(molecule * _ptr) :
+  ptr(_ptr)
+{}
+
+MoleculePtrDescriptor_impl::~MoleculePtrDescriptor_impl()
+{}
+
+bool MoleculePtrDescriptor_impl::predicate(std::pair<moleculeId_t,molecule*> molecule) {
+  return molecule.second==ptr;
+}
+
+MoleculeDescriptor MoleculeByPtr(molecule * ptr){
+  return MoleculeDescriptor(MoleculeDescriptor::impl_ptr(new MoleculePtrDescriptor_impl(ptr)));
+}
+
+molecule *MoleculePtrDescriptor_impl::find(){
+  World::MoleculeSet molecules = getMolecules();
+  World::MoleculeSet::iterator res = molecules.find(ptr->getId());
+  return (res!=molecules.end())?((*res).second):0;
+}
+
+vector<molecule*> MoleculePtrDescriptor_impl::findAll(){
+  molecule *res = find();
+  return (res)?(vector<molecule*>(1,res)):(vector<molecule*>());
+}
Index: src/Descriptors/MoleculePtrDescriptor.hpp
===================================================================
--- src/Descriptors/MoleculePtrDescriptor.hpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
+++ src/Descriptors/MoleculePtrDescriptor.hpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
@@ -0,0 +1,16 @@
+/*
+ * MoleculeIdDescriptor.hpp
+ *
+ *  Created on: Feb 5, 2010
+ *      Author: crueger
+ */
+
+#ifndef MOLECULEPTRDESCRIPTOR_HPP_
+#define MOLECULEPTRDESCRIPTOR_HPP_
+
+#include "defs.hpp"
+#include "Descriptors/MoleculeDescriptor.hpp"
+
+MoleculeDescriptor MoleculeByPtr(molecule * ptr);
+
+#endif /* MOLECULEPTRDESCRIPTOR_HPP_ */
Index: src/Descriptors/MoleculePtrDescriptor_impl.hpp
===================================================================
--- src/Descriptors/MoleculePtrDescriptor_impl.hpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
+++ src/Descriptors/MoleculePtrDescriptor_impl.hpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
@@ -0,0 +1,23 @@
+#ifndef MOLECULEPTRDESCRIPTOR_IMPL_HPP
+#define MOLECULEPTRDESCRIPTOR_IMPL_HPP
+
+#include "Descriptors/MoleculeDescriptor_impl.hpp"
+
+class molecule;
+
+class MoleculePtrDescriptor_impl : public MoleculeDescriptor_impl
+{
+public:
+  MoleculePtrDescriptor_impl(molecule * ptr);
+  virtual ~MoleculePtrDescriptor_impl();
+
+  bool predicate(std::pair<moleculeId_t,molecule*> molecule);
+
+protected:
+  virtual molecule *find();
+  virtual std::vector<molecule*> findAll();
+private:
+  molecule * ptr;
+};
+
+#endif //MOLECULEPTRDESCRIPTOR_IMPL_HPP
Index: src/Makefile.am
===================================================================
--- src/Makefile.am	(revision 584a2a322e04645b47cee8b1353d66e700542023)
+++ src/Makefile.am	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
@@ -113,5 +113,6 @@
   Descriptors/AtomTypeDescriptor.cpp \
   Descriptors/MoleculeDescriptor.cpp \
-  Descriptors/MoleculeIdDescriptor.cpp 
+  Descriptors/MoleculeIdDescriptor.cpp \ 
+  Descriptors/MoleculePtrDescriptor.cpp 
 				   
 
@@ -120,5 +121,6 @@
   Descriptors/AtomTypeDescriptor.hpp \
   Descriptors/MoleculeDescriptor.hpp \
-  Descriptors/MoleculeIdDescriptor.hpp
+  Descriptors/MoleculeIdDescriptor.hpp \
+  Descriptors/MoleculePtrDescriptor.hpp
 				   
 EXCEPTIONSOURCE = Exceptions/CustomException.cpp \
Index: src/UIElements/CommandLineUI/CommandLineDialog.cpp
===================================================================
--- src/UIElements/CommandLineUI/CommandLineDialog.cpp	(revision 584a2a322e04645b47cee8b1353d66e700542023)
+++ src/UIElements/CommandLineUI/CommandLineDialog.cpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
@@ -192,5 +192,9 @@
   if (CommandLineParser::getInstance().vm.count(getTitle())) {
     IdxOfMol = CommandLineParser::getInstance().vm[getTitle()].as<int>();
-    tmp = World::getInstance().getMolecule(MoleculeById(IdxOfMol));
+    cout << "IdxOfMol " << IdxOfMol << endl;
+    if (IdxOfMol >= 0)
+      tmp = World::getInstance().getMolecule(MoleculeById(IdxOfMol));
+    else
+      tmp = NULL;
     return true;
   } else
Index: src/builder.cpp
===================================================================
--- src/builder.cpp	(revision 584a2a322e04645b47cee8b1353d66e700542023)
+++ src/builder.cpp	(revision 3610bbd6dd22cef268eb768a7a49227356ab66d0)
@@ -2354,50 +2354,9 @@
                 performCriticalExit();
               } else {
-                SaveFlag = true;
-                double * const cell_size = World::getInstance().getDomain();
-                for (int axis = 1; axis <= NDIM; axis++) {
-                  int faktor = atoi(argv[argptr++]);
-                  int count;
-                  const element ** Elements;
-                  Vector ** vectors;
-                  if (faktor < 1) {
-                    DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor mus be greater than 1!" << endl);
-                    faktor = 1;
-                  }
-                  if (mol->getAtomCount() != 0) {  // if there is more than none
-                    count = mol->getAtomCount();   // is changed becausing of adding, thus has to be stored away beforehand
-                    Elements = new const element *[count];
-                    vectors = new Vector *[count];
-                    j = 0;
-                    for(molecule::iterator iter = mol->begin();iter!=mol->end();++iter){
-                      Elements[j] = (*iter)->type;
-                      vectors[j] = &(*iter)->x;
-                      j++;
-                    }
-                    if (count != j)
-                      DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
-                    x.Zero();
-                    y.Zero();
-                    y[abs(axis)-1] = cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] * abs(axis)/axis; // last term is for sign, first is for magnitude
-                    for (int i=1;i<faktor;i++) {  // then add this list with respective translation factor times
-                      x += y; // per factor one cell width further
-                      for (int k=count;k--;) { // go through every atom of the original cell
-                        first = World::getInstance().createAtom(); // create a new body
-                        first->x = (*vectors[k]) + x;
-                        first->type = Elements[k];  // insert original element
-                        mol->AddAtom(first);        // and add to the molecule (which increments ElementsInMolecule, AtomCount, ...)
-                      }
-                    }
-                    // free memory
-                    delete[](Elements);
-                    delete[](vectors);
-                    // correct cell size
-                    if (axis < 0) { // if sign was negative, we have to translate everything
-                      x =(-(faktor-1)) * y;
-                      mol->Translate(&x);
-                    }
-                    cell_size[(abs(axis) == 2) ? 2 : ((abs(axis) == 3) ? 5 : 0)] *= faktor;
-                  }
-                }
+                ArgcList.insert(argptr-1);
+                ArgcList.insert(argptr);
+                ArgcList.insert(argptr+1);
+                ArgcList.insert(argptr+2);
+                argptr+=3;
               }
               break;
