Candidate_v1.6.1
        Candidate_v1.7.0
        ChemicalSpaceEvaluator
        stable
      
      
        
          | 
            Last change
 on this file since 3e334e was             9861d0, checked in by Frederik Heber <frederik.heber@…>, 8 years ago           | 
        
        
          | 
             
BondVectors now return subset of BondVectors for a given atom. 
 
- functionality extracted from ForceAnnealing::annealWithBondgraph().
 - also the mapped_t type is now kept up-to-date internally as we need it
for returning the subset efficiently over a number of atoms, e.g. all
in the given range.
 - also moved a few simple implementations over to _impl module.
  
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.4 KB
           | 
        
      
      
| Rev | Line |   | 
|---|
| [d51e62] | 1 | /*
 | 
|---|
 | 2 |  * BondVectors_impl.hpp
 | 
|---|
 | 3 |  *
 | 
|---|
 | 4 |  *  Created on: Jun 13, 2017
 | 
|---|
 | 5 |  *      Author: heber
 | 
|---|
 | 6 |  */
 | 
|---|
 | 7 | 
 | 
|---|
 | 8 | 
 | 
|---|
 | 9 | #ifndef DYNAMICS_BONDVECTORS_IMPL_HPP_
 | 
|---|
 | 10 | #define DYNAMICS_BONDVECTORS_IMPL_HPP_
 | 
|---|
 | 11 | 
 | 
|---|
 | 12 | // include config.h
 | 
|---|
 | 13 | #ifdef HAVE_CONFIG_H
 | 
|---|
 | 14 | #include <config.h>
 | 
|---|
 | 15 | #endif
 | 
|---|
 | 16 | 
 | 
|---|
 | 17 | #include "BondVectors.hpp"
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | #include <algorithm>
 | 
|---|
 | 20 | 
 | 
|---|
 | 21 | #include "Atom/atom.hpp"
 | 
|---|
 | 22 | 
 | 
|---|
| [9861d0] | 23 | BondVectors::BondVectors() :
 | 
|---|
 | 24 |   map_is_dirty(false),
 | 
|---|
 | 25 |   current_step_for_map((size_t)-1)
 | 
|---|
 | 26 | {}
 | 
|---|
 | 27 | 
 | 
|---|
| [d51e62] | 28 | template <class T>
 | 
|---|
 | 29 | void BondVectors::setFromAtomRange(
 | 
|---|
 | 30 |     typename T::iterator _start,
 | 
|---|
 | 31 |     typename T::iterator _end,
 | 
|---|
 | 32 |     const size_t &_step)
 | 
|---|
 | 33 | {
 | 
|---|
 | 34 |   container.clear();
 | 
|---|
 | 35 |   for (typename T::iterator iter = _start; iter != _end; ++iter) {
 | 
|---|
 | 36 |     const atom &walker = **iter;
 | 
|---|
 | 37 |     const BondList &ListOfBonds = walker.getListOfBondsAtStep(_step);
 | 
|---|
 | 38 |     container.insert(container.end(), ListOfBonds.begin(), ListOfBonds.end());
 | 
|---|
 | 39 |   }
 | 
|---|
 | 40 |   // sort and make unique
 | 
|---|
 | 41 |   std::sort(container.begin(), container.end());
 | 
|---|
 | 42 |   container.erase(std::unique(container.begin(), container.end()), container.end());
 | 
|---|
| [9861d0] | 43 |   map_is_dirty = true;
 | 
|---|
 | 44 | }
 | 
|---|
 | 45 | 
 | 
|---|
 | 46 | const BondVectors::mapped_t&
 | 
|---|
 | 47 | BondVectors::getBondVectorsAtStep(const size_t &_step) const
 | 
|---|
 | 48 | {
 | 
|---|
 | 49 |   if (map_is_dirty || (current_step_for_map != _step))
 | 
|---|
 | 50 |     recalculateBondVectorsAtStep(_step);
 | 
|---|
 | 51 |   return current_mapped_vectors;
 | 
|---|
| [d51e62] | 52 | }
 | 
|---|
 | 53 | 
 | 
|---|
| [9861d0] | 54 | const BondVectors::container_t&
 | 
|---|
 | 55 | BondVectors::getSorted() const
 | 
|---|
 | 56 | {
 | 
|---|
 | 57 |   ASSERT( !container.empty(),
 | 
|---|
 | 58 |       "BondVectors::getSorted() - empty internal container, not set properly?");
 | 
|---|
 | 59 |   return container;
 | 
|---|
 | 60 | }
 | 
|---|
| [d51e62] | 61 | 
 | 
|---|
 | 62 | #endif /* DYNAMICS_BONDVECTORS_IMPL_HPP_ */
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.