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/Fragmentation.cpp

    rb6b5b8 rd760bb  
    200200{
    201201  Info FunctionInfo(__func__);
    202   Graph ***FragmentLowerOrdersList = NULL;
     202  std::vector<Graph*> *FragmentLowerOrdersList = NULL;
    203203  int NumLevels = 0;
    204204  int NumMolecules = 0;
     
    210210  int RootKeyNr = 0;
    211211  int RootNr = 0;
    212   UniqueFragments FragmentSearch;
    213212
    214213  // FragmentLowerOrdersList is a 2D-array of pointer to MoleculeListClass objects, one dimension represents the ANOVA expansion of a single order (i.e. 5)
    215214  // with all needed lower orders that are subtracted, the other dimension is the BondOrder (i.e. from 1 to 5)
    216215  NumMoleculesOfOrder = new int[UpgradeCount];
    217   FragmentLowerOrdersList = new Graph**[UpgradeCount];
    218 
    219   for(int i=0;i<UpgradeCount;i++) {
     216  FragmentLowerOrdersList = new std::vector<Graph*>[UpgradeCount];
     217
     218  for(int i=0;i<UpgradeCount;i++)
    220219    NumMoleculesOfOrder[i] = 0;
    221     FragmentLowerOrdersList[i] = NULL;
    222   }
    223 
    224   FragmentSearch.Init(mol->FindAtom(RootKeyNr));
    225220
    226221  // Construct the complete KeySet which we need for topmost level only (but for all Roots)
     
    244239    //} else
    245240    {
    246       // increase adaptive order by one
    247       Walker->GetTrueFather()->AdaptiveOrder++;
     241      // set adaptive order to desired max order
     242      Walker->GetTrueFather()->AdaptiveOrder = Walker->GetTrueFather()->MaxOrder;
    248243      Order = Walker->AdaptiveOrder = Walker->GetTrueFather()->AdaptiveOrder;
    249244
     245      // allocate memory for all lower level orders
     246      NumLevels = Order;
     247      FragmentLowerOrdersList[RootNr].resize(NumLevels, NULL);
     248      for( size_t i=0;i<NumLevels;++i)
     249        FragmentLowerOrdersList[RootNr][i] = new Graph;
     250
    250251      // initialise Order-dependent entries of UniqueFragments structure
    251       class PowerSetGenerator PSG(&FragmentSearch, Walker->AdaptiveOrder);
    252 
    253       // allocate memory for all lower level orders in this 1D-array of ptrs
    254       NumLevels = 1 << (Order-1); // (int)pow(2,Order);
    255       FragmentLowerOrdersList[RootNr] = new Graph*[NumLevels];
    256       for (int i=0;i<NumLevels;i++)
    257         FragmentLowerOrdersList[RootNr][i] = NULL;
     252      UniqueFragments FragmentSearch(1., FragmentLowerOrdersList[RootNr], Walker);
     253      PowerSetGenerator PSG(&FragmentSearch, Walker->AdaptiveOrder);
    258254
    259255      // create top order where nothing is reduced
    260256      LOG(0, "==============================================================================================================");
    261       LOG(0, "Creating KeySets of Bond Order " << Order << " for " << *Walker << ", " << (RootStack.size()-RootNr) << " Roots remaining."); // , NumLevels is " << NumLevels << "
     257      LOG(0, "Creating KeySets up till Bond Order " << Order << " for " << *Walker << ", " << (RootStack.size()-RootNr) << " Roots remaining."); // , NumLevels is " << NumLevels << "
    262258
    263259      // Create list of Graphs of current Bond Order (i.e. F_{ij})
    264       FragmentLowerOrdersList[RootNr][0] = new Graph;
    265       FragmentSearch.PrepareForPowersetGeneration(1., FragmentLowerOrdersList[RootNr][0], Walker);
    266260      NumMoleculesOfOrder[RootNr] = PSG(CompleteMolecule, saturation);
    267261
     
    270264      if (NumMoleculesOfOrder[RootNr] != 0) {
    271265        NumMolecules = 0;
    272       } else {
    273         Walker->GetTrueFather()->MaxOrder = true;
    274266      }
    275267      // now, we have completely filled each cell of FragmentLowerOrdersList[] for the current Walker->AdaptiveOrder
     
    284276  LOG(1, "Total number of resulting molecules is: " << TotalNumMolecules << ".");
    285277  LOG(0, "==============================================================================================================");
    286 
    287   // cleanup FragmentSearch structure
    288   FragmentSearch.Cleanup();
    289278
    290279  // now, FragmentLowerOrdersList is complete, it looks - for BondOrder 5 - as this (number is the ANOVA Order of the terms therein)
     
    362351    delete[](IndexKeySetList);
    363352  } else { // global increase of Bond Order
    364     for(molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) {
     353    for(molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) {
    365354      if (AtomMask.isTrue((*iter)->getNr())) { // skip masked out
     355        (*iter)->MaxOrder = (Order != 0 ? Order : (*iter)->MaxOrder+1);
    366356        // remove all that have reached desired order
    367         if ((Order != 0) && ((*iter)->AdaptiveOrder >= Order)) // && ((*iter)->AdaptiveOrder < MinimumRingSize[(*iter)->getNr()]))
     357        if ((*iter)->AdaptiveOrder >= (*iter)->MaxOrder) // && ((*iter)->AdaptiveOrder < MinimumRingSize[(*iter)->getNr()]))
    368358          AtomMask.setFalse((*iter)->getNr());
    369359        else
     
    450440    for(molecule::iterator iter=mol->begin();iter!=mol->end();++iter){
    451441      (*iter)->AdaptiveOrder = OrderArray[(*iter)->getNr()];
    452       (*iter)->MaxOrder = MaxArray.isTrue((*iter)->getNr());
     442      (*iter)->MaxOrder = OrderArray[(*iter)->getNr()]; //MaxArray.isTrue((*iter)->getNr());
    453443    }
    454444    //SetAtomValueToIndexedArray( OrderArray, &atom::getNr(), &atom::AdaptiveOrder );
Note: See TracChangeset for help on using the changeset viewer.