Changeset 59fff1


Ignore:
Timestamp:
Dec 28, 2011, 3:25:49 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:
afa9d8
Parents:
30c753
git-author:
Frederik Heber <heber@…> (12/23/11 10:09:37)
git-committer:
Frederik Heber <heber@…> (12/28/11 15:25:49)
Message:

Replaced the molecule::const_iterator by a true const version of the transform_iterator.

  • lots of places used const_iterator where it made no sense, atom some others one could have sensibly done so but details prevented it, e.g.
    • FormatParserStorage::save() requires vector<atom*> not const atom *,
    • Boundaries (and most of Tesselation for that) requires atom *, not const atom *.
  • Added new function molecule::isInMolecule() to check whether atomic id is in molecule::atomIds.
  • Added const version of atom::GetTrueFather().
Location:
src
Files:
17 edited

Legend:

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

    r30c753 r59fff1  
    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

    r30c753 r59fff1  
    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

    r30c753 r59fff1  
    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

    r30c753 r59fff1  
    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/Fragmentation/Fragmentation.cpp

    r30c753 r59fff1  
    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

    r30c753 r59fff1  
    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

    r30c753 r59fff1  
    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

    r30c753 r59fff1  
    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::const_iterator AtomIter = (*MolIter)->begin();
     283    for(molecule::iterator AtomIter = (*MolIter)->begin();
    281284        AtomIter != (*MolIter)->end();
    282285        ++AtomIter) {
  • src/Tesselation/BoundaryMaps.hpp

    r30c753 r59fff1  
    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

    r30c753 r59fff1  
    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

    r30c753 r59fff1  
    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

    r30c753 r59fff1  
    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

    r30c753 r59fff1  
    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;
     183  const_iterator iter = loc;
    184184  ++iter;
    185   atom* atom = *loc;
    186   atomIds.erase( atom->getId() );
    187   formula-=atom->getType();
    188   atom->removeFromMolecule();
     185  atom * const _atom = const_cast<atom *>(*loc);
     186  atomIds.erase( _atom->getId() );
     187  formula-=_atom->getType();
     188  _atom->removeFromMolecule();
    189189  return iter;
    190190}
     
    193193{
    194194  OBSERVE;
    195   molecule::const_iterator iter = find(key);
     195  const_iterator iter = find(key);
    196196  if (iter != end()){
    197197    ++iter;
     
    233233//      iter != MyIter(atomIds.end(), FromIdToAtom());
    234234//      ++iter)
    235   for (molecule::const_iterator iter = begin(); iter != end(); ++iter)
     235  for (molecule::iterator iter = begin(); iter != end(); ++iter)
    236236    vector_of_atoms.push_back(*iter);
    237237  return vector_of_atoms;
     
    634634  // copy all atoms
    635635  std::map< const atom *, atom *> FatherFinder;
    636   for (const_iterator iter = begin(); iter != end(); ++iter) {
    637     atom *const copy_atom = copy->AddCopyAtom(*iter);
     636  for (iterator iter = begin(); iter != end(); ++iter) {
     637    atom * const copy_atom = copy->AddCopyAtom(*iter);
    638638    FatherFinder.insert( std::make_pair( *iter, copy_atom ) );
    639639  }
     
    649649        // get the pendant atoms of current bond in the copy molecule
    650650        ASSERT(FatherFinder.count(Binder->leftatom),
    651             "molecule::CopyMolecule() - No copy of original left atom for bond copy found");
     651            "molecule::CopyMolecule() - No copy of original left atom "
     652            +toString(Binder->leftatom)+" for bond copy found");
    652653        ASSERT(FatherFinder.count(Binder->rightatom),
    653             "molecule::CopyMolecule() - No copy of original right atom for bond copy found");
     654            "molecule::CopyMolecule() - No copy of original right atom "
     655            +toString(Binder->rightatom)+"  for bond copy found");
    654656        atom * const LeftAtom = FatherFinder[Binder->leftatom];
    655657        atom * const RightAtom = FatherFinder[Binder->rightatom];
     
    674676{
    675677  // remove each atom from world
    676   for(const_iterator AtomRunner = begin(); !empty(); AtomRunner = begin())
     678  for(iterator AtomRunner = begin(); !empty(); AtomRunner = begin())
    677679    World::getInstance().destroyAtom(*AtomRunner);
    678680};
     
    690692  // copy all atoms
    691693  std::map< const atom *, atom *> FatherFinder;
    692   for (const_iterator iter = begin(); iter != end(); ++iter) {
     694  for (iterator iter = begin(); iter != end(); ++iter) {
    693695    if((*iter)->IsInShape(region)){
    694       atom *const copy_atom = copy->AddCopyAtom(*iter);
     696      atom * const copy_atom = copy->AddCopyAtom(*iter);
    695697      FatherFinder.insert( std::make_pair( *iter, copy_atom ) );
    696698    }
     
    739741
    740742  // some checks to make sure we are able to create the bond
    741   ASSERT(atom1, "First atom in bond-creation was an invalid pointer");
    742   ASSERT(atom2, "Second atom in bond-creation was an invalid pointer");
    743   ASSERT(FindAtom(atom1->getNr()),"First atom in bond-creation was not part of molecule");
    744   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");
    745755
    746756  Binder = new bond(atom1, atom2, degree);
    747757  atom1->RegisterBond(WorldTime::getTime(), Binder);
    748758  atom2->RegisterBond(WorldTime::getTime(), Binder);
    749   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))
    750763    NoNonBonds++;
    751764
     
    850863atom * molecule::FindAtom(int Nr)  const
    851864{
    852   molecule::const_iterator iter = begin();
     865  molecule::iterator iter = begin();
    853866  for (; iter != end(); ++iter)
    854     if ((*iter)->getNr() == Nr)
    855       break;
     867  if ((*iter)->getNr() == Nr)
     868    break;
    856869  if (iter != end()) {
    857870    //LOG(0, "Found Atom Nr. " << walker->getNr());
    858871    return (*iter);
    859872  } else {
    860     LOG(0, "Atom not found in list.");
     873    ELOG(1, "Atom not found in molecule " << getName() << "'s list.");
    861874    return NULL;
    862875  }
    863 };
     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}
    864893
    865894/** Asks for atom number, and checks whether in list.
     
    10021031  int i = 0;
    10031032  NoNonHydrogen = 0;
    1004   for (molecule::const_iterator iter = begin(); iter != end(); ++iter) {
     1033  for (molecule::iterator iter = begin(); iter != end(); ++iter) {
    10051034    (*iter)->setNr(i);   // update number in molecule (for easier referencing in FragmentMolecule lateron)
    10061035    if ((*iter)->getType()->getAtomicNumber() != 1) // count non-hydrogen atoms whilst at it
  • src/molecule.hpp

    r30c753 r59fff1  
    8181  typedef std::set<atomId_t> atomIdSet;
    8282  typedef boost::transform_iterator<FromIdToAtom, atomIdSet::iterator, atom *, atomId_t> iterator;
    83   typedef iterator const_iterator;
     83  typedef boost::transform_iterator<FromIdToAtom, atomIdSet::const_iterator, const atom *, atomId_t const &> const_iterator;
    8484
    8585  const periodentafel * const elemente; //!< periodic table with each element
     
    185185  atom * FindAtom(int Nr) const;
    186186  atom * AskAtom(string text);
     187  bool isInMolecule(const atom * const _atom);
    187188
    188189  /// Count and change present atoms' coordination.
  • src/molecule_geometry.cpp

    r30c753 r59fff1  
    306306void molecule::Scale(const double ** const factor)
    307307{
    308   for (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 (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));
     
    435435  alpha = atan(-n->at(0)/n->at(2));
    436436  LOG(1, "INFO: Z-X-angle: " << alpha << " ... ");
    437   for (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 (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

    r30c753 r59fff1  
    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        }
  • src/moleculelist.cpp

    r30c753 r59fff1  
    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.