Changeset 84f449


Ignore:
Timestamp:
Jul 5, 2017, 7:45:46 PM (8 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
ForceAnnealing_oldresults
Children:
bd0159
Parents:
8ab061f
git-author:
Frederik Heber <heber@…> (04/05/17 15:10:22)
git-committer:
Frederik Heber <frederik.heber@…> (07/05/17 19:45:46)
Message:

Added reset() function to ForceAnnealing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Dynamics/ForceAnnealing.hpp

    r8ab061f r84f449  
    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.