Changeset 07d4b1 for src/Dynamics


Ignore:
Timestamp:
Apr 10, 2018, 6:43:30 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
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:
90050b
Parents:
f433ec
git-author:
Frederik Heber <frederik.heber@…> (08/02/17 20:25:57)
git-committer:
Frederik Heber <frederik.heber@…> (04/10/18 06:43:30)
Message:

BondVectors::getRemnant...() now requires atom's gradient.

  • No more default anneal() without bondgraph, and can't store remnant gradient in force.
Location:
src/Dynamics
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Dynamics/BondVectors.cpp

    rf433ec r07d4b1  
    287287Vector BondVectors::getRemnantGradientForAtomAtStep(
    288288    const atom &_walker,
     289    const Vector &_walkerGradient,
    289290    const std::vector<Vector> _BondVectors,
    290291    const BondVectors::weights_t &_weights,
     
    292293    forcestore_t _forcestore) const
    293294{
    294   const Vector &walkerGradient = _walker.getAtomicForceAtStep(_step);
    295295  BondVectors::weights_t::const_iterator weightiter = _weights.begin();
    296296  std::vector<Vector>::const_iterator vectoriter = _BondVectors.begin();
     
    303303    const Vector &BondVector = *vectoriter;
    304304
    305     const double temp = (*weightiter)*walkerGradient.ScalarProduct(BondVector);
     305    const double temp = (*weightiter)*_walkerGradient.ScalarProduct(BondVector);
    306306    _forcestore(_walker, current_bond, _step, temp);
    307307    LOG(4, "DEBUG: BondVector " << BondVector << " receives projected force of "
    308         << temp);
     308        << (*weightiter) << "*" << _walkerGradient << "*" << BondVector << " = " << temp);
    309309    forcesum += temp * BondVector;
    310310  }
     
    314314      "BondVectors::getRemnantGradientForAtomAtStep() - vectoriter is not at end when it should be.");
    315315
    316   return walkerGradient-forcesum;
     316  return _walkerGradient-forcesum;
    317317}
    318318
  • src/Dynamics/BondVectors.hpp

    rf433ec r07d4b1  
    129129   *
    130130   * \param _walker atom to get BondVectors for
     131   * \param _walkerGradient gradient of atom to get BondVectors for
    131132   * \param _BondVectors precalculated bond vectors for given \a _walker
    132133   * \param _weights weight per bond vector (as it is a frame, not a basis)
     
    137138  Vector getRemnantGradientForAtomAtStep(
    138139      const atom &_walker,
     140      const Vector &_walkerGradient,
    139141      const std::vector<Vector> _BondVectors,
    140142      const BondVectors::weights_t &_weights,
  • src/Dynamics/ForceAnnealing.hpp

    rf433ec r07d4b1  
    122122      if (_UseBondgraph)
    123123        annealWithBondGraph(_CurrentTimeStep, _offset, maxComponents);
    124       anneal(_CurrentTimeStep, _offset, maxComponents);
     124      // cannot store RemnantGradient in Atom's Force as it ruins BB stepwidth calculation
     125      else
     126        anneal(_CurrentTimeStep, _offset, maxComponents);
    125127    }
    126128
     
    368370                  boost::cref(bv), boost::ref(projected_forces));
    369371          const Vector RemnantGradient = bv.getRemnantGradientForAtomAtStep(
    370               walker, BondVectors, weights, timestep, forcestoring
     372              walker, walkerGradient, BondVectors, weights, timestep, forcestoring
    371373          );
    372374          RemnantGradient_per_atom.insert( std::make_pair(walker.getId(), RemnantGradient) );
     
    513515          + update);
    514516      walker->setAtomicVelocity(update);
    515       walker->setAtomicForce( RemnantGradient_per_atom[walker->getId()] );
     517//      walker->setAtomicForce( RemnantGradient_per_atom[walker->getId()] );
    516518    }
    517519  }
Note: See TracChangeset for help on using the changeset viewer.