Changeset df350c
- Timestamp:
- Feb 27, 2013, 12:39:03 PM (12 years ago)
- 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:
- 9897ee9
- Parents:
- caa00e9
- git-author:
- Frederik Heber <heber@…> (12/06/12 10:38:00)
- git-committer:
- Frederik Heber <heber@…> (02/27/13 12:39:03)
- Location:
- src/FunctionApproximation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/FunctionApproximation/Extractors.cpp
rcaa00e9 rdf350c 506 506 } 507 507 508 FunctionModel::arguments_t Extractors::reorderArgumentsByParticleTypes( 509 const FunctionModel::arguments_t &args, 510 const ParticleTypes_t &_types 511 ) 512 { 513 typedef std::list< argument_t > ListArguments_t; 514 ListArguments_t availableList(args.begin(), args.end()); 515 FunctionModel::arguments_t returnargs; 516 returnargs.reserve(args.size()); 517 518 // TODO: fill a lookup map such that we don't have O(M^3) scaling, if M is number 519 // of types (and we always must have M(M-1)/2 args) but O(M^2 log(M)). However, as 520 // M is very small (<=3), this is not necessary fruitful now. 521 // typedef ParticleTypes_t firsttype; 522 // typedef ParticleTypes_t secondtype; 523 // typedef std::map< firsttype, std::map< secondtype, boost::ref(args) > > ArgsLookup_t; 524 // ArgsLookup_t ArgsLookup; 525 526 // basically, we have two choose any two pairs out of types but only those 527 // where the first is less than the letter. Hence, we start the second 528 // iterator at the current position of the first one and skip the equal case. 529 for (ParticleTypes_t::const_iterator firstiter = _types.begin(); 530 firstiter != _types.end(); 531 ++firstiter) { 532 for (ParticleTypes_t::const_iterator seconditer = firstiter; 533 seconditer != _types.end(); 534 ++seconditer) { 535 if (seconditer == firstiter) 536 continue; 537 538 // search the right one in _args (we might allow switching places of 539 // firstiter and seconditer, as distance is symmetric). 540 ListArguments_t::iterator iter = availableList.begin(); 541 for (;iter != availableList.end(); ++iter) { 542 LOG(3, "DEBUG: Current args is " << *iter << "."); 543 if ((iter->types.first == *firstiter) 544 && (iter->types.second == *seconditer)) { 545 returnargs.push_back( *iter ); 546 break; 547 } 548 else if ((iter->types.first == *seconditer) 549 && (iter->types.second == *firstiter)) { 550 argument_t flippedtypes(*iter); 551 std::swap( flippedtypes.indices.first, flippedtypes.indices.second ); 552 std::swap( flippedtypes.types.first, flippedtypes.types.second ); 553 returnargs.push_back( flippedtypes ); 554 break; 555 } 556 } 557 ASSERT( iter != availableList.end(), 558 "Extractors::reorderArgumentsByParticleTypes() - could not find arguments to " 559 +toString(*firstiter)+","+toString(*seconditer)+"."); 560 availableList.erase(iter); 561 } 562 } 563 // LOG(2, "DEBUG: Final list of args is " << returnargs << "."); 564 565 return returnargs; 566 } -
src/FunctionApproximation/Extractors.hpp
rcaa00e9 rdf350c 33 33 typedef std::map< element_t, chargeiters_t > elementtargets_t; 34 34 typedef std::vector< chargeiters_t > targets_per_combination_t; 35 //!> typedef for particle designation 36 typedef int ParticleType_t; 37 //!> typedef for a vector of particle designations 38 typedef std::vector<ParticleType_t> ParticleTypes_t; 35 39 36 40 /** Namespace for some internal helper functions. … … 297 301 ); 298 302 303 /** Reorder arguments according to types. 304 * 305 * If particle types is (0,1,2) and three argumens, each with a pair of types, 306 * are given, then the alignment will be: (0,1), (0,2), and (1,2). 307 * 308 * \param args arguments to reorder 309 * \param _types particle type vector 310 * \return reordered args 311 */ 312 FunctionModel::arguments_t reorderArgumentsByParticleTypes( 313 const FunctionModel::arguments_t &args, 314 const ParticleTypes_t &_types 315 ); 299 316 }; /* namespace Extractors */ 300 317
Note:
See TracChangeset
for help on using the changeset viewer.