Ignore:
Timestamp:
Feb 24, 2013, 12:59:18 PM (13 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, Candidate_v1.7.0, 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:
c91572
Parents:
b6b5b8
git-author:
Frederik Heber <heber@…> (02/19/13 12:42:38)
git-committer:
Frederik Heber <heber@…> (02/24/13 12:59:18)
Message:

REFACTOR: PowerSetGenerator now creates all orders in one go, not limited to one by one increments.

  • atom_bondedparticle's MaxOrder is not a bool but an int containing the desired final order set by CheckOrderAtSite and compared to AdaptiveOrder to obtain its old meaning.
  • UniqueFragments now contains a vector of n Graphs to place n-body fragments in that are later combined. Also, cleaned up a lot of old functions and merged stuff into cstor. FreeAllOrdersList() and CombineAllOrderListIntoOne() have been adapted accordingly.
  • Fragmentation::FragmentBOSSANOVA now uses fully again FragmentLowerOrdersList which now has the above n slots to place n-body fragments in and which is passed by ref to UniqueFragments.
  • SPFragmentGenerator now always stores the current fragment, only in a specific slot in UniqueFragment's Graphs, and it recurses if there are enough SP levels and plces left.
  • FIX: BondsPerShortestPath properly prints and informs about resetting the path list.
  • We checked extra that BondFragments come out exactly as before (same order because of the Graph being a map naturally). The only difference is the OrderAtSite file which now has more than 0/1 values in the second entry.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Fragmentation/PowerSetGenerator.cpp

    rb6b5b8 rd760bb  
    5050 *
    5151 */
    52 PowerSetGenerator::PowerSetGenerator(class UniqueFragments *_FragmentSearch, int Order) :
    53   BondsPerSPList(Order),
     52PowerSetGenerator::PowerSetGenerator(UniqueFragments *_FragmentSearch, int _Order) :
     53  BondsPerSPList(_Order),
    5454  FragmentSearch(_FragmentSearch)
    5555{}
     
    213213  int SP = BondsPerSPList.CountNumbersInBondsList();
    214214  LOG(0, "Total number of edges is " << SP << ".");
    215   if (SP >= (BondsPerSPList.getOrder()-1)) {
     215  {
    216216    // start with root (push on fragment stack)
    217217    LOG(0, "Starting fragment generation with " << *FragmentSearch->getRoot() << ", local nr is " << FragmentSearch->getRoot()->getNr() << ".");
     
    227227
    228228    SPFragmentGenerator(0, BondsList, BondsPerSPList.BondsPerSPCount[0], BondsPerSPList.getOrder());
    229   } else {
    230     LOG(0, "Not enough total number of edges to build " << BondsPerSPList.getOrder() << "-body fragments.");
    231229  }
    232230
     
    261259  Info info(__func__);
    262260  int verbosity = 0; //FragmentSearch->ANOVAOrder-SubOrder;
    263   int NumCombinations;
    264   int bits, TouchedIndex, SubSetDimension, SP, Added;
     261  int TouchedIndex, SubSetDimension, Added;
    265262  int SpaceLeft;
    266263  int *TouchedList = new int[SubOrder + 1];
    267264  KeySetTestPair TestKeySetInsert;
    268265
    269   NumCombinations = 1 << SetDimension;
     266  const int NumCombinations = 1 << SetDimension;
    270267
    271268  // here for all bonds of Walker all combinations of end pieces (from the bonds)
     
    282279  for (int i=1;i<NumCombinations;i++) {  // sweep through all power set combinations (skip empty set!)
    283280    // count the set bit of i
    284     bits = 0;
    285     for (int j=SetDimension;j--;)
    286       bits += (i & (1 << j)) >> j;
     281    const int bits = countBits(i, SetDimension);
    287282
    288283    LOG(1+verbosity, "Current set is " << Binary(i | (1 << SetDimension)) << ", number of bits is " << bits << ".");
     
    291286      Added = AddPowersetToSnakeStack(verbosity, i, SetDimension, FragmentSearch->FragmentSet, BondsSet, TouchedList, TouchedIndex);
    292287
     288      // --2-- store the fragment
     289      const int order = BondsPerSPList.getOrder() - SubOrder + Added - 1;
     290      LOG(1+verbosity, "Storing fragment as order " << order << ".");
     291      // store fragment as a KeySet
     292      if (DoLog(2)) {
     293        std::stringstream output;
     294        output << "Found a new fragment[" << FragmentSearch->FragmentCounter << "], local nr.s are: ";
     295        for(KeySet::iterator runner = FragmentSearch->FragmentSet->begin(); runner != FragmentSearch->FragmentSet->end(); runner++)
     296          output << (*runner) << " ";
     297        LOG(2, output.str());
     298      }
     299      FragmentSearch->InsertFragmentIntoGraph(order);
     300
     301      // --3-- if below SubOrder still, recurse
    293302      SpaceLeft = SubOrder - Added ;// SubOrder - bits; // due to item's maybe being already present, this does not work anymore
    294       if (SpaceLeft > 0) {
     303      if ((SpaceLeft > 0) && (RootDistance < BondsPerSPList.getOrder())) {
    295304        LOG(1+verbosity, "There's still some space left on stack: " << SpaceLeft << ".");
    296305        if (SubOrder > 1) {    // Due to Added above we have to check extra whether we're not already reaching beyond the desired Order
    297306          // --2-- look at all added end pieces of this combination, construct bond subsets and sweep through a power set of these by recursion
    298           SP = RootDistance+1;  // this is the next level
     307          const int SP = RootDistance+1;  // this is the next level
    299308
    300309          // first count the members in the subset
     
    311320        }
    312321      } else {
    313         // --2-- otherwise store the complete fragment
    314         LOG(1+verbosity, "Enough items on stack for a fragment!");
    315         // store fragment as a KeySet
    316         if (DoLog(2)) {
    317           std::stringstream output;
    318           output << "Found a new fragment[" << FragmentSearch->FragmentCounter << "], local nr.s are: ";
    319           for(KeySet::iterator runner = FragmentSearch->FragmentSet->begin(); runner != FragmentSearch->FragmentSet->end(); runner++)
    320             output << (*runner) << " ";
    321           LOG(2, output.str());
    322         }
    323         FragmentSearch->InsertFragmentIntoGraph();
     322        LOG(1+verbosity, "No more space or no shortest path levels, not recursing.");
    324323      }
    325324
Note: See TracChangeset for help on using the changeset viewer.