Changeset 0dd99b for src/Dynamics/BondVectors.cpp
- Timestamp:
- Nov 29, 2017, 11:06:25 PM (7 years ago)
- Branches:
- ForceAnnealing_with_BondGraph_continued_betteresults
- Children:
- 2a0a651
- Parents:
- 9f1fee5
- git-author:
- Frederik Heber <frederik.heber@…> (08/10/17 15:35:45)
- git-committer:
- Frederik Heber <frederik.heber@…> (11/29/17 23:06:25)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Dynamics/BondVectors.cpp
r9f1fee5 r0dd99b 285 285 } 286 286 287 void BondVectors::getProjectedGradientsForAtomAtStep( 288 const atom &_walker, 289 const Vector &_walkerGradient, 290 const size_t _timestep, 291 std::vector< std::vector<double> > &_projected_forces) const 292 { 293 // gather subset of BondVectors for the current atom 294 const std::vector<Vector> BondVectors = getAtomsBondVectorsAtStep(_walker, _timestep); 295 const BondList& ListOfBonds = _walker.getListOfBonds(); // we always use current bonds 296 297 // go over all its bonds 298 std::vector<Vector>::const_iterator vectoriter = BondVectors.begin(); 299 for(BondList::const_iterator bonditer = ListOfBonds.begin(); 300 bonditer != ListOfBonds.end(); ++bonditer, ++vectoriter) { 301 const bond::ptr ¤t_bond = *bonditer; 302 const Vector &BondVector = *vectoriter; 303 304 // bv goes from rightatom to leftatom 305 // as plus sign in force indicates expansion, minus indicates contraction 306 // leftatom: from right to left means same sign expansion, opposite contraction 307 // rightatom: from right to left means opposite sign expansion, same sign contraction 308 const double sign = (&_walker == current_bond->leftatom) ? 1. : -1.; 309 const double temp = sign*_walkerGradient.ScalarProduct(BondVector); 310 LOG(4, "DEBUG: BondVector " << BondVector << " receives projected force of " 311 << sign << "*" << _walkerGradient << "*" << BondVector << " = " << temp); 312 const size_t index = getIndexForBond(current_bond); 313 ASSERT( index != (size_t)-1, 314 "ForceAnnealing() - could not find bond "+toString(*current_bond) 315 +" in bondvectors"); 316 std::vector<double> &forcelist = (&_walker == current_bond->leftatom) ? 317 _projected_forces[leftside] : _projected_forces[rightside]; 318 forcelist[index] = temp; 319 } 320 ASSERT( vectoriter == BondVectors.end(), 321 "BondVectors::getRemnantGradientForAtomAtStep() - vectoriter is not at end when it should be."); 322 } 323 287 324 Vector BondVectors::getRemnantGradientForAtomAtStep( 288 325 const atom &_walker,
Note:
See TracChangeset
for help on using the changeset viewer.