- Timestamp:
- May 19, 2021, 7:06:29 PM (4 years ago)
- Branches:
- Candidate_v1.7.0, stable
- Children:
- 9b0dcd
- Parents:
- 698185
- git-author:
- Frederik Heber <frederik.heber@…> (05/19/21 11:00:24)
- git-committer:
- Frederik Heber <frederik.heber@…> (05/19/21 19:06:29)
- Location:
- src/Potentials
- Files:
-
- 5 edited
-
BindingModel.cpp (modified) (2 diffs)
-
BindingModel.hpp (modified) (1 diff)
-
CompoundPotential.cpp (modified) (3 diffs)
-
StreamFactory_EmpiricalPotential.cpp (modified) (1 diff)
-
StreamFactory_EmpiricalPotential.hpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Potentials/BindingModel.cpp
r698185 rc98620 37 37 38 38 #include "Potentials/BindingModel.hpp" 39 40 #include <iostream> 41 42 #include "CodePatterns/toString.hpp" 39 43 40 44 static HomologyGraph::nodes_t getMapOfNodes(const BindingModel::vector_nodes_t &_nodes) … … 79 83 } 80 84 85 std::ostream& operator<<(std::ostream& ost, const BindingModel &model) { 86 model.getGraph().printEdges(ost); 87 ost << ", " << model.getNodes(); 88 return ost; 89 } -
src/Potentials/BindingModel.hpp
r698185 rc98620 71 71 }; 72 72 73 74 std::ostream& operator<<(std::ostream& ost, const BindingModel &model); 75 76 73 77 #endif /* POTENTIALS_BINDINGMODEL_HPP_ */ -
src/Potentials/CompoundPotential.cpp
r698185 rc98620 62 62 // look though graph and place all matching FunctionModel's in 63 63 // PotentialRegistry in models 64 PotentialRegistry::const_iterator potentialiter = 65 PotentialRegistry::getInstance().getBeginIter(); 66 while (potentialiter != PotentialRegistry::getInstance().getEndIter()) { 64 for(PotentialRegistry::const_iterator potentialiter = PotentialRegistry::getInstance().getBeginIter(); 65 potentialiter != PotentialRegistry::getInstance().getEndIter(); ++potentialiter) { 67 66 // get model and types 68 67 EmpiricalPotential * const potential = potentialiter->second; … … 73 72 Extractors::elementcounts_t counts_per_element = 74 73 Extractors::_detail::getElementCounts(types); 75 // ASSERT( !counts_per_element.empty(),76 // "getFirstGraphwithSpecifiedElements() - element counts are empty?");77 74 LOG(2, "DEBUG: counts_per_element is " << counts_per_element << "."); 78 75 79 76 // check whether graph contains suitable types 80 Extractors::elementcounts_t::const_iterator countiter = counts_per_element.begin(); 81 for (; countiter != counts_per_element.end(); ++countiter) 82 if (!graph.hasGreaterEqualTimesAtomicNumber( 77 bool status = true; 78 for (Extractors::elementcounts_t::const_iterator countiter = counts_per_element.begin(); 79 (countiter != counts_per_element.end()) && (status); ++countiter) 80 status = status & (graph.hasGreaterEqualTimesAtomicNumber( 83 81 static_cast<size_t>(countiter->first), 84 82 static_cast<size_t>(countiter->second)) 85 ) 86 break; 87 // if we have a match for every count, store model 88 if( countiter == counts_per_element.end()) { 89 LOG(1, "INFO: Potential " << potentialiter->first << " matches with fragment."); 83 ); 84 // check whether graph contains all necessary edges 85 status &= graph.contains(potential->getBindingModel().getGraph()); 86 87 // if we have a matched all nodes and edges, store model 88 if( status) { 89 LOG(1, "INFO: Potential " << potential->getName() << " matches with fragment."); 90 90 models.push_back(static_cast<FunctionModel*>(potential)); 91 91 particletypes_per_model.push_back(types); 92 92 } 93 ++potentialiter;94 93 } 95 94 … … 430 429 ASSERT(!returnresults.empty(), 431 430 "CompoundPotential::parameter_derivative() - could not determine derivative for index " 432 +toString(index)+". This typically indicates that the derivative of the parameterof "433 +" a model should be evaluated which has notarguments in the partial argument list.");431 +toString(index)+". This typically indicates that a parameter derivative of " 432 +"a model is evaluated which has no arguments in the partial argument list."); 434 433 return returnresults; 435 434 } -
src/Potentials/StreamFactory_EmpiricalPotential.cpp
r698185 rc98620 49 49 std::istream &serialized) const 50 50 { 51 EmpiricalPotential * const potential = getDefaultPotential(potentialtype);51 EmpiricalPotential * full_potential; 52 52 // now stream in types and parameters 53 53 try { 54 EmpiricalPotential * const potential = getDefaultPotential(potentialtype); 54 55 potential->stream_from(serialized); 56 // also need to generate the binding model 57 full_potential = createInstance(potentialtype, potential->getParticleTypes()); 58 delete potential; 55 59 } catch (SerializerMissingValueException &e) { 56 60 ELOG(1, "Missing value for potential in line " << e.what()); 57 61 } 58 62 59 return potential;63 return full_potential; 60 64 } -
src/Potentials/StreamFactory_EmpiricalPotential.hpp
r698185 rc98620 16 16 17 17 #include "StreamFactory.hpp" 18 19 #include <string> 18 20 19 21 #include "Potentials/EmpiricalPotential.hpp" … … 48 50 */ 49 51 virtual EmpiricalPotential* getDefaultPotential(const std::string &_name) const=0; 52 53 virtual EmpiricalPotential *createInstance( 54 const std::string &potentialtype, 55 const SerializablePotential::ParticleTypes_t &charges) const=0; 56 50 57 }; 51 58
Note:
See TracChangeset
for help on using the changeset viewer.
