Changeset 137845
- Timestamp:
- Jun 20, 2017, 8:02:18 PM (8 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChangeBugEmailaddress, ChemicalSpaceEvaluator, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph_documentation, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, ForceAnnealing_oldresults, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, IndependentFragmentGrids_IntegrationTest, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, StoppableMakroAction, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps
- Children:
- 9f2071
- Parents:
- 15d21e
- git-author:
- Frederik Heber <heber@…> (03/23/17 03:35:32)
- git-committer:
- Frederik Heber <frederik.heber@…> (06/20/17 20:02:18)
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/WorldAction/StepWorldTimeAction.cpp
r15d21e r137845 47 47 using namespace MoleCuilder; 48 48 49 // if both are given, we use backwards50 static int getSteps(const unsigned int _forward, const unsigned int _backward)51 {52 int steps = 0;53 if (_backward > 0)54 steps = -_backward;55 else56 steps = _forward;57 58 return steps;59 }60 61 49 // and construct the stuff 62 50 #include "StepWorldTimeAction.def" … … 69 57 WorldStepWorldTimeState *UndoState = new WorldStepWorldTimeState(oldtime, params); 70 58 71 const int steps = getSteps(params.steps_forward.get(), params.steps_backward.get()); 72 73 if ((oldtime + steps) < 0) { 59 if ((oldtime + params.steps.get()) < 0) { 74 60 ELOG(1, "Cannot step back before time step #0."); 75 61 delete UndoState; 76 62 return Action::failure; 77 63 } 78 World::getInstance().setTime(oldtime+ steps);64 World::getInstance().setTime(oldtime+params.steps.get()); 79 65 LOG(0, "Current time step is now: " << WorldTime::getTime() << "."); 80 66 return ActionState::ptr(UndoState); … … 93 79 WorldStepWorldTimeState *state = assert_cast<WorldStepWorldTimeState*>(_state.get()); 94 80 95 const int steps = getSteps( 96 state->params.steps_forward.get(), 97 state->params.steps_backward.get()); 98 99 World::getInstance().setTime(state->oldtime+steps); 81 World::getInstance().setTime(state->oldtime+state->params.steps.get()); 100 82 LOG(0, "Current time step is now: " << WorldTime::getTime() << "."); 101 83 -
src/Actions/WorldAction/StepWorldTimeAction.def
r15d21e r137845 14 14 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 15 15 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 16 #define paramtypes ( unsigned int)(unsignedint)17 #define paramtokens ("step s-forward")("steps-backward")18 #define paramdescriptions ("how many steps to take forward or backward")("how many steps to take forward or backward")19 #define paramdefaults (PARAM_DEFAULT(1)) (PARAM_DEFAULT(0))20 #define paramreferences (steps _forward)(steps_backward)16 #define paramtypes (int) 17 #define paramtokens ("step-world-time") 18 #define paramdescriptions ("how many steps to take forward (positive) or backward (negative)") 19 #define paramdefaults (PARAM_DEFAULT(1)) 20 #define paramreferences (steps) 21 21 #define paramvalids \ 22 (DummyValidator< unsigned int >()) \ 23 (DummyValidator< unsigned int >()) 22 (DummyValidator< int >()) 24 23 25 24 #define statetypes (unsigned int) -
tests/Python/AllActions/options.dat
r15d21e r137845 228 228 skiplines "2" 229 229 start-step "0" 230 steps-forward "1"231 steps-backward "0"232 230 steps "5" 231 step-world-time "1" 233 232 store-grids "0" 234 233 store-saturated-fragment "BondFragment" -
tests/regression/WorldTime/StepWorldTime/testsuite-worldtime-step-world-time.at
r15d21e r137845 21 21 AT_KEYWORDS([worldtime step-world-time set-world-time]) 22 22 23 AT_CHECK([../../molecuilder --step-world-time --steps-forward1], 0, [stdout], [stderr])23 AT_CHECK([../../molecuilder --step-world-time 1], 0, [stdout], [stderr]) 24 24 AT_CHECK([fgrep "Current time step is now: 1" stdout], 0, [ignore], [ignore]) 25 AT_CHECK([../../molecuilder --set-world-time 4 --step-world-time - -steps-backward2], 0, [stdout], [stderr])25 AT_CHECK([../../molecuilder --set-world-time 4 --step-world-time -2], 0, [stdout], [stderr]) 26 26 AT_CHECK([fgrep "Current time step is now: 2" stdout], 0, [ignore], [ignore]) 27 27 # stepping back too far fails 28 AT_CHECK([../../molecuilder --set-world-time 1 --step-world-time - -steps-backward2], 5, [stdout], [stderr])28 AT_CHECK([../../molecuilder --set-world-time 1 --step-world-time -2], 5, [stdout], [stderr]) 29 29 30 30 AT_CLEANUP … … 34 34 AT_KEYWORDS([worldtime step-world-time set-world-time undo]) 35 35 36 AT_CHECK([../../molecuilder --set-world-time 2 --step-world-time - -steps-backward1 --undo], 0, [stdout], [stderr])36 AT_CHECK([../../molecuilder --set-world-time 2 --step-world-time -1 --undo], 0, [stdout], [stderr]) 37 37 AT_CHECK([fgrep "Current time step is now again: 2" stdout], 0, [ignore], [ignore]) 38 38 … … 42 42 AT_KEYWORDS([worldtime step-world-time set-world-time undo redo]) 43 43 44 AT_CHECK([../../molecuilder --set-world-time 2 --step-world-time - -steps-backward1 --undo --redo], 0, [stdout], [stderr])44 AT_CHECK([../../molecuilder --set-world-time 2 --step-world-time -1 --undo --redo], 0, [stdout], [stderr]) 45 45 AT_CHECK([fgrep "Current time step is now: 1" stdout], 0, [ignore], [ignore]) 46 46
Note:
See TracChangeset
for help on using the changeset viewer.