Ignore:
Timestamp:
May 19, 2021, 7:06:29 PM (4 years ago)
Author:
Frederik Heber <frederik.heber@…>
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)
Message:

FIX: StreamFactory did not set BindingModel.

  • we streamed into a default potential instance but this does not set the BindingModel. Now, we use the particle types from that deseralized instance and instantiate a new potential that then also generates the BindingModel.
  • added output operator to BindingModel.
  • TEST: This fixes the fit-compound-potential regression test case.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Potentials/CompoundPotential.cpp

    r698185 rc98620  
    6262  // look though graph and place all matching FunctionModel's in
    6363  // 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) {
    6766    // get model and types
    6867    EmpiricalPotential * const potential = potentialiter->second;
     
    7372    Extractors::elementcounts_t counts_per_element =
    7473        Extractors::_detail::getElementCounts(types);
    75 //    ASSERT( !counts_per_element.empty(),
    76 //        "getFirstGraphwithSpecifiedElements() - element counts are empty?");
    7774    LOG(2, "DEBUG: counts_per_element is " << counts_per_element << ".");
    7875
    7976    // 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(
    8381          static_cast<size_t>(countiter->first),
    8482          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.");
    9090      models.push_back(static_cast<FunctionModel*>(potential));
    9191      particletypes_per_model.push_back(types);
    9292    }
    93     ++potentialiter;
    9493  }
    9594
     
    430429  ASSERT(!returnresults.empty(),
    431430      "CompoundPotential::parameter_derivative() - could not determine derivative for index "
    432       +toString(index)+". This typically indicates that the derivative of the parameter of "
    433       +" a model should be evaluated which has not arguments 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.");
    434433  return returnresults;
    435434}
Note: See TracChangeset for help on using the changeset viewer.