Changeset 821b07
- Timestamp:
- Sep 1, 2016, 2:45:48 PM (9 years ago)
- Branches:
- Gui_Fixes
- Children:
- 0b785a
- Parents:
- 622f71
- git-author:
- Frederik Heber <heber@…> (09/01/16 14:45:46)
- git-committer:
- Frederik Heber <heber@…> (09/01/16 14:45:48)
- Location:
- src/Potentials
- Files:
-
- 2 edited
-
PotentialTrainer.cpp (modified) (2 diffs)
-
PotentialTrainer.hpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/Potentials/PotentialTrainer.cpp
r622f71 r821b07 192 192 ASSERT( !counts_per_charge.empty(), 193 193 "getFirstGraphwithSpecifiedElements() - charge counts are empty?"); 194 LOG( 2, "DEBUG: counts_per_charge is " << counts_per_charge << ".");194 LOG(1, "DEBUG: counts_per_charge is " << counts_per_charge << "."); 195 195 // we want to check each (unique) key only once 196 196 HomologyContainer::const_key_iterator olditer = homologies.key_end(); … … 203 203 else 204 204 olditer = iter; 205 // if it's a new key, check if every element has the right number of counts 206 Extractors::elementcounts_t::const_iterator countiter = counts_per_charge.begin(); 207 for (; countiter != counts_per_charge.end(); ++countiter) 208 if (!(*iter).hasTimesAtomicNumber( 209 static_cast<size_t>(countiter->first), 210 static_cast<size_t>(countiter->second)) 211 ) 212 break; 213 if( countiter == counts_per_charge.end()) 205 // check whether we have the same set of atomic numbers 206 const HomologyGraph::nodes_t &nodes = (*iter).getNodes(); 207 Extractors::elementcounts_t nodes_counts_per_charge; 208 for (HomologyGraph::nodes_t::const_iterator nodeiter = nodes.begin(); 209 nodeiter != nodes.end(); ++nodeiter) { 210 const Extractors::element_t elem = nodeiter->first.getAtomicNumber(); 211 const std::pair<Extractors::elementcounts_t::iterator, bool> inserter = 212 nodes_counts_per_charge.insert( std::make_pair(elem, (Extractors::count_t)nodeiter->second ) ); 213 if (!inserter.second) 214 inserter.first->second += (Extractors::count_t)nodeiter->second; 215 } 216 LOG(1, "DEBUG: Node (" << *iter << ")'s counts_per_charge is " << nodes_counts_per_charge << "."); 217 if (counts_per_charge == nodes_counts_per_charge) 214 218 return *iter; 215 219 } -
src/Potentials/PotentialTrainer.hpp
r622f71 r821b07 40 40 const unsigned int _best_of_howmany) const; 41 41 42 /** Get the first matching homologous graph based only on the number of nodes. 43 * 44 * We could directly access the equal_range in the HomologyContainer we if were 45 * specified the full HomologyGraph. However, if we have only get "CH4", then 46 * we lack the bonding structure, hence one half of the graph is missing. 47 * 48 * Therefore, we step through all graphs and get the first to match exactly 49 * with the number of specified element.s 50 * 51 * \param homologies container sorted by homologous fragments/graphs 52 * \param types fragment specification, e.g. "CH4" 53 * \return the first matching HomologyGraph 54 */ 42 55 static 43 56 HomologyGraph getFirstGraphwithSpecifiedElements(
Note:
See TracChangeset
for help on using the changeset viewer.
