Changeset 1e4f0a
- Timestamp:
- Sep 13, 2017, 5:20:45 PM (8 years ago)
- Children:
- 1db3520
- Parents:
- 15acdb
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MoleculeAction/ForceAnnealingAction.cpp
r15acdb r1e4f0a 35 35 //#include "CodePatterns/MemDebug.hpp" 36 36 37 #include "Actions/ActionExceptions.hpp" 38 #include "Actions/MakroAction.hpp" 37 39 #include "Actions/UndoRedoHelpers.hpp" 38 40 #include "Atom/atom.hpp" … … 126 128 // perform optimization step 127 129 LOG(1, "Structural optimization."); 128 optimizer(CurrentStep, 1, params.UseBondGraph.get());130 const bool StopStatus = optimizer(CurrentStep, 1, params.UseBondGraph.get()); 129 131 STATUS("Successfully optimized structure by one step."); 132 133 if (StopStatus && ActionQueue::getInstance().isMakroAction()) { 134 // send stop signal if we are taking part in MakroAction 135 MakroAction * const makroaction = 136 dynamic_cast<MakroAction *>( 137 const_cast<Action *>( 138 &ActionQueue::getInstance().getCurrentAction())); 139 if (makroaction != NULL) { 140 makroaction->setLoop(makroaction->getStep()); 141 } else { 142 ELOG(2, "ActionQueue said we are inside process, but current Action is not a process?"); 143 // do nothing 144 } 145 } 130 146 131 147 std::vector<AtomicInfo> RedoInfo; -
src/Dynamics/ForceAnnealing.hpp
r15acdb r1e4f0a 78 78 maxSteps(_maxSteps), 79 79 max_distance(_max_distance), 80 damping_factor(_damping_factor) 80 damping_factor(_damping_factor), 81 FORCE_THRESHOLD(1e-8) 81 82 {} 82 83 … … 94 95 * \param _TimeStep current time step (i.e. \f$ t + \Delta t \f$ in the sense of the velocity verlet) 95 96 * \param offset offset in matrix file to the first force component 97 * \return false - need to continue annealing, true - may stop because forces very small 96 98 * \todo This is not yet checked if it is correctly working with DoConstrainedMD set >0. 97 99 */ 98 voidoperator()(100 bool operator()( 99 101 const int _TimeStep, 100 102 const size_t _offset, … … 134 136 << currentStep << " are " << maxComponents); 135 137 138 // check whether are smaller than threshold 139 bool AnnealingFinished = false; 140 double maxcomp = 0.; 141 for (size_t i=0;i<NDIM;++i) 142 maxcomp = std::max(maxcomp, fabs(maxComponents[i])); 143 if (maxcomp < FORCE_THRESHOLD) { 144 LOG(1, "STATUS: Force components are all less than " << FORCE_THRESHOLD 145 << ", stopping."); 146 currentStep = maxSteps; 147 AnnealingFinished = true; 148 } 149 136 150 // are we in final step? Remember to reset static entities 137 151 if (currentStep == maxSteps) { … … 139 153 reset(); 140 154 } 155 156 return AnnealingFinished; 141 157 } 142 158 … … 627 643 //!> the shifted is dampened by this factor with the power of the bond graph distance to the shift causing atom 628 644 const double damping_factor; 645 //!> threshold for force components to stop annealing 646 const double FORCE_THRESHOLD; 629 647 }; 630 648
Note:
See TracChangeset
for help on using the changeset viewer.