- Timestamp:
- Dec 28, 2011, 3:27:15 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, 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:
- 3e4fb6
- Parents:
- f9b967 (diff), adb5cda (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src
- Files:
-
- 22 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Actions/WorldAction/BoundInBoxAction.cpp
rf9b967 r401f90 76 76 MolRunner != AllMolecules.end(); 77 77 ++MolRunner) { 78 for(molecule:: const_iterator AtomRunner = (*MolRunner)->begin();78 for(molecule::iterator AtomRunner = (*MolRunner)->begin(); 79 79 AtomRunner != (*MolRunner)->end(); 80 80 ++AtomRunner) { -
src/Actions/WorldAction/CenterInBoxAction.cpp
rf9b967 r401f90 109 109 MolRunner != AllMolecules.end(); 110 110 ++MolRunner) { 111 for(molecule:: const_iterator AtomRunner = (*MolRunner)->begin();111 for(molecule::iterator AtomRunner = (*MolRunner)->begin(); 112 112 AtomRunner != (*MolRunner)->end(); 113 113 ++AtomRunner) { -
src/Analysis/analysis_correlation.cpp
rf9b967 r401f90 212 212 LOG(1,"INFO: Resulting relative angle for molecule " << _mol->getName() 213 213 << " is " << angle << "."); 214 outmap->insert ( make_pair (angle, *iter ) );214 outmap->insert ( std::make_pair (angle, *iter ) ); 215 215 ++i; 216 216 } … … 322 322 distance = domain.periodicDistance((*iter)->getPosition(),(*runner)->getPosition()); 323 323 //LOG(1, "Inserting " << *(*iter) << " and " << *(*runner)); 324 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) ); 324 outmap->insert ( 325 std::pair<double, std::pair <const atom *, const atom*> > ( 326 distance, 327 std::pair<const atom *, const atom*> ((*iter), (*runner)) 328 ) 329 ); 325 330 } 326 331 } … … 403 408 distance = checkX.distance(checkOtherX); 404 409 //LOG(1, "Inserting " << *(*iter) << " and " << *(*runner)); 405 outmap->insert ( pair<double, pair <atom *, atom*> > (distance, pair<atom *, atom*> ((*iter), (*runner)) ) ); 410 outmap->insert ( 411 std::pair<double, std::pair <const atom *, const atom*> > ( 412 distance, 413 std::pair<const atom *, const atom*> ( 414 (*iter), 415 (*runner)) 416 ) 417 ); 406 418 } 407 419 } … … 444 456 distance = domain.periodicDistance((*iter)->getPosition(),*point); 445 457 LOG(4, "Current distance is " << distance << "."); 446 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> ((*iter), point) ) ); 458 outmap->insert ( 459 std::pair<double, std::pair<const atom *, const Vector*> >( 460 distance, 461 std::pair<const atom *, const Vector*> ( 462 (*iter), 463 point) 464 ) 465 ); 447 466 } 448 467 } … … 491 510 distance = checkX.distance(*point); 492 511 LOG(4, "Current distance is " << distance << "."); 493 outmap->insert ( pair<double, pair<atom *, const Vector*> >(distance, pair<atom *, const Vector*> (*iter, point) ) ); 512 outmap->insert ( 513 std::pair<double, 514 std::pair<const atom *, const Vector*> >( 515 distance, 516 std::pair<const atom *, const Vector*> ( 517 *iter, 518 point) 519 ) 520 ); 494 521 } 495 522 } … … 533 560 distance = Intersections.GetSmallestDistance(); 534 561 triangle = Intersections.GetClosestTriangle(); 535 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(distance, pair<atom *, BoundaryTriangleSet*> ((*iter), triangle) ) ); 562 outmap->insert ( 563 std::pair<double, 564 std::pair<const atom *, BoundaryTriangleSet*> >( 565 distance, 566 std::pair<const atom *, BoundaryTriangleSet*> ( 567 (*iter), 568 triangle) 569 ) 570 ); 536 571 } 537 572 } … … 597 632 } 598 633 // insert 599 outmap->insert ( pair<double, pair<atom *, BoundaryTriangleSet*> >(ShortestDistance, pair<atom *, BoundaryTriangleSet*> (*iter, ShortestTriangle) ) ); 634 outmap->insert ( 635 std::pair<double, 636 std::pair<const atom *, BoundaryTriangleSet*> >( 637 ShortestDistance, 638 std::pair<const atom *, BoundaryTriangleSet*> ( 639 *iter, 640 ShortestTriangle) 641 ) 642 ); 600 643 //LOG(1, "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << "."); 601 644 } -
src/Analysis/analysis_correlation.hpp
rf9b967 r401f90 46 46 /********************************************** definitions *********************************/ 47 47 48 typedef multimap<double, pair< atom *,atom *> > PairCorrelationMap;49 typedef multimap<double, atom * > DipoleAngularCorrelationMap;50 typedef multimap<double, pair< molecule *,molecule *> > DipoleCorrelationMap;51 typedef multimap<double, pair< atom *, const Vector *> > CorrelationToPointMap;52 typedef multimap<double, pair< atom *, BoundaryTriangleSet *> > CorrelationToSurfaceMap;48 typedef multimap<double, pair<const atom *, const atom *> > PairCorrelationMap; 49 typedef multimap<double, const atom * > DipoleAngularCorrelationMap; 50 typedef multimap<double, pair<const molecule *, const molecule *> > DipoleCorrelationMap; 51 typedef multimap<double, pair<const atom *, const Vector *> > CorrelationToPointMap; 52 typedef multimap<double, pair<const atom *, BoundaryTriangleSet *> > CorrelationToSurfaceMap; 53 53 typedef map<double, int> BinPairMap; 54 54 -
src/Descriptors/AtomOfMoleculeSelectionDescriptor.cpp
rf9b967 r401f90 53 53 iter != instance.endMoleculeSelection(); 54 54 ++iter) { 55 transform(iter->second->begin(), 56 iter->second->end(), 57 back_inserter(res), 58 _take<atom*,molecule::atomSet::value_type>::get); 55 std::copy(iter->second->begin(), iter->second->end(), res.begin()); 59 56 } 60 57 return res; -
src/Dynamics/LinearInterpolationBetweenSteps.hpp
rf9b967 r401f90 55 55 if (!MapByIdentity) { 56 56 LOG(1, "STATUS: Constructing atom mapping from start to end position."); 57 molecule::atomSet atoms_list; 58 copy(atoms.begin(), atoms.end(), atoms_list.begin()); 59 MinimiseConstrainedPotential Minimiser(atoms_list, PermutationMap); 57 MinimiseConstrainedPotential Minimiser(atoms, PermutationMap); 60 58 Minimiser(startstep, endstep, IsAngstroem); 61 59 } else { -
src/Dynamics/MinimiseConstrainedPotential.cpp
rf9b967 r401f90 40 40 41 41 MinimiseConstrainedPotential::MinimiseConstrainedPotential( 42 molecule::atomSet&_atoms,42 World::AtomComposite &_atoms, 43 43 std::map<atom*, atom *> &_PermutationMap) : 44 44 atoms(_atoms), … … 59 59 PermutationMap.clear(); 60 60 DoubleList.clear(); 61 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {61 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 62 62 DistanceList[*iter].clear(); 63 63 } … … 90 90 LOG(2, "Starting round " << ++round << ", at current potential " << OldPotential << " ... "); 91 91 OlderPotential = OldPotential; 92 molecule::atomSet::const_iterator iter;92 World::AtomComposite::const_iterator iter; 93 93 do { 94 94 iter = atoms.begin(); … … 105 105 //LOG(2, "Current Walker: " << *(*iter) << " with old/next candidate " << *Sprinter << "/" << *DistanceIterators[(*iter)]->second << "."); 106 106 // find source of the new target 107 molecule::atomSet::const_iterator runner = atoms.begin();107 World::AtomComposite::const_iterator runner = atoms.begin(); 108 108 for (; runner != atoms.end(); ++runner) { // find the source whose toes we might be stepping on (Walker's new target should be in use by another already) 109 109 if (PermutationMap[(*runner)] == DistanceIterators[(*iter)]->second) { … … 165 165 void MinimiseConstrainedPotential::FillDistanceList() 166 166 { 167 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {168 for ( molecule::atomSet::const_iterator runner = atoms.begin(); runner != atoms.end(); ++runner) {167 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 168 for (World::AtomComposite::const_iterator runner = atoms.begin(); runner != atoms.end(); ++runner) { 169 169 DistanceList[(*iter)].insert( DistancePair((*iter)->getPositionAtStep(startstep).distance((*runner)->getPositionAtStep(endstep)), (*runner)) ); 170 170 } … … 174 174 void MinimiseConstrainedPotential::CreateInitialLists() 175 175 { 176 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {176 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 177 177 StepList[(*iter)] = DistanceList[(*iter)].begin(); // stores the step to the next iterator that could be a possible next target 178 178 PermutationMap[(*iter)] = DistanceList[(*iter)].begin()->second; // always pick target with the smallest distance … … 185 185 void MinimiseConstrainedPotential::MakeInjectivePermutation() 186 186 { 187 molecule::atomSet::const_iterator iter = atoms.begin();187 World::AtomComposite::const_iterator iter = atoms.begin(); 188 188 DistanceMap::iterator NewBase; 189 189 double Potential = fabs(ConstrainedPotential()); … … 204 204 Potential = TryNextNearestNeighbourForInjectivePermutation((*iter), Potential); 205 205 } 206 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {206 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 207 207 // now each single entry in the DoubleList should be <=1 208 208 if (DoubleList[*iter] > 1) { … … 216 216 unsigned int MinimiseConstrainedPotential::CalculateDoubleList() 217 217 { 218 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter)218 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) 219 219 DoubleList[*iter] = 0; 220 220 unsigned int doubles = 0; 221 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter)221 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) 222 222 DoubleList[ PermutationMap[*iter] ]++; 223 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter)223 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) 224 224 if (DoubleList[*iter] > 1) 225 225 doubles++; … … 235 235 zeile1 << "PermutationMap: "; 236 236 zeile2 << " "; 237 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {237 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 238 238 zeile1 << (*iter)->getName() << " "; 239 239 zeile2 << (PermutationMap[*iter])->getName() << " "; 240 240 } 241 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {241 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 242 242 std::map<atom *, unsigned int>::const_iterator value_iter = DoubleList.find(*iter); 243 243 if (value_iter->second > (unsigned int)1) … … 255 255 // go through every atom 256 256 atom *Runner = NULL; 257 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {257 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 258 258 // first term: distance to target 259 259 Runner = PermutationMap[(*iter)]; // find target point … … 299 299 { 300 300 double result = 0.; 301 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {301 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 302 302 if ((PermutationMap[Walker] == PermutationMap[(*iter)]) && (Walker < (*iter))) { 303 303 // atom *Sprinter = PermutationMap[Walker->nr]; … … 324 324 double Norm1, Norm2, tmp, result = 0.; 325 325 326 for ( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {326 for (World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 327 327 if ((*iter) == Walker) // hence, we only go up to the Walker, not beyond (similar to i=0; i<j; i++) 328 328 break; … … 407 407 /// evaluate forces (only the distance to target dependent part) with the final PermutationMap 408 408 LOG(1, "Calculating forces and adding onto ForceMatrix ... "); 409 for( molecule::atomSet::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {409 for(World::AtomComposite::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) { 410 410 atom *Sprinter = PermutationMap[(*iter)]; 411 411 // set forces -
src/Dynamics/MinimiseConstrainedPotential.hpp
rf9b967 r401f90 19 19 #include <map> 20 20 21 #include " molecule.hpp"21 #include "World.hpp" 22 22 23 23 /** Structure to contain parameters needed for evaluation of constraint potential. … … 33 33 * @return 34 34 */ 35 MinimiseConstrainedPotential( molecule::atomSet&_atoms, std::map<atom*, atom *> &_PermutationMap);35 MinimiseConstrainedPotential(World::AtomComposite &_atoms, std::map<atom*, atom *> &_PermutationMap); 36 36 37 37 /** Destructor. … … 79 79 typedef std::pair < DistanceMap::iterator, bool> DistanceTestPair; 80 80 81 molecule::atomSetatoms;81 World::AtomComposite atoms; 82 82 int startstep; //!< start configuration (MDStep in atom::trajectory) 83 83 int endstep; //!< end configuration (MDStep in atom::trajectory) -
src/Dynamics/VerletForceIntegration.hpp
rf9b967 r401f90 98 98 // calculate forces and potential 99 99 std::map<atom *, atom*> PermutationMap; 100 molecule::atomSet atoms_list; 101 copy(atoms.begin(), atoms.end(), atoms_list.begin()); 102 MinimiseConstrainedPotential Minimiser(atoms_list, PermutationMap); 100 MinimiseConstrainedPotential Minimiser(atoms, PermutationMap); 103 101 //double ConstrainedPotentialEnergy = 104 102 Minimiser(DoConstrainedMD, 0, IsAngstroem); -
src/Fragmentation/Fragmentation.cpp
rf9b967 r401f90 595 595 596 596 // set atom values 597 for(molecule:: const_iterator iter=mol->begin();iter!=mol->end();++iter){597 for(molecule::iterator iter=mol->begin();iter!=mol->end();++iter){ 598 598 (*iter)->AdaptiveOrder = OrderArray[(*iter)->getNr()]; 599 599 (*iter)->MaxOrder = MaxArray[(*iter)->getNr()]; … … 676 676 677 677 // we increment the iter just before skipping the hydrogen 678 for (molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end();) { 678 // as we use AddBond, we cannot have a const_iterator here 679 for (molecule::iterator iter = Leaf->begin(); iter != Leaf->end();) { 679 680 LonelyFlag = true; 680 681 FatherOfRunner = (*iter)->father; -
src/Graph/BuildInducedSubgraph.cpp
rf9b967 r401f90 46 46 // fill parent list with sons 47 47 LOG(3, "Filling Parent List."); 48 for (molecule:: const_iterator iter = Son->begin(); iter != Son->end(); ++iter) {48 for (molecule::iterator iter = Son->begin(); iter != Son->end(); ++iter) { 49 49 ParentList[(*iter)->father] = (*iter); 50 50 // Outputting List for debugging … … 59 59 // check each entry of parent list and if ok (one-to-and-onto matching) create bonds 60 60 LOG(2, "STATUS: Creating bonds."); 61 for (molecule:: const_iterator iter = Father->begin(); iter != Father->end(); ++iter) {61 for (molecule::iterator iter = Father->begin(); iter != Father->end(); ++iter) { 62 62 if (ParentList.count(*iter)) { 63 63 if (ParentList[(*iter)]->father != (*iter)) { -
src/MoleculeLeafClass.cpp
rf9b967 r401f90 110 110 bool MoleculeLeafClass::FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter, const enum HydrogenSaturation saturation) 111 111 { 112 atom *Father = NULL;113 114 112 if (RootStack != NULL) { 115 113 // find first root candidates … … 117 115 RootStack[FragmentCounter].clear(); 118 116 for(molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end(); ++iter) { 119 Father = (*iter)->GetTrueFather();117 const atom * const Father = (*iter)->GetTrueFather(); 120 118 if (AtomMask[Father->getNr()]) // apply mask 121 119 if ((saturation == DontSaturate) || ((*iter)->getType()->getAtomicNumber() != 1)) // skip hydrogen -
src/Parser/FormatParserStorage.cpp
rf9b967 r401f90 267 267 * We store in the order of the atomic ids, not in the order they appear in the molecules. 268 268 * Hence, we first create a vector from all selected molecules' atoms. 269 * 270 * TODO: Change here atom * to const atom * when FormatParserStorage::save() uses vector<const atom *> 271 * 269 272 * \param &output output stream 270 273 * \param suffix … … 278 281 MolIter != molecules.end(); 279 282 ++MolIter) { 280 for(molecule:: atomSet::const_iterator AtomIter = (*MolIter)->begin();283 for(molecule::iterator AtomIter = (*MolIter)->begin(); 281 284 AtomIter != (*MolIter)->end(); 282 285 ++AtomIter) { -
src/Tesselation/BoundaryMaps.hpp
rf9b967 r401f90 29 29 30 30 // ============= TesselPoint maps ======================== // 31 typedef std::pair < double, classTesselPoint * > TesselPointDistancePair;32 typedef std::multimap < double, class TesselPoint * > TesselPointDistanceMap;33 typedef std::pair < TesselPointDistanceMap::iterator, bool > TesselPointDistanceTestPair;31 typedef std::pair < double, TesselPoint * > TesselPointDistancePair; 32 //typedef std::multimap < double, class TesselPoint * > TesselPointDistanceMap; 33 //typedef std::pair < TesselPointDistanceMap::iterator, bool > TesselPointDistanceTestPair; 34 34 35 35 typedef std::list <TesselPoint *> TesselPointList; -
src/Tesselation/boundary.cpp
rf9b967 r401f90 189 189 190 190 // 3b. construct set of all points, transformed into cylindrical system and with left and right neighbours 191 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 191 // Boundaries stores non-const TesselPoint ref, hence we need iterator here 192 for (molecule::iterator iter = mol->begin(); iter != mol->end(); ++iter) { 192 193 ProjectedVector = (*iter)->getPosition() - (*MolCenter); 193 194 ProjectedVector.ProjectOntoPlane(AxisVector); … … 874 875 phi[i] = (random()/(rng_max-rng_min))*(2.*M_PI); 875 876 876 for(molecule::const_iterator iter = filler->begin(); iter !=filler->end();++iter){ 877 // atom::clone is not const member function, hence we need iterator here 878 for(molecule::iterator iter = filler->begin(); iter !=filler->end();++iter){ 877 879 878 880 // create atomic random translation vector ... -
src/atom.cpp
rf9b967 r401f90 79 79 80 80 atom *atom::GetTrueFather() 81 { 82 const atom *father = const_cast<const atom *>(this)->GetTrueFather(); 83 return const_cast<atom *>(father); 84 } 85 86 const atom *atom::GetTrueFather() const 81 87 { 82 88 if(father == this){ // top most father is the one that points on itself -
src/atom.hpp
rf9b967 r401f90 153 153 */ 154 154 atom *GetTrueFather(); 155 156 /** Const version of \sa GetTrueFather(). 157 * \return true father, i.e. whose father points to itself, NULL if it could not be found or has none (added hydrogen) 158 */ 159 const atom *GetTrueFather() const; 155 160 156 161 /** Compares the indices of \a this atom with a given \a ptr. -
src/molecule.cpp
rf9b967 r401f90 150 150 151 151 molecule::iterator molecule::begin(){ 152 return molecule::iterator(atoms.begin(),this);152 return iterator(atomIds.begin(), FromIdToAtom()); 153 153 } 154 154 155 155 molecule::const_iterator molecule::begin() const{ 156 return atoms.begin();156 return const_iterator(atomIds.begin(), FromIdToAtom()); 157 157 } 158 158 159 159 molecule::iterator molecule::end(){ 160 return molecule::iterator(atoms.end(),this);160 return iterator(atomIds.end(), FromIdToAtom()); 161 161 } 162 162 163 163 molecule::const_iterator molecule::end() const{ 164 return atoms.end();164 return const_iterator(atomIds.end(), FromIdToAtom()); 165 165 } 166 166 167 167 bool molecule::empty() const 168 168 { 169 return ( begin() == end());169 return (atomIds.empty()); 170 170 } 171 171 … … 173 173 { 174 174 size_t counter = 0; 175 for ( molecule::const_iterator iter = begin(); iter != end (); ++iter)175 for (const_iterator iter = begin(); iter != end (); ++iter) 176 176 counter++; 177 177 return counter; … … 181 181 { 182 182 OBSERVE; 183 molecule::const_iterator iter = loc; 184 iter++; 185 atom* atom = *loc; 186 atomIds.erase( atom->getId() ); 187 atoms.remove( atom ); 188 formula-=atom->getType(); 189 atom->removeFromMolecule(); 183 const_iterator iter = loc; 184 ++iter; 185 atom * const _atom = const_cast<atom *>(*loc); 186 atomIds.erase( _atom->getId() ); 187 formula-=_atom->getType(); 188 _atom->removeFromMolecule(); 190 189 return iter; 191 190 } … … 194 193 { 195 194 OBSERVE; 196 molecule::const_iterator iter = find(key);195 const_iterator iter = find(key); 197 196 if (iter != end()){ 198 iter++;197 ++iter; 199 198 atomIds.erase( key->getId() ); 200 atoms.remove( key );201 199 formula-=key->getType(); 202 200 key->removeFromMolecule(); … … 207 205 molecule::const_iterator molecule::find ( atom * key ) const 208 206 { 209 molecule::const_iterator iter; 210 for (molecule::const_iterator Runner = begin(); Runner != end(); ++Runner) { 211 if (*Runner == key) 212 return molecule::const_iterator(Runner); 213 } 214 return molecule::const_iterator(atoms.end()); 207 return const_iterator(atomIds.find(key->getId()), FromIdToAtom()); 215 208 } 216 209 … … 220 213 pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId()); 221 214 if (res.second) { // push atom if went well 222 atoms.push_back(key);223 215 formula+=key->getType(); 224 return pair<iterator,bool>( molecule::iterator(--end()),res.second);216 return pair<iterator,bool>(iterator(res.first, FromIdToAtom()),res.second); 225 217 } else { 226 return pair<iterator,bool>( molecule::iterator(end()),res.second);218 return pair<iterator,bool>(end(),res.second); 227 219 } 228 220 } … … 235 227 { 236 228 World::AtomComposite vector_of_atoms; 237 BOOST_FOREACH(atom *_atom, atoms) 238 vector_of_atoms.push_back(_atom); 229 // std::copy(MyIter(atomIds.begin(), FromIdToAtom()), 230 // MyIter(atomIds.end(), FromIdToAtom()), 231 // vector_of_atoms.begin()); 232 // for (MyIter iter = MyIter(atomIds.begin(), FromIdToAtom()); 233 // iter != MyIter(atomIds.end(), FromIdToAtom()); 234 // ++iter) 235 for (molecule::iterator iter = begin(); iter != end(); ++iter) 236 vector_of_atoms.push_back(*iter); 239 237 return vector_of_atoms; 240 238 } … … 635 633 636 634 // copy all atoms 637 for_each(atoms.begin(),atoms.end(),bind1st(mem_fun(&molecule::AddCopyAtom),copy)); 635 std::map< const atom *, atom *> FatherFinder; 636 for (iterator iter = begin(); iter != end(); ++iter) { 637 atom * const copy_atom = copy->AddCopyAtom(*iter); 638 FatherFinder.insert( std::make_pair( *iter, copy_atom ) ); 639 } 640 641 // copy all bonds 642 for(const_iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 643 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 644 for(BondList::const_iterator BondRunner = ListOfBonds.begin(); 645 BondRunner != ListOfBonds.end(); 646 ++BondRunner) 647 if ((*BondRunner)->leftatom == *AtomRunner) { 648 bond *Binder = (*BondRunner); 649 // get the pendant atoms of current bond in the copy molecule 650 ASSERT(FatherFinder.count(Binder->leftatom), 651 "molecule::CopyMolecule() - No copy of original left atom " 652 +toString(Binder->leftatom)+" for bond copy found"); 653 ASSERT(FatherFinder.count(Binder->rightatom), 654 "molecule::CopyMolecule() - No copy of original right atom " 655 +toString(Binder->rightatom)+" for bond copy found"); 656 atom * const LeftAtom = FatherFinder[Binder->leftatom]; 657 atom * const RightAtom = FatherFinder[Binder->rightatom]; 658 659 bond * const NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree); 660 NewBond->Cyclic = Binder->Cyclic; 661 if (Binder->Cyclic) 662 copy->NoCyclicBonds++; 663 NewBond->Type = Binder->Type; 664 } 665 } 666 // correct fathers 667 //for_each(begin(),end(),mem_fun(&atom::CorrectFather)); 668 669 return copy; 670 }; 671 672 673 /** Destroys all atoms inside this molecule. 674 */ 675 void molecule::removeAtomsinMolecule() 676 { 677 // remove each atom from world 678 for(iterator AtomRunner = begin(); !empty(); AtomRunner = begin()) 679 World::getInstance().destroyAtom(*AtomRunner); 680 }; 681 682 683 /** 684 * Copies all atoms of a molecule which are within the defined parallelepiped. 685 * 686 * @param offest for the origin of the parallelepiped 687 * @param three vectors forming the matrix that defines the shape of the parallelpiped 688 */ 689 molecule* molecule::CopyMoleculeFromSubRegion(const Shape ®ion) const { 690 molecule *copy = World::getInstance().createMolecule(); 691 692 // copy all atoms 693 std::map< const atom *, atom *> FatherFinder; 694 for (iterator iter = begin(); iter != end(); ++iter) { 695 if((*iter)->IsInShape(region)){ 696 atom * const copy_atom = copy->AddCopyAtom(*iter); 697 FatherFinder.insert( std::make_pair( *iter, copy_atom ) ); 698 } 699 } 638 700 639 701 // copy all bonds … … 645 707 if ((*BondRunner)->leftatom == *AtomRunner) { 646 708 bond *Binder = (*BondRunner); 647 // get the pendant atoms of current bond in the copy molecule 648 atomSet::iterator leftiter=find_if(copy->atoms.begin(),copy->atoms.end(),bind2nd(mem_fun(&atom::isFather),Binder->leftatom)); 649 atomSet::iterator rightiter=find_if(copy->atoms.begin(),copy->atoms.end(),bind2nd(mem_fun(&atom::isFather),Binder->rightatom)); 650 ASSERT(leftiter!=copy->atoms.end(),"No copy of original left atom for bond copy found"); 651 ASSERT(leftiter!=copy->atoms.end(),"No copy of original right atom for bond copy found"); 652 atom *LeftAtom = *leftiter; 653 atom *RightAtom = *rightiter; 654 655 bond *NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree); 656 NewBond->Cyclic = Binder->Cyclic; 657 if (Binder->Cyclic) 658 copy->NoCyclicBonds++; 659 NewBond->Type = Binder->Type; 709 if ((FatherFinder.count(Binder->leftatom)) 710 && (FatherFinder.count(Binder->rightatom))) { 711 // if copy present, then it must be from subregion 712 atom * const LeftAtom = FatherFinder[Binder->leftatom]; 713 atom * const RightAtom = FatherFinder[Binder->rightatom]; 714 715 bond * const NewBond = copy->AddBond(LeftAtom, RightAtom, Binder->BondDegree); 716 NewBond->Cyclic = Binder->Cyclic; 717 if (Binder->Cyclic) 718 copy->NoCyclicBonds++; 719 NewBond->Type = Binder->Type; 720 } 660 721 } 661 722 } 662 723 // correct fathers 663 //for_each(atoms.begin(),atoms.end(),mem_fun(&atom::CorrectFather)); 664 665 return copy; 666 }; 667 668 669 /** Destroys all atoms inside this molecule. 670 */ 671 void molecule::removeAtomsinMolecule() 672 { 673 // remove each atom from world 674 for(molecule::const_iterator AtomRunner = begin(); !empty(); AtomRunner = begin()) 675 World::getInstance().destroyAtom(*AtomRunner); 676 }; 677 678 679 /** 680 * Copies all atoms of a molecule which are within the defined parallelepiped. 681 * 682 * @param offest for the origin of the parallelepiped 683 * @param three vectors forming the matrix that defines the shape of the parallelpiped 684 */ 685 molecule* molecule::CopyMoleculeFromSubRegion(const Shape ®ion) const { 686 molecule *copy = World::getInstance().createMolecule(); 687 688 BOOST_FOREACH(atom *iter,atoms){ 689 if(iter->IsInShape(region)){ 690 copy->AddCopyAtom(iter); 691 } 692 } 724 //for_each(begin(),end(),mem_fun(&atom::CorrectFather)); 693 725 694 726 //TODO: copy->BuildInducedSubgraph(this); … … 709 741 710 742 // some checks to make sure we are able to create the bond 711 ASSERT(atom1, "First atom in bond-creation was an invalid pointer"); 712 ASSERT(atom2, "Second atom in bond-creation was an invalid pointer"); 713 ASSERT(FindAtom(atom1->getNr()),"First atom in bond-creation was not part of molecule"); 714 ASSERT(FindAtom(atom2->getNr()),"Second atom in bond-creation was not part of molecule"); 743 ASSERT(atom1, 744 "molecule::AddBond() - First atom "+toString(atom1) 745 +" is not a invalid pointer"); 746 ASSERT(atom2, 747 "molecule::AddBond() - Second atom "+toString(atom2) 748 +" is not a invalid pointer"); 749 ASSERT(isInMolecule(atom1), 750 "molecule::AddBond() - First atom "+toString(atom1) 751 +" is not part of molecule"); 752 ASSERT(isInMolecule(atom2), 753 "molecule::AddBond() - Second atom "+toString(atom2) 754 +" is not part of molecule"); 715 755 716 756 Binder = new bond(atom1, atom2, degree); 717 757 atom1->RegisterBond(WorldTime::getTime(), Binder); 718 758 atom2->RegisterBond(WorldTime::getTime(), Binder); 719 if ((atom1->getType() != NULL) && (atom1->getType()->getAtomicNumber() != 1) && (atom2->getType() != NULL) && (atom2->getType()->getAtomicNumber() != 1)) 759 if ((atom1->getType() != NULL) 760 && (atom1->getType()->getAtomicNumber() != 1) 761 && (atom2->getType() != NULL) 762 && (atom2->getType()->getAtomicNumber() != 1)) 720 763 NoNonBonds++; 721 764 … … 820 863 atom * molecule::FindAtom(int Nr) const 821 864 { 822 molecule:: const_iterator iter = begin();865 molecule::iterator iter = begin(); 823 866 for (; iter != end(); ++iter) 824 825 867 if ((*iter)->getNr() == Nr) 868 break; 826 869 if (iter != end()) { 827 870 //LOG(0, "Found Atom Nr. " << walker->getNr()); 828 871 return (*iter); 829 872 } else { 830 LOG(0, "Atom not found inlist.");873 ELOG(1, "Atom not found in molecule " << getName() << "'s list."); 831 874 return NULL; 832 875 } 833 }; 876 } 877 878 /** Checks whether the given atom is a member of this molecule. 879 * 880 * We make use here of molecule::atomIds to get a result on 881 * 882 * @param _atom atom to check 883 * @return true - is member, false - is not 884 */ 885 bool molecule::isInMolecule(const atom * const _atom) 886 { 887 ASSERT(_atom->getMolecule() == this, 888 "molecule::isInMolecule() - atom is not designated to be in molecule '" 889 +toString(this->getName())+"'."); 890 molecule::atomIdSet::const_iterator iter = atomIds.find(_atom->getId()); 891 return (iter != atomIds.end()); 892 } 834 893 835 894 /** Asks for atom number, and checks whether in list. … … 878 937 enumeration<const element*> elementLookup = formula.enumerateElements(); 879 938 *output << "#Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon)" << endl; 880 for_each( atoms.begin(),atoms.end(),boost::bind(&atom::OutputArrayIndexed,_1,output,elementLookup,AtomNo,(const char*)0));939 for_each(begin(),end(),boost::bind(&atom::OutputArrayIndexed,_1,output,elementLookup,AtomNo,(const char*)0)); 881 940 return true; 882 941 } … … 900 959 memset(AtomNo,0,(MAX_ELEMENTS-1)*sizeof(*AtomNo)); 901 960 enumeration<const element*> elementLookup = formula.enumerateElements(); 902 for_each( atoms.begin(),atoms.end(),boost::bind(&atom::OutputTrajectory,_1,output,elementLookup, AtomNo, (const int)step));961 for_each(begin(),end(),boost::bind(&atom::OutputTrajectory,_1,output,elementLookup, AtomNo, (const int)step)); 903 962 } 904 963 return true; … … 941 1000 for (int step=0;step<MDSteps;step++) { 942 1001 *output << getAtomCount() << "\n\tCreated by molecuilder, step " << step << ", on " << ctime(&now); 943 for_each( atoms.begin(),atoms.end(),boost::bind(&atom::OutputTrajectoryXYZ,_1,output,step));1002 for_each(begin(),end(),boost::bind(&atom::OutputTrajectoryXYZ,_1,output,step)); 944 1003 } 945 1004 return true; … … 958 1017 now = time((time_t *)NULL); // Get the system time and put it into 'now' as 'calender time' 959 1018 *output << getAtomCount() << "\n\tCreated by molecuilder on " << ctime(&now); 960 for_each( atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputXYZLine),output));1019 for_each(begin(),end(),bind2nd(mem_fun(&atom::OutputXYZLine),output)); 961 1020 return true; 962 1021 } else … … 972 1031 int i = 0; 973 1032 NoNonHydrogen = 0; 974 for (molecule:: const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {1033 for (molecule::iterator iter = begin(); iter != end(); ++iter) { 975 1034 (*iter)->setNr(i); // update number in molecule (for easier referencing in FragmentMolecule lateron) 976 1035 if ((*iter)->getType()->getAtomicNumber() != 1) // count non-hydrogen atoms whilst at it -
src/molecule.hpp
rf9b967 r401f90 21 21 #include <vector> 22 22 23 #include <boost/iterator/transform_iterator.hpp> 24 23 25 #include <string> 24 26 25 #include " types.hpp"27 #include "AtomSet.hpp" 26 28 #include "CodePatterns/Observer.hpp" 27 29 #include "CodePatterns/ObservedIterator.hpp" 28 30 #include "CodePatterns/Cacheable.hpp" 31 #include "Descriptors/AtomIdDescriptor.hpp" 29 32 #include "Fragmentation/HydrogenSaturation_enum.hpp" 33 #include "Formula.hpp" 30 34 #include "Helpers/defs.hpp" 31 #include " Formula.hpp"32 #include "AtomSet.hpp" 33 35 #include "types.hpp" 36 37 // TODO: Was is the include of MoleculeDescriptor_impl.hpp doing in molecule.hpp 34 38 #include "Descriptors/MoleculeDescriptor_impl.hpp" 35 39 … … 55 59 /******************************** Some definitions for easier reading **********************************/ 56 60 61 struct FromIdToAtom : 62 public std::unary_function<atom *, atomId_t> 63 { 64 atom * operator()(atomId_t id) const { 65 return World::getInstance().getAtom(AtomById(id)); 66 } 67 }; 68 57 69 /************************************* Class definitions ****************************************/ 58 70 … … 66 78 67 79 public: 68 typedef ATOMSET(std::list) atomSet;69 80 typedef std::set<atomId_t> atomIdSet; 70 typedef ObservedIterator<atomSet> iterator;71 typedef atomSet::const_iteratorconst_iterator;81 typedef boost::transform_iterator<FromIdToAtom, atomIdSet::iterator, atom *, atomId_t> iterator; 82 typedef boost::transform_iterator<FromIdToAtom, atomIdSet::const_iterator, const atom *, atomId_t const &> const_iterator; 72 83 73 84 const periodentafel * const elemente; //!< periodic table with each element 74 // old deprecated atom handling75 //atom *start; //!< start of atom list76 //atom *end; //!< end of atom list77 //bond *first; //!< start of bond list78 //bond *last; //!< end of bond list79 85 int MDSteps; //!< The number of MD steps in Trajectories 80 86 mutable int NoNonHydrogen; //!< number of non-hydrogen atoms in molecule … … 82 88 mutable int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis() 83 89 bool ActiveFlag; //!< in a MoleculeListClass used to discern active from inactive molecules 84 //Vector Center; //!< Center of molecule in a global box85 90 int IndexNr; //!< index of molecule in a MoleculeListClass 86 91 char name[MAXSTRINGSIZE]; //!< arbitrary name … … 91 96 Cacheable<int> BondCount; //!< number of atoms, brought up-to-date by doCountBonds() 92 97 moleculeId_t id; 93 atomSet atoms; //<!list of atoms94 98 atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms 95 99 protected: 96 //void CountAtoms();97 /**98 * this iterator type should be used for internal variables, \99 * since it will not lock100 */101 typedef atomSet::iterator internal_iterator;102 100 103 101 molecule(const periodentafel * const teil); … … 174 172 atom * FindAtom(int Nr) const; 175 173 atom * AskAtom(string text); 174 bool isInMolecule(const atom * const _atom); 176 175 177 176 /// Count and change present atoms' coordination. -
src/molecule_geometry.cpp
rf9b967 r401f90 55 55 56 56 // go through all atoms 57 BOOST_FOREACH(atom* iter, atoms){57 for (iterator iter = begin(); iter != end(); ++iter) { 58 58 if (DoLog(4) && (*Center != *CenterBox)) 59 LOG(4, "INFO: atom before is at " << * iter);60 * iter -= *Center;61 * iter += *CenterBox;59 LOG(4, "INFO: atom before is at " << **iter); 60 **iter -= *Center; 61 **iter += *CenterBox; 62 62 if (DoLog(4) && (*Center != *CenterBox)) 63 LOG(4, "INFO: atom after is at " << * iter);64 } 65 atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));63 LOG(4, "INFO: atom after is at " << **iter); 64 } 65 getAtomSet().transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1)); 66 66 67 67 delete(Center); … … 80 80 81 81 // go through all atoms 82 atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));82 getAtomSet().transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1)); 83 83 84 84 return status; … … 94 94 Vector *min = new Vector; 95 95 96 molecule::const_iterator iter = begin(); // start at first in list96 const_iterator iter = begin(); // start at first in list 97 97 if (iter != end()) { //list not empty? 98 98 for (int i=NDIM;i--;) { … … 122 122 { 123 123 int Num = 0; 124 molecule::const_iterator iter = begin(); // start at first in list124 const_iterator iter = begin(); // start at first in list 125 125 Vector Center; 126 126 … … 141 141 Vector * molecule::DetermineCenterOfAll() const 142 142 { 143 molecule::const_iterator iter = begin(); // start at first in list143 const_iterator iter = begin(); // start at first in list 144 144 Vector *a = new Vector(); 145 145 double Num = 0; … … 174 174 Vector * molecule::DetermineCenterOfGravity() const 175 175 { 176 molecule::const_iterator iter = begin(); // start at first in list176 const_iterator iter = begin(); // start at first in list 177 177 Vector *a = new Vector(); 178 178 Vector tmp; … … 202 202 DeterminePeriodicCenter(NewCenter); 203 203 // go through all atoms 204 BOOST_FOREACH(atom* iter, atoms){205 * iter -= NewCenter;204 for (iterator iter = begin(); iter != end(); ++iter) { 205 **iter -= NewCenter; 206 206 } 207 207 }; … … 215 215 { 216 216 // go through all atoms 217 BOOST_FOREACH(atom* iter, atoms){218 * iter -= *newcenter;217 for (iterator iter = begin(); iter != end(); ++iter) { 218 **iter -= *newcenter; 219 219 } 220 220 }; … … 233 233 234 234 // sum up inertia tensor 235 for ( molecule::const_iterator iter = begin(); iter != end(); ++iter) {235 for (const_iterator iter = begin(); iter != end(); ++iter) { 236 236 Vector x = (*iter)->getPosition(); 237 237 x -= *CenterOfGravity; … … 286 286 287 287 // and rotate 288 for ( molecule::iterator iter = begin(); iter != end(); ++iter) {288 for (iterator iter = begin(); iter != end(); ++iter) { 289 289 *(*iter) -= *CenterOfGravity; 290 290 (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), alpha)); … … 306 306 void molecule::Scale(const double ** const factor) 307 307 { 308 for ( molecule::const_iterator iter = begin(); iter != end(); ++iter) {308 for (iterator iter = begin(); iter != end(); ++iter) { 309 309 for (size_t j=0;j<(*iter)->getTrajectorySize();j++) { 310 310 Vector temp = (*iter)->getPositionAtStep(j); … … 320 320 void molecule::Translate(const Vector *trans) 321 321 { 322 for ( molecule::const_iterator iter = begin(); iter != end(); ++iter) {322 for (iterator iter = begin(); iter != end(); ++iter) { 323 323 for (size_t j=0;j<(*iter)->getTrajectorySize();j++) { 324 324 (*iter)->setPositionAtStep(j, (*iter)->getPositionAtStep(j) + (*trans)); … … 336 336 337 337 // go through all atoms 338 BOOST_FOREACH(atom* iter, atoms){339 * iter += *trans;340 } 341 atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));338 for (iterator iter = begin(); iter != end(); ++iter) { 339 **iter += *trans; 340 } 341 getAtomSet().transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1)); 342 342 343 343 }; … … 351 351 OBSERVE; 352 352 Plane p(*n,0); 353 atoms.transformNodes(boost::bind(&Plane::mirrorVector,p,_1));353 getAtomSet().transformNodes(boost::bind(&Plane::mirrorVector,p,_1)); 354 354 }; 355 355 … … 371 371 Center.Zero(); 372 372 flag = true; 373 for ( molecule::const_iterator iter = begin(); iter != end(); ++iter) {373 for (const_iterator iter = begin(); iter != end(); ++iter) { 374 374 if ((saturation == DontSaturate) || ((*iter)->getType()->getAtomicNumber() != 1)) { 375 375 Testvector = inversematrix * (*iter)->getPosition(); … … 435 435 alpha = atan(-n->at(0)/n->at(2)); 436 436 LOG(1, "INFO: Z-X-angle: " << alpha << " ... "); 437 for ( molecule::const_iterator iter = begin(); iter != end(); ++iter) {437 for (iterator iter = begin(); iter != end(); ++iter) { 438 438 tmp = (*iter)->at(0); 439 439 (*iter)->set(0, cos(alpha) * tmp + sin(alpha) * (*iter)->at(2)); … … 455 455 alpha = atan(-n->at(1)/n->at(2)); 456 456 LOG(1, "INFO: Z-Y-angle: " << alpha << " ... "); 457 for ( molecule::const_iterator iter = begin(); iter != end(); ++iter) {457 for (iterator iter = begin(); iter != end(); ++iter) { 458 458 tmp = (*iter)->at(1); 459 459 (*iter)->set(1, cos(alpha) * tmp + sin(alpha) * (*iter)->at(2)); -
src/molecule_graph.cpp
rf9b967 r401f90 52 52 bool molecule::FillBondStructureFromReference(const molecule * const reference, atom **&ListOfLocalAtoms, bool FreeList) 53 53 { 54 atom *OtherWalker = NULL; 55 atom *Father = NULL; 56 bool status = true; 57 int AtomNo; 54 bool status = true; 58 55 59 56 LOG(1, "Begin of FillBondStructureFromReference."); … … 71 68 72 69 73 for(molecule:: const_iterator iter = begin(); iter != end(); ++iter) {74 Father = (*iter)->GetTrueFather();75 AtomNo = Father->getNr(); // global id of the current walker70 for(molecule::iterator iter = begin(); iter != end(); ++iter) { 71 const atom * const Father = (*iter)->GetTrueFather(); 72 const int AtomNo = Father->getNr(); // global id of the current walker 76 73 const BondList& ListOfBonds = Father->getListOfBonds(); 77 74 for (BondList::const_iterator Runner = ListOfBonds.begin(); 78 75 Runner != ListOfBonds.end(); 79 76 ++Runner) { 80 OtherWalker = ListOfLocalAtoms[(*Runner)->GetOtherAtom((*iter)->GetTrueFather())->getNr()]; // local copy of current bond partner of walker 77 atom * const OtherAtom = (*Runner)->GetOtherAtom((*iter)->GetTrueFather()); 78 atom * const OtherWalker = ListOfLocalAtoms[OtherAtom->getNr()]; // local copy of current bond partner of walker 81 79 if (OtherWalker != NULL) { 82 80 if (OtherWalker->getNr() > (*iter)->getNr()) 83 81 AddBond((*iter), OtherWalker, (*Runner)->BondDegree); 84 82 } else { 85 LOG(1, "OtherWalker = ListOfLocalAtoms[" << (*Runner)->GetOtherAtom((*iter)->GetTrueFather())->getNr() << "] is NULL!");83 LOG(1, "OtherWalker = ListOfLocalAtoms[" << OtherAtom->getNr() << "] is NULL!"); 86 84 status = false; 87 85 } … … 154 152 if (AdjacencyFile.good()) { 155 153 AdjacencyFile << "m\tn" << endl; 156 for_each( atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputAdjacency),&AdjacencyFile));154 for_each(begin(),end(),bind2nd(mem_fun(&atom::OutputAdjacency),&AdjacencyFile)); 157 155 AdjacencyFile.close(); 158 156 LOG(1, "\t... done."); … … 186 184 if (BondFile.good()) { 187 185 BondFile << "m\tn" << endl; 188 for_each( atoms.begin(),atoms.end(),bind2nd(mem_fun(&atom::OutputBonds),&BondFile));186 for_each(begin(),end(),bind2nd(mem_fun(&atom::OutputBonds),&BondFile)); 189 187 BondFile.close(); 190 188 LOG(1, "\t... done."); -
src/moleculelist.cpp
rf9b967 r401f90 571 571 // output file 572 572 std::vector<atom *> atoms; 573 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 573 // TODO: Convert iterator to const_iterator when FormatParserStorage::save() has vector<const atom *> 574 // We need iterator here because FormatParserStorage::save() need vector<atom *> not const refs. 575 for (molecule::iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 574 576 atoms.push_back(*iter); 575 577 }
Note:
See TracChangeset
for help on using the changeset viewer.