Changes in / [b1ac7a:9c27b0]


Ignore:
Files:
9 added
22 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/MoleculeAction/CopyAction.cpp

    rb1ac7a r9c27b0  
    5959  MoleculeCopyState *state = assert_cast<MoleculeCopyState*>(_state.get());
    6060
    61   for (molecule::iterator AtomRunner = state->copy->begin();
    62       !state->copy->empty();
    63       AtomRunner = state->copy->begin()) {
    64     (*AtomRunner)->removeAllBonds();
    65 //    BondList& ListOfBonds = (*AtomRunner)->getListOfBonds();
    66 //    for(BondList::iterator BondRunner = ListOfBonds.begin();
    67 //        !ListOfBonds.empty();
    68 //        BondRunner = ListOfBonds.begin()) {
    69 //      delete(*BondRunner);
    70 //    }
    71     atom *Walker = *AtomRunner;
    72     World::getInstance().destroyAtom(Walker);
    73   }
     61  state->copy->removeAtomsinMolecule();
    7462  World::getInstance().destroyMolecule(state->copy);
    7563
  • src/Actions/WorldAction/AddEmptyBoundaryAction.cpp

    rb1ac7a r9c27b0  
    1818#endif
    1919
     20// include headers that implement a archive in simple text format
     21#include <boost/archive/text_oarchive.hpp>
     22#include <boost/archive/text_iarchive.hpp>
     23#include "boost/serialization/vector.hpp"
     24
    2025#include "CodePatterns/MemDebug.hpp"
    2126
    2227#include "atom.hpp"
     28#include "Box.hpp"
    2329#include "CodePatterns/Log.hpp"
     30#include "LinearAlgebra/MatrixContent.hpp"
    2431#include "LinearAlgebra/RealSpaceMatrix.hpp"
    2532#include "LinearAlgebra/Vector.hpp"
     
    4653  getParametersfromValueStorage();
    4754
     55  // create undo domain
     56  std::stringstream undostream;
     57  boost::archive::text_oarchive oa(undostream);
     58  const RealSpaceMatrix &matrix = World::getInstance().getDomain().getM();
     59  oa << matrix;
     60
    4861  // get maximum and minimum
    49   vector<atom *> AllAtoms = World::getInstance().getAllAtoms();
     62  std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms();
    5063  ASSERT(AllAtoms.size() > 0, "There must be atoms present for AddingEmptyBoundary.");
    51   vector<atom *>::iterator AtomRunner = AllAtoms.begin();
     64  std::vector<atom *>::iterator AtomRunner = AllAtoms.begin();
    5265  Min = (*AtomRunner)->getPosition();
    5366  Max = (*AtomRunner)->getPosition();
     
    7386  // translate all atoms, such that Min is aty (0,0,0)
    7487  AtomRunner = AllAtoms.begin();
    75   for (; AtomRunner != AllAtoms.end(); ++AtomRunner)
     88  for (std::vector<atom *>::iterator AtomRunner = AllAtoms.begin();
     89      AtomRunner != AllAtoms.end();
     90      ++AtomRunner)
    7691    *(*AtomRunner) -= Min - params.boundary;
    7792
     
    7994  LOG(0, "Box domain is now " << World::getInstance().getDomain().getM());
    8095
    81   return Action::success;
     96  // create undo state
     97  WorldAddEmptyBoundaryState *UndoState =
     98      new WorldAddEmptyBoundaryState(
     99          undostream.str(),
     100          World::getInstance().getDomain().getM(),
     101          Min,
     102          params
     103          );
     104
     105  return Action::state_ptr(UndoState);
    82106}
    83107
    84108Action::state_ptr WorldAddEmptyBoundaryAction::performUndo(Action::state_ptr _state) {
    85 //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
     109  WorldAddEmptyBoundaryState *state = assert_cast<WorldAddEmptyBoundaryState*>(_state.get());
    86110
    87   return Action::failure;
    88 //  string newName = state->mol->getName();
    89 //  state->mol->setName(state->lastName);
    90 //
    91 //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
     111  // restore domain
     112  RealSpaceMatrix matrix;
     113  std::stringstream undostream(state->undostring);
     114  boost::archive::text_iarchive ia(undostream);
     115  ia >> matrix;
     116  World::getInstance().setDomain(matrix);
     117
     118  // give final box size
     119  LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM());
     120
     121  // restore atoms
     122  std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms();
     123  for (std::vector<atom *>::iterator AtomRunner = AllAtoms.begin();
     124      AtomRunner != AllAtoms.end();
     125      ++AtomRunner)
     126    *(*AtomRunner) += state->Min - state->params.boundary;
     127
     128  return Action::state_ptr(_state);
    92129}
    93130
    94131Action::state_ptr WorldAddEmptyBoundaryAction::performRedo(Action::state_ptr _state){
    95   return Action::failure;
     132  WorldAddEmptyBoundaryState *state = assert_cast<WorldAddEmptyBoundaryState*>(_state.get());
     133
     134  World::getInstance().setDomain(state->newdomain);
     135
     136  // give final box size
     137  LOG(0, "Box domain is again " << World::getInstance().getDomain().getM());
     138
     139  // shift atoms
     140  std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms();
     141  for (std::vector<atom *>::iterator AtomRunner = AllAtoms.begin();
     142      AtomRunner != AllAtoms.end();
     143      ++AtomRunner)
     144    *(*AtomRunner) -= state->Min - state->params.boundary;
     145
     146  return Action::state_ptr(_state);
    96147}
    97148
    98149bool WorldAddEmptyBoundaryAction::canUndo() {
    99   return false;
     150  return true;
    100151}
    101152
    102153bool WorldAddEmptyBoundaryAction::shouldUndo() {
    103   return false;
     154  return true;
    104155}
    105156/** =========== end of function ====================== */
  • src/Actions/WorldAction/AddEmptyBoundaryAction.def

    rb1ac7a r9c27b0  
    88// all includes and forward declarations necessary for non-integral types below
    99#include "Actions/Values.hpp"
     10#include "LinearAlgebra/RealSpaceMatrix.hpp"
    1011#include "LinearAlgebra/Vector.hpp"
    1112
     
    1920#define paramreferences (boundary)
    2021
    21 #undef statetypes
    22 #undef statereferences
     22#define statetypes (std::string)(RealSpaceMatrix)(Vector)
     23#define statereferences (undostring)(newdomain)(Min)
    2324
    2425// some defines for all the names, you may use ACTION, STATE and PARAMS
  • src/Actions/WorldAction/BoundInBoxAction.cpp

    rb1ac7a r9c27b0  
    2020#include "CodePatterns/MemDebug.hpp"
    2121
     22#include <boost/shared_ptr.hpp>
     23
    2224#include "CodePatterns/Log.hpp"
    2325#include "molecule.hpp"
     
    4042  getParametersfromValueStorage();
    4143
     44  // create undo state
     45  std::vector< boost::shared_ptr<Vector> > OldPositions;
     46  std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();
     47  for (vector<molecule*>::iterator MolRunner = AllMolecules.begin();
     48      MolRunner != AllMolecules.end();
     49      ++MolRunner) {
     50    for(molecule::const_iterator AtomRunner = (*MolRunner)->begin();
     51        AtomRunner != (*MolRunner)->end();
     52        ++AtomRunner) {
     53      OldPositions.push_back(
     54          boost::shared_ptr<Vector>(new Vector(
     55              (*AtomRunner)->getPosition()
     56              ))
     57          );
     58    }
     59  }
     60  WorldBoundInBoxState *undoState = new WorldBoundInBoxState(OldPositions, params);
     61
    4262  // center
    43   vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();
    44   for (vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
     63  for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
    4564    (*MolRunner)->BoundInBox();
    4665  }
    47   return Action::success;
     66  return Action::state_ptr(undoState);
    4867}
    4968
    5069Action::state_ptr WorldBoundInBoxAction::performUndo(Action::state_ptr _state) {
    51 //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
     70  WorldBoundInBoxState *state = assert_cast<WorldBoundInBoxState*>(_state.get());
    5271
    53   return Action::failure;
    54 //  string newName = state->mol->getName();
    55 //  state->mol->setName(state->lastName);
    56 //
    57 //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
     72  // place atoms on old positions
     73  std::vector< boost::shared_ptr<Vector> >::const_iterator OldPositionsIter = state->OldPositions.begin();
     74  std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();
     75  for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin();
     76      MolRunner != AllMolecules.end();
     77      ++MolRunner) {
     78    for(molecule::const_iterator AtomRunner = (*MolRunner)->begin();
     79        AtomRunner != (*MolRunner)->end();
     80        ++AtomRunner) {
     81      ASSERT(OldPositionsIter != state->OldPositions.end(),
     82          "WorldBoundInBoxAction::performUndo() - too few positions stored in UndoState.");
     83      (*AtomRunner)->setPosition(**(OldPositionsIter++));
     84    }
     85  }
     86
     87  return Action::state_ptr(_state);
    5888}
    5989
    6090Action::state_ptr WorldBoundInBoxAction::performRedo(Action::state_ptr _state){
    61   return Action::failure;
     91//  WorldBoundInBoxState *state = assert_cast<WorldBoundInBoxState*>(_state.get());
     92
     93  // center
     94  std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();
     95  for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin();
     96      MolRunner != AllMolecules.end();
     97      ++MolRunner) {
     98    (*MolRunner)->BoundInBox();
     99  }
     100
     101  return Action::state_ptr(_state);
    62102}
    63103
    64104bool WorldBoundInBoxAction::canUndo() {
    65   return false;
     105  return true;
    66106}
    67107
    68108bool WorldBoundInBoxAction::shouldUndo() {
    69   return false;
     109  return true;
    70110}
    71111/** =========== end of function ====================== */
  • src/Actions/WorldAction/BoundInBoxAction.def

    rb1ac7a r9c27b0  
    77
    88// all includes and forward declarations necessary for non-integral types below
     9#include <boost/shared_ptr.hpp>
     10#include "LinearAlgebra/Vector.hpp"
    911
    1012
     
    1820#undef paramreferences
    1921
    20 #undef statetypes
    21 #undef statereferences
     22#define statetypes (std::vector< boost::shared_ptr<Vector> >)
     23#define statereferences (OldPositions)
    2224
    2325// some defines for all the names, you may use ACTION, STATE and PARAMS
  • src/Actions/WorldAction/CenterInBoxAction.cpp

    rb1ac7a r9c27b0  
    1818#endif
    1919
     20// include headers that implement a archive in simple text format
     21#include <boost/archive/text_oarchive.hpp>
     22#include <boost/archive/text_iarchive.hpp>
     23#include "boost/serialization/vector.hpp"
     24
    2025#include "CodePatterns/MemDebug.hpp"
     26
     27#include <boost/shared_ptr.hpp>
    2128
    2229#include "Box.hpp"
    2330#include "CodePatterns/Log.hpp"
     31#include "LinearAlgebra/MatrixContent.hpp"
    2432#include "LinearAlgebra/RealSpaceMatrix.hpp"
    2533#include "molecule.hpp"
     
    2836#include <iostream>
    2937#include <string>
     38#include <vector>
    3039
    3140#include "Actions/WorldAction/CenterInBoxAction.hpp"
     
    4150  getParametersfromValueStorage();
    4251
     52  // create undo state
     53  std::stringstream undostream;
     54  boost::archive::text_oarchive oa(undostream);
     55  RealSpaceMatrix matrix(World::getInstance().getDomain().getM());
     56  oa << matrix;
     57  std::vector< boost::shared_ptr<Vector> > OldPositions;
     58  std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();
     59  for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin();
     60      MolRunner != AllMolecules.end();
     61      ++MolRunner) {
     62    for(molecule::const_iterator AtomRunner = (*MolRunner)->begin();
     63        AtomRunner != (*MolRunner)->end();
     64        ++AtomRunner) {
     65      OldPositions.push_back(
     66          boost::shared_ptr<Vector>(new Vector(
     67              (*AtomRunner)->getPosition()
     68              ))
     69          );
     70    }
     71  }
     72
     73  // set new domain
    4374  World::getInstance().setDomain(params.cell_size.getM());
    4475
    45   // center
    46   vector<molecule *> AllMolecules = World::getInstance().getAllMolecules();
    47   for (vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
     76  // center atoms
     77  for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
    4878    (*MolRunner)->CenterInBox();
    4979  }
     
    5282  LOG(0, "Box domain is now " << World::getInstance().getDomain().getM());
    5383
    54   return Action::success;
     84  // create undo state
     85  WorldCenterInBoxState *UndoState =
     86      new WorldCenterInBoxState(
     87          undostream.str(),
     88          OldPositions,
     89          params
     90          );
     91
     92  return Action::state_ptr(UndoState);
    5593}
    5694
    5795Action::state_ptr WorldCenterInBoxAction::performUndo(Action::state_ptr _state) {
    58 //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
     96  WorldCenterInBoxState *state = assert_cast<WorldCenterInBoxState*>(_state.get());
    5997
    60   return Action::failure;
    61 //  string newName = state->mol->getName();
    62 //  state->mol->setName(state->lastName);
    63 //
    64 //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
     98  // restore domain
     99  RealSpaceMatrix matrix;
     100  std::stringstream undostream(state->undostring);
     101  boost::archive::text_iarchive ia(undostream);
     102  ia >> matrix;
     103  World::getInstance().setDomain(matrix);
     104
     105  // place atoms on old positions
     106  std::vector< boost::shared_ptr<Vector> >::const_iterator OldPositionsIter = state->OldPositions.begin();
     107  std::vector<molecule*> AllMolecules = World::getInstance().getAllMolecules();
     108  for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin();
     109      MolRunner != AllMolecules.end();
     110      ++MolRunner) {
     111    for(molecule::const_iterator AtomRunner = (*MolRunner)->begin();
     112        AtomRunner != (*MolRunner)->end();
     113        ++AtomRunner) {
     114      ASSERT(OldPositionsIter != state->OldPositions.end(),
     115          "WorldBoundInBoxAction::performUndo() - too few positions stored in UndoState.");
     116      (*AtomRunner)->setPosition(**(OldPositionsIter++));
     117    }
     118  }
     119
     120  // give final box size
     121  LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM());
     122
     123  return Action::state_ptr(_state);
    65124}
    66125
    67126Action::state_ptr WorldCenterInBoxAction::performRedo(Action::state_ptr _state){
    68   return Action::failure;
     127  WorldCenterInBoxState *state = assert_cast<WorldCenterInBoxState*>(_state.get());
     128
     129  // set new domain
     130  World::getInstance().setDomain(state->params.cell_size.getM());
     131
     132  // center atoms
     133  std::vector<molecule *> AllMolecules = World::getInstance().getAllMolecules();
     134  for (std::vector<molecule*>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
     135    (*MolRunner)->CenterInBox();
     136  }
     137
     138  // give final box size
     139  LOG(0, "Box domain is again " << World::getInstance().getDomain().getM());
     140
     141  return Action::state_ptr(_state);
    69142}
    70143
    71144bool WorldCenterInBoxAction::canUndo() {
    72   return false;
     145  return true;
    73146}
    74147
    75148bool WorldCenterInBoxAction::shouldUndo() {
    76   return false;
     149  return true;
    77150}
    78151/** =========== end of function ====================== */
  • src/Actions/WorldAction/CenterInBoxAction.def

    rb1ac7a r9c27b0  
    99#include "Actions/Values.hpp"
    1010#include "Box.hpp"
     11#include "LinearAlgebra/Vector.hpp"
     12#include <boost/shared_ptr.hpp>
    1113
    1214// i.e. there is an integer with variable name Z that can be found in
     
    1921#define paramreferences (cell_size)
    2022
    21 #undef statetypes
    22 #undef statereferences
     23#define statetypes (std::string)(std::vector< boost::shared_ptr<Vector> >)
     24#define statereferences (undostring)(OldPositions)
    2325
    2426// some defines for all the names, you may use ACTION, STATE and PARAMS
  • src/Actions/WorldAction/CenterOnEdgeAction.cpp

    rb1ac7a r9c27b0  
    1818#endif
    1919
     20// include headers that implement a archive in simple text format
     21#include <boost/archive/text_oarchive.hpp>
     22#include <boost/archive/text_iarchive.hpp>
     23#include "boost/serialization/vector.hpp"
     24
    2025#include "CodePatterns/MemDebug.hpp"
    2126
    2227#include "atom.hpp"
    2328#include "CodePatterns/Log.hpp"
     29#include "LinearAlgebra/MatrixContent.hpp"
     30#include "LinearAlgebra/RealSpaceMatrix.hpp"
    2431#include "LinearAlgebra/Vector.hpp"
     32#include "molecule.hpp"
    2533#include "World.hpp"
    26 #include "LinearAlgebra/RealSpaceMatrix.hpp"
    2734
    2835#include <iostream>
    2936#include <string>
     37#include <vector>
    3038
    3139#include "Actions/WorldAction/CenterOnEdgeAction.hpp"
     
    4452  getParametersfromValueStorage();
    4553
     54  // create undo state
     55  std::stringstream undostream;
     56  boost::archive::text_oarchive oa(undostream);
     57  const RealSpaceMatrix &matrix = World::getInstance().getDomain().getM();
     58  oa << matrix;
     59  std::vector< boost::shared_ptr<Vector> > OldPositions;
     60  std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms();
     61  for (std::vector<atom *>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner)
     62    OldPositions.push_back(
     63        boost::shared_ptr<Vector>(new Vector(
     64            (*AtomRunner)->getPosition()
     65            ))
     66        );
     67
    4668  // get maximum and minimum
    47   vector<atom *> AllAtoms = World::getInstance().getAllAtoms();
    4869  ASSERT(AllAtoms.size() > 0, "For CenteronEdge atoms must be present.");
    49   vector<atom *>::iterator AtomRunner = AllAtoms.begin();
     70  std::vector<atom *>::iterator AtomRunner = AllAtoms.begin();
    5071  Min = (*AtomRunner)->getPosition();
    5172  Max = (*AtomRunner)->getPosition();
     
    6788  World::getInstance().setDomain(domain);
    6889  // translate all atoms, such that Min is aty (0,0,0)
    69   for (vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner)
     90  for (std::vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner)
    7091    *(*AtomRunner) -= Min;
    7192
     
    7394  LOG(0, "Box domain is now " << World::getInstance().getDomain().getM());
    7495
    75   return Action::success;
     96  // create undo state
     97  WorldCenterOnEdgeState *UndoState =
     98      new WorldCenterOnEdgeState(
     99          undostream.str(),
     100          Min,
     101          Max,
     102          params
     103          );
     104
     105  return Action::state_ptr(UndoState);
    76106}
    77107
    78108Action::state_ptr WorldCenterOnEdgeAction::performUndo(Action::state_ptr _state) {
    79 //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
     109  WorldCenterOnEdgeState *state = assert_cast<WorldCenterOnEdgeState*>(_state.get());
    80110
    81   return Action::failure;
    82 //  string newName = state->mol->getName();
    83 //  state->mol->setName(state->lastName);
    84 //
    85 //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
     111  // restore domain
     112  RealSpaceMatrix matrix;
     113  std::stringstream undostream(state->undostring);
     114  boost::archive::text_iarchive ia(undostream);
     115  ia >> matrix;
     116  World::getInstance().setDomain(matrix);
     117
     118  // translate all atoms back
     119  std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms();
     120  for (vector<atom*>::iterator AtomRunner = AllAtoms.begin();
     121      AtomRunner != AllAtoms.end();
     122      ++AtomRunner)
     123    *(*AtomRunner) += state->Min;
     124
     125  // give final box size
     126  LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM());
     127
     128  return Action::state_ptr(_state);
    86129}
    87130
    88131Action::state_ptr WorldCenterOnEdgeAction::performRedo(Action::state_ptr _state){
    89   return Action::failure;
     132  WorldCenterOnEdgeState *state = assert_cast<WorldCenterOnEdgeState*>(_state.get());
     133
     134  // set new box size
     135  RealSpaceMatrix rmatrix;
     136  for (int i=0;i<NDIM;i++) {
     137    double tmp = state->Max[i]-state->Min[i];
     138    tmp = fabs(tmp)>=1. ? tmp : 1.0;
     139    rmatrix.at(i,i) = tmp;
     140  }
     141  World::getInstance().setDomain(rmatrix);
     142  // translate all atoms, such that Min is aty (0,0,0)
     143  std::vector<atom *> AllAtoms = World::getInstance().getAllAtoms();
     144  for (vector<atom*>::iterator AtomRunner = AllAtoms.begin();
     145      AtomRunner != AllAtoms.end();
     146      ++AtomRunner)
     147    *(*AtomRunner) -= state->Min;
     148
     149  // give final box size
     150  LOG(0, "Box domain is again " << World::getInstance().getDomain().getM());
     151
     152  return Action::state_ptr(_state);
    90153}
    91154
    92155bool WorldCenterOnEdgeAction::canUndo() {
    93   return false;
     156  return true;
    94157}
    95158
    96159bool WorldCenterOnEdgeAction::shouldUndo() {
    97   return false;
     160  return true;
    98161}
    99162/** =========== end of function ====================== */
  • src/Actions/WorldAction/CenterOnEdgeAction.def

    rb1ac7a r9c27b0  
    77
    88// all includes and forward declarations necessary for non-integral types below
    9 
     9#include "LinearAlgebra/Vector.hpp"
    1010
    1111// i.e. there is an integer with variable name Z that can be found in
     
    1818#undef paramreferences
    1919
    20 #undef statetypes
    21 #undef statereferences
     20#define statetypes (std::string)(Vector)(Vector)
     21#define statereferences (undostring)(Min)(Max)
    2222
    2323// some defines for all the names, you may use ACTION, STATE and PARAMS
  • src/Actions/WorldAction/ChangeBoxAction.cpp

    rb1ac7a r9c27b0  
    1818#endif
    1919
     20// include headers that implement a archive in simple text format
     21#include <boost/archive/text_oarchive.hpp>
     22#include <boost/archive/text_iarchive.hpp>
     23#include "boost/serialization/vector.hpp"
     24
    2025#include "CodePatterns/MemDebug.hpp"
    2126
    2227#include "CodePatterns/Log.hpp"
    2328#include "CodePatterns/Verbose.hpp"
     29#include "LinearAlgebra/MatrixContent.hpp"
     30#include "LinearAlgebra/RealSpaceMatrix.hpp"
    2431#include "World.hpp"
    2532#include "Box.hpp"
    26 #include "LinearAlgebra/RealSpaceMatrix.hpp"
    2733
    2834#include <iostream>
     
    4147  getParametersfromValueStorage();
    4248
     49  // create undo state
     50  std::stringstream undostream;
     51  boost::archive::text_oarchive oa(undostream);
     52  const RealSpaceMatrix &matrix = World::getInstance().getDomain().getM();
     53  oa << matrix;
     54
    4355  World::getInstance().setDomain(params.cell_size.getM()); // this is needed as only this function is OBSERVEd.
    4456
     
    4658  LOG(0, "Box domain is now " << World::getInstance().getDomain().getM());
    4759
    48   return Action::success;
     60  // create undo state
     61  WorldChangeBoxState *UndoState =
     62      new WorldChangeBoxState(
     63          undostream.str(),
     64          params
     65          );
     66
     67  return Action::state_ptr(UndoState);
    4968}
    5069
    5170Action::state_ptr WorldChangeBoxAction::performUndo(Action::state_ptr _state) {
    52 //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
     71  WorldChangeBoxState *state = assert_cast<WorldChangeBoxState*>(_state.get());
    5372
    54   return Action::failure;
    55 //  string newName = state->mol->getName();
    56 //  state->mol->setName(state->lastName);
    57 //
    58 //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
     73  // restore domain
     74  RealSpaceMatrix matrix;
     75  std::stringstream undostream(state->undostring);
     76  boost::archive::text_iarchive ia(undostream);
     77  ia >> matrix;
     78  World::getInstance().setDomain(matrix);
     79
     80  // give final box size
     81  LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM());
     82
     83  return Action::state_ptr(_state);
    5984}
    6085
    6186Action::state_ptr WorldChangeBoxAction::performRedo(Action::state_ptr _state){
    62   return Action::failure;
     87  World::getInstance().setDomain(params.cell_size.getM()); // this is needed as only this function is OBSERVEd.
     88
     89  // give final box size
     90  LOG(0, "Box domain is again " << World::getInstance().getDomain().getM());
     91
     92  return Action::state_ptr(_state);
    6393}
    6494
    6595bool WorldChangeBoxAction::canUndo() {
    66   return false;
     96  return true;
    6797}
    6898
    6999bool WorldChangeBoxAction::shouldUndo() {
    70   return false;
     100  return true;
    71101}
    72102/** =========== end of function ====================== */
  • src/Actions/WorldAction/ChangeBoxAction.def

    rb1ac7a r9c27b0  
    1919#define paramreferences (cell_size)
    2020
    21 #undef statetypes
    22 #undef statereferences
     21#define statetypes (std::string)
     22#define statereferences (undostring)
    2323
    2424// some defines for all the names, you may use ACTION, STATE and PARAMS
  • src/Actions/WorldAction/RepeatBoxAction.cpp

    rb1ac7a r9c27b0  
    3131
    3232#include <iostream>
     33#include <set>
    3334#include <string>
    3435#include <vector>
     
    4243#include "Action_impl_pre.hpp"
    4344/** =========== define the function ====================== */
    44 Action::state_ptr WorldRepeatBoxAction::performCall() {
     45
     46void repeatMoleculesinDomain(Vector Repeater, const std::vector<molecule *> &AllMolecules)
     47{
    4548  int count;
    4649  const element ** Elements;
    47   molecule *mol = NULL;
    4850  int j = 0;
    4951  atom *Walker = NULL;
    5052  MoleculeListClass *molecules = World::getInstance().getMolecules();
    5153
    52   // obtain information
    53   getParametersfromValueStorage();
    54 
    55   vector<molecule *> AllMolecules;
    56   if (mol != NULL) {
    57     DoLog(0) && (Log() << Verbose(0) << "Using molecule " << mol->name << "." << endl);
    58     AllMolecules = World::getInstance().getAllMolecules(MoleculeByPtr(mol));
    59   } else {
    60     DoLog(0) && (Log() << Verbose(0) << "Using all molecules." << endl);
    61     AllMolecules = World::getInstance().getAllMolecules();
    62   }
    63 
    64   (cout << "Repeating box " << params.Repeater << " times for (x,y,z) axis." << endl);
     54  LOG(0, "STATUS: Repeating box " << Repeater << " times for (x,y,z) axis.");
     55
     56  // set new domain
    6557  RealSpaceMatrix M = World::getInstance().getDomain().getM();
    6658  RealSpaceMatrix newM = M;
     
    6961  RealSpaceMatrix repMat;
    7062  for (int axis = 0; axis < NDIM; axis++) {
    71     params.Repeater[axis] = floor(params.Repeater[axis]);
    72     if (params.Repeater[axis] < 1) {
    73       DoeLog(1) && (eLog()<< Verbose(1) << "Repetition factor must be greater than 1!" << endl);
    74       params.Repeater[axis] = 1;
     63    Repeater[axis] = floor(Repeater[axis]);
     64    if (Repeater[axis] < 1) {
     65      ELOG(1, "Repetition factor must be greater than 1!");
     66      Repeater[axis] = 1;
    7567    }
    76     repMat.at(axis,axis) = params.Repeater[axis];
     68    repMat.at(axis,axis) = Repeater[axis];
    7769  }
    7870  newM *= repMat;
    7971  World::getInstance().setDomain(newM);
    8072
     73  // add molecules in each repeated domain part
    8174  molecule *newmol = NULL;
    8275  std::vector<Vector> vectors;
    83   for (n[0] = 0; n[0] < params.Repeater[0]; n[0]++) {
     76  for (n[0] = 0; n[0] < Repeater[0]; n[0]++) {
    8477    y[0] = n[0];
    85     for (n[1] = 0; n[1] < params.Repeater[1]; n[1]++) {
     78    for (n[1] = 0; n[1] < Repeater[1]; n[1]++) {
    8679      y[1] = n[1];
    87       for (n[2] = 0; n[2] < params.Repeater[2]; n[2]++) {
     80      for (n[2] = 0; n[2] < Repeater[2]; n[2]++) {
    8881        y[2] = n[2];
    8982        if ((n[0] == 0) && (n[1] == 0) && (n[2] == 0))
    9083          continue;
    91         for (vector<molecule *>::iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
    92           mol = *MolRunner;
    93           DoLog(1) && (Log() << Verbose(1) << "Current mol is " << mol->name << "." << endl);
     84        for (vector<molecule *>::const_iterator MolRunner = AllMolecules.begin(); MolRunner != AllMolecules.end(); ++MolRunner) {
     85          const molecule *mol = *MolRunner;
     86          LOG(2, "INFO: Current mol is " << mol->name << ".");
    9487          count = mol->getAtomCount();   // is changed becausing of adding, thus has to be stored away beforehand
    9588          if (count != 0) {  // if there is more than none
     
    9790            vectors.resize(count);
    9891            j = 0;
    99             for(molecule::iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {
     92            for(molecule::const_iterator AtomRunner = mol->begin(); AtomRunner != mol->end(); ++AtomRunner) {
    10093              Elements[j] = (*AtomRunner)->getType();
    10194              vectors[j] = (*AtomRunner)->getPosition();
     
    10396            }
    10497            if (count != j)
    105               DoeLog(1) && (eLog()<< Verbose(1) << "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!" << endl);
     98              ELOG(1, "AtomCount " << count << " is not equal to number of atoms in molecule " << j << "!");
    10699            x = y;
    107100            x *= M;
    108101            newmol = World::getInstance().createMolecule();
     102            // TODO: Remove this when World don't has deprecated MoleculeListClass anymore
    109103            molecules->insert(newmol);
    110104            for (int k=count;k--;) { // go through every atom of the original cell
     
    118112            delete[](Elements);
    119113          } else {
    120             DoLog(1) && (Log() << Verbose(1) << "\t ... is empty." << endl);
     114            LOG(1, "\t ... is empty.");
    121115          }
    122116        }
     
    124118    }
    125119  }
     120}
     121
     122Action::state_ptr WorldRepeatBoxAction::performCall() {
     123  molecule *mol = NULL;
     124
     125  // obtain information
     126  getParametersfromValueStorage();
     127
     128  std::vector<molecule *> AllMolecules;
     129  if (mol != NULL) {
     130    DoLog(0) && (Log() << Verbose(0) << "Using molecule " << mol->name << "." << endl);
     131    AllMolecules = World::getInstance().getAllMolecules(MoleculeByPtr(mol));
     132  } else {
     133    DoLog(0) && (Log() << Verbose(0) << "Using all molecules." << endl);
     134    AllMolecules = World::getInstance().getAllMolecules();
     135  }
     136
     137  // prepare undo state
     138  RealSpaceMatrix olddomain = World::getInstance().getDomain().getM();
     139  std::set<molecule *> oldmolecules;
     140  for(std::vector<molecule *>::const_iterator iter = AllMolecules.begin();
     141      iter != AllMolecules.end();
     142      ++iter)
     143    oldmolecules.insert(*iter);
     144  WorldRepeatBoxState *undostate = new WorldRepeatBoxState(olddomain, oldmolecules, params);
     145
     146  repeatMoleculesinDomain(params.Repeater, AllMolecules);
    126147
    127148  // give final box size
    128149  LOG(0, "Box domain is now " << World::getInstance().getDomain().getM());
    129150
    130   return Action::success;
     151  return Action::state_ptr(undostate);
    131152}
    132153
    133154Action::state_ptr WorldRepeatBoxAction::performUndo(Action::state_ptr _state) {
    134 //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
    135 
    136   return Action::failure;
    137 //  string newName = state->mol->getName();
    138 //  state->mol->setName(state->lastName);
    139 //
    140 //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
     155  WorldRepeatBoxState *state = assert_cast<WorldRepeatBoxState*>(_state.get());
     156  MoleculeListClass *molecules = World::getInstance().getMolecules();
     157
     158  // set old domain
     159  World::getInstance().setDomain(state->olddomain);
     160
     161  // remove all added molecules (and their atoms)
     162  std::vector<molecule *> allmolecules = World::getInstance().getAllMolecules();
     163  for (std::vector<molecule *>::iterator iter = allmolecules.begin();
     164      iter != allmolecules.end();
     165      ++iter) {
     166    if (state->oldmolecules.find(*iter) == state->oldmolecules.end()) {
     167      (*iter)->removeAtomsinMolecule();
     168      // TODO: Remove this when World don't has deprecated MoleculeListClass anymore
     169      molecules->erase(*iter);
     170      World::getInstance().destroyMolecule(*iter);
     171    }
     172  }
     173
     174  // give final box size
     175  LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM());
     176
     177  return Action::state_ptr(_state);
    141178}
    142179
    143180Action::state_ptr WorldRepeatBoxAction::performRedo(Action::state_ptr _state){
    144   return Action::failure;
     181  WorldRepeatBoxState *state = assert_cast<WorldRepeatBoxState*>(_state.get());
     182
     183  std::vector<molecule *> originalmolecules;
     184  for(std::set<molecule *>::const_iterator iter = state->oldmolecules.begin();
     185      iter != state->oldmolecules.end();
     186      ++iter)
     187    originalmolecules.push_back(*iter);
     188  repeatMoleculesinDomain(state->params.Repeater, originalmolecules);
     189
     190  // give final box size
     191  LOG(0, "Box domain is again " << World::getInstance().getDomain().getM());
     192
     193  return Action::state_ptr(_state);
    145194}
    146195
    147196bool WorldRepeatBoxAction::canUndo() {
    148   return false;
     197  return true;
    149198}
    150199
    151200bool WorldRepeatBoxAction::shouldUndo() {
    152   return false;
     201  return true;
    153202}
    154203/** =========== end of function ====================== */
  • src/Actions/WorldAction/RepeatBoxAction.def

    rb1ac7a r9c27b0  
    88// all includes and forward declarations necessary for non-integral types below
    99#include "Actions/Values.hpp"
     10#include "LinearAlgebra/RealSpaceMatrix.hpp"
    1011#include "LinearAlgebra/Vector.hpp"
     12#include <set>
     13
     14class molecule;
    1115
    1216// i.e. there is an integer with variable name Z that can be found in
     
    1923#define paramreferences (Repeater)
    2024
    21 #undef statetypes
    22 #undef statereferences
     25#define statetypes (RealSpaceMatrix)(std::set< molecule *>)
     26#define statereferences (olddomain)(oldmolecules)
    2327
    2428// some defines for all the names, you may use ACTION, STATE and PARAMS
  • src/Actions/WorldAction/ScaleBoxAction.cpp

    rb1ac7a r9c27b0  
    2222#include "atom.hpp"
    2323#include "CodePatterns/Log.hpp"
     24#include "LinearAlgebra/RealSpaceMatrix.hpp"
    2425#include "LinearAlgebra/Vector.hpp"
    25 #include "CodePatterns/Verbose.hpp"
    2626#include "World.hpp"
    2727#include "Box.hpp"
    28 #include "LinearAlgebra/RealSpaceMatrix.hpp"
    2928
    3029#include <iostream>
    3130#include <string>
     31#include <vector>
    3232
    3333#include "Actions/WorldAction/ScaleBoxAction.hpp"
     
    4545  getParametersfromValueStorage();
    4646
    47   DoLog(1) && (Log() << Verbose(1) << "Scaling all atomic positions by factor." << endl);
     47  // scale atoms
    4848  for (int i=0;i<NDIM;i++)
    4949    x[i] = params.Scaler[i];
    50   vector<atom*> AllAtoms = World::getInstance().getAllAtoms();
    51   for(vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
     50  std::vector<atom*> AllAtoms = World::getInstance().getAllAtoms();
     51  for(std::vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
    5252    (*AtomRunner)->ScaleAll(x);
    5353  }
    5454
     55  // scale box
    5556  RealSpaceMatrix M = World::getInstance().getDomain().getM();
    5657  RealSpaceMatrix scale;
    57 
    5858  for (int i=0;i<NDIM;i++) {
    59     scale.at(i,i) = x[i];
     59    scale.at(i,i) = params.Scaler[i];
    6060  }
    6161  M *= scale;
     
    6565  LOG(0, "Box domain is now " << World::getInstance().getDomain().getM());
    6666
    67   return Action::success;
     67  // create undo state
     68  WorldScaleBoxState *UndoState = new WorldScaleBoxState(params);
     69
     70  return Action::state_ptr(UndoState);
    6871}
    6972
    7073Action::state_ptr WorldScaleBoxAction::performUndo(Action::state_ptr _state) {
    71 //  ParserLoadXyzState *state = assert_cast<ParserLoadXyzState*>(_state.get());
     74  WorldScaleBoxState *state = assert_cast<WorldScaleBoxState*>(_state.get());
    7275
    73   return Action::failure;
    74 //  string newName = state->mol->getName();
    75 //  state->mol->setName(state->lastName);
    76 //
    77 //  return Action::state_ptr(new ParserLoadXyzState(state->mol,newName));
     76  // scale back atoms
     77  double x[NDIM];
     78  for (int i=0;i<NDIM;i++)
     79    x[i] = 1./state->params.Scaler[i];
     80  vector<atom*> AllAtoms = World::getInstance().getAllAtoms();
     81  for(vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
     82    (*AtomRunner)->ScaleAll(x);
     83  }
     84
     85  // scale back box
     86  RealSpaceMatrix M = World::getInstance().getDomain().getM();
     87  RealSpaceMatrix scale;
     88  for (int i=0;i<NDIM;i++) {
     89    scale.at(i,i) = 1./state->params.Scaler[i];
     90  }
     91  M *= scale;
     92  World::getInstance().setDomain(M);
     93
     94  // give final box size
     95  LOG(0, "Box domain restored to " << World::getInstance().getDomain().getM());
     96
     97  return Action::state_ptr(_state);
    7898}
    7999
    80100Action::state_ptr WorldScaleBoxAction::performRedo(Action::state_ptr _state){
    81   return Action::failure;
     101  WorldScaleBoxState *state = assert_cast<WorldScaleBoxState*>(_state.get());
     102
     103  // scale atoms
     104  double x[NDIM];
     105  for (int i=0;i<NDIM;i++)
     106    x[i] = state->params.Scaler[i];
     107  vector<atom*> AllAtoms = World::getInstance().getAllAtoms();
     108  for(vector<atom*>::iterator AtomRunner = AllAtoms.begin(); AtomRunner != AllAtoms.end(); ++AtomRunner) {
     109    (*AtomRunner)->ScaleAll(x);
     110  }
     111
     112  // scale box
     113  RealSpaceMatrix M = World::getInstance().getDomain().getM();
     114  RealSpaceMatrix scale;
     115  for (int i=0;i<NDIM;i++) {
     116    scale.at(i,i) = state->params.Scaler[i];
     117  }
     118  M *= scale;
     119  World::getInstance().setDomain(M);
     120
     121  // give final box size
     122  LOG(0, "Box domain is again " << World::getInstance().getDomain().getM());
     123
     124  return Action::state_ptr(_state);
    82125}
    83126
    84127bool WorldScaleBoxAction::canUndo() {
    85   return false;
     128  return true;
    86129}
    87130
    88131bool WorldScaleBoxAction::shouldUndo() {
    89   return false;
     132  return true;
    90133}
    91134/** =========== end of function ====================== */
  • tests/regression/Domain/AddEmptyBoundary/testsuite-domain-add-empty-boundary.at

    rb1ac7a r9c27b0  
    1515
    1616AT_SETUP([Domain - center and add empty boundary with Undo])
    17 AT_XFAIL_IF([/bin/true])
    18 AT_KEYWORDS([domain add-empty-boundar undo])
     17AT_KEYWORDS([domain add-empty-boundary undo])
    1918
    2019file=test.conf
     
    2221AT_CHECK([chmod u+w $file], 0)
    2322AT_CHECK([../../molecuilder -i $file  -c "5, 10, 15" --undo], 0, [stdout], [stderr])
    24 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
    25 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/AddEmptyBoundary/post/test.conf], 0, [stdout], [stderr])
     23AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore])
     24AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/AddEmptyBoundary/post/test-undo.conf], 0, [stdout], [stderr])
    2625
    2726AT_CLEANUP
     
    2928
    3029AT_SETUP([Domain - center and add empty boundary with Redo])
    31 AT_XFAIL_IF([/bin/true])
    3230AT_KEYWORDS([domain add-empty-boundary redo])
    3331
  • tests/regression/Domain/CenterInBox/testsuite-domain-center-in-box.at

    rb1ac7a r9c27b0  
    1515
    1616AT_SETUP([Domain - setting and centering in domain with Undo])
    17 AT_XFAIL_IF([/bin/true])
    1817AT_KEYWORDS([domain center-in-box undo])
    1918
     
    2221AT_CHECK([chmod u+w $file], 0)
    2322AT_CHECK([../../molecuilder -i $file  -b "15, 0, 15, 0, 0, 15" --undo], 0, [stdout], [stderr])
    24 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
    25 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterInBox/post/test.conf], 0, [stdout], [stderr])
     23AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore])
     24AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterInBox/post/test-undo.conf], 0, [stdout], [stderr])
    2625
    2726AT_CLEANUP
     
    2928
    3029AT_SETUP([Domain - setting and centering in domain with Redo])
    31 AT_XFAIL_IF([/bin/true])
    3230AT_KEYWORDS([domain center-in-box redo])
    3331
     
    3634AT_CHECK([chmod u+w $file], 0)
    3735AT_CHECK([../../molecuilder -i $file  -b "15, 0, 15, 0, 0, 15" --undo --redo], 0, [stdout], [stderr])
    38 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
     36AT_CHECK([fgrep "Box domain is again" stdout], 0, [ignore], [ignore])
    3937AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterInBox/post/test.conf], 0, [stdout], [stderr])
    4038
  • tests/regression/Domain/CenterOnEdge/testsuite-domain-center-on-edge.at

    rb1ac7a r9c27b0  
    77AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/pre/test.conf $file], 0)
    88AT_CHECK([chmod u+w $file], 0)
    9 AT_CHECK([../../molecuilder -i $file  -O], 0, [stdout], [stderr])
     9AT_CHECK([../../molecuilder -i $file -O], 0, [stdout], [stderr])
    1010AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
    1111AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/post/test.conf], 0, [stdout], [stderr])
     
    1515
    1616AT_SETUP([Domain - set domain to minimum size with Undo])
    17 AT_XFAIL_IF([/bin/true])
    1817AT_KEYWORDS([domain center-edge undo])
    1918
     
    2120AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/pre/test.conf $file], 0)
    2221AT_CHECK([chmod u+w $file], 0)
    23 AT_CHECK([../../molecuilder -i $file  -O --undo], 0, [stdout], [stderr])
     22AT_CHECK([../../molecuilder -i $file -O --undo], 0, [stdout], [stderr])
    2423AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
    25 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/post/test.conf], 0, [stdout], [stderr])
     24AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/post/test-undo.conf], 0, [stdout], [stderr])
    2625
    2726AT_CLEANUP
     
    2928
    3029AT_SETUP([Domain - set domain to minimum size with Redo])
    31 AT_XFAIL_IF([/bin/true])
    3230AT_KEYWORDS([domain center-edge redo])
    3331
     
    3533AT_CHECK([/bin/cp -f ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/pre/test.conf $file], 0)
    3634AT_CHECK([chmod u+w $file], 0)
    37 AT_CHECK([../../molecuilder -i $file  -O --undo --redo], 0, [stdout], [stderr])
     35AT_CHECK([../../molecuilder -i $file -O --undo --redo], 0, [stdout], [stderr])
    3836AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
    3937AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/CenterOnEdge/post/test.conf], 0, [stdout], [stderr])
  • tests/regression/Domain/ChangeBox/testsuite-domain-change-box.at

    rb1ac7a r9c27b0  
    1313
    1414AT_SETUP([Domain - defining simulation domain])
    15 AT_XFAIL_IF([/bin/true])
    1615AT_KEYWORDS([domain change-box undo])
    1716
     
    2524
    2625AT_SETUP([Domain - defining simulation domain])
    27 AT_XFAIL_IF([/bin/true])
    2826AT_KEYWORDS([domain change-box redo])
    2927
  • tests/regression/Domain/RepeatBox/testsuite-domain-repeat-box.at

    rb1ac7a r9c27b0  
    4444
    4545AT_SETUP([Domain - duplicating box with Undo])
    46 AT_XFAIL_IF([/bin/true])
    4746AT_KEYWORDS([domain repeat-box undo])
    4847
     
    5150AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
    5251AT_CHECK([../../molecuilder -i $file  -o xyz -d "1, 1, 1" --undo], 0, [stdout], [stderr])
    53 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
     52AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore])
    5453AT_CHECK([file=test.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore])
    55 AT_CHECK([file=test.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
     54AT_CHECK([file=test.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-undo.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
    5655AT_CHECK([file=test.xyz; diff $file-sorted $file-sorted2], 0, [ignore], [ignore])
    5756
     
    6059AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
    6160AT_CHECK([../../molecuilder -i $file -o xyz -d "2, 1, 1" --undo], 0, [stdout], [stderr])
    62 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
     61AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore])
    6362AT_CHECK([file=test-x.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore])
    64 AT_CHECK([file=test-x.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-x.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
     63AT_CHECK([file=test-x.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-undo.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
    6564AT_CHECK([file=test-x.xyz; diff $file-sorted $file-sorted2], 0, [ignore], [ignore])
    6665
     
    6968AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
    7069AT_CHECK([../../molecuilder -i $file  -o xyz -d "1, 2, 1" --undo], 0, [stdout], [stderr])
    71 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
     70AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore])
    7271AT_CHECK([file=test-y.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore])
    73 AT_CHECK([file=test-y.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-y.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
     72AT_CHECK([file=test-y.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-undo.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
    7473AT_CHECK([file=test-y.xyz; diff $file-sorted $file-sorted2], 0, [ignore], [ignore])
    7574
     
    7877AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
    7978AT_CHECK([../../molecuilder -i $file  -o xyz -d "1, 1, 2" --undo], 0, [stdout], [stderr])
    80 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
     79AT_CHECK([fgrep "Box domain restored to" stdout], 0, [ignore], [ignore])
    8180AT_CHECK([file=test-z.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore])
    82 AT_CHECK([file=test-z.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-z.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
     81AT_CHECK([file=test-z.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-undo.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
    8382AT_CHECK([file=test-z.xyz; diff $file-sorted $file-sorted2], 0, [ignore], [ignore])
    8483
     
    8786
    8887AT_SETUP([Domain - duplicating box with Redo])
    89 AT_XFAIL_IF([/bin/true])
    9088AT_KEYWORDS([domain repeat-box redo])
    9189
     
    9492AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
    9593AT_CHECK([../../molecuilder -i $file  -o xyz -d "1, 1, 1" --undo --redo], 0, [stdout], [stderr])
    96 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
     94AT_CHECK([fgrep "Box domain is again" stdout], 0, [ignore], [ignore])
    9795AT_CHECK([file=test.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore])
    9896AT_CHECK([file=test.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
     
    103101AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
    104102AT_CHECK([../../molecuilder -i $file -o xyz -d "2, 1, 1" --undo --redo], 0, [stdout], [stderr])
    105 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
     103AT_CHECK([fgrep "Box domain is again" stdout], 0, [ignore], [ignore])
    106104AT_CHECK([file=test-x.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore])
    107105AT_CHECK([file=test-x.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-x.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
     
    112110AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
    113111AT_CHECK([../../molecuilder -i $file  -o xyz -d "1, 2, 1" --undo --redo], 0, [stdout], [stderr])
    114 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
     112AT_CHECK([fgrep "Box domain is again" stdout], 0, [ignore], [ignore])
    115113AT_CHECK([file=test-y.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore])
    116114AT_CHECK([file=test-y.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-y.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
     
    121119AT_CHECK([chmod u+w $file], 0, [ignore], [ignore])
    122120AT_CHECK([../../molecuilder -i $file  -o xyz -d "1, 1, 2" --undo --redo], 0, [stdout], [stderr])
    123 AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
     121AT_CHECK([fgrep "Box domain is again" stdout], 0, [ignore], [ignore])
    124122AT_CHECK([file=test-z.xyz;sort -n $file | grep -v "Created by" >$file-sorted], 0, [ignore], [ignore])
    125123AT_CHECK([file=test-z.xyz;sort -n ${abs_top_srcdir}/tests/regression/Domain/RepeatBox/post/test-z.xyz  | grep -v "Created by" >$file-sorted2], 0, [ignore], [ignore])
  • tests/regression/Domain/ScaleBox/testsuite-domain-scale-box.at

    rb1ac7a r9c27b0  
    1515
    1616AT_SETUP([Domain - scaling box with Undo])
    17 AT_XFAIL_IF([/bin/true])
    1817AT_KEYWORDS([domain scale-box undo])
    1918
     
    2322AT_CHECK([../../molecuilder -i $file  --scale-box "0.5, 1., 0.9" --undo], 0, [stdout], [stderr])
    2423AT_CHECK([fgrep "Box domain is now" stdout], 0, [ignore], [ignore])
    25 AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/ScaleBox/post/test.conf], 0, [stdout], [stderr])
     24AT_CHECK([diff $file ${abs_top_srcdir}/tests/regression/Domain/ScaleBox/post/test-undo.conf], 0, [stdout], [stderr])
    2625
    2726AT_CLEANUP
     
    2928
    3029AT_SETUP([Domain - scaling box with Redo])
    31 AT_XFAIL_IF([/bin/true])
    3230AT_KEYWORDS([domain scale-box redo])
    3331
  • tests/regression/Domain/testsuite-domain.at

    rb1ac7a r9c27b0  
    33# define box setting
    44m4_include([Domain/ChangeBox/testsuite-domain-change-box.at])
     5
     6# bound atoms in defined domain
     7m4_include([Domain/BoundInBox/testsuite-domain-bound-in-box.at])
    58
    69# center atoms in defined domain
  • tests/regression/Makefile.am

    rb1ac7a r9c27b0  
    4141        $(srcdir)/Analysis/AngularDipoleCorrelation-DiscreteAngles/testsuite-analysis-angular-dipole-correlation-discrete-angles.at \
    4242        $(srcdir)/Domain/testsuite-domain.at \
     43        $(srcdir)/Domain/BoundInBox/testsuite-domain-bound-in-box.at \
    4344        $(srcdir)/Domain/ChangeBox/testsuite-domain-change-box.at \
    4445        $(srcdir)/Domain/CenterInBox/testsuite-domain-center-in-box.at \
Note: See TracChangeset for help on using the changeset viewer.