Changeset 322d58 for src/Dynamics/ForceAnnealing.hpp
- Timestamp:
- Apr 4, 2018, 4:59:48 PM (7 years ago)
- Branches:
- AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Exclude_Hydrogens_annealWithBondGraph, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, StoppableMakroAction, TremoloParser_IncreasedPrecision
- Children:
- bca6b6
- Parents:
- 1e49e6
- git-author:
- Frederik Heber <heber@…> (04/06/17 05:09:37)
- git-committer:
- Frederik Heber <frederik.heber@…> (04/04/18 16:59:48)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Dynamics/ForceAnnealing.hpp
r1e49e6 r322d58 32 32 * 33 33 * Sadly, we have to use some static instances as so far values cannot be passed 34 * between actions. Hence, we need to store the current step and the adaptive 34 * between actions. Hence, we need to store the current step and the adaptive- 35 35 * step width (we cannot perform a linesearch, as we have no control over the 36 36 * calculation of the forces). … … 42 42 /** Constructor of class ForceAnnealing. 43 43 * 44 * \note We use a fixed delta t of 1. 45 * 44 46 * \param _atoms set of atoms to integrate 45 47 * \param _Deltat time step width in atomic units … … 49 51 ForceAnnealing( 50 52 AtomSetMixin<T> &_atoms, 51 double _Deltat,52 53 bool _IsAngstroem, 53 54 const size_t _maxSteps) : 54 AtomicForceManipulator<T>(_atoms, _Deltat, _IsAngstroem),55 AtomicForceManipulator<T>(_atoms, 1., _IsAngstroem), 55 56 maxSteps(_maxSteps) 56 57 {} … … 89 90 iter != AtomicForceManipulator<T>::atoms.end(); ++iter) { 90 91 // atom's force vector gives steepest descent direction 92 const Vector oldPosition = (*iter)->getPositionAtStep(NextStep-2 >= 0 ? NextStep - 2 : 0); 91 93 const Vector currentPosition = (*iter)->getPosition(); 94 const Vector oldGradient = (*iter)->getAtomicForceAtStep(NextStep-2 >= 0 ? NextStep - 2 : 0); 92 95 const Vector currentGradient = (*iter)->getAtomicForce(); 93 96 LOG(4, "DEBUG: Force for atom " << **iter << " is " << currentGradient); 94 97 95 // artificial update: deltat may be considered as 1/2 s^2 units, mass 96 // is neglected deliberately as this makes all atoms equally fast or 97 // hydrogens slower (and they need to wait for other atoms to arrive at 98 // final position). 99 Vector PositionUpdate = currentDeltat * currentGradient; 98 // we use Barzilai-Borwein update with position reversed to get descent 99 const Vector GradientDifference = (currentGradient - oldGradient); 100 const double stepwidth = 101 fabs((currentPosition - oldPosition).ScalarProduct(GradientDifference))/ 102 GradientDifference.NormSquared(); 103 Vector PositionUpdate = stepwidth * currentGradient; 104 if (fabs(stepwidth) < 1e-10) { 105 // dont' warn in first step, deltat usage normal 106 if (currentStep != 1) 107 ELOG(1, "INFO: Barzilai-Borwein stepwidth is zero, using deltat " << currentDeltat << " instead."); 108 PositionUpdate = currentDeltat * currentGradient; 109 } 100 110 LOG(3, "DEBUG: Update would be " << PositionUpdate); 101 111
Note:
See TracChangeset
for help on using the changeset viewer.