Ignore:
Timestamp:
Feb 27, 2013, 12:39:03 PM (12 years ago)
Author:
Frederik Heber <heber@…>
Branches:
Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, 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_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, 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, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
Children:
7b019a
Parents:
9897ee9
git-author:
Frederik Heber <heber@…> (12/07/12 14:48:44)
git-committer:
Frederik Heber <heber@…> (02/27/13 12:39:03)
Message:

FIX: Extractor's convertTargetsToArguments() did not set argument_t's indices correctly.

  • we cannot use gatherAllSymmetricDistanceArguments() as then the correct indices are lost. Hence, we rewrite convertTargetsToArguments() to convert directly to arguments (as also the naming suggests).
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/FunctionApproximation/Extractors.cpp

    r9897ee9 r69fcba  
    348348}
    349349
     350const Fragment::position_t& getPositionToChargeIter(
     351    const Fragment::positions_t& positions,
     352    const Fragment::charges_t& charges,
     353    const Extractors::chargeiter_t &iter
     354    )
     355{
     356  Fragment::positions_t::const_iterator positer = positions.begin();
     357  std::advance(positer, std::distance(charges.begin(), iter));
     358  const Fragment::position_t &position = *positer;
     359  return position;
     360}
     361
     362
    350363FunctionModel::arguments_t
    351364Extractors::_detail::convertTargetsToArguments(
     
    357370{
    358371  FunctionModel::arguments_t args;
    359   // create arguments from each combination
     372  // create arguments from each combination. We cannot use
     373  // gatherallSymmetricDistanceArguments() because it would not create the
     374  // correct indices.
    360375  for (targets_per_combination_t::const_iterator iter = combinations.begin();
    361376      iter != combinations.end();
    362377      ++iter) {
    363     Fragment::positions_t partpositions;
    364     Fragment::charges_t partcharges;
    365     partpositions.reserve(iter->size());
    366     partcharges.reserve(iter->size());
    367     for(chargeiters_t::const_iterator targetiter = iter->begin();
    368         targetiter != iter->end();
    369         ++targetiter) {
    370       Fragment::positions_t::const_iterator positer = positions.begin();
    371       std::advance(positer, std::distance(charges.begin(), *targetiter));
    372       partpositions.push_back(*positer);
    373       partcharges.push_back(**targetiter);
    374     }
    375     FunctionModel::arguments_t partargs =
    376         gatherAllSymmetricDistanceArguments(partpositions, partcharges, globalid);
    377     args.insert(args.end(), partargs.begin(), partargs.end());
     378    for(chargeiters_t::const_iterator firstiter = iter->begin();
     379        firstiter != iter->end();
     380        ++firstiter) {
     381      const Fragment::position_t &firstpos =
     382          getPositionToChargeIter(positions, charges, *firstiter);
     383      const Vector firsttemp(firstpos[0],firstpos[1],firstpos[2]);
     384      for(chargeiters_t::const_iterator seconditer = firstiter;
     385          seconditer != iter->end();
     386          ++seconditer) {
     387        if (firstiter == seconditer)
     388          continue;
     389        const Fragment::position_t &secondpos =
     390            getPositionToChargeIter(positions, charges, *seconditer);
     391        const Vector secondtemp(secondpos[0],secondpos[1],secondpos[2]);
     392        argument_t arg;
     393        arg.distance = firsttemp.distance(secondtemp);
     394        arg.indices.first = std::distance(charges.begin(), *firstiter);
     395        arg.indices.second = std::distance(charges.begin(), *seconditer);
     396        arg.types.first = **firstiter;
     397        arg.types.second = **seconditer;
     398        args.push_back( arg );
     399      }
     400    }
    378401  }
    379402
Note: See TracChangeset for help on using the changeset viewer.