Changeset 5e2f80
- Timestamp:
- Oct 6, 2011, 4:06:10 PM (14 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:
- 9c18e4
- Parents:
- 37b2575
- git-author:
- Frederik Heber <heber@…> (09/01/11 17:06:04)
- git-committer:
- Frederik Heber <heber@…> (10/06/11 16:06:10)
- Location:
- src
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/GraphAction/CreateAdjacencyAction.cpp
r37b2575 r5e2f80 72 72 ++AtomRunner) { 73 73 AtomCount++; 74 BondList& ListOfBonds = (AtomRunner->second)->getListOfBonds(); 75 for(BondList::iterator BondRunner = ListOfBonds.begin(); 76 !ListOfBonds.empty(); 77 BondRunner = ListOfBonds.begin()) 78 if ((*BondRunner)->leftatom == AtomRunner->second) 79 delete((*BondRunner)); 74 (AtomRunner->second)->removeAllBonds(); 75 // BondList& ListOfBonds = (AtomRunner->second)->getListOfBonds(); 76 // for(BondList::iterator BondRunner = ListOfBonds.begin(); 77 // !ListOfBonds.empty(); 78 // BondRunner = ListOfBonds.begin()) 79 // if ((*BondRunner)->leftatom == AtomRunner->second) 80 // delete((*BondRunner)); 80 81 } 81 82 int BondCount = 0; -
src/Actions/MoleculeAction/CopyAction.cpp
r37b2575 r5e2f80 62 62 !state->copy->empty(); 63 63 AtomRunner = state->copy->begin()) { 64 BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 65 for(BondList::iterator BondRunner = ListOfBonds.begin(); 66 !ListOfBonds.empty(); 67 BondRunner = ListOfBonds.begin()) { 68 delete(*BondRunner); 69 } 64 (*AtomRunner)->removeAllBonds(); 65 // BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 66 // for(BondList::iterator BondRunner = ListOfBonds.begin(); 67 // !ListOfBonds.empty(); 68 // BondRunner = ListOfBonds.begin()) { 69 // delete(*BondRunner); 70 // } 70 71 atom *Walker = *AtomRunner; 71 72 World::getInstance().destroyAtom(Walker); -
src/Graph/BondGraph.hpp
r37b2575 r5e2f80 266 266 // remove every bond from the list 267 267 for(iterator_type AtomRunner = Set.begin(); AtomRunner != Set.end(); ++AtomRunner) { 268 BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 269 for(BondList::iterator BondRunner = ListOfBonds.begin(); 270 !ListOfBonds.empty(); 271 BondRunner = ListOfBonds.begin()) { 272 ASSERT((*BondRunner)->Contains(*AtomRunner), 273 "BondGraph::cleanAdjacencyList() - "+ 274 toString(*BondRunner)+" does not contain "+ 275 toString(*AtomRunner)+"."); 276 delete((*BondRunner)); 277 } 268 (*AtomRunner)->removeAllBonds(); 269 // BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 270 // for(BondList::iterator BondRunner = ListOfBonds.begin(); 271 // !ListOfBonds.empty(); 272 // BondRunner = ListOfBonds.begin()) { 273 // ASSERT((*BondRunner)->Contains(*AtomRunner), 274 // "BondGraph::cleanAdjacencyList() - "+ 275 // toString(*BondRunner)+" does not contain "+ 276 // toString(*AtomRunner)+"."); 277 // delete((*BondRunner)); 278 // } 278 279 } 279 280 } … … 354 355 // reset bond degrees 355 356 for(iterator_type AtomRunner = Set.begin(); AtomRunner != Set.end(); ++AtomRunner) { 356 BondList &ListOfBonds = (*AtomRunner)->getListOfBonds(); 357 for (BondList::iterator BondIter = ListOfBonds.begin(); 358 BondIter != ListOfBonds.end(); 359 ++BondIter) 360 (*BondIter)->BondDegree = 1; 357 (*AtomRunner)->resetBondDegree(); 361 358 } 362 359 } -
src/atom_bondedparticle.cpp
r37b2575 r5e2f80 40 40 BondedParticle::~BondedParticle() 41 41 { 42 const size_t max = ListOfBonds.size(); 43 for (size_t i = 0; i < max; ++i) { 44 ClearBondsAtStep(i); 45 } 42 removeAllBonds(); 46 43 }; 47 44 … … 127 124 } 128 125 126 /** Removes all bonds and their instances, too. 127 * 128 */ 129 void BondedParticle::removeAllBonds() 130 { 131 OBSERVE; 132 NOTIFY(BondedParticle::BondsChanged); 133 for (size_t index = 0; index < ListOfBonds.size(); ++index) 134 { 135 for (BondList::iterator iter = ListOfBonds[index].begin(); 136 !ListOfBonds[index].empty(); 137 iter = ListOfBonds[index].begin()) { 138 delete (*iter); 139 // erase is done by bond::~bond() 140 } 141 } 142 } 143 129 144 /** Puts a given bond into atom::ListOfBonds. 130 145 * @param _step time step to access … … 140 155 NOTIFY(AtomObservable::BondsChanged); 141 156 //LOG(3,"INFO: Registering bond "<< *Binder << " with atom " << *this << " at step " << _step); 142 BondList& ListOfBonds = getListOfBondsAtStep(_step); 143 ListOfBonds.push_back(Binder); 157 if (ListOfBonds.size() <= _step) 158 ListOfBonds.resize(_step+1); 159 ListOfBonds[_step].push_back(Binder); 144 160 status = true; 145 161 } else { … … 164 180 if (step != -1) { 165 181 NOTIFY(AtomObservable::BondsChanged); 166 //LOG( 3,"INFO: Unregistering bond "<< *Binder << " from list " << &ListOfBonds << " of atom " << *this << " at step " << step);182 //LOG(0,"INFO: Unregistering bond "<< *Binder << " from list " << &ListOfBonds << " of atom " << *this << " at step " << step); 167 183 ListOfBonds[step].remove(Binder); 168 184 status = true; … … 266 282 }; 267 283 284 /** Sets the weight of all connected bonds to one. 285 */ 286 void BondedParticle::resetBondDegree() 287 { 288 OBSERVE; 289 NOTIFY(BondedParticle::BondsChanged); 290 for (std::vector<BondList>::iterator Runner = ListOfBonds.begin(); 291 Runner != ListOfBonds.end(); 292 ++Runner) 293 for (BondList::iterator BondRunner = (*Runner).begin(); 294 BondRunner != (*Runner).end(); 295 ++BondRunner) 296 (*BondRunner)->BondDegree = 1; 297 }; 298 268 299 /** Counts the number of bonds weighted by bond::BondDegree. 269 300 * @param _step time step to access -
src/atom_bondedparticle.hpp
r37b2575 r5e2f80 39 39 const bond * addBond(const unsigned int _step, BondedParticle* Partner); 40 40 void removeBond(bond *binder); 41 void removeAllBonds(); 41 42 bool IsBondedTo(const unsigned int _step, BondedParticle * const BondPartner) const; 42 43 void ClearBondsAtStep(const unsigned int _step); 43 44 int CountBonds() const; 44 45 int CorrectBondDegree(); 46 void resetBondDegree(); 45 47 void OutputBondOfAtom(std::ostream &ost) const; 46 48 void OutputAdjacency(ofstream * const AdjacencyFile) const; -
src/atom_bondedparticleinfo.cpp
r37b2575 r5e2f80 27 27 #include "atom_bondedparticleinfo.hpp" 28 28 29 30 BondList BondedParticleInfo::emptyList; 31 29 32 /** Constructor of class BondedParticleInfo. 30 33 */ … … 47 50 const BondList& BondedParticleInfo::getListOfBonds() const 48 51 { 49 ASSERT(WorldTime::getTime() < ListOfBonds.size(), 50 "BondedParticleInfo::getBondsAtStep() - Access out of range: " 51 +toString(WorldTime::getTime()) 52 +" not in [0,"+toString(ListOfBonds.size())+")."); 53 return ListOfBonds[WorldTime::getTime()]; 52 if(WorldTime::getTime() < ListOfBonds.size()) 53 return ListOfBonds[WorldTime::getTime()]; 54 else 55 return emptyList; 54 56 } 55 57 56 BondList& BondedParticleInfo::getListOfBonds()57 {58 // todo: here we actually need a container on whose destruction notifiy is emitted, i.e.59 // similar or simply an ObservedContainer.60 OBSERVE;61 NOTIFY(AtomObservable::BondsChanged);62 const unsigned int size = ListOfBonds.size();63 ASSERT(WorldTime::getTime() <= size,64 "BondedParticleInfo::getBondsAtStep() - Access out of range: "65 +toString(WorldTime::getTime())66 +" not in [0,"+toString(size)+"].");67 if (WorldTime::getTime() == size) {68 UpdateSteps();69 }70 return ListOfBonds[WorldTime::getTime()];71 }58 //BondList& BondedParticleInfo::getListOfBonds() 59 //{ 60 // // todo: here we actually need a container on whose destruction notifiy is emitted, i.e. 61 // // similar or simply an ObservedContainer. 62 // OBSERVE; 63 // NOTIFY(AtomObservable::BondsChanged); 64 // const unsigned int size = ListOfBonds.size(); 65 // ASSERT(WorldTime::getTime() <= size, 66 // "BondedParticleInfo::getBondsAtStep() - Access out of range: " 67 // +toString(WorldTime::getTime()) 68 // +" not in [0,"+toString(size)+"]."); 69 // if (WorldTime::getTime() == size) { 70 // UpdateSteps(); 71 // } 72 // return ListOfBonds[WorldTime::getTime()]; 73 //} 72 74 73 75 const BondList& BondedParticleInfo::getListOfBondsAtStep(unsigned int _step) const 74 76 { 75 ASSERT(_step < ListOfBonds.size(), 76 "BondedParticleInfo::getBondsAtStep() - Access out of range: " 77 +toString(_step) 78 +" not in [0,"+toString(ListOfBonds.size())+")."); 79 return ListOfBonds[_step]; 77 if(_step < ListOfBonds.size()) 78 return ListOfBonds[_step]; 79 else 80 return emptyList; 80 81 } 81 82 82 BondList& BondedParticleInfo::getListOfBondsAtStep(unsigned int _step)83 {84 const unsigned int size = ListOfBonds.size();85 ASSERT(_step <= size,86 "BondedParticleInfo::getBondsAtStep() - Access out of range: "87 +toString(_step)88 +" not in [0,"+toString(size)+"].");89 if (_step == size) {90 UpdateSteps();91 }92 return ListOfBonds[_step];93 }83 //BondList& BondedParticleInfo::getListOfBondsAtStep(unsigned int _step) 84 //{ 85 // const unsigned int size = ListOfBonds.size(); 86 // ASSERT(_step <= size, 87 // "BondedParticleInfo::getBondsAtStep() - Access out of range: " 88 // +toString(_step) 89 // +" not in [0,"+toString(size)+"]."); 90 // if (_step == size) { 91 // UpdateSteps(); 92 // } 93 // return ListOfBonds[_step]; 94 //} -
src/atom_bondedparticleinfo.hpp
r37b2575 r5e2f80 54 54 */ 55 55 const BondList& getListOfBonds() const; 56 56 57 /** Accessor to ListOfBonds of WorldTime::CurrentTime. 57 58 * … … 61 62 * @return ListOfBonds[WorldTime::CurrentTime] 62 63 */ 63 BondList& getListOfBonds();64 // BondList& getListOfBonds(); 64 65 65 66 /** Const Accessor ListOfBonds of any present time step. … … 69 70 */ 70 71 const BondList& getListOfBondsAtStep(unsigned int _step) const; 72 71 73 /** Accessor ListOfBonds of any present time step. 72 74 * … … 77 79 * @return ListOfBonds[_step]. 78 80 */ 79 BondList& getListOfBondsAtStep(unsigned int _step);81 // BondList& getListOfBondsAtStep(unsigned int _step); 80 82 81 83 protected: … … 86 88 87 89 std::vector<BondList> ListOfBonds; //!< list of all bonds 88 90 static BondList emptyList; //!< empty list to return when step is not present 89 91 }; 90 92 -
src/molecule.cpp
r37b2575 r5e2f80 772 772 { 773 773 //DoeLog(1) && (eLog()<< Verbose(1) << "molecule::RemoveBond: Function not implemented yet." << endl); 774 BondList::const_iterator ForeRunner; 775 BondList& ListOfBonds = BondPartner->getListOfBonds(); 776 while (!ListOfBonds.empty()) { 777 ForeRunner = ListOfBonds.begin(); 778 RemoveBond(*ForeRunner); 779 } 774 BondPartner->removeAllBonds(); 780 775 return false; 781 776 }; -
src/molecule_graph.cpp
r37b2575 r5e2f80 104 104 { 105 105 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 106 //LOG(0, "molecule::hasBondStructure() - checking bond list of atom " << (*AtomRunner)->getId() << "."); 106 107 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 107 108 if (!ListOfBonds.empty()) -
src/moleculelist.cpp
r37b2575 r5e2f80 283 283 bool MoleculeListClass::AddHydrogenCorrection(std::string &path) 284 284 { 285 bond *Binder = NULL;285 const bond *Binder = NULL; 286 286 double ***FitConstant = NULL, **correction = NULL; 287 287 int a, b; … … 395 395 //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "." << endl; 396 396 // 3. take every other hydrogen that is the not the first and not bound to same bonding partner 397 Binder = *((*runner)->getListOfBonds().begin()); 397 const BondList &bondlist = (*runner)->getListOfBonds(); 398 Binder = *(bondlist.begin()); 398 399 if (((*runner)->getType()->getAtomicNumber() == 1) && ((*runner)->getNr() > (*iter)->getNr()) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!) 399 400 // 4. evaluate the morse potential for each matrix component and add up -
src/unittests/ListOfBondsUnitTest.cpp
r37b2575 r5e2f80 51 51 { 52 52 atom *Walker = NULL; 53 54 WorldTime::setTime(0); 53 55 54 56 // construct element … … 127 129 128 130 // check that bond is present in both atoms 131 const BondList &bondlist1 = atom1->getListOfBonds(); 129 132 BondList::const_iterator bonditer; 130 bonditer = atom1->getListOfBonds().begin();133 bonditer = bondlist1.begin(); 131 134 bond *TestBond1 = *bonditer; 132 135 CPPUNIT_ASSERT_EQUAL( TestBond1, Binder ); 133 bonditer = atom2->getListOfBonds().begin(); 136 const BondList &bondlist2 = atom2->getListOfBonds(); 137 bonditer = bondlist2.begin(); 134 138 bond *TestBond2 = *bonditer; 135 139 CPPUNIT_ASSERT_EQUAL( TestBond2, Binder );
Note:
See TracChangeset
for help on using the changeset viewer.