Changeset be729b for src/Dynamics
- Timestamp:
- Apr 10, 2018, 6:43:30 AM (7 years ago)
- Branches:
- AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Exclude_Hydrogens_annealWithBondGraph, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, PythonUI_with_named_parameters, StoppableMakroAction, TremoloParser_IncreasedPrecision
- Children:
- 038ccd
- Parents:
- 6458e7
- git-author:
- Frederik Heber <frederik.heber@…> (06/27/17 21:13:13)
- git-committer:
- Frederik Heber <frederik.heber@…> (04/10/18 06:43:30)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Dynamics/ForceAnnealing.hpp
r6458e7 rbe729b 170 170 Vector &maxComponents) 171 171 { 172 bool deltat_decreased = false; 172 173 for(typename AtomSetMixin<T>::iterator iter = AtomicForceManipulator<T>::atoms.begin(); 173 174 iter != AtomicForceManipulator<T>::atoms.end(); ++iter) { … … 193 194 maxComponents[i] = std::max(maxComponents[i], fabs(currentGradient[i])); 194 195 195 // are we in initial step? Then don't check against velocity 196 if ((currentStep > 1) && (!(*iter)->getAtomicVelocity().IsZero())) 197 // update with currentDelta tells us how the current gradient relates to 198 // the last one: If it has become larger, reduce currentDelta 199 if ((PositionUpdate.ScalarProduct((*iter)->getAtomicVelocity()) < 0) 200 && (currentDeltat > MinimumDeltat)) { 201 currentDeltat = .5*currentDeltat; 202 LOG(2, "DEBUG: Upgrade in other direction: " << PositionUpdate.NormSquared() 203 << " > " << (*iter)->getAtomicVelocity().NormSquared() 204 << ", decreasing deltat: " << currentDeltat); 196 // steps may go back and forth again (updates are of same magnitude but 197 // have different sign: Check whether this is the case and one step with 198 // deltat to interrupt this sequence 199 const Vector PositionDifference = currentPosition - oldPosition; 200 if ((currentStep > 1) && (!PositionDifference.IsZero())) 201 if ((PositionUpdate.ScalarProduct(PositionDifference) < 0) 202 && (fabs(PositionUpdate.NormSquared()-PositionDifference.NormSquared()) < 1e-3)) { 203 // for convergence we want a null sequence here, too 204 if (!deltat_decreased) { 205 deltat_decreased = true; 206 currentDeltat = .5*currentDeltat; 207 } 208 LOG(2, "DEBUG: Upgrade in other direction: " << PositionUpdate 209 << " > " << PositionDifference 210 << ", using deltat: " << currentDeltat); 205 211 PositionUpdate = currentDeltat * currentGradient; 206 212 } 213 207 214 // finally set new values 208 215 (*iter)->setPosition(currentPosition + PositionUpdate); 209 (*iter)->setAtomicVelocity(PositionUpdate);210 //std::cout << "Id of atom is " << (*iter)->getId() << std::endl;211 // (*iter)->VelocityVerletUpdateU((*iter)->getId(), CurrentTimeStep-1, Deltat, IsAngstroem);212 216 } 213 217 }
Note:
See TracChangeset
for help on using the changeset viewer.