- Timestamp:
- May 8, 2017, 2:01:48 PM (8 years ago)
- Branches:
- ForceAnnealing_goodresults, ForceAnnealing_tocheck
- Children:
- db0833
- Parents:
- 73faf4 (diff), c1446cd (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 3 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/Action.hpp
r73faf4 rc8165c 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
r73faf4 rc8165c 88 88 (MoleculeLoad) \ 89 89 (MoleculeRemove) \ 90 (MoleculeRotateAroundBond) \ 90 91 (MoleculeRotateAroundSelfByAngle) \ 91 92 (MoleculeRotateToPrincipalAxisSystem) \ -
src/Actions/Makefile.am
r73faf4 rc8165c 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
r73faf4 rc8165c 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
r73faf4 rc8165c 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
r73faf4 rc8165c 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
r73faf4 rc8165c 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
r73faf4 rc8165c 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
r73faf4 rc8165c 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
r73faf4 rc8165c 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
r73faf4 rc8165c 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
r73faf4 rc8165c 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
r73faf4 rc8165c 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> … … 461 464 } 462 465 466 /** This is due to the answer by Aleksey Vitebskiy 467 * in http://stackoverflow.com/questions/4107087/accepting-negative-doubles-with-boostprogram-options 468 * 469 */ 470 std::vector<po::option> ignore_numbers(std::vector<std::string>& args) 471 { 472 std::vector<po::option> result; 473 int pos = 0; 474 while(!args.empty()) { 475 const std::string& arg = args[0]; 476 bool isNumber = true; 477 try { 478 boost::lexical_cast<double>(arg); 479 } catch(boost::bad_lexical_cast) { 480 isNumber = false; 481 } 482 if (isNumber) { 483 result.push_back(po::option()); 484 po::option& opt = result.back(); 485 486 opt.position_key = pos++; 487 opt.value.push_back(arg); 488 opt.original_tokens.push_back(arg); 489 490 args.erase(args.begin()); 491 } else { 492 break; 493 } 494 } 495 496 return result; 497 } 498 463 499 /** Parses the command line arguments. 464 500 * Calls program_options::store() and program_options::notify() … … 471 507 bool status = true; 472 508 try { 473 po::store(po::command_line_parser(argc,argv). options(cmdline_options).run(), vm);509 po::store(po::command_line_parser(argc,argv).extra_style_parser(&ignore_numbers).options(cmdline_options).run(), vm); 474 510 } catch (std::exception &e) { 475 511 std::cerr << "Something went wrong with parsing the command-line arguments: " -
src/World.cpp
r73faf4 rc8165c 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)
Note:
See TracChangeset
for help on using the changeset viewer.