Changes in / [be848d:78ea3c]
- Files:
-
- 9 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
doc/userguide/userguide.xml
rbe848d r78ea3c 1177 1177 <link linkend='geometry'>Geometry</link>.</para> 1178 1178 </section> 1179 <section xml:id="molecule.rotate-around-bond"> 1180 <title xml:id="molecule.rotate-around-bond.title">Rotate around bond </title> 1181 <para>This rotates parts of a molecule around a given bond, i.e. the 1182 bond vector becomes the rotation axis but only atoms on the side of 1183 second atom get rotated. This naturally does not work for bonds in a 1184 cycle.</para> 1185 <programlisting> 1186 ... --rotate-around-bond "90" \ 1187 --bond-side 0\ 1188 </programlisting> 1189 </section> 1179 1190 <section xml:id="molecule.rotate-around-self"> 1180 1191 <title xml:id="molecule.rotate-around-self.title">Rotate around self </title> … … 2658 2669 under the command-line interface and look up the function name via 2659 2670 help.</para> 2671 <para>You can freely mix calls to the pymolecuilder module and other python commands.</para> 2672 <note>However, be aware that all Actions are executed in another thread, 2673 i.e. run in parallel. That means that a pymolecuilder command is not 2674 necessarily finished when python steps on to the next line!</note> 2675 <para>In order to make python wait for the Actions to finish before 2676 stepping, there is the special wait() command.</para> 2677 <programlisting> 2678 mol.MoleculeLoad("...") 2679 mol.wait() 2680 </programlisting> 2681 <para>This will continue first after the molecule has been fully loaded. 2682 </para> 2683 <warning>These wait()s will have no effect if the python script is loaded 2684 via the "load-session" command inside a User Interface (command-line, 2685 GUI, ...) as this would cause the queue to wait indefinitely, namely till 2686 the load-session itself would have finished.</warning> 2687 <para>Therefore, more complex python scripts need to be called with 2688 python and a set PYTHONPATH as described above.</para> 2660 2689 </section> 2661 2690 </chapter> -
src/Actions/Action.hpp
rbe848d r78ea3c 29 29 */ 30 30 #ifndef STATUS 31 #define STATUS(msg) pushStatus(msg) 31 #define STATUS(msg) \ 32 pushStatus(msg); \ 33 LOG(0, "STATUS: " << msg) 32 34 #endif 33 35 -
src/Actions/GlobalListOfActions.hpp
rbe848d r78ea3c 88 88 (MoleculeLoad) \ 89 89 (MoleculeRemove) \ 90 (MoleculeRotateAroundBond) \ 90 91 (MoleculeRotateAroundSelfByAngle) \ 91 92 (MoleculeRotateToPrincipalAxisSystem) \ -
src/Actions/Makefile.am
rbe848d r78ea3c 339 339 Actions/MoleculeAction/LoadAction.cpp \ 340 340 Actions/MoleculeAction/RemoveAction.cpp \ 341 Actions/MoleculeAction/RotateAroundBondAction.cpp \ 341 342 Actions/MoleculeAction/RotateAroundSelfByAngleAction.cpp \ 342 343 Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp \ … … 357 358 Actions/MoleculeAction/LoadAction.hpp \ 358 359 Actions/MoleculeAction/RemoveAction.hpp \ 360 Actions/MoleculeAction/RotateAroundBondAction.hpp \ 359 361 Actions/MoleculeAction/RotateAroundSelfByAngleAction.hpp \ 360 362 Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.hpp \ … … 375 377 Actions/MoleculeAction/LoadAction.def \ 376 378 Actions/MoleculeAction/RemoveAction.def \ 379 Actions/MoleculeAction/RotateAroundBondAction.def \ 377 380 Actions/MoleculeAction/RotateAroundSelfByAngleAction.def \ 378 381 Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.def \ -
src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.cpp
rbe848d r78ea3c 35 35 //#include "CodePatterns/MemDebug.hpp" 36 36 37 #include "CodePatterns/Assert.hpp" 37 38 #include "CodePatterns/Log.hpp" 38 #include "CodePatterns/Verbose.hpp" 39 40 #include "Actions/UndoRedoHelpers.hpp" 41 #include "Atom/AtomicInfo.hpp" 39 42 #include "LinearAlgebra/Line.hpp" 40 43 #include "LinearAlgebra/RealSpaceMatrix.hpp" … … 58 61 molecule *mol = NULL; 59 62 63 std::vector<AtomicInfo> UndoInfo; 60 64 for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); iter != World::getInstance().endMoleculeSelection(); ++iter) { 61 65 mol = iter->second; 62 66 LOG(0, "Converting to prinicipal axis system."); 63 67 64 RealSpaceMatrix InertiaTensor = mol->getInertiaTensor(); 68 // gather undo information: store position of all atoms of molecule 69 UndoInfo.reserve(UndoInfo.size()+mol->size()); 70 { 71 for (molecule::const_iterator iter = const_cast<molecule const *>(mol)->begin(); 72 iter != const_cast<molecule const *>(mol)->end(); 73 ++iter) { 74 const atom * const Walker = *iter; 75 UndoInfo.push_back(AtomicInfo(*Walker)); 76 } 77 } 65 78 79 // rotate 80 // RealSpaceMatrix InertiaTensor = mol->getInertiaTensor(); 66 81 mol->RotateToPrincipalAxisSystem(params.Axis.get()); 67 82 68 83 // summing anew for debugging (resulting matrix has to be diagonal!) 69 InertiaTensor = mol->getInertiaTensor();84 RealSpaceMatrix InertiaTensor = mol->getInertiaTensor(); 70 85 } 71 return Action::success; 86 87 MoleculeRotateToPrincipalAxisSystemState *UndoState = 88 new MoleculeRotateToPrincipalAxisSystemState(UndoInfo, params); 89 return ActionState::ptr(UndoState); 72 90 } 73 91 74 92 ActionState::ptr MoleculeRotateToPrincipalAxisSystemAction::performUndo(ActionState::ptr _state) { 75 // MoleculeRotateToPrincipalAxisSystemState *state = assert_cast<MoleculeRotateToPrincipalAxisSystemState*>(_state.get()); 93 MoleculeRotateToPrincipalAxisSystemState *state = 94 assert_cast<MoleculeRotateToPrincipalAxisSystemState*>(_state.get()); 76 95 77 // string newName = state->mol->getName(); 78 // state->mol->setName(state->lastName);96 // set stored old state 97 SetAtomsFromAtomicInfo(state->undoinfo); 79 98 80 STATUS("Undo of MoleculeRotateToPrincipalAxisSystemAction not implemented."); 81 return Action::failure; 99 return ActionState::ptr(_state); 82 100 } 83 101 84 102 ActionState::ptr MoleculeRotateToPrincipalAxisSystemAction::performRedo(ActionState::ptr _state){ 85 STATUS("Redo of MoleculeRotateToPrincipalAxisSystemAction not implemented."); 86 return Action::failure; 103 MoleculeRotateToPrincipalAxisSystemState *state = 104 assert_cast<MoleculeRotateToPrincipalAxisSystemState*>(_state.get()); 105 106 for (World::MoleculeSelectionIterator iter = World::getInstance().beginMoleculeSelection(); 107 iter != World::getInstance().endMoleculeSelection(); ++iter) { 108 molecule * const mol = iter->second; 109 mol->RotateToPrincipalAxisSystem(state->params.Axis.get()); 110 } 111 112 return ActionState::ptr(_state); 87 113 } 88 114 -
src/Actions/MoleculeAction/RotateToPrincipalAxisSystemAction.def
rbe848d r78ea3c 7 7 8 8 // all includes and forward declarations necessary for non-integral types below 9 #include <vector> 10 9 11 #include "Actions/Values.hpp" 12 #include "Atom/AtomicInfo.hpp" 10 13 #include "LinearAlgebra/Vector.hpp" 11 14 … … 23 26 (VectorNotZeroValidator()) 24 27 25 # undef statetypes26 # undef statereferences28 #define statetypes (std::vector<AtomicInfo>) 29 #define statereferences (undoinfo) 27 30 28 31 // some defines for all the names, you may use ACTION, STATE and PARAMS -
src/Actions/PotentialAction/ParsePotentialsAction.cpp
rbe848d r78ea3c 73 73 deserialize(); 74 74 } catch (SerializerMissingValueException &e) { 75 if (const std::string *key = boost::get_error_info<SerializerKey>(e)) 75 if (const std::string *key = boost::get_error_info<SerializerKey>(e)) { 76 76 STATUS("Missing value when parsing information for potential "+*key+"."); 77 else77 } else 78 78 STATUS("Missing value parsing information for potential with unknown key."); 79 79 return Action::failure; 80 80 } catch (SerializerIllegalKeyException &e) { 81 if (const std::string *key = boost::get_error_info<SerializerKey>(e)) 81 if (const std::string *key = boost::get_error_info<SerializerKey>(e)) { 82 82 STATUS("Illegal key parsing information for potential "+*key+"."); 83 else83 } else { 84 84 STATUS("Illegal key parsing information for potential with unknown key."); 85 } 85 86 return Action::failure; 86 87 } -
src/Actions/WorldAction/StepWorldTimeAction.cpp
rbe848d r78ea3c 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
rbe848d r78ea3c 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) -
src/Atom/atom.cpp
rbe848d r78ea3c 103 103 LOG(4,"atom::UpdateStep() called."); 104 104 // append to position, velocity and force vector 105 AtomInfo::AppendTrajectoryStep(WorldTime::getTime() +1);105 AtomInfo::AppendTrajectoryStep(WorldTime::getTime()); 106 106 // append to ListOfBonds vector 107 BondedParticleInfo::AppendTrajectoryStep(WorldTime::getTime() +1);107 BondedParticleInfo::AppendTrajectoryStep(WorldTime::getTime()); 108 108 } 109 109 -
src/Atom/atom_atominfo.cpp
rbe848d r78ea3c 91 91 void AtomInfo::AppendTrajectoryStep(const unsigned int _step) 92 92 { 93 ASSERT (WorldTime::getTime() != _step,94 "AtomInfo::AppendTrajectoryStep() - cannot append current time step.");95 93 NOTIFY(TrajectoryChanged); 96 94 AtomicPosition.insert( std::make_pair(_step, zeroVec) ); … … 105 103 void AtomInfo::removeTrajectoryStep(const unsigned int _step) 106 104 { 107 ASSERT (WorldTime::getTime() != _step,108 "AtomInfo::removeTrajectoryStep() - cannot remove current time step.");109 105 NOTIFY(TrajectoryChanged); 110 106 AtomicPosition.erase(_step); -
src/Fragmentation/Exporters/HydrogenPool.cpp
rbe848d r78ea3c 91 91 +" from pool is already in use."); 92 92 LOG(3, "DEBUG: Leasing " << *Walker << "."); 93 UpdateSteps(Walker);94 93 HydrogenInUse.insert( std::make_pair( Walker->getId(), Walker) ); 95 94 HydrogenQueue.pop_front(); 96 95 97 96 return Walker; 98 }99 100 void HydrogenPool::UpdateSteps(atom * _atom) const101 {102 // make sure we are up to current time step103 const size_t CurrentTime = WorldTime::getTime();104 for (size_t step = _atom->getTrajectorySize(); step <= CurrentTime; ++step)105 _atom->UpdateStep(step);106 97 } 107 98 -
src/Fragmentation/Exporters/HydrogenPool.hpp
rbe848d r78ea3c 73 73 void cleanup(); 74 74 75 /** Helper function to make sure \a _atom is up to current time step.76 *77 * \param _atom atom to bring trajectory size up to speed78 */79 void UpdateSteps(atom * _atom) const;80 81 82 75 private: 83 76 //!> typedef for the deque of available hydrogens. -
src/UIElements/CommandLineUI/CommandLineParser.cpp
rbe848d r78ea3c 36 36 37 37 #include <boost/filesystem.hpp> 38 #include <boost/lexical_cast.hpp> 39 #include <boost/program_options/option.hpp> 40 #include <boost/program_options/value_semantic.hpp> 38 41 #include <boost/program_options.hpp> 39 42 #include <fstream> … … 463 466 } 464 467 468 /** This is due to the answer by Aleksey Vitebskiy 469 * in http://stackoverflow.com/questions/4107087/accepting-negative-doubles-with-boostprogram-options 470 * 471 */ 472 std::vector<po::option> ignore_numbers(std::vector<std::string>& args) 473 { 474 std::vector<po::option> result; 475 int pos = 0; 476 while(!args.empty()) { 477 const std::string& arg = args[0]; 478 bool isNumber = true; 479 try { 480 boost::lexical_cast<double>(arg); 481 } catch(boost::bad_lexical_cast) { 482 isNumber = false; 483 } 484 if (isNumber) { 485 result.push_back(po::option()); 486 po::option& opt = result.back(); 487 488 opt.position_key = pos++; 489 opt.value.push_back(arg); 490 opt.original_tokens.push_back(arg); 491 492 args.erase(args.begin()); 493 } else { 494 break; 495 } 496 } 497 498 return result; 499 } 500 465 501 /** Parses the command line arguments. 466 502 * Calls program_options::store() and program_options::notify() … … 473 509 bool status = true; 474 510 try { 475 po::store(po::command_line_parser(argc,argv). options(cmdline_options).run(), vm);511 po::store(po::command_line_parser(argc,argv).extra_style_parser(&ignore_numbers).options(cmdline_options).run(), vm); 476 512 } catch (std::exception &e) { 477 513 std::cerr << "Something went wrong with parsing the command-line arguments: " -
src/World.cpp
rbe848d r78ea3c 221 221 } 222 222 223 bool areBondsPresent(const unsigned int _step)223 static bool areBondsPresent(const unsigned int _step) 224 224 { 225 225 bool status = false; … … 234 234 } 235 235 236 void copyBondgraph(const unsigned int _srcstep, const unsigned int _deststep) 236 static bool areAtomsPresent(const unsigned int _step) 237 { 238 bool status = false; 239 240 for (World::AtomConstIterator iter = const_cast<const World &>(World::getInstance()).getAtomIter(); 241 (!status) && (iter != const_cast<const World &>(World::getInstance()).atomEnd()); ++iter) { 242 const atom * const Walker = *iter; 243 status |= (Walker->getTrajectorySize() >= _step); 244 } 245 246 return status; 247 } 248 249 static void copyBondgraph(const unsigned int _srcstep, const unsigned int _deststep) 237 250 { 238 251 // gather all bonds from _srcstep … … 259 272 } 260 273 274 //static void copyAtoms(const unsigned int _srcstep, const unsigned int _deststep) 275 //{ 276 // for (World::AtomIterator iter = World::getInstance().getAtomIter(); 277 // iter != World::getInstance().atomEnd(); ++iter) { 278 // atom * const Walker = *iter; 279 // Walker->UpdateStep(_deststep); 280 // Walker->setPositionAtStep(_deststep, Walker->getPositionAtStep(_srcstep)); 281 // Walker->setAtomicVelocityAtStep(_deststep, Walker->getAtomicVelocityAtStep(_srcstep)); 282 // Walker->setAtomicForceAtStep(_deststep, Walker->getAtomicForceAtStep(_srcstep)); 283 // } 284 //} 285 261 286 void World::setTime(const unsigned int _step) 262 287 { 263 288 if (_step != WorldTime::getTime()) { 264 289 const unsigned int oldstep = WorldTime::getTime(); 290 291 // if (!areAtomsPresent(_step)) 292 // copyAtoms(oldstep, _step); 265 293 266 294 // 1. copy bond graph (such not each addBond causes GUI update) -
tests/Python/AllActions/options.dat
rbe848d r78ea3c 33 33 bond-degree "1" 34 34 bond-file "bond.dat" 35 bondside "1" 35 36 bond-table "table.dat" 36 37 calculate-bounding-box "" … … 166 167 reset 1 167 168 reverse "0" 169 rotate-around-bond "90." 168 170 rotate-around-origin "180." 169 171 rotate-around-origin "20." … … 233 235 skiplines "2" 234 236 start-step "0" 235 steps-forward "1"236 steps-backward "0"237 237 steps "5" 238 step-world-time "1" 238 239 store-grids "0" 239 240 store-saturated-fragment "BondFragment" -
tests/regression/Makefile.am
rbe848d r78ea3c 140 140 $(srcdir)/Molecules/LinearInterpolationofTrajectories/testsuite-molecules-linear-interpolation-of-trajectories.at \ 141 141 $(srcdir)/Molecules/Remove/testsuite-molecules-remove.at \ 142 $(srcdir)/Molecules/RotateAroundBond/testsuite-molecules-rotate-around-bond.at \ 142 143 $(srcdir)/Molecules/RotateAroundOrigin/testsuite-molecules-rotate-around-origin.at \ 143 144 $(srcdir)/Molecules/RotateAroundSelf/testsuite-molecules-rotate-around-self.at \ -
tests/regression/Molecules/RotateToPrincipalAxisSystem/testsuite-molecules-rotate-to-principal-axis-system.at
rbe848d r78ea3c 49 49 50 50 AT_SETUP([Molecules - Rotate to PAS with Undo]) 51 AT_XFAIL_IF([/bin/true])52 51 AT_KEYWORDS([molecules rotate-to-principal-axis-system undo]) 53 52 … … 80 79 81 80 AT_SETUP([Molecules - Rotate to PAS with Redo]) 82 AT_XFAIL_IF([/bin/true])83 81 AT_KEYWORDS([molecules rotate-to-principal-axis-system redo]) 84 82 -
tests/regression/Molecules/testsuite-molecules.at
rbe848d r78ea3c 60 60 m4_include([Molecules/RotateToPrincipalAxisSystem/testsuite-molecules-rotate-to-principal-axis-system.at]) 61 61 62 # rotate around one of its bond 63 m4_include([Molecules/RotateAroundBond/testsuite-molecules-rotate-around-bond.at]) 64 62 65 # Rotate around origin 63 66 m4_include([Molecules/RotateAroundOrigin/testsuite-molecules-rotate-around-origin.at]) -
tests/regression/WorldTime/StepWorldTime/testsuite-worldtime-step-world-time.at
rbe848d r78ea3c 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.