- Timestamp:
- Apr 8, 2013, 11:56:18 AM (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:
- 356ae4
- Parents:
- 569e42
- git-author:
- Frederik Heber <heber@…> (03/04/13 17:11:03)
- git-committer:
- Frederik Heber <heber@…> (04/08/13 11:56:18)
- Location:
- src/Fragmentation
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Fragmentation/PowerSetGenerator.cpp
r569e42 ra1d035 65 65 /** Clears the touched list 66 66 * \param verbosity verbosity level 67 * \param *&TouchedList touched list67 * \param &TouchedList touched list 68 68 * \param SubOrder current suborder 69 69 * \param TouchedIndex currently touched 70 70 */ 71 void PowerSetGenerator::ClearingTouched(int verbosity, int *&TouchedList, int SubOrder, int &TouchedIndex)71 void PowerSetGenerator::ClearingTouched(int verbosity, TouchedList_t &TouchedList, int SubOrder, int &TouchedIndex) 72 72 { 73 73 LOG(1+verbosity, "Clearing touched list."); 74 TouchedList.resize(SubOrder+1, -1); 74 75 for (TouchedIndex=SubOrder+1;TouchedIndex--;) // empty touched list 75 76 TouchedList[TouchedIndex] = -1; 76 77 TouchedIndex = 0; 77 78 78 } 79 79 … … 84 84 * \param *FragmentSet snake stack to remove from 85 85 * \param &BondsSet set of bonds 86 * \param *&TouchedList touched list86 * \param &TouchedList touched list 87 87 * \param TouchedIndex currently touched 88 88 * \return number of set bits 89 89 */ 90 int PowerSetGenerator::AddPowersetToSnakeStack(int verbosity, int CurrentCombination, int SetDimension, KeySet *FragmentSet, std::vector<bond::ptr > &BondsSet, int *&TouchedList, int &TouchedIndex)90 int PowerSetGenerator::AddPowersetToSnakeStack(int verbosity, int CurrentCombination, int SetDimension, KeySet *FragmentSet, std::vector<bond::ptr > &BondsSet, TouchedList_t &TouchedList, int &TouchedIndex) 91 91 { 92 92 atom *OtherWalker = NULL; … … 118 118 * \param SetFirst begin iterator first bond 119 119 * \param SetLast end iterator 120 * \param *&TouchedList touched list120 * \param &TouchedList touched list 121 121 * \param TouchedIndex currently touched 122 122 * \return number of elements 123 123 */ 124 int PowerSetGenerator::CountSetMembers(std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, int *&TouchedList, int TouchedIndex)124 int PowerSetGenerator::CountSetMembers(std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, const TouchedList_t &TouchedList, int TouchedIndex) 125 125 { 126 126 int SetDimension = 0; … … 128 128 Binder != SetLast; 129 129 ++Binder) { 130 for (int k=TouchedIndex;k--;) { 131 if ((*Binder)->Contains(TouchedList[k])) // if we added this very endpiece 130 for (TouchedList_t::const_iterator iter = TouchedList.begin(); 131 iter != TouchedList.end(); ++iter) { 132 if ((*Binder)->Contains(*iter)) // if we added this very endpiece 132 133 SetDimension++; 133 134 } … … 140 141 * \param SetFirst begin iterator first bond 141 142 * \param SetLast end iterator 142 * \param *&TouchedList touched list143 * \param &TouchedList touched list 143 144 * \param TouchedIndex currently touched 144 145 * \return number of elements 145 146 */ 146 int PowerSetGenerator::FillBondsList(std::vector<bond::ptr > &BondsList, std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, int *&TouchedList, int TouchedIndex)147 int PowerSetGenerator::FillBondsList(std::vector<bond::ptr > &BondsList, std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, const TouchedList_t &TouchedList, int TouchedIndex) 147 148 { 148 149 int SetDimension = 0; … … 150 151 Binder != SetLast; 151 152 ++Binder) { 152 for (int k=0;k<TouchedIndex;k++) { 153 if ((*Binder)->leftatom->getNr() == TouchedList[k]) // leftatom is always the closer one 153 for (TouchedList_t::const_iterator iter = TouchedList.begin(); 154 iter != TouchedList.end(); ++iter) { 155 if ((*Binder)->leftatom->getNr() == *iter) // leftatom is always the closer one 154 156 BondsList[SetDimension++] = (*Binder); 155 157 } … … 161 163 * \param verbosity verbosity level 162 164 * \param *FragmentSet snake stack to remove from 163 * \param *&TouchedList touched list164 * \param TouchedIndex currently touched 165 */ 166 void PowerSetGenerator::RemoveAllTouchedFromSnakeStack(int verbosity, KeySet *FragmentSet, int *&TouchedList, int &TouchedIndex)167 { 168 int Removal = 0;169 for(int j=0;j<TouchedIndex;j++) {170 Removal = TouchedList[j];165 * \param &TouchedList touched list 166 * \param TouchedIndex currently touched 167 */ 168 void PowerSetGenerator::RemoveAllTouchedFromSnakeStack(int verbosity, KeySet *FragmentSet, TouchedList_t &TouchedList, int &TouchedIndex) 169 { 170 for (TouchedList_t::iterator iter = TouchedList.begin(); 171 iter != TouchedList.end();++iter) { 172 const int Removal = *iter; 171 173 LOG(2+verbosity, "Removing item nr. " << Removal << " from snake stack."); 172 174 FragmentSet->erase(Removal); 173 TouchedList[j]= -1;175 (*iter) = -1; 174 176 } 175 177 std::stringstream output; … … 261 263 int TouchedIndex, SubSetDimension, Added; 262 264 int SpaceLeft; 263 int *TouchedList = new int[SubOrder + 1];265 TouchedList_t TouchedList(SubOrder + 1, -1); 264 266 KeySetTestPair TestKeySetInsert; 265 267 … … 330 332 } 331 333 } 332 delete[](TouchedList);333 334 LOG(1+verbosity, "End of SPFragmentGenerator, " << RootDistance << " away from Root " << *FragmentSearch->getRoot() << " and SubOrder is " << SubOrder << "."); 334 335 }; -
src/Fragmentation/PowerSetGenerator.hpp
r569e42 ra1d035 29 29 ~PowerSetGenerator(); 30 30 31 typedef std::vector<int> TouchedList_t; 32 31 33 void SPFragmentGenerator(int RootDistance, std::vector<bond::ptr > &BondsSet, int SetDimension, int SubOrder); 32 34 int operator()(KeySet &RestrictedKeySet, const enum HydrogenTreatment treatment); 33 void RemoveAllTouchedFromSnakeStack(int verbosity, KeySet *FragmentSet, int *&TouchedList, int &TouchedIndex);34 int FillBondsList(std::vector<bond::ptr > &BondsList, std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, int *&TouchedList, int TouchedIndex);35 int CountSetMembers(std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, int *&TouchedList, int TouchedIndex);36 int AddPowersetToSnakeStack(int verbosity, int CurrentCombination, int SetDimension, KeySet *FragmentSet, std::vector<bond::ptr > &BondsSet, int *&TouchedList, int &TouchedIndex);37 void ClearingTouched(int verbosity, int *&TouchedList, int SubOrder, int &TouchedIndex);35 void RemoveAllTouchedFromSnakeStack(int verbosity, KeySet *FragmentSet, TouchedList_t &TouchedList, int &TouchedIndex); 36 int FillBondsList(std::vector<bond::ptr > &BondsList, std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, const TouchedList_t &TouchedList, int TouchedIndex); 37 int CountSetMembers(std::list<bond::ptr >::const_iterator SetFirst, std::list<bond::ptr >::const_iterator SetLast, const TouchedList_t &TouchedList, int TouchedIndex); 38 int AddPowersetToSnakeStack(int verbosity, int CurrentCombination, int SetDimension, KeySet *FragmentSet, std::vector<bond::ptr > &BondsSet, TouchedList_t &TouchedList, int &TouchedIndex); 39 void ClearingTouched(int verbosity, TouchedList_t &TouchedList, int SubOrder, int &TouchedIndex); 38 40 39 41 private:
Note:
See TracChangeset
for help on using the changeset viewer.