Changeset c5e75f3 for src/Potentials


Ignore:
Timestamp:
Nov 4, 2016, 9:37:50 AM (8 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, Automaking_mpqc_open, AutomationFragmentation_failures, 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_ChronosMutex, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, 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_IntegrationTest, 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, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, ThirdParty_MPQC_rebuilt_buildsystem, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, Ubuntu_1604_changes, stable
Children:
d5ca1a
Parents:
c7aac9
git-author:
Frederik Heber <heber@…> (10/03/16 10:35:00)
git-committer:
Frederik Heber <heber@…> (11/04/16 09:37:50)
Message:

ParticleType_t is now an unsigned int.

  • this allows direct use of atomicNumber_t and also signed integers dont' make much sense for a particle type, i.e. an id.
Location:
src/Potentials
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/Potentials/CompoundPotential.cpp

    rc7aac9 rc5e75f3  
    7070        potential->getParticleTypes();
    7171
    72     // create charges
    73     Fragment::charges_t charges;
    74     charges.resize(types.size());
    75     std::transform(types.begin(), types.end(),
    76         charges.begin(), boost::lambda::_1);
    7772    // convert into count map
    78     Extractors::elementcounts_t counts_per_charge =
    79         Extractors::_detail::getElementCounts(charges);
    80 //    ASSERT( !counts_per_charge.empty(),
    81 //        "getFirstGraphwithSpecifiedElements() - charge counts are empty?");
    82     LOG(2, "DEBUG: counts_per_charge is " << counts_per_charge << ".");
     73    Extractors::elementcounts_t counts_per_element =
     74        Extractors::_detail::getElementCounts(types);
     75//    ASSERT( !counts_per_element.empty(),
     76//        "getFirstGraphwithSpecifiedElements() - element counts are empty?");
     77    LOG(2, "DEBUG: counts_per_element is " << counts_per_element << ".");
    8378
    8479    // check whether graph contains suitable types
    85     Extractors::elementcounts_t::const_iterator countiter = counts_per_charge.begin();
    86     for (; countiter != counts_per_charge.end(); ++countiter)
     80    Extractors::elementcounts_t::const_iterator countiter = counts_per_element.begin();
     81    for (; countiter != counts_per_element.end(); ++countiter)
    8782      if (!graph.hasGreaterEqualTimesAtomicNumber(
    8883          static_cast<size_t>(countiter->first),
     
    9186        break;
    9287    // if we have a match for every count, store model
    93     if( countiter == counts_per_charge.end()) {
     88    if( countiter == counts_per_element.end()) {
    9489      LOG(1, "INFO: Potential " << potentialiter->first << " matches with fragment.");
    9590      models.push_back(static_cast<FunctionModel*>(potential));
  • src/Potentials/PotentialTrainer.cpp

    rc7aac9 rc5e75f3  
    193193  ASSERT( !types.empty(),
    194194      "getFirstGraphwithSpecifiedElements() - charges is empty?");
    195   // create charges
    196   Fragment::charges_t charges;
    197   charges.resize(types.size());
    198   std::transform(types.begin(), types.end(),
    199       charges.begin(), boost::lambda::_1);
     195
    200196  // convert into count map
    201   Extractors::elementcounts_t counts_per_charge =
    202       Extractors::_detail::getElementCounts(charges);
    203   ASSERT( !counts_per_charge.empty(),
    204       "getFirstGraphwithSpecifiedElements() - charge counts are empty?");
    205   LOG(1, "DEBUG: counts_per_charge is " << counts_per_charge << ".");
     197  Extractors::elementcounts_t counts_per_element =
     198      Extractors::_detail::getElementCounts(types);
     199  ASSERT( !counts_per_element.empty(),
     200      "getFirstGraphwithSpecifiedElements() - element counts are empty?");
     201  LOG(1, "DEBUG: counts_per_element is " << counts_per_element << ".");
    206202  // we want to check each (unique) key only once
    207203  HomologyContainer::const_key_iterator olditer = homologies.key_end();
     
    216212    // check whether we have the same set of atomic numbers
    217213    const HomologyGraph::nodes_t &nodes = (*iter).getNodes();
    218     Extractors::elementcounts_t nodes_counts_per_charge;
     214    Extractors::elementcounts_t nodes_counts_per_element;
    219215    for (HomologyGraph::nodes_t::const_iterator nodeiter = nodes.begin();
    220216        nodeiter != nodes.end(); ++nodeiter) {
    221217      const Extractors::element_t elem = nodeiter->first.getAtomicNumber();
    222218      const std::pair<Extractors::elementcounts_t::iterator, bool> inserter =
    223           nodes_counts_per_charge.insert( std::make_pair(elem, (Extractors::count_t)nodeiter->second ) );
     219          nodes_counts_per_element.insert( std::make_pair(elem, (Extractors::count_t)nodeiter->second ) );
    224220      if (!inserter.second)
    225221        inserter.first->second += (Extractors::count_t)nodeiter->second;
    226222    }
    227     LOG(1, "DEBUG: Node (" << *iter << ")'s counts_per_charge is " << nodes_counts_per_charge << ".");
    228     if (counts_per_charge == nodes_counts_per_charge)
     223    LOG(1, "DEBUG: Node (" << *iter << ")'s counts_per_element is " << nodes_counts_per_element << ".");
     224    if (counts_per_element == nodes_counts_per_element)
    229225      return *iter;
    230226  }
  • src/Potentials/SerializablePotential.hpp

    rc7aac9 rc5e75f3  
    3939public:
    4040  //!> typedef for particle designation
    41   typedef int ParticleType_t;
     41  typedef unsigned int ParticleType_t;
    4242  //!> typedef for a vector of particle designations
    4343  typedef std::vector<ParticleType_t> ParticleTypes_t;
Note: See TracChangeset for help on using the changeset viewer.