Ignore:
Timestamp:
Apr 4, 2018, 4:59:48 PM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
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:
322d58
Parents:
9b32071
git-author:
Frederik Heber <heber@…> (04/05/17 15:10:22)
git-committer:
Frederik Heber <frederik.heber@…> (04/04/18 16:59:48)
Message:

Added reset() function to ForceAnnealing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Dynamics/ForceAnnealing.hpp

    r9b32071 r1e49e6  
    8585    }
    8686
    87     // are we in initial step? Then don't check against velocity
    8887    Vector maxComponents(zeroVec);
    8988    for(typename AtomSetMixin<T>::iterator iter = AtomicForceManipulator<T>::atoms.begin();
     
    9392      const Vector currentGradient = (*iter)->getAtomicForce();
    9493      LOG(4, "DEBUG: Force for atom " << **iter << " is " << currentGradient);
     94
     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).
    9599      Vector PositionUpdate = currentDeltat * currentGradient;
    96100      LOG(3, "DEBUG: Update would be " << PositionUpdate);
     
    101105          maxComponents[i] = currentGradient[i];
    102106
    103       // update with currentDelta tells us how the current gradient relates to
    104       // the last one: If it has become larger, reduce currentDelta
     107      // are we in initial step? Then don't check against velocity
    105108      if ((currentStep > 1) && (!(*iter)->getAtomicVelocity().IsZero()))
     109        // update with currentDelta tells us how the current gradient relates to
     110        // the last one: If it has become larger, reduce currentDelta
    106111        if ((PositionUpdate.ScalarProduct((*iter)->getAtomicVelocity()) < 0)
    107112            && (currentDeltat > MinimumDeltat)) {
     
    130135    if (currentStep == maxSteps) {
    131136      LOG(2, "DEBUG: Final step, resetting values");
    132       currentDeltat = 0.;
    133       currentStep = 0;
     137      reset();
     138    }
     139  }
    134140
    135       // reset (artifical) velocities
    136       for(typename AtomSetMixin<T>::iterator iter = AtomicForceManipulator<T>::atoms.begin();
    137           iter != AtomicForceManipulator<T>::atoms.end(); ++iter)
    138         (*iter)->setAtomicVelocity(zeroVec);
    139     }
     141  /** Reset function to unset static entities and artificial velocities.
     142   *
     143   */
     144  void reset()
     145  {
     146    currentDeltat = 0.;
     147    currentStep = 0;
     148
     149    // reset (artifical) velocities
     150    for(typename AtomSetMixin<T>::iterator iter = AtomicForceManipulator<T>::atoms.begin();
     151        iter != AtomicForceManipulator<T>::atoms.end(); ++iter)
     152      (*iter)->setAtomicVelocity(zeroVec);
    140153  }
    141154
Note: See TracChangeset for help on using the changeset viewer.