Changeset d760bb for src/Fragmentation/PowerSetGenerator.cpp
- Timestamp:
- Feb 24, 2013, 12:59:18 PM (13 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, 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)
- File:
-
- 1 edited
-
src/Fragmentation/PowerSetGenerator.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/PowerSetGenerator.cpp
rb6b5b8 rd760bb 50 50 * 51 51 */ 52 PowerSetGenerator::PowerSetGenerator( class UniqueFragments *_FragmentSearch, intOrder) :53 BondsPerSPList( Order),52 PowerSetGenerator::PowerSetGenerator(UniqueFragments *_FragmentSearch, int _Order) : 53 BondsPerSPList(_Order), 54 54 FragmentSearch(_FragmentSearch) 55 55 {} … … 213 213 int SP = BondsPerSPList.CountNumbersInBondsList(); 214 214 LOG(0, "Total number of edges is " << SP << "."); 215 if (SP >= (BondsPerSPList.getOrder()-1)){215 { 216 216 // start with root (push on fragment stack) 217 217 LOG(0, "Starting fragment generation with " << *FragmentSearch->getRoot() << ", local nr is " << FragmentSearch->getRoot()->getNr() << "."); … … 227 227 228 228 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.");231 229 } 232 230 … … 261 259 Info info(__func__); 262 260 int verbosity = 0; //FragmentSearch->ANOVAOrder-SubOrder; 263 int NumCombinations; 264 int bits, TouchedIndex, SubSetDimension, SP, Added; 261 int TouchedIndex, SubSetDimension, Added; 265 262 int SpaceLeft; 266 263 int *TouchedList = new int[SubOrder + 1]; 267 264 KeySetTestPair TestKeySetInsert; 268 265 269 NumCombinations = 1 << SetDimension;266 const int NumCombinations = 1 << SetDimension; 270 267 271 268 // here for all bonds of Walker all combinations of end pieces (from the bonds) … … 282 279 for (int i=1;i<NumCombinations;i++) { // sweep through all power set combinations (skip empty set!) 283 280 // 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); 287 282 288 283 LOG(1+verbosity, "Current set is " << Binary(i | (1 << SetDimension)) << ", number of bits is " << bits << "."); … … 291 286 Added = AddPowersetToSnakeStack(verbosity, i, SetDimension, FragmentSearch->FragmentSet, BondsSet, TouchedList, TouchedIndex); 292 287 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 293 302 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())) { 295 304 LOG(1+verbosity, "There's still some space left on stack: " << SpaceLeft << "."); 296 305 if (SubOrder > 1) { // Due to Added above we have to check extra whether we're not already reaching beyond the desired Order 297 306 // --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 level307 const int SP = RootDistance+1; // this is the next level 299 308 300 309 // first count the members in the subset … … 311 320 } 312 321 } 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."); 324 323 } 325 324
Note:
See TracChangeset
for help on using the changeset viewer.
