Ignore:
Timestamp:
Sep 6, 2016, 2:36:46 PM (8 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, GeometryObjects, Gui_displays_atomic_force_velocity, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
ce70d25
Parents:
29ce5f
git-author:
Frederik Heber <heber@…> (09/01/16 14:45:46)
git-committer:
Frederik Heber <heber@…> (09/06/16 14:36:46)
Message:

FIX: PotentialTrainer::getFirstGraphwithSpecifiedElements() did not match graph exactly.

  • we just checked for the set of elements to be contained but the given set of elements needs to be matched exactly, e.g. CNH4 contains CH4 but is not what we want.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Potentials/PotentialTrainer.cpp

    r29ce5f r945797  
    192192  ASSERT( !counts_per_charge.empty(),
    193193      "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 << ".");
    195195  // we want to check each (unique) key only once
    196196  HomologyContainer::const_key_iterator olditer = homologies.key_end();
     
    203203    else
    204204      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)
    214218      return *iter;
    215219  }
Note: See TracChangeset for help on using the changeset viewer.