Changeset 9d83b6
- Timestamp:
- Feb 24, 2011, 6:51:32 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:
- a2bdbe
- Parents:
- c0d9eb
- git-author:
- Frederik Heber <heber@…> (02/24/11 14:41:13)
- git-committer:
- Frederik Heber <heber@…> (02/24/11 18:51:32)
- Location:
- src
- Files:
-
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/FragmentationAction/ConstructBondGraphAction.cpp
rc0d9eb r9d83b6 32 32 #include "molecule.hpp" 33 33 #include "World.hpp" 34 #include "WorldTime.hpp" 34 35 35 36 #include <iostream> … … 67 68 // remove every bond from the selected atoms' list 68 69 int AtomCount = 0; 69 for (World::AtomSelectionIterator AtomRunner = World::getInstance().beginAtomSelection(); AtomRunner != World::getInstance().endAtomSelection(); ++AtomRunner) { 70 for (World::AtomSelectionIterator AtomRunner = World::getInstance().beginAtomSelection(); 71 AtomRunner != World::getInstance().endAtomSelection(); 72 ++AtomRunner) { 70 73 AtomCount++; 71 for(BondList::iterator BondRunner = (AtomRunner->second)->ListOfBonds.begin(); !(AtomRunner->second)->ListOfBonds.empty(); BondRunner = (AtomRunner->second)->ListOfBonds.begin()) 74 BondList& ListOfBonds = (AtomRunner->second)->getListOfBonds(); 75 for(BondList::iterator BondRunner = ListOfBonds.begin(); 76 !ListOfBonds.empty(); 77 BondRunner = ListOfBonds.begin()) 72 78 if ((*BondRunner)->leftatom == AtomRunner->second) 73 79 delete((*BondRunner)); … … 81 87 DoLog(2) && (Log() << Verbose(2) << "Creating Linked Cell structure ... " << endl); 82 88 LinkedCell::LinkedNodes list; 83 for (World::AtomSelectionIterator AtomRunner = World::getInstance().beginAtomSelection(); AtomRunner != World::getInstance().endAtomSelection(); ++AtomRunner) { 89 for (World::AtomSelectionIterator AtomRunner = World::getInstance().beginAtomSelection(); 90 AtomRunner != World::getInstance().endAtomSelection(); 91 ++AtomRunner) { 84 92 list.push_back(AtomRunner->second); 85 93 } … … 92 100 std::map<TesselPoint *, int> AtomIds; 93 101 int i=0; 94 for (World::AtomSelectionIterator AtomRunner = World::getInstance().beginAtomSelection(); AtomRunner != World::getInstance().endAtomSelection(); ++AtomRunner) { 102 for (World::AtomSelectionIterator AtomRunner = World::getInstance().beginAtomSelection(); 103 AtomRunner != World::getInstance().endAtomSelection(); 104 ++AtomRunner) { 95 105 AtomIds.insert(pair<TesselPoint *, int> (AtomRunner->second, i++) ); 96 106 } … … 104 114 // Log() << Verbose(2) << "Current cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl; 105 115 if (List != NULL) { 106 for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); Runner != List->end(); Runner++) { 116 for (LinkedCell::LinkedNodes::const_iterator Runner = List->begin(); 117 Runner != List->end(); 118 Runner++) { 107 119 Walker = dynamic_cast<atom*>(*Runner); 108 120 ASSERT(Walker,"Tesselpoint that was not an atom retrieved from LinkedNode"); -
src/Actions/FragmentationAction/SubgraphDissectionAction.cpp
rc0d9eb r9d83b6 78 78 vector <atom *> allatoms = World::getInstance().getAllAtoms(); 79 79 for(vector<atom *>::iterator AtomRunner = allatoms.begin(); AtomRunner != allatoms.end(); ++AtomRunner) { 80 BondCount += (*AtomRunner)->ListOfBonds.size(); 81 // for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin()) 80 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 81 BondCount += ListOfBonds.size(); 82 // for(BondList::iterator BondRunner = ListOfBonds.begin(); 83 // !ListOfBonds.empty(); 84 // BondRunner = ListOfBonds.begin()) { 82 85 // delete(*BondRunner); 86 // } 83 87 mol->AddAtom(*AtomRunner); 84 88 } -
src/Actions/MoleculeAction/CopyAction.cpp
rc0d9eb r9d83b6 59 59 MoleculeCopyState *state = assert_cast<MoleculeCopyState*>(_state.get()); 60 60 61 for (molecule::iterator AtomRunner = state->copy->begin(); !state->copy->empty(); AtomRunner = state->copy->begin()) { 62 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin()) 61 for (molecule::iterator AtomRunner = state->copy->begin(); 62 !state->copy->empty(); 63 AtomRunner = state->copy->begin()) { 64 BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 65 for(BondList::iterator BondRunner = ListOfBonds.begin(); 66 !ListOfBonds.empty(); 67 BondRunner = ListOfBonds.begin()) { 63 68 delete(*BondRunner); 69 } 64 70 atom *Walker = *AtomRunner; 65 71 state->copy->erase(AtomRunner); -
src/Parser/PdbParser.cpp
rc0d9eb r9d83b6 325 325 * Writes the neighbor information of one atom to the provided stream. 326 326 * 327 * Note that ListOfBonds of WorldTime::CurrentTime is used. 328 * 327 329 * \param *file where to write neighbor information to 328 330 * \param MaxnumberOfNeighbors of neighbors … … 331 333 void PdbParser::writeNeighbors(ostream* file, int MaxnumberOfNeighbors, atom* currentAtom) { 332 334 int MaxNo = MaxnumberOfNeighbors; 333 if (!currentAtom->ListOfBonds.empty()) { 334 for(BondList::iterator currentBond = currentAtom->ListOfBonds.begin(); currentBond != currentAtom->ListOfBonds.end(); ++currentBond) { 335 const BondList & ListOfBonds = currentAtom->getListOfBonds(); 336 if (!ListOfBonds.empty()) { 337 for(BondList::const_iterator currentBond = ListOfBonds.begin(); currentBond != ListOfBonds.end(); ++currentBond) { 335 338 if (MaxNo >= MaxnumberOfNeighbors) { 336 339 *file << "CONECT"; -
src/Parser/TremoloParser.cpp
rc0d9eb r9d83b6 26 26 #include "TremoloParser.hpp" 27 27 #include "World.hpp" 28 #include "WorldTime.hpp" 28 29 #include "atom.hpp" 29 30 #include "bond.hpp" … … 258 259 * Writes the neighbor information of one atom to the provided stream. 259 260 * 261 * Note that ListOfBonds of WorldTime::CurrentTime is used. 262 * 260 263 * \param stream where to write neighbor information to 261 264 * \param number of neighbors … … 263 266 */ 264 267 void TremoloParser::writeNeighbors(ostream* file, int numberOfNeighbors, atom* currentAtom) { 265 BondList::iterator currentBond = currentAtom->ListOfBonds.begin(); 268 const BondList& ListOfBonds = currentAtom->getListOfBonds(); 269 BondList::const_iterator currentBond = ListOfBonds.begin(); 266 270 for (int i = 0; i < numberOfNeighbors; i++) { 267 *file << (currentBond != currentAtom->ListOfBonds.end()271 *file << (currentBond != ListOfBonds.end() 268 272 ? (*currentBond)->GetOtherAtom(currentAtom)->getId()+1 : 0) << "\t"; 269 if (currentBond != currentAtom->ListOfBonds.end())273 if (currentBond != ListOfBonds.end()) 270 274 ++currentBond; 271 275 } -
src/WorldTime.hpp
rc0d9eb r9d83b6 22 22 //!> own unit test should be friend to access private variables. 23 23 friend class WorldTimeTest; 24 //!> ListOfBonds test has to be friend to access private variables. 25 friend class ListOfBondsTest; 24 26 25 27 //!> World is friend to access setTime (alone!) -
src/analysis_bonds.cpp
rc0d9eb r9d83b6 43 43 int AtomCount = 0; 44 44 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 45 const int count = (*iter)->ListOfBonds.size(); 45 const BondList& ListOfBonds = (*iter)->getListOfBonds(); 46 const int count = ListOfBonds.size(); 46 47 if (Max < count) 47 48 Max = count; … … 72 73 int AtomNo = 0; 73 74 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 74 if ((*iter)->getType() == type1) 75 for (BondList::const_iterator BondRunner = (*iter)->ListOfBonds.begin(); BondRunner != (*iter)->ListOfBonds.end(); BondRunner++) 75 if ((*iter)->getType() == type1) { 76 const BondList& ListOfBonds = (*iter)->getListOfBonds(); 77 for (BondList::const_iterator BondRunner = ListOfBonds.begin(); 78 BondRunner != ListOfBonds.end(); 79 BondRunner++) 76 80 if ((*BondRunner)->GetOtherAtom((*iter))->getType() == type2) { 77 81 const double distance = (*BondRunner)->GetDistanceSquared(); … … 83 87 AtomNo++; 84 88 } 89 } 85 90 } 86 91 if (Max < 0) { … … 161 166 InterfaceFlag = (InterfaceElement == NULL); 162 167 Interface2Flag = (Interface2Element == NULL); 163 for (BondList::const_iterator BondRunner = (*Runner)->ListOfBonds.begin(); BondRunner != (*Runner)->ListOfBonds.end(); BondRunner++) { 168 const BondList& ListOfBonds = (*Runner)->getListOfBonds(); 169 for (BondList::const_iterator BondRunner = ListOfBonds.begin(); 170 BondRunner != ListOfBonds.end(); 171 BondRunner++) { 164 172 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Runner); 165 173 // if hydrogen, check angle to be greater(!) than 30 degrees … … 187 195 if (InterfaceFlag && Interface2Flag && OtherHydrogenFlag) { 188 196 // on this element (Walker) we check for bond to hydrogen, i.e. part of water molecule 189 for (BondList::const_iterator BondRunner = (*Walker)->ListOfBonds.begin(); BondRunner != (*Walker)->ListOfBonds.end(); BondRunner++) { 197 const BondList& ListOfBonds = (*Walker)->getListOfBonds(); 198 for (BondList::const_iterator BondRunner = ListOfBonds.begin(); 199 BondRunner != ListOfBonds.end(); 200 BondRunner++) { 190 201 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(*Walker); 191 202 if (OtherAtom->getType()->getAtomicNumber() == 1) { … … 223 234 atom * theAtom = *Walker; 224 235 if ((theAtom->getType() == first) || (theAtom->getType() == second)) { // first element matches 225 for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) { 236 const BondList& ListOfBonds = theAtom->getListOfBonds(); 237 for (BondList::const_iterator BondRunner = ListOfBonds.begin(); 238 BondRunner != ListOfBonds.end(); 239 BondRunner++) { 226 240 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom); 227 241 if (((OtherAtom->getType() == first) || (OtherAtom->getType() == second)) && (theAtom->nr < OtherAtom->nr)) { … … 261 275 for (int i=0;i<2;i++) 262 276 MatchFlag[i] = false; 263 for (BondList::const_iterator BondRunner = theAtom->ListOfBonds.begin(); BondRunner != theAtom->ListOfBonds.end(); BondRunner++) { 277 const BondList& ListOfBonds = theAtom->getListOfBonds(); 278 for (BondList::const_iterator BondRunner = ListOfBonds.begin(); 279 BondRunner != ListOfBonds.end(); 280 BondRunner++) { 264 281 atom * const OtherAtom = (*BondRunner)->GetOtherAtom(theAtom); 265 282 for (int i=0;i<2;i++) -
src/analysis_correlation.cpp
rc0d9eb r9d83b6 66 66 ++atomiter) { 67 67 // go through all bonds 68 for (BondList::const_iterator bonditer = (*atomiter)->ListOfBonds.begin(); 69 bonditer != (*atomiter)->ListOfBonds.end(); 68 const BondList& ListOfBonds = (*atomiter)->getListOfBonds(); 69 for (BondList::const_iterator bonditer = ListOfBonds.begin(); 70 bonditer != ListOfBonds.end(); 70 71 ++bonditer) { 71 72 const atom * Otheratom = (*bonditer)->GetOtherAtom(*atomiter); -
src/atom.cpp
rc0d9eb r9d83b6 72 72 { 73 73 removeFromMolecule(); 74 for(BondList::iterator iter=ListOfBonds.begin(); iter!=ListOfBonds.end();){75 // deleting the bond will invalidate the iterator !!!76 bond *bond =*(iter++);77 delete(bond);78 }79 74 }; 80 75 … … 294 289 if (ComponentNr != NULL) 295 290 delete[](ComponentNr); 291 const BondList& ListOfBonds = getListOfBonds(); 296 292 ComponentNr = new int[ListOfBonds.size()+1]; 297 293 for (int i=ListOfBonds.size()+1;i--;) -
src/atom_bondedparticle.cpp
rc0d9eb r9d83b6 27 27 #include "CodePatterns/Log.hpp" 28 28 #include "CodePatterns/Verbose.hpp" 29 #include "WorldTime.hpp" 29 30 30 31 /** Constructor of class BondedParticle. … … 32 33 BondedParticle::BondedParticle() 33 34 { 35 ListOfBonds.push_back(BondList()); 34 36 }; 35 37 … … 38 40 BondedParticle::~BondedParticle() 39 41 { 40 BondList::const_iterator Runner; 41 while (!ListOfBonds.empty()) { 42 Runner = ListOfBonds.begin(); 43 removewithoutcheck(*Runner); 42 BondList::iterator Runner; 43 for (std::vector<BondList>::iterator iter = ListOfBonds.begin(); 44 !ListOfBonds.empty(); 45 iter = ListOfBonds.begin()) { 46 while (!(*iter).empty()) { 47 Runner = (*iter).begin(); 48 removewithoutcheck(*Runner); 49 } 50 ListOfBonds.erase(iter); 44 51 } 45 52 }; … … 58 65 void BondedParticle::OutputBondOfAtom() const 59 66 { 67 const BondList& ListOfBonds = getListOfBonds(); 60 68 DoLog(4) && (Log() << Verbose(4) << "Atom " << getName() << "/" << nr << " with " << ListOfBonds.size() << " bonds: " << endl); 61 69 int TotalDegree = 0; … … 72 80 void BondedParticle::OutputAdjacency(ofstream * const AdjacencyFile) const 73 81 { 82 const BondList& ListOfBonds = getListOfBonds(); 74 83 *AdjacencyFile << nr << "\t"; 75 84 for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) … … 84 93 void BondedParticle::OutputBonds(ofstream * const BondFile) const 85 94 { 95 const BondList& ListOfBonds = getListOfBonds(); 86 96 for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) 87 97 if (nr < (*Runner)->GetOtherAtom(this)->nr) … … 113 123 if (Binder != NULL) { 114 124 if (Binder->Contains(this)) { 125 BondList& ListOfBonds = getListOfBonds(); 115 126 ListOfBonds.push_back(Binder); 116 127 status = true; … … 125 136 126 137 /** Removes a given bond from atom::ListOfBonds. 138 * @param _step time step to access 127 139 * \param *Binder bond to remove 128 140 */ … … 132 144 if (Binder != NULL) { 133 145 if (Binder->Contains(this)) { 146 BondList& ListOfBonds = getListOfBonds(); 134 147 ListOfBonds.remove(Binder); 135 148 status = true; … … 148 161 void BondedParticle::UnregisterAllBond() 149 162 { 163 BondList& ListOfBonds = getListOfBonds(); 150 164 ListOfBonds.clear(); 151 165 }; … … 165 179 //Log() << Verbose(3) << "Walker " << *this << ": " << (int)this->type->NoValenceOrbitals << " > " << NoBonds << "?" << endl; 166 180 if ((int)(getType()->getNoValenceOrbitals()) > NoBonds) { // we have a mismatch, check all bonding partners for mismatch 181 const BondList& ListOfBonds = getListOfBonds(); 167 182 for (BondList::const_iterator Runner = ListOfBonds.begin(); Runner != ListOfBonds.end(); (++Runner)) { 168 183 OtherWalker = (*Runner)->GetOtherAtom(this); … … 170 185 //Log() << Verbose(3) << "OtherWalker " << *OtherWalker << ": " << (int)OtherWalker->type->NoValenceOrbitals << " > " << OtherNoBonds << "?" << endl; 171 186 if ((int)(OtherWalker->getType()->getNoValenceOrbitals()) > OtherNoBonds) { // check if possible candidate 172 if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherWalker->ListOfBonds.size())) { // pick the one with fewer number of bonds first 187 const BondList& OtherListOfBonds = OtherWalker->getListOfBonds(); 188 if ((CandidateBond == NULL) || (ListOfBonds.size() > OtherListOfBonds.size())) { // pick the one with fewer number of bonds first 173 189 CandidateBond = (*Runner); 174 190 //Log() << Verbose(3) << "New candidate is " << *CandidateBond << "." << endl; … … 194 210 { 195 211 int NoBonds = 0; 212 const BondList& ListOfBonds = getListOfBonds(); 196 213 for (BondList::const_iterator Runner = ListOfBonds.begin(); 197 214 Runner != ListOfBonds.end(); … … 209 226 bool status = false; 210 227 211 for (BondList::iterator runner = ListOfBonds.begin(); runner != ListOfBonds.end(); runner++) { 228 const BondList& ListOfBonds = getListOfBonds(); 229 for (BondList::const_iterator runner = ListOfBonds.begin(); runner != ListOfBonds.end(); runner++) { 212 230 status = status || ((*runner)->Contains(BondPartner)); 213 231 } -
src/atom_bondedparticleinfo.cpp
rc0d9eb r9d83b6 20 20 #include "CodePatterns/MemDebug.hpp" 21 21 22 #include "CodePatterns/Assert.hpp" 23 24 #include "WorldTime.hpp" 25 22 26 #include "atom_bondedparticleinfo.hpp" 23 27 … … 27 31 AdaptiveOrder(0), 28 32 MaxOrder(false) 29 {} ;33 {} 30 34 31 35 /** Destructor of class BondedParticleInfo. 32 36 */ 33 37 BondedParticleInfo::~BondedParticleInfo() 38 {} 39 40 const BondList& BondedParticleInfo::getListOfBonds() const 34 41 { 35 }; 42 ASSERT(WorldTime::getTime() < ListOfBonds.size(), 43 "BondedParticleInfo::getBondsAtStep() - Access out of range: " 44 +toString(WorldTime::getTime()) 45 +" not in [0,"+toString(ListOfBonds.size())+")."); 46 return ListOfBonds[WorldTime::getTime()]; 47 } 36 48 49 BondList& BondedParticleInfo::getListOfBonds() 50 { 51 const unsigned int size = ListOfBonds.size(); 52 ASSERT(WorldTime::getTime() <= size, 53 "BondedParticleInfo::getBondsAtStep() - Access out of range: " 54 +toString(WorldTime::getTime()) 55 +" not in [0,"+toString(size)+"]."); 56 if (WorldTime::getTime() == size) { 57 ListOfBonds.push_back(BondList()); 58 } 59 return ListOfBonds[WorldTime::getTime()]; 60 } 61 62 const BondList& BondedParticleInfo::getListOfBondsAtStep(unsigned int _step) const 63 { 64 ASSERT(_step < ListOfBonds.size(), 65 "BondedParticleInfo::getBondsAtStep() - Access out of range: " 66 +toString(WorldTime::getTime()) 67 +" not in [0,"+toString(ListOfBonds.size())+")."); 68 return ListOfBonds[_step]; 69 } 70 71 BondList& BondedParticleInfo::getListOfBondsAtStep(unsigned int _step) 72 { 73 const unsigned int size = ListOfBonds.size(); 74 ASSERT(_step <= size, 75 "BondedParticleInfo::getBondsAtStep() - Access out of range: " 76 +toString(_step) 77 +" not in [0,"+toString(size)+"]."); 78 if (_step == size) { 79 ListOfBonds.push_back(BondList()); 80 } 81 return ListOfBonds[_step]; 82 } -
src/atom_bondedparticleinfo.hpp
rc0d9eb r9d83b6 24 24 25 25 class bond; 26 class BondedParticle; 26 27 27 28 #define BondList list<bond *> … … 30 31 31 32 class BondedParticleInfo { 33 friend class BondedParticle; 32 34 public: 33 35 unsigned char AdaptiveOrder; //!< current present bond order at site (0 means "not set") 34 36 bool MaxOrder; //!< whether this atom as a root in fragmentation still creates more fragments on higher orders or not 35 BondList ListOfBonds; //!< list of all bonds36 37 37 38 BondedParticleInfo(); 38 39 virtual ~BondedParticleInfo(); 39 40 41 /** Const accessor to ListOfBonds of WorldTime::CurrentTime. 42 * 43 * @return ListOfBonds[WorldTime::CurrentTime] 44 */ 45 const BondList& getListOfBonds() const; 46 /** Accessor to ListOfBonds of WorldTime::CurrentTime. 47 * 48 * Note, new empty BondList is returned if array entry at upper boundary is 49 * accessed. Beyond std will issue exception due to out-of-range access. 50 * 51 * @return ListOfBonds[WorldTime::CurrentTime] 52 */ 53 BondList& getListOfBonds(); 54 55 /** Const Accessor ListOfBonds of any present time step. 56 * 57 * @param _step time step to access 58 * @return ListOfBonds[_step]. 59 */ 60 const BondList& getListOfBondsAtStep(unsigned int _step) const; 61 /** Accessor ListOfBonds of any present time step. 62 * 63 * Note, new empty BondList is returned if array entry at upper boundary is 64 * accessed. Beyond std will issue exception due to out-of-range access. 65 * 66 * @param _step time step to access 67 * @return ListOfBonds[_step]. 68 */ 69 BondList& getListOfBondsAtStep(unsigned int _step); 70 40 71 private: 72 std::vector<BondList> ListOfBonds; //!< list of all bonds 41 73 42 74 }; -
src/boundary.cpp
rc0d9eb r9d83b6 818 818 const int FillerCount = filler->getAtomCount(); 819 819 DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl); 820 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) 821 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 820 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) { 821 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 822 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 823 BondRunner != ListOfBonds.end(); 824 ++BondRunner) { 822 825 if ((*BondRunner)->leftatom == *AtomRunner) 823 826 DoLog(2) && (Log() << Verbose(2) << " " << *(*BondRunner) << endl); 827 } 828 } 824 829 825 830 atom * CopyAtoms[FillerCount]; … … 912 917 } 913 918 // go through all bonds and add as well 914 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) 915 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 919 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) { 920 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 921 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 922 BondRunner != ListOfBonds.end(); 923 ++BondRunner) 916 924 if ((*BondRunner)->leftatom == *AtomRunner) { 917 925 Binder = (*BondRunner); … … 921 929 } 922 930 } 931 } 923 932 } 924 933 for (MoleculeList::iterator ListRunner = List->ListOfMolecules.begin(); ListRunner != List->ListOfMolecules.end(); ListRunner++) { … … 1084 1093 //const int FillerCount = filler->getAtomCount(); 1085 1094 DoLog(2) && (Log() << Verbose(2) << "INFO: Filler molecule has the following bonds:" << endl); 1086 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) 1087 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 1095 for(molecule::iterator AtomRunner = filler->begin(); AtomRunner != filler->end(); ++AtomRunner) { 1096 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 1097 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 1098 BondRunner != ListOfBonds.end(); 1099 ++BondRunner) 1088 1100 if ((*BondRunner)->leftatom == *AtomRunner) 1089 1101 DoLog(2) && (Log() << Verbose(2) << " " << *(*BondRunner) << endl); 1102 } 1090 1103 1091 1104 // calculate filler grid in [0,1]^3 -
src/config.cpp
rc0d9eb r9d83b6 965 965 int MaxNeighbours = 0; 966 966 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 967 const int count = (*iter)-> ListOfBonds.size();967 const int count = (*iter)->getListOfBonds().size(); 968 968 if (MaxNeighbours < count) 969 969 MaxNeighbours = count; … … 979 979 *output << static_cast<double>((*iter)->getType()->getValence()) << "\t"; 980 980 *output << (*iter)->getType()->getSymbol() << "\t"; 981 for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++) 981 const BondList& ListOfBonds = (*iter)->getListOfBonds(); 982 for (BondList::const_iterator runner = ListOfBonds.begin(); 983 runner != ListOfBonds.end(); 984 runner++) { 982 985 *output << (*runner)->GetOtherAtom(*iter)->nr << "\t"; 983 for(int i=(*iter)->ListOfBonds.size(); i < MaxNeighbours; i++) 986 } 987 for(int i = ListOfBonds.size(); i < MaxNeighbours; i++) 984 988 *output << "-\t"; 985 989 *output << endl; … … 1017 1021 for (MoleculeList::const_iterator MolWalker = MolList->ListOfMolecules.begin(); MolWalker != MolList->ListOfMolecules.end(); MolWalker++) { 1018 1022 for (molecule::const_iterator iter = (*MolWalker)->begin(); iter != (*MolWalker)->end(); ++iter) { 1019 const int count = (*iter)-> ListOfBonds.size();1023 const int count = (*iter)->getListOfBonds().size(); 1020 1024 if (MaxNeighbours < count) 1021 1025 MaxNeighbours = count; … … 1051 1055 *output << (double)(*iter)->getType()->getValence() << "\t"; 1052 1056 *output << (*iter)->getType()->getSymbol() << "\t"; 1053 for (BondList::iterator runner = (*iter)->ListOfBonds.begin(); runner != (*iter)->ListOfBonds.end(); runner++) 1057 const BondList& ListOfBonds = (*iter)->getListOfBonds(); 1058 for (BondList::const_iterator runner = ListOfBonds.begin(); 1059 runner != ListOfBonds.end(); 1060 runner++) { 1054 1061 *output << LocalNotoGlobalNoMap[ (*runner)->GetOtherAtom((*iter))->getId() ] << "\t"; 1055 for(int i=(*iter)->ListOfBonds.size(); i < MaxNeighbours; i++) 1062 } 1063 for(int i = ListOfBonds.size(); i < MaxNeighbours; i++) 1056 1064 *output << "-\t"; 1057 1065 *output << endl; -
src/molecule.cpp
rc0d9eb r9d83b6 26 26 #include <gsl/gsl_heapsort.h> 27 27 28 #include "World.hpp"29 28 #include "atom.hpp" 30 29 #include "bond.hpp" 30 #include "Box.hpp" 31 #include "CodePatterns/enumeration.hpp" 32 #include "CodePatterns/Log.hpp" 31 33 #include "config.hpp" 32 34 #include "element.hpp" 35 #include "Exceptions/LinearDependenceException.hpp" 33 36 #include "graph.hpp" 34 37 #include "Helpers/helpers.hpp" 35 38 #include "LinearAlgebra/leastsquaremin.hpp" 39 #include "LinearAlgebra/Plane.hpp" 40 #include "LinearAlgebra/RealSpaceMatrix.hpp" 41 #include "LinearAlgebra/Vector.hpp" 36 42 #include "linkedcell.hpp" 37 43 #include "lists.hpp" 38 #include "CodePatterns/Log.hpp"39 44 #include "molecule.hpp" 40 41 45 #include "periodentafel.hpp" 42 46 #include "tesselation.hpp" 43 #include "LinearAlgebra/Vector.hpp"44 #include "LinearAlgebra/RealSpaceMatrix.hpp"45 47 #include "World.hpp" 46 #include "Box.hpp" 47 #include "LinearAlgebra/Plane.hpp" 48 #include "Exceptions/LinearDependenceException.hpp" 49 50 #include "CodePatterns/enumeration.hpp" 48 #include "WorldTime.hpp" 49 51 50 52 51 /************************************* Functions for class molecule *********************************/ … … 383 382 break; 384 383 case 2: 385 // determine two other bonds (warning if there are more than two other) plus valence sanity check 386 for (BondList::const_iterator Runner = TopOrigin->ListOfBonds.begin(); Runner != TopOrigin->ListOfBonds.end(); (++Runner)) { 387 if ((*Runner) != TopBond) { 388 if (FirstBond == NULL) { 389 FirstBond = (*Runner); 390 FirstOtherAtom = (*Runner)->GetOtherAtom(TopOrigin); 391 } else if (SecondBond == NULL) { 392 SecondBond = (*Runner); 393 SecondOtherAtom = (*Runner)->GetOtherAtom(TopOrigin); 394 } else { 395 DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->getName()); 384 { 385 // determine two other bonds (warning if there are more than two other) plus valence sanity check 386 const BondList& ListOfBonds = TopOrigin->getListOfBonds(); 387 for (BondList::const_iterator Runner = ListOfBonds.begin(); 388 Runner != ListOfBonds.end(); 389 ++Runner) { 390 if ((*Runner) != TopBond) { 391 if (FirstBond == NULL) { 392 FirstBond = (*Runner); 393 FirstOtherAtom = (*Runner)->GetOtherAtom(TopOrigin); 394 } else if (SecondBond == NULL) { 395 SecondBond = (*Runner); 396 SecondOtherAtom = (*Runner)->GetOtherAtom(TopOrigin); 397 } else { 398 DoeLog(2) && (eLog()<< Verbose(2) << "Detected more than four bonds for atom " << TopOrigin->getName()); 399 } 396 400 } 397 401 } … … 642 646 643 647 // copy all bonds 644 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 645 for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 648 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 649 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 650 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 651 BondRunner != ListOfBonds.end(); 652 ++BondRunner) 646 653 if ((*BondRunner)->leftatom == *AtomRunner) { 647 654 bond *Binder = (*BondRunner); … … 660 667 NewBond->Type = Binder->Type; 661 668 } 669 } 662 670 // correct fathers 663 671 for_each(atoms.begin(),atoms.end(),mem_fun(&atom::CorrectFather)); … … 749 757 //DoeLog(1) && (eLog()<< Verbose(1) << "molecule::RemoveBond: Function not implemented yet." << endl); 750 758 BondList::const_iterator ForeRunner; 751 while (!BondPartner->ListOfBonds.empty()) { 752 ForeRunner = BondPartner->ListOfBonds.begin(); 759 BondList& ListOfBonds = BondPartner->getListOfBonds(); 760 while (!ListOfBonds.empty()) { 761 ForeRunner = ListOfBonds.begin(); 753 762 RemoveBond(*ForeRunner); 754 763 } -
src/molecule_fragmentation.cpp
rc0d9eb r9d83b6 56 56 // get maximum bond degree 57 57 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) { 58 c = ((*iter)->ListOfBonds.size() > c) ? (*iter)->ListOfBonds.size() : c; 58 const BondList& ListOfBonds = (*iter)->getListOfBonds(); 59 c = (ListOfBonds.size() > c) ? ListOfBonds.size() : c; 59 60 } 60 61 FragmentCount = NoNonHydrogen*(1 << (c*order)); … … 670 671 atomiter != (*iter)->end(); 671 672 ++atomiter) { 672 for (BondList::iterator bonditer = (*atomiter)->ListOfBonds.begin(); 673 bonditer != (*atomiter)->ListOfBonds.end(); 673 const BondList& ListOfBonds = (*atomiter)->getListOfBonds(); 674 for (BondList::const_iterator bonditer = ListOfBonds.begin(); 675 bonditer != ListOfBonds.end(); 674 676 ++bonditer) { 675 677 (*bonditer)->BondDegree = 1; … … 1009 1011 if (SonList[FatherOfRunner->nr] != NULL) { // check if this, our father, is present in list 1010 1012 // create all bonds 1011 for (BondList::const_iterator BondRunner = FatherOfRunner->ListOfBonds.begin(); BondRunner != FatherOfRunner->ListOfBonds.end(); (++BondRunner)) { 1013 const BondList& ListOfBonds = FatherOfRunner->getListOfBonds(); 1014 for (BondList::const_iterator BondRunner = ListOfBonds.begin(); 1015 BondRunner != ListOfBonds.end(); 1016 ++BondRunner) { 1012 1017 OtherFather = (*BondRunner)->GetOtherAtom(FatherOfRunner); 1013 1018 // Log() << Verbose(2) << "Father " << *FatherOfRunner << " of son " << *SonList[FatherOfRunner->nr] << " is bound to " << *OtherFather; … … 1416 1421 // go through all its bonds 1417 1422 DoLog(1) && (Log() << Verbose(1) << "Going through all bonds of Walker." << endl); 1418 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 1423 const BondList& ListOfBonds = Walker->getListOfBonds(); 1424 for (BondList::const_iterator Runner = ListOfBonds.begin(); 1425 Runner != ListOfBonds.end(); 1426 ++Runner) { 1419 1427 OtherWalker = (*Runner)->GetOtherAtom(Walker); 1420 1428 if ((RestrictedKeySet.find(OtherWalker->nr) != RestrictedKeySet.end()) … … 1811 1819 // scan all bonds 1812 1820 flag = false; 1813 for(molecule::iterator AtomRunner = begin(); (!flag) && (AtomRunner != end()); ++AtomRunner) 1814 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); (!flag) && (BondRunner != (*AtomRunner)->ListOfBonds.end()); ++BondRunner) { 1821 for(molecule::iterator AtomRunner = begin(); (!flag) && (AtomRunner != end()); ++AtomRunner) { 1822 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 1823 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 1824 (!flag) && (BondRunner != ListOfBonds.end()); 1825 ++BondRunner) { 1815 1826 Binder = (*BondRunner); 1816 1827 for (int i=NDIM;i--;) { … … 1832 1843 } 1833 1844 } 1845 } 1834 1846 //if (flag) { 1835 1847 if (0) { … … 1853 1865 ColorList[Walker->nr] = black; // mark as explored 1854 1866 *Walker += Translationvector; // translate 1855 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 1867 const BondList& ListOfBonds = Walker->getListOfBonds(); 1868 for (BondList::const_iterator Runner = ListOfBonds.begin(); 1869 Runner != ListOfBonds.end(); 1870 ++Runner) { 1856 1871 if ((*Runner) != Binder) { 1857 1872 OtherWalker = (*Runner)->GetOtherAtom(Walker); -
src/molecule_geometry.cpp
rc0d9eb r9d83b6 384 384 Testvector = inversematrix * (*iter)->getPosition(); 385 385 Translationvector.Zero(); 386 for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) { 386 const BondList& ListOfBonds = (*iter)->getListOfBonds(); 387 for (BondList::const_iterator Runner = ListOfBonds.begin(); 388 Runner != ListOfBonds.end(); 389 ++Runner) { 387 390 if ((*iter)->nr < (*Runner)->GetOtherAtom((*iter))->nr) // otherwise we shift one to, the other fro and gain nothing 388 391 for (int j=0;j<NDIM;j++) { … … 404 407 #ifdef ADDHYDROGEN 405 408 // now also change all hydrogens 406 for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) { 409 for (BondList::const_iterator Runner = ListOfBonds.begin(); 410 Runner != ListOfBonds.end(); 411 ++Runner) { 407 412 if ((*Runner)->GetOtherAtom((*iter))->getType()->getAtomicNumber() == 1) { 408 413 Testvector = inversematrix * (*Runner)->GetOtherAtom((*iter))->getPosition(); -
src/molecule_graph.cpp
rc0d9eb r9d83b6 35 35 #include "molecule.hpp" 36 36 #include "World.hpp" 37 #include "WorldTime.hpp" 37 38 #include "Box.hpp" 38 39 … … 149 150 DoLog(0) && (Log() << Verbose(0) << "Begin of CreateAdjacencyList." << endl); 150 151 // remove every bond from the list 151 for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 152 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin()) 152 for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 153 BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 154 for(BondList::iterator BondRunner = ListOfBonds.begin(); 155 !ListOfBonds.empty(); 156 BondRunner = ListOfBonds.begin()) 153 157 if ((*BondRunner)->leftatom == *AtomRunner) 154 158 delete((*BondRunner)); 159 } 155 160 BondCount = 0; 156 161 … … 239 244 bool molecule::hasBondStructure() const 240 245 { 241 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 242 if (!(*AtomRunner)->ListOfBonds.empty()) 246 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 247 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 248 if (!ListOfBonds.empty()) 243 249 return true; 250 } 244 251 return false; 245 252 } … … 251 258 { 252 259 unsigned int counter = 0; 253 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 254 for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 260 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 261 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 262 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 263 BondRunner != ListOfBonds.end(); 264 ++BondRunner) 255 265 if ((*BondRunner)->leftatom == *AtomRunner) 256 266 counter++; 267 } 257 268 return counter; 258 269 } … … 264 275 { 265 276 DoLog(1) && (Log() << Verbose(1) << endl << "From contents of bond chain list:"); 266 for(molecule::const_iterator AtomRunner = molecule::begin(); AtomRunner != molecule::end(); ++AtomRunner) 267 for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 277 for(molecule::const_iterator AtomRunner = molecule::begin(); AtomRunner != molecule::end(); ++AtomRunner) { 278 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 279 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 280 BondRunner != ListOfBonds.end(); 281 ++BondRunner) 268 282 if ((*BondRunner)->leftatom == *AtomRunner) { 269 283 DoLog(0) && (Log() << Verbose(0) << *(*BondRunner) << "\t" << endl); 270 284 } 285 } 271 286 DoLog(0) && (Log() << Verbose(0) << endl); 272 287 } … … 315 330 MoleculeLeafClass *Subgraphs = NULL; 316 331 std::deque<bond *> *BackEdgeStack = NULL; 317 for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 318 if ((!(*AtomRunner)->ListOfBonds.empty()) && ((*(*AtomRunner)->ListOfBonds.begin())->Type == Undetermined)) { 332 for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 333 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 334 if ((!ListOfBonds.empty()) && ((*ListOfBonds.begin())->Type == Undetermined)) { 319 335 DoLog(0) && (Log() << Verbose(0) << "No Depth-First-Search analysis performed so far, calling ..." << endl); 320 336 Subgraphs = DepthFirstSearchAnalysis(BackEdgeStack); … … 327 343 break; 328 344 } 329 for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 330 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 345 } 346 for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 347 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 348 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 349 BondRunner != ListOfBonds.end(); 350 ++BondRunner) 331 351 if ((*BondRunner)->leftatom == *AtomRunner) 332 352 if ((*BondRunner)->Cyclic) 333 353 NoCyclicBonds++; 354 } 334 355 delete (BackEdgeStack); 335 356 return NoCyclicBonds; … … 637 658 { 638 659 NoCyclicBonds = 0; 639 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 640 for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 660 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 661 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 662 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 663 BondRunner != ListOfBonds.end(); 664 ++BondRunner) 641 665 if ((*BondRunner)->leftatom == *AtomRunner) 642 666 if ((*BondRunner)->rightatom->LowpointNr == (*BondRunner)->leftatom->LowpointNr) { // cyclic ?? … … 644 668 NoCyclicBonds++; 645 669 } 670 } 646 671 } 647 672 ; … … 662 687 void molecule::OutputGraphInfoPerBond() const 663 688 { 664 bond *Binder = NULL;665 689 DoLog(1) && (Log() << Verbose(1) << "Final graph info for each bond is:" << endl); 666 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 667 for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 690 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 691 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 692 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 693 BondRunner != ListOfBonds.end(); 694 ++BondRunner) 668 695 if ((*BondRunner)->leftatom == *AtomRunner) { 669 Binder = *BondRunner;696 const bond *Binder = *BondRunner; 670 697 if (DoLog(2)) { 671 698 ostream &out = (Log() << Verbose(2)); … … 681 708 DoLog(3) && (Log() << Verbose(3) << "Lowpoint at each side are equal: CYCLIC!" << endl); 682 709 } 710 } 683 711 } 684 712 ; … … 762 790 BFS.BFSStack->pop_front(); 763 791 DoLog(2) && (Log() << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *BFS.Root << "." << endl); 764 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 792 const BondList& ListOfBonds = Walker->getListOfBonds(); 793 for (BondList::const_iterator Runner = ListOfBonds.begin(); 794 Runner != ListOfBonds.end(); 795 ++Runner) { 765 796 if ((*Runner) != BackEdge) { // only walk along DFS spanning tree (otherwise we always find SP of one being backedge Binder) 766 797 OtherAtom = (*Runner)->GetOtherAtom(Walker); … … 895 926 BFS.BFSStack->pop_front(); 896 927 //Log() << Verbose(2) << "Current Walker is " << *Walker << ", we look for SP to Root " << *Root << "." << endl; 897 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 928 const BondList& ListOfBonds = Walker->getListOfBonds(); 929 for (BondList::const_iterator Runner = ListOfBonds.begin(); 930 Runner != ListOfBonds.end(); 931 ++Runner) { 898 932 // "removed (*Runner) != BackEdge) || " from next if, is u 899 if (( Walker->ListOfBonds.size() == 1)) { // only walk along DFS spanning tree (otherwise we always find SP of 1 being backedge Binder), but terminal hydrogens may be connected via backedge, hence extra check933 if ((ListOfBonds.size() == 1)) { // only walk along DFS spanning tree (otherwise we always find SP of 1 being backedge Binder), but terminal hydrogens may be connected via backedge, hence extra check 900 934 OtherAtom = (*Runner)->GetOtherAtom(Walker); 901 935 //Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *Binder << "." << endl; … … 1017 1051 size_t i = 0; 1018 1052 if (vertex != NULL) { 1019 for (; i < vertex->ListOfBonds.size(); i++) { 1053 const BondList& ListOfBonds = vertex->getListOfBonds(); 1054 for (; i < ListOfBonds.size(); i++) { 1020 1055 if (vertex->ComponentNr[i] == -1) { // check if not yet used 1021 1056 vertex->ComponentNr[i] = nr; … … 1024 1059 break; // breaking here will not cause error! 1025 1060 } 1026 if (i == vertex->ListOfBonds.size()) {1061 if (i == ListOfBonds.size()) { 1027 1062 DoeLog(0) && (eLog()<< Verbose(0) << "Error: All Component entries are already occupied!" << endl); 1028 1063 performCriticalExit(); … … 1041 1076 bond * molecule::FindNextUnused(atom *vertex) const 1042 1077 { 1043 for (BondList::const_iterator Runner = vertex->ListOfBonds.begin(); Runner != vertex->ListOfBonds.end(); (++Runner)) 1078 const BondList& ListOfBonds = vertex->getListOfBonds(); 1079 for (BondList::const_iterator Runner = ListOfBonds.begin(); 1080 Runner != ListOfBonds.end(); 1081 ++Runner) 1044 1082 if ((*Runner)->IsUsed() == white) 1045 1083 return ((*Runner)); … … 1053 1091 void molecule::ResetAllBondsToUnused() const 1054 1092 { 1055 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) 1056 for(BondList::const_iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); BondRunner != (*AtomRunner)->ListOfBonds.end(); ++BondRunner) 1093 for(molecule::const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 1094 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 1095 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 1096 BondRunner != ListOfBonds.end(); 1097 ++BondRunner) 1057 1098 if ((*BondRunner)->leftatom == *AtomRunner) 1058 1099 (*BondRunner)->ResetUsed(); 1100 } 1059 1101 } 1060 1102 ; … … 1168 1210 1169 1211 //Log() << Verbose(2) << "Walker is " << *Walker << ", bond partners: "; 1170 if (CurrentBondsOfAtom == Walker->ListOfBonds.size()) { 1171 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 1212 const BondList& ListOfBonds = Walker->getListOfBonds(); 1213 if (CurrentBondsOfAtom == ListOfBonds.size()) { 1214 for (BondList::const_iterator Runner = ListOfBonds.begin(); 1215 Runner != ListOfBonds.end(); 1216 ++Runner) { 1172 1217 id = (*Runner)->GetOtherAtom(Walker)->nr; 1173 1218 j = 0; … … 1185 1230 //Log() << Verbose(0) << endl; 1186 1231 } else { 1187 DoLog(0) && (Log() << Verbose(0) << "Number of bonds for Atom " << *Walker << " does not match, parsed " << CurrentBondsOfAtom << " against " << Walker->ListOfBonds.size() << "." << endl);1232 DoLog(0) && (Log() << Verbose(0) << "Number of bonds for Atom " << *Walker << " does not match, parsed " << CurrentBondsOfAtom << " against " << ListOfBonds.size() << "." << endl); 1188 1233 status = false; 1189 1234 } … … 1271 1316 do { // go through all bonds and push local ones 1272 1317 Walker = ListOfLocalAtoms[Binder->leftatom->nr]; // get one atom in the reference molecule 1273 if (Walker != NULL) // if this Walker exists in the subgraph ... 1274 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 1318 if (Walker != NULL) { // if this Walker exists in the subgraph ... 1319 const BondList& ListOfBonds = Walker->getListOfBonds(); 1320 for (BondList::const_iterator Runner = ListOfBonds.begin(); 1321 Runner != ListOfBonds.end(); 1322 ++Runner) { 1275 1323 OtherAtom = (*Runner)->GetOtherAtom(Walker); 1276 1324 if (OtherAtom == ListOfLocalAtoms[(*Runner)->rightatom->nr]) { // found the bond … … 1280 1328 } 1281 1329 } 1330 } 1282 1331 ASSERT(!ReferenceStack->empty(), "molecule::PickLocalBackEdges() - ReferenceStack is empty!"); 1283 1332 Binder = ReferenceStack->front(); // loop the stack for next item … … 1423 1472 Walker = BFS.BFSStack->front(); // pop oldest added 1424 1473 BFS.BFSStack->pop_front(); 1425 DoLog(1) && (Log() << Verbose(1) << "Current Walker is: " << Walker->getName() << ", and has " << Walker->ListOfBonds.size() << " bonds." << endl); 1426 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 1474 const BondList& ListOfBonds = Walker->getListOfBonds(); 1475 DoLog(1) && (Log() << Verbose(1) << "Current Walker is: " << Walker->getName() << ", and has " << ListOfBonds.size() << " bonds." << endl); 1476 for (BondList::const_iterator Runner = ListOfBonds.begin(); 1477 Runner != ListOfBonds.end(); 1478 ++Runner) { 1427 1479 if ((*Runner) != NULL) { // don't look at bond equal NULL 1428 1480 Binder = (*Runner); … … 1496 1548 status = false; 1497 1549 } else { 1498 for (BondList::const_iterator Runner = (*iter)->ListOfBonds.begin(); Runner != (*iter)->ListOfBonds.end(); (++Runner)) { 1550 const BondList& ListOfBonds = (*iter)->getListOfBonds(); 1551 for (BondList::const_iterator Runner = ListOfBonds.begin(); 1552 Runner != ListOfBonds.end(); 1553 ++Runner) { 1499 1554 OtherAtom = (*Runner)->GetOtherAtom((*iter)); 1500 1555 if (ParentList[OtherAtom->nr] != NULL) { // if otheratom is also a father of an atom on this molecule, create the bond … … 1534 1589 1535 1590 /** For a given keyset \a *Fragment, checks whether it is connected in the current molecule. 1536 * \param *out output stream for debugging1537 1591 * \param *Fragment Keyset of fragment's vertices 1538 1592 * \return true - connected, false - disconnected … … 1558 1612 for (KeySet::iterator runners = Fragment->begin(); runners != Fragment->end(); runners++) { 1559 1613 Walker2 = FindAtom(*runners); 1560 for (BondList::const_iterator Runner = Walker->ListOfBonds.begin(); Runner != Walker->ListOfBonds.end(); (++Runner)) { 1614 const BondList& ListOfBonds = Walker->getListOfBonds(); 1615 for (BondList::const_iterator Runner = ListOfBonds.begin(); 1616 Runner != ListOfBonds.end(); 1617 ++Runner) { 1561 1618 if ((*Runner)->GetOtherAtom(Walker) == Walker2) { 1562 1619 BondStatus = true; -
src/moleculelist.cpp
rc0d9eb r9d83b6 363 363 // 2. take every hydrogen that is a saturated one 364 364 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 365 //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)-> ListOfBonds.begin()) << "." << endl;365 //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "." << endl; 366 366 if (((*iter)->getType()->getAtomicNumber() == 1) && (((*iter)->father == NULL) 367 367 || ((*iter)->father->getType()->getAtomicNumber() != 1))) { // if it's a hydrogen 368 368 for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) { 369 //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)-> ListOfBonds.begin()) << "." << endl;369 //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->getListOfBonds().begin()) << "." << endl; 370 370 // 3. take every other hydrogen that is the not the first and not bound to same bonding partner 371 Binder = *((*runner)-> ListOfBonds.begin());371 Binder = *((*runner)->getListOfBonds().begin()); 372 372 if (((*runner)->getType()->getAtomicNumber() == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!) 373 373 // 4. evaluate the morse potential for each matrix component and add up … … 805 805 DoLog(1) && (Log() << Verbose(1) << "Creating adjacency list for subgraph " << Leaf << "." << endl); 806 806 // remove every bond from the list 807 for(molecule::iterator AtomRunner = Leaf->begin(); AtomRunner != Leaf->end(); ++AtomRunner) 808 for(BondList::iterator BondRunner = (*AtomRunner)->ListOfBonds.begin(); !(*AtomRunner)->ListOfBonds.empty(); BondRunner = (*AtomRunner)->ListOfBonds.begin()) 807 for(molecule::iterator AtomRunner = Leaf->begin(); AtomRunner != Leaf->end(); ++AtomRunner) { 808 BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 809 for(BondList::iterator BondRunner = ListOfBonds.begin(); 810 !ListOfBonds.empty(); 811 BondRunner = ListOfBonds.begin()) 809 812 if ((*BondRunner)->leftatom == *AtomRunner) 810 813 delete((*BondRunner)); 814 } 815 811 816 812 817 for(molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end(); ++iter) { 813 818 Father = (*iter)->GetTrueFather(); 814 819 AtomNo = Father->nr; // global id of the current walker 815 for (BondList::const_iterator Runner = Father->ListOfBonds.begin(); Runner != Father->ListOfBonds.end(); (++Runner)) { 820 const BondList& ListOfBonds = Father->getListOfBonds(); 821 for (BondList::const_iterator Runner = ListOfBonds.begin(); 822 Runner != ListOfBonds.end(); 823 ++Runner) { 816 824 OtherWalker = ListOfLocalAtoms[(*Runner)->GetOtherAtom((*iter)->GetTrueFather())->nr]; // local copy of current bond partner of walker 817 825 if (OtherWalker != NULL) { -
src/unittests/ListOfBondsUnitTest.cpp
rc0d9eb r9d83b6 126 126 127 127 // check that bond is present in both atoms 128 bond *TestBond1 = *(atom1->ListOfBonds.begin()); 128 BondList::const_iterator bonditer; 129 bonditer = atom1->getListOfBonds().begin(); 130 bond *TestBond1 = *bonditer; 129 131 CPPUNIT_ASSERT_EQUAL( TestBond1, Binder ); 130 bond *TestBond2 = *(atom2->ListOfBonds.begin()); 132 bonditer = atom2->getListOfBonds().begin(); 133 bond *TestBond2 = *bonditer; 131 134 CPPUNIT_ASSERT_EQUAL( TestBond2, Binder ); 132 135 }; … … 153 156 154 157 // check if removed from atoms 155 CPPUNIT_ASSERT_EQUAL( (size_t) 0, atom1->ListOfBonds.size() ); 156 CPPUNIT_ASSERT_EQUAL( (size_t) 0, atom2->ListOfBonds.size() ); 158 { 159 const BondList& ListOfBonds = atom1->getListOfBonds(); 160 CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() ); 161 } 162 { 163 const BondList& ListOfBonds = atom2->getListOfBonds(); 164 CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() ); 165 } 157 166 158 167 // check if removed from molecule … … 185 194 186 195 // check that all are present 187 CPPUNIT_ASSERT_EQUAL( (size_t) 2, atom1->ListOfBonds.size() ); 188 CPPUNIT_ASSERT_EQUAL( (size_t) 2, atom2->ListOfBonds.size() ); 189 CPPUNIT_ASSERT_EQUAL( (size_t) 2, atom3->ListOfBonds.size() ); 196 { 197 const BondList& ListOfBonds = atom1->getListOfBonds(); 198 CPPUNIT_ASSERT_EQUAL( (size_t) 2, ListOfBonds.size() ); 199 } 200 { 201 const BondList& ListOfBonds = atom2->getListOfBonds(); 202 CPPUNIT_ASSERT_EQUAL( (size_t) 2, ListOfBonds.size() ); 203 } 204 { 205 const BondList& ListOfBonds = atom3->getListOfBonds(); 206 CPPUNIT_ASSERT_EQUAL( (size_t) 2, ListOfBonds.size() ); 207 } 190 208 191 209 // remove bond … … 193 211 194 212 // check if removed from atoms 195 CPPUNIT_ASSERT_EQUAL( (size_t) 0, atom1->ListOfBonds.size() ); 196 CPPUNIT_ASSERT_EQUAL( (size_t) 1, atom2->ListOfBonds.size() ); 197 CPPUNIT_ASSERT_EQUAL( (size_t) 1, atom3->ListOfBonds.size() ); 213 { 214 const BondList& ListOfBonds = atom1->getListOfBonds(); 215 CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() ); 216 } 217 { 218 const BondList& ListOfBonds = atom2->getListOfBonds(); 219 CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() ); 220 } 221 { 222 const BondList& ListOfBonds = atom3->getListOfBonds(); 223 CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() ); 224 } 198 225 199 226 // check if removed from molecule … … 223 250 224 251 // check if removed from atoms 225 CPPUNIT_ASSERT_EQUAL( (size_t) 0, atom1->ListOfBonds.size() ); 226 CPPUNIT_ASSERT_EQUAL( (size_t) 0, atom2->ListOfBonds.size() ); 252 { 253 const BondList& ListOfBonds = atom1->getListOfBonds(); 254 CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() ); 255 } 256 { 257 const BondList& ListOfBonds = atom2->getListOfBonds(); 258 CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() ); 259 } 227 260 228 261 // check if removed from molecule … … 251 284 252 285 // check bond if removed from other atom 253 CPPUNIT_ASSERT_EQUAL( (size_t) 0, atom1->ListOfBonds.size() ); 286 { 287 const BondList& ListOfBonds = atom1->getListOfBonds(); 288 CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() ); 289 } 254 290 255 291 // check if removed from molecule … … 278 314 CPPUNIT_ASSERT( Binder != NULL ); 279 315 280 CPPUNIT_ASSERT_EQUAL( (size_t) 1, atom1->ListOfBonds.size() ); 281 CPPUNIT_ASSERT_EQUAL( (size_t) 1, atom2->ListOfBonds.size() ); 316 { 317 const BondList& ListOfBonds = atom1->getListOfBonds(); 318 CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() ); 319 } 320 { 321 const BondList& ListOfBonds = atom2->getListOfBonds(); 322 CPPUNIT_ASSERT_EQUAL( (size_t) 1, ListOfBonds.size() ); 323 } 282 324 283 325 CPPUNIT_ASSERT_EQUAL( true, TestMolecule->hasBondStructure() ); … … 287 329 288 330 // check bond if removed from other atom 289 CPPUNIT_ASSERT_EQUAL( (size_t) 0, atom1->ListOfBonds.size() ); 331 { 332 const BondList& ListOfBonds = atom1->getListOfBonds(); 333 CPPUNIT_ASSERT_EQUAL( (size_t) 0, ListOfBonds.size() ); 334 } 290 335 291 336 // check if removed from molecule
Note:
See TracChangeset
for help on using the changeset viewer.