- 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)
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/MoleculeAction/ForceAnnealingAction.cpp
r1e49e6 r322d58 92 92 ForceAnnealing<std::vector<atom *> > optimizer( 93 93 set, 94 params.Deltat.get(),95 94 true, 96 95 params.steps.get()); -
src/Actions/MoleculeAction/ForceAnnealingAction.def
r1e49e6 r322d58 16 16 // ValueStorage by the token "Z" -> first column: int, Z, "Z" 17 17 // "undefine" if no parameters are required, use (NOPARAM_DEFAULT) for each (undefined) default value 18 #define paramtypes (boost::filesystem::path)( double)(unsigned int)(bool)19 #define paramtokens ("forces-file")(" deltat")("steps")("output-every-step")20 #define paramdescriptions ("file containing")(" time step width")("fixed number of optimization steps to be performed")("whether WorldTime should be increased and output written after every step, useful if optimization might hang")21 #define paramdefaults (PARAM_DEFAULT(""))( PARAM_DEFAULT(0.1))(NOPARAM_DEFAULT)(PARAM_DEFAULT("0"))22 #define paramreferences (forcesfile)( Deltat)(steps)(DoOutput)18 #define paramtypes (boost::filesystem::path)(unsigned int)(bool) 19 #define paramtokens ("forces-file")("steps")("output-every-step") 20 #define paramdescriptions ("file containing")("fixed number of optimization steps to be performed")("whether WorldTime should be increased and output written after every step, useful if optimization might hang") 21 #define paramdefaults (PARAM_DEFAULT(""))(NOPARAM_DEFAULT)(PARAM_DEFAULT("0")) 22 #define paramreferences (forcesfile)(steps)(DoOutput) 23 23 #define paramvalids \ 24 24 (DummyValidator< boost::filesystem::path >()) \ 25 (PositiveValidator< double >()) \26 25 (NotZeroValidator< unsigned int >()) \ 27 26 (DummyValidator<bool>()) -
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.