Changeset 401f90 for src


Ignore:
Timestamp:
Dec 28, 2011, 3:27:15 PM (13 years ago)
Author:
Frederik Heber <heber@…>
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.
Message:

Merge branch 'Removing_molecule_atomSet' into Merge_molecule_atomSet_removal

Conflicts:

src/molecule_geometry.cpp

  • molecule::CenterInBox(): don't use BOOST_FOREACH but new transform_iterators.
Location:
src
Files:
22 edited

Legend:

Unmodified
Added
Removed
  • src/Actions/WorldAction/BoundInBoxAction.cpp

    rf9b967 r401f90  
    7676      MolRunner != AllMolecules.end();
    7777      ++MolRunner) {
    78     for(molecule::const_iterator AtomRunner = (*MolRunner)->begin();
     78    for(molecule::iterator AtomRunner = (*MolRunner)->begin();
    7979        AtomRunner != (*MolRunner)->end();
    8080        ++AtomRunner) {
  • src/Actions/WorldAction/CenterInBoxAction.cpp

    rf9b967 r401f90  
    109109      MolRunner != AllMolecules.end();
    110110      ++MolRunner) {
    111     for(molecule::const_iterator AtomRunner = (*MolRunner)->begin();
     111    for(molecule::iterator AtomRunner = (*MolRunner)->begin();
    112112        AtomRunner != (*MolRunner)->end();
    113113        ++AtomRunner) {
  • src/Analysis/analysis_correlation.cpp

    rf9b967 r401f90  
    212212    LOG(1,"INFO: Resulting relative angle for molecule " << _mol->getName()
    213213        << " is " << angle << ".");
    214     outmap->insert ( make_pair (angle, *iter ) );
     214    outmap->insert ( std::make_pair (angle, *iter ) );
    215215    ++i;
    216216  }
     
    322322                distance = domain.periodicDistance((*iter)->getPosition(),(*runner)->getPosition());
    323323                //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                    );
    325330              }
    326331          }
     
    403408                              distance = checkX.distance(checkOtherX);
    404409                              //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                                  );
    406418                            }
    407419                      }
     
    444456          distance = domain.periodicDistance((*iter)->getPosition(),*point);
    445457          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              );
    447466        }
    448467    }
     
    491510                distance = checkX.distance(*point);
    492511                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                    );
    494521              }
    495522        }
     
    533560          distance = Intersections.GetSmallestDistance();
    534561          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              );
    536571        }
    537572    }
     
    597632              }
    598633          // 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              );
    600643          //LOG(1, "INFO: Inserting " << Walker << " with distance " << ShortestDistance << " to " << *ShortestTriangle << ".");
    601644        }
  • src/Analysis/analysis_correlation.hpp

    rf9b967 r401f90  
    4646/********************************************** definitions *********************************/
    4747
    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;
     48typedef multimap<double, pair<const atom *, const atom *> > PairCorrelationMap;
     49typedef multimap<double, const atom * > DipoleAngularCorrelationMap;
     50typedef multimap<double, pair<const molecule *, const molecule *> > DipoleCorrelationMap;
     51typedef multimap<double, pair<const atom *, const Vector *> > CorrelationToPointMap;
     52typedef multimap<double, pair<const atom *, BoundaryTriangleSet *> > CorrelationToSurfaceMap;
    5353typedef map<double, int> BinPairMap;
    5454
  • src/Descriptors/AtomOfMoleculeSelectionDescriptor.cpp

    rf9b967 r401f90  
    5353      iter != instance.endMoleculeSelection();
    5454      ++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());
    5956  }
    6057  return res;
  • src/Dynamics/LinearInterpolationBetweenSteps.hpp

    rf9b967 r401f90  
    5555    if (!MapByIdentity) {
    5656      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);
    6058      Minimiser(startstep, endstep, IsAngstroem);
    6159    } else {
  • src/Dynamics/MinimiseConstrainedPotential.cpp

    rf9b967 r401f90  
    4040
    4141MinimiseConstrainedPotential::MinimiseConstrainedPotential(
    42     molecule::atomSet &_atoms,
     42    World::AtomComposite &_atoms,
    4343    std::map<atom*, atom *> &_PermutationMap) :
    4444  atoms(_atoms),
     
    5959  PermutationMap.clear();
    6060  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) {
    6262    DistanceList[*iter].clear();
    6363  }
     
    9090    LOG(2, "Starting round " << ++round << ", at current potential " << OldPotential << " ... ");
    9191    OlderPotential = OldPotential;
    92     molecule::atomSet::const_iterator iter;
     92    World::AtomComposite::const_iterator iter;
    9393    do {
    9494      iter = atoms.begin();
     
    105105        //LOG(2, "Current Walker: " << *(*iter) << " with old/next candidate " << *Sprinter << "/" << *DistanceIterators[(*iter)]->second << ".");
    106106        // find source of the new target
    107         molecule::atomSet::const_iterator runner = atoms.begin();
     107        World::AtomComposite::const_iterator runner = atoms.begin();
    108108        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)
    109109          if (PermutationMap[(*runner)] == DistanceIterators[(*iter)]->second) {
     
    165165void MinimiseConstrainedPotential::FillDistanceList()
    166166{
    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) {
    169169      DistanceList[(*iter)].insert( DistancePair((*iter)->getPositionAtStep(startstep).distance((*runner)->getPositionAtStep(endstep)), (*runner)) );
    170170    }
     
    174174void MinimiseConstrainedPotential::CreateInitialLists()
    175175{
    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) {
    177177    StepList[(*iter)] = DistanceList[(*iter)].begin();    // stores the step to the next iterator that could be a possible next target
    178178    PermutationMap[(*iter)] = DistanceList[(*iter)].begin()->second;   // always pick target with the smallest distance
     
    185185void MinimiseConstrainedPotential::MakeInjectivePermutation()
    186186{
    187   molecule::atomSet::const_iterator iter = atoms.begin();
     187  World::AtomComposite::const_iterator iter = atoms.begin();
    188188  DistanceMap::iterator NewBase;
    189189  double Potential = fabs(ConstrainedPotential());
     
    204204    Potential = TryNextNearestNeighbourForInjectivePermutation((*iter), Potential);
    205205  }
    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) {
    207207    // now each single entry in the DoubleList should be <=1
    208208    if (DoubleList[*iter] > 1) {
     
    216216unsigned int MinimiseConstrainedPotential::CalculateDoubleList()
    217217{
    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)
    219219    DoubleList[*iter] = 0;
    220220  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)
    222222      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)
    224224    if (DoubleList[*iter] > 1)
    225225      doubles++;
     
    235235  zeile1 << "PermutationMap: ";
    236236  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) {
    238238    zeile1 << (*iter)->getName() << " ";
    239239    zeile2 << (PermutationMap[*iter])->getName() << " ";
    240240  }
    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) {
    242242    std::map<atom *, unsigned int>::const_iterator value_iter = DoubleList.find(*iter);
    243243    if (value_iter->second > (unsigned int)1)
     
    255255  // go through every atom
    256256  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) {
    258258    // first term: distance to target
    259259    Runner = PermutationMap[(*iter)];   // find target point
     
    299299{
    300300  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) {
    302302    if ((PermutationMap[Walker] == PermutationMap[(*iter)]) && (Walker < (*iter))) {
    303303//    atom *Sprinter = PermutationMap[Walker->nr];
     
    324324  double Norm1, Norm2, tmp, result = 0.;
    325325
    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) {
    327327    if ((*iter) == Walker) // hence, we only go up to the Walker, not beyond (similar to i=0; i<j; i++)
    328328      break;
     
    407407  /// evaluate forces (only the distance to target dependent part) with the final PermutationMap
    408408  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) {
    410410    atom *Sprinter = PermutationMap[(*iter)];
    411411    // set forces
  • src/Dynamics/MinimiseConstrainedPotential.hpp

    rf9b967 r401f90  
    1919#include <map>
    2020
    21 #include "molecule.hpp"
     21#include "World.hpp"
    2222
    2323/** Structure to contain parameters needed for evaluation of constraint potential.
     
    3333   * @return
    3434   */
    35   MinimiseConstrainedPotential(molecule::atomSet &_atoms, std::map<atom*, atom *> &_PermutationMap);
     35  MinimiseConstrainedPotential(World::AtomComposite &_atoms, std::map<atom*, atom *> &_PermutationMap);
    3636
    3737  /** Destructor.
     
    7979  typedef std::pair < DistanceMap::iterator, bool> DistanceTestPair;
    8080
    81   molecule::atomSet atoms;
     81  World::AtomComposite atoms;
    8282  int startstep; //!< start configuration (MDStep in atom::trajectory)
    8383  int endstep; //!< end configuration (MDStep in atom::trajectory)
  • src/Dynamics/VerletForceIntegration.hpp

    rf9b967 r401f90  
    9898      // calculate forces and potential
    9999      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);
    103101      //double ConstrainedPotentialEnergy =
    104102      Minimiser(DoConstrainedMD, 0, IsAngstroem);
  • src/Fragmentation/Fragmentation.cpp

    rf9b967 r401f90  
    595595
    596596    // 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){
    598598      (*iter)->AdaptiveOrder = OrderArray[(*iter)->getNr()];
    599599      (*iter)->MaxOrder = MaxArray[(*iter)->getNr()];
     
    676676
    677677  // 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();) {
    679680    LonelyFlag = true;
    680681    FatherOfRunner = (*iter)->father;
  • src/Graph/BuildInducedSubgraph.cpp

    rf9b967 r401f90  
    4646  // fill parent list with sons
    4747  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) {
    4949    ParentList[(*iter)->father] = (*iter);
    5050    // Outputting List for debugging
     
    5959  // check each entry of parent list and if ok (one-to-and-onto matching) create bonds
    6060  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) {
    6262    if (ParentList.count(*iter)) {
    6363      if (ParentList[(*iter)]->father != (*iter)) {
  • src/MoleculeLeafClass.cpp

    rf9b967 r401f90  
    110110bool MoleculeLeafClass::FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter, const enum HydrogenSaturation saturation)
    111111{
    112   atom *Father = NULL;
    113 
    114112  if (RootStack != NULL) {
    115113    // find first root candidates
     
    117115      RootStack[FragmentCounter].clear();
    118116      for(molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end(); ++iter) {
    119         Father = (*iter)->GetTrueFather();
     117        const atom * const Father = (*iter)->GetTrueFather();
    120118        if (AtomMask[Father->getNr()]) // apply mask
    121119          if ((saturation == DontSaturate) || ((*iter)->getType()->getAtomicNumber() != 1)) // skip hydrogen
  • src/Parser/FormatParserStorage.cpp

    rf9b967 r401f90  
    267267 * We store in the order of the atomic ids, not in the order they appear in the molecules.
    268268 * 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 *
    269272 * \param &output output stream
    270273 * \param suffix
     
    278281      MolIter != molecules.end();
    279282      ++MolIter) {
    280     for(molecule::atomSet::const_iterator AtomIter = (*MolIter)->begin();
     283    for(molecule::iterator AtomIter = (*MolIter)->begin();
    281284        AtomIter != (*MolIter)->end();
    282285        ++AtomIter) {
  • src/Tesselation/BoundaryMaps.hpp

    rf9b967 r401f90  
    2929
    3030// ============= TesselPoint maps ======================== //
    31 typedef std::pair < double, class TesselPoint * > TesselPointDistancePair;
    32 typedef std::multimap < double, class TesselPoint * > TesselPointDistanceMap;
    33 typedef std::pair < TesselPointDistanceMap::iterator, bool > TesselPointDistanceTestPair;
     31typedef std::pair < double, TesselPoint * > TesselPointDistancePair;
     32//typedef std::multimap < double, class TesselPoint * > TesselPointDistanceMap;
     33//typedef std::pair < TesselPointDistanceMap::iterator, bool > TesselPointDistanceTestPair;
    3434
    3535typedef std::list <TesselPoint *> TesselPointList;
  • src/Tesselation/boundary.cpp

    rf9b967 r401f90  
    189189
    190190    // 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) {
    192193      ProjectedVector = (*iter)->getPosition() - (*MolCenter);
    193194      ProjectedVector.ProjectOntoPlane(AxisVector);
     
    874875            phi[i] = (random()/(rng_max-rng_min))*(2.*M_PI);
    875876
    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){
    877879
    878880          // create atomic random translation vector ...
  • src/atom.cpp

    rf9b967 r401f90  
    7979
    8080atom *atom::GetTrueFather()
     81{
     82  const atom *father = const_cast<const atom *>(this)->GetTrueFather();
     83  return const_cast<atom *>(father);
     84}
     85
     86const atom *atom::GetTrueFather() const
    8187{
    8288  if(father == this){ // top most father is the one that points on itself
  • src/atom.hpp

    rf9b967 r401f90  
    153153   */
    154154  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;
    155160
    156161  /** Compares the indices of \a this atom with a given \a ptr.
  • src/molecule.cpp

    rf9b967 r401f90  
    150150
    151151molecule::iterator molecule::begin(){
    152   return molecule::iterator(atoms.begin(),this);
     152  return iterator(atomIds.begin(), FromIdToAtom());
    153153}
    154154
    155155molecule::const_iterator molecule::begin() const{
    156   return atoms.begin();
     156  return const_iterator(atomIds.begin(), FromIdToAtom());
    157157}
    158158
    159159molecule::iterator molecule::end(){
    160   return molecule::iterator(atoms.end(),this);
     160  return iterator(atomIds.end(), FromIdToAtom());
    161161}
    162162
    163163molecule::const_iterator molecule::end() const{
    164   return atoms.end();
     164  return const_iterator(atomIds.end(), FromIdToAtom());
    165165}
    166166
    167167bool molecule::empty() const
    168168{
    169   return (begin() == end());
     169  return (atomIds.empty());
    170170}
    171171
     
    173173{
    174174  size_t counter = 0;
    175   for (molecule::const_iterator iter = begin(); iter != end (); ++iter)
     175  for (const_iterator iter = begin(); iter != end (); ++iter)
    176176    counter++;
    177177  return counter;
     
    181181{
    182182  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();
    190189  return iter;
    191190}
     
    194193{
    195194  OBSERVE;
    196   molecule::const_iterator iter = find(key);
     195  const_iterator iter = find(key);
    197196  if (iter != end()){
    198     iter++;
     197    ++iter;
    199198    atomIds.erase( key->getId() );
    200     atoms.remove( key );
    201199    formula-=key->getType();
    202200    key->removeFromMolecule();
     
    207205molecule::const_iterator molecule::find ( atom * key ) const
    208206{
    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());
    215208}
    216209
     
    220213  pair<atomIdSet::iterator,bool> res = atomIds.insert(key->getId());
    221214  if (res.second) { // push atom if went well
    222     atoms.push_back(key);
    223215    formula+=key->getType();
    224     return pair<iterator,bool>(molecule::iterator(--end()),res.second);
     216    return pair<iterator,bool>(iterator(res.first, FromIdToAtom()),res.second);
    225217  } else {
    226     return pair<iterator,bool>(molecule::iterator(end()),res.second);
     218    return pair<iterator,bool>(end(),res.second);
    227219  }
    228220}
     
    235227{
    236228  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);
    239237  return vector_of_atoms;
    240238}
     
    635633
    636634  // 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 */
     675void 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 */
     689molecule* molecule::CopyMoleculeFromSubRegion(const Shape &region) 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  }
    638700
    639701  // copy all bonds
     
    645707      if ((*BondRunner)->leftatom == *AtomRunner) {
    646708        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        }
    660721      }
    661722  }
    662723  // 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 &region) 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));
    693725
    694726  //TODO: copy->BuildInducedSubgraph(this);
     
    709741
    710742  // 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");
    715755
    716756  Binder = new bond(atom1, atom2, degree);
    717757  atom1->RegisterBond(WorldTime::getTime(), Binder);
    718758  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))
    720763    NoNonBonds++;
    721764
     
    820863atom * molecule::FindAtom(int Nr)  const
    821864{
    822   molecule::const_iterator iter = begin();
     865  molecule::iterator iter = begin();
    823866  for (; iter != end(); ++iter)
    824     if ((*iter)->getNr() == Nr)
    825       break;
     867  if ((*iter)->getNr() == Nr)
     868    break;
    826869  if (iter != end()) {
    827870    //LOG(0, "Found Atom Nr. " << walker->getNr());
    828871    return (*iter);
    829872  } else {
    830     LOG(0, "Atom not found in list.");
     873    ELOG(1, "Atom not found in molecule " << getName() << "'s list.");
    831874    return NULL;
    832875  }
    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 */
     885bool 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}
    834893
    835894/** Asks for atom number, and checks whether in list.
     
    878937    enumeration<const element*> elementLookup = formula.enumerateElements();
    879938    *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));
    881940    return true;
    882941  }
     
    900959      memset(AtomNo,0,(MAX_ELEMENTS-1)*sizeof(*AtomNo));
    901960      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));
    903962    }
    904963    return true;
     
    9411000    for (int step=0;step<MDSteps;step++) {
    9421001      *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));
    9441003    }
    9451004    return true;
     
    9581017    now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
    9591018    *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));
    9611020    return true;
    9621021  } else
     
    9721031  int i = 0;
    9731032  NoNonHydrogen = 0;
    974   for (molecule::const_iterator iter = atoms.begin(); iter != atoms.end(); ++iter) {
     1033  for (molecule::iterator iter = begin(); iter != end(); ++iter) {
    9751034    (*iter)->setNr(i);   // update number in molecule (for easier referencing in FragmentMolecule lateron)
    9761035    if ((*iter)->getType()->getAtomicNumber() != 1) // count non-hydrogen atoms whilst at it
  • src/molecule.hpp

    rf9b967 r401f90  
    2121#include <vector>
    2222
     23#include <boost/iterator/transform_iterator.hpp>
     24
    2325#include <string>
    2426
    25 #include "types.hpp"
     27#include "AtomSet.hpp"
    2628#include "CodePatterns/Observer.hpp"
    2729#include "CodePatterns/ObservedIterator.hpp"
    2830#include "CodePatterns/Cacheable.hpp"
     31#include "Descriptors/AtomIdDescriptor.hpp"
    2932#include "Fragmentation/HydrogenSaturation_enum.hpp"
     33#include "Formula.hpp"
    3034#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
    3438#include "Descriptors/MoleculeDescriptor_impl.hpp"
    3539
     
    5559/******************************** Some definitions for easier reading **********************************/
    5660
     61struct 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
    5769/************************************* Class definitions ****************************************/
    5870
     
    6678
    6779public:
    68   typedef ATOMSET(std::list) atomSet;
    6980  typedef std::set<atomId_t> atomIdSet;
    70   typedef ObservedIterator<atomSet> iterator;
    71   typedef atomSet::const_iterator const_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;
    7283
    7384  const periodentafel * const elemente; //!< periodic table with each element
    74   // old deprecated atom handling
    75   //atom *start;        //!< start of atom list
    76   //atom *end;          //!< end of atom list
    77   //bond *first;        //!< start of bond list
    78   //bond *last;         //!< end of bond list
    7985  int MDSteps; //!< The number of MD steps in Trajectories
    8086  mutable int NoNonHydrogen; //!< number of non-hydrogen atoms in molecule
     
    8288  mutable int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()
    8389  bool ActiveFlag; //!< in a MoleculeListClass used to discern active from inactive molecules
    84   //Vector Center;      //!< Center of molecule in a global box
    8590  int IndexNr; //!< index of molecule in a MoleculeListClass
    8691  char name[MAXSTRINGSIZE]; //!< arbitrary name
     
    9196  Cacheable<int> BondCount; //!< number of atoms, brought up-to-date by doCountBonds()
    9297  moleculeId_t id;
    93   atomSet atoms; //<!list of atoms
    9498  atomIdSet atomIds; //<!set of atomic ids to check uniqueness of atoms
    9599protected:
    96   //void CountAtoms();
    97   /**
    98    * this iterator type should be used for internal variables, \
    99      * since it will not lock
    100    */
    101   typedef atomSet::iterator internal_iterator;
    102100
    103101  molecule(const periodentafel * const teil);
     
    174172  atom * FindAtom(int Nr) const;
    175173  atom * AskAtom(string text);
     174  bool isInMolecule(const atom * const _atom);
    176175
    177176  /// Count and change present atoms' coordination.
  • src/molecule_geometry.cpp

    rf9b967 r401f90  
    5555
    5656  // go through all atoms
    57   BOOST_FOREACH(atom* iter, atoms){
     57  for (iterator iter = begin(); iter != end(); ++iter) {
    5858    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;
    6262    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));
    6666
    6767  delete(Center);
     
    8080
    8181  // go through all atoms
    82   atoms.transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
     82  getAtomSet().transformNodes(boost::bind(&Box::WrapPeriodically,domain,_1));
    8383
    8484  return status;
     
    9494  Vector *min = new Vector;
    9595
    96   molecule::const_iterator iter = begin();  // start at first in list
     96  const_iterator iter = begin();  // start at first in list
    9797  if (iter != end()) { //list not empty?
    9898    for (int i=NDIM;i--;) {
     
    122122{
    123123  int Num = 0;
    124   molecule::const_iterator iter = begin();  // start at first in list
     124  const_iterator iter = begin();  // start at first in list
    125125  Vector Center;
    126126
     
    141141Vector * molecule::DetermineCenterOfAll() const
    142142{
    143   molecule::const_iterator iter = begin();  // start at first in list
     143  const_iterator iter = begin();  // start at first in list
    144144  Vector *a = new Vector();
    145145  double Num = 0;
     
    174174Vector * molecule::DetermineCenterOfGravity() const
    175175{
    176   molecule::const_iterator iter = begin();  // start at first in list
     176  const_iterator iter = begin();  // start at first in list
    177177  Vector *a = new Vector();
    178178  Vector tmp;
     
    202202  DeterminePeriodicCenter(NewCenter);
    203203  // go through all atoms
    204   BOOST_FOREACH(atom* iter, atoms){
    205     *iter -= NewCenter;
     204  for (iterator iter = begin(); iter != end(); ++iter) {
     205    **iter -= NewCenter;
    206206  }
    207207};
     
    215215{
    216216  // go through all atoms
    217   BOOST_FOREACH(atom* iter, atoms){
    218     *iter -= *newcenter;
     217  for (iterator iter = begin(); iter != end(); ++iter) {
     218    **iter -= *newcenter;
    219219  }
    220220};
     
    233233
    234234  // sum up inertia tensor
    235   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     235  for (const_iterator iter = begin(); iter != end(); ++iter) {
    236236    Vector x = (*iter)->getPosition();
    237237    x -= *CenterOfGravity;
     
    286286
    287287  // and rotate
    288   for (molecule::iterator iter = begin(); iter != end(); ++iter) {
     288  for (iterator iter = begin(); iter != end(); ++iter) {
    289289    *(*iter) -= *CenterOfGravity;
    290290    (*iter)->setPosition(RotationAxis.rotateVector((*iter)->getPosition(), alpha));
     
    306306void molecule::Scale(const double ** const factor)
    307307{
    308   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     308  for (iterator iter = begin(); iter != end(); ++iter) {
    309309    for (size_t j=0;j<(*iter)->getTrajectorySize();j++) {
    310310      Vector temp = (*iter)->getPositionAtStep(j);
     
    320320void molecule::Translate(const Vector *trans)
    321321{
    322   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     322  for (iterator iter = begin(); iter != end(); ++iter) {
    323323    for (size_t j=0;j<(*iter)->getTrajectorySize();j++) {
    324324      (*iter)->setPositionAtStep(j, (*iter)->getPositionAtStep(j) + (*trans));
     
    336336
    337337  // 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));
    342342
    343343};
     
    351351  OBSERVE;
    352352  Plane p(*n,0);
    353   atoms.transformNodes(boost::bind(&Plane::mirrorVector,p,_1));
     353  getAtomSet().transformNodes(boost::bind(&Plane::mirrorVector,p,_1));
    354354};
    355355
     
    371371    Center.Zero();
    372372    flag = true;
    373     for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     373    for (const_iterator iter = begin(); iter != end(); ++iter) {
    374374      if ((saturation == DontSaturate) || ((*iter)->getType()->getAtomicNumber() != 1)) {
    375375        Testvector = inversematrix * (*iter)->getPosition();
     
    435435  alpha = atan(-n->at(0)/n->at(2));
    436436  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) {
    438438    tmp = (*iter)->at(0);
    439439    (*iter)->set(0,  cos(alpha) * tmp + sin(alpha) * (*iter)->at(2));
     
    455455  alpha = atan(-n->at(1)/n->at(2));
    456456  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) {
    458458    tmp = (*iter)->at(1);
    459459    (*iter)->set(1,  cos(alpha) * tmp + sin(alpha) * (*iter)->at(2));
  • src/molecule_graph.cpp

    rf9b967 r401f90  
    5252bool molecule::FillBondStructureFromReference(const molecule * const reference, atom **&ListOfLocalAtoms, bool FreeList)
    5353{
    54   atom *OtherWalker = NULL;
    55   atom *Father = NULL;
    56   bool status = true;
    57   int AtomNo;
     54  bool status = true;
    5855
    5956  LOG(1, "Begin of FillBondStructureFromReference.");
     
    7168
    7269
    73     for(molecule::const_iterator iter = begin(); iter != end(); ++iter) {
    74       Father = (*iter)->GetTrueFather();
    75       AtomNo = Father->getNr(); // global id of the current walker
     70    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
    7673      const BondList& ListOfBonds = Father->getListOfBonds();
    7774      for (BondList::const_iterator Runner = ListOfBonds.begin();
    7875          Runner != ListOfBonds.end();
    7976          ++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
    8179        if (OtherWalker != NULL) {
    8280          if (OtherWalker->getNr() > (*iter)->getNr())
    8381            AddBond((*iter), OtherWalker, (*Runner)->BondDegree);
    8482        } else {
    85           LOG(1, "OtherWalker = ListOfLocalAtoms[" << (*Runner)->GetOtherAtom((*iter)->GetTrueFather())->getNr() << "] is NULL!");
     83          LOG(1, "OtherWalker = ListOfLocalAtoms[" << OtherAtom->getNr() << "] is NULL!");
    8684          status = false;
    8785        }
     
    154152  if (AdjacencyFile.good()) {
    155153    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));
    157155    AdjacencyFile.close();
    158156    LOG(1, "\t... done.");
     
    186184  if (BondFile.good()) {
    187185    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));
    189187    BondFile.close();
    190188    LOG(1, "\t... done.");
  • src/moleculelist.cpp

    rf9b967 r401f90  
    571571      // output file
    572572      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) {
    574576        atoms.push_back(*iter);
    575577      }
Note: See TracChangeset for help on using the changeset viewer.