Changeset 24430b for src/Dynamics/BondVectors.cpp
- Timestamp:
- Nov 12, 2017, 8:48:39 AM (7 years ago)
- Branches:
- ForceAnnealing_with_BondGraph_continued_betteresults
- Children:
- 1f244c
- Parents:
- fd0b4a
- git-author:
- Frederik Heber <frederik.heber@…> (06/29/17 14:40:12)
- git-committer:
- Frederik Heber <frederik.heber@…> (11/12/17 08:48:39)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Dynamics/BondVectors.cpp
rfd0b4a r24430b 41 41 #include <iterator> 42 42 43 #include "CodePatterns/Assert.hpp" 44 #include "CodePatterns/Log.hpp" 45 43 46 #include "Atom/atom.hpp" 47 #include "Bond/bond.hpp" 44 48 45 BondVectors::mapped_t BondVectors::getBondVectorsAtStep(49 void BondVectors::recalculateBondVectorsAtStep( 46 50 const size_t &_step) const 47 51 { 48 mapped_t returnlist;52 current_mapped_vectors.clear(); 49 53 50 54 ASSERT( !container.empty(), … … 56 60 - current_bond->rightatom->getPositionAtStep(_step); 57 61 BondVector.Normalize(); 58 returnlist.insert( std::make_pair(current_bond, BondVector) );62 current_mapped_vectors.insert( std::make_pair(current_bond, BondVector) ); 59 63 } 60 ASSERT( returnlist.size() == container.size(),64 ASSERT( current_mapped_vectors.size() == container.size(), 61 65 "BondVectors::getBondVectors() - not same amount of bond vectors as bonds?"); 62 66 63 return returnlist; 67 map_is_dirty = false; 68 current_step_for_map = _step; 64 69 } 65 70 … … 76 81 } 77 82 83 std::vector<Vector> BondVectors::getAtomsBondVectorsAtStep( 84 const atom &_walker, 85 const size_t &_step) const 86 { 87 if (map_is_dirty || (current_step_for_map != _step)) 88 recalculateBondVectorsAtStep(_step); 89 90 std::vector<Vector> BondVectors; 91 // gather subset of BondVectors for the current atom 92 const BondList& ListOfBonds = _walker.getListOfBonds(); 93 for(BondList::const_iterator bonditer = ListOfBonds.begin(); 94 bonditer != ListOfBonds.end(); ++bonditer) { 95 const bond::ptr ¤t_bond = *bonditer; 96 const BondVectors::mapped_t::const_iterator bviter = 97 current_mapped_vectors.find(current_bond); 98 ASSERT( bviter != current_mapped_vectors.end(), 99 "ForceAnnealing() - cannot find current_bond ?"); 100 ASSERT( bviter != current_mapped_vectors.end(), 101 "ForceAnnealing - cannot find current bond "+toString(*current_bond) 102 +" in bonds."); 103 BondVectors.push_back(bviter->second); 104 } 105 LOG(4, "DEBUG: BondVectors for atom #" << _walker.getId() << ": " << BondVectors); 106 107 return BondVectors; 108 }
Note:
See TracChangeset
for help on using the changeset viewer.