Ignore:
Timestamp:
May 31, 2010, 5:32:27 PM (16 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, Candidate_v1.7.0, 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:
e08c46
Parents:
42af9e (diff), a7b761b (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.
git-author:
Frederik Heber <heber@…> (05/31/10 17:29:30)
git-committer:
Frederik Heber <heber@…> (05/31/10 17:32:27)
Message:

Merge commit 'jupiter/MoleculeStartEndSwitch' into CommandLineActionMapping

Conflicts:

molecuilder/src/Makefile.am
molecuilder/src/builder.cpp
molecuilder/src/config.cpp
molecuilder/src/helpers.hpp
molecuilder/src/molecule.cpp
molecuilder/src/molecule_dynamics.cpp
molecuilder/src/molecule_fragmentation.cpp
molecuilder/src/molecule_geometry.cpp
molecuilder/src/molecule_graph.cpp
molecuilder/src/moleculelist.cpp
molecuilder/src/unittests/AnalysisCorrelationToPointUnitTest.cpp
molecuilder/src/unittests/listofbondsunittest.cpp

Integration of MoleculeStartEndSwitch had the following consequences:

  • no more AtomCount -> getAtomCount()
  • no more start/end -> begin(), end() and iterator
  • no more decent ordering in atomic ids (hence, Simple_configuration/8 and Domain/5, Domain/6 now check by comparing sorted xyz, not confs)

There is still a huge problem with bonds. One test runs into an endless loop.

Signed-off-by: Frederik Heber <heber@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/moleculelist.cpp

    r42af9e r1024cb  
    2020#include "memoryallocator.hpp"
    2121#include "periodentafel.hpp"
    22 #include "World.hpp"
     22#include "Helpers/Assert.hpp"
    2323
    2424#include "Helpers/Assert.hpp"
     
    7171  int Count, Counter, aCounter, bCounter;
    7272  int flag;
    73   atom *aWalker = NULL;
    74   atom *bWalker = NULL;
    7573
    7674  // sort each atom list and put the numbers into a list, then go through
    7775  //Log() << Verbose(0) << "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "." << endl;
    78   if ((**(molecule **) a).AtomCount < (**(molecule **) b).AtomCount) {
     76  // Yes those types are awkward... but check it for yourself it checks out this way
     77  molecule *const *mol1_ptr= static_cast<molecule *const *>(a);
     78  molecule *mol1 = *mol1_ptr;
     79  molecule *const *mol2_ptr= static_cast<molecule *const *>(b);
     80  molecule *mol2 = *mol2_ptr;
     81  if (mol1->getAtomCount() < mol2->getAtomCount()) {
    7982    return -1;
    8083  } else {
    81     if ((**(molecule **) a).AtomCount > (**(molecule **) b).AtomCount)
     84    if (mol1->getAtomCount() > mol2->getAtomCount())
    8285      return +1;
    8386    else {
    84       Count = (**(molecule **) a).AtomCount;
     87      Count = mol1->getAtomCount();
    8588      aList = new int[Count];
    8689      bList = new int[Count];
    8790
    8891      // fill the lists
    89       aWalker = (**(molecule **) a).start;
    90       bWalker = (**(molecule **) b).start;
    9192      Counter = 0;
    9293      aCounter = 0;
    9394      bCounter = 0;
    94       while ((aWalker->next != (**(molecule **) a).end) && (bWalker->next != (**(molecule **) b).end)) {
    95         aWalker = aWalker->next;
    96         bWalker = bWalker->next;
    97         if (aWalker->GetTrueFather() == NULL)
     95      molecule::const_iterator aiter = mol1->begin();
     96      molecule::const_iterator biter = mol2->begin();
     97      for (;(aiter != mol1->end()) && (biter != mol2->end());
     98          ++aiter, ++biter) {
     99        if ((*aiter)->GetTrueFather() == NULL)
    98100          aList[Counter] = Count + (aCounter++);
    99101        else
    100           aList[Counter] = aWalker->GetTrueFather()->nr;
    101         if (bWalker->GetTrueFather() == NULL)
     102          aList[Counter] = (*aiter)->GetTrueFather()->nr;
     103        if ((*biter)->GetTrueFather() == NULL)
    102104          bList[Counter] = Count + (bCounter++);
    103105        else
    104           bList[Counter] = bWalker->GetTrueFather()->nr;
     106          bList[Counter] = (*biter)->GetTrueFather()->nr;
    105107        Counter++;
    106108      }
    107109      // check if AtomCount was for real
    108110      flag = 0;
    109       if ((aWalker->next == (**(molecule **) a).end) && (bWalker->next != (**(molecule **) b).end)) {
     111      if ((aiter == mol1->end()) && (biter != mol2->end())) {
    110112        flag = -1;
    111113      } else {
    112         if ((aWalker->next != (**(molecule **) a).end) && (bWalker->next == (**(molecule **) b).end))
     114        if ((aiter != mol1->end()) && (biter == mol2->end()))
    113115          flag = 1;
    114116      }
     
    144146void MoleculeListClass::Enumerate(ostream *out)
    145147{
    146   atom *Walker = NULL;
    147148  periodentafel *periode = World::getInstance().getPeriode();
    148149  std::map<atomicNumber_t,unsigned int> counts;
     
    160161      // count atoms per element and determine size of bounding sphere
    161162      size=0.;
    162       Walker = (*ListRunner)->start;
    163       while (Walker->next != (*ListRunner)->end) {
    164         Walker = Walker->next;
    165         counts[Walker->type->getNumber()]++;
    166         if (Walker->x.DistanceSquared(Origin) > size)
    167           size = Walker->x.DistanceSquared(Origin);
     163      for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
     164        counts[(*iter)->type->getNumber()]++;
     165        if ((*iter)->x.DistanceSquared(Origin) > size)
     166          size = (*iter)->x.DistanceSquared(Origin);
    168167      }
    169168      // output Index, Name, number of atoms, chemical formula
    170       (*out) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t";
     169      (*out) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->getAtomCount() << "\t";
    171170
    172171      std::map<atomicNumber_t,unsigned int>::reverse_iterator iter;
     
    204203
    205204  // put all molecules of src into mol
    206   atom *Walker = srcmol->start;
    207   atom *NextAtom = Walker->next;
    208   while (NextAtom != srcmol->end) {
    209     Walker = NextAtom;
    210     NextAtom = Walker->next;
    211     srcmol->UnlinkAtom(Walker);
    212     mol->AddAtom(Walker);
     205  molecule::iterator runner;
     206  for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
     207    runner = iter++;
     208    srcmol->UnlinkAtom((*runner));
     209    mol->AddAtom((*runner));
    213210  }
    214211
     
    230227
    231228  // put all molecules of src into mol
    232   atom *Walker = srcmol->start;
    233   atom *NextAtom = Walker->next;
    234   while (NextAtom != srcmol->end) {
    235     Walker = NextAtom;
    236     NextAtom = Walker->next;
    237     Walker = mol->AddCopyAtom(Walker);
     229  atom *Walker = NULL;
     230  for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
     231    Walker = mol->AddCopyAtom((*iter));
    238232    Walker->father = Walker;
    239233  }
     
    332326
    333327  // prepare index list for bonds
    334   srcmol->CountAtoms();
    335   atom ** CopyAtoms = new atom*[srcmol->AtomCount];
    336   for(int i=0;i<srcmol->AtomCount;i++)
     328  atom ** CopyAtoms = new atom*[srcmol->getAtomCount()];
     329  for(int i=0;i<srcmol->getAtomCount();i++)
    337330    CopyAtoms[i] = NULL;
    338331
    339332  // for each of the source atoms check whether we are in- or outside and add copy atom
    340   atom *Walker = srcmol->start;
    341333  int nr=0;
    342   while (Walker->next != srcmol->end) {
    343     Walker = Walker->next;
    344     DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << *Walker << "." << endl);
    345     if (!TesselStruct->IsInnerPoint(Walker->x, LCList)) {
    346       CopyAtoms[Walker->nr] = Walker->clone();
    347       mol->AddAtom(CopyAtoms[Walker->nr]);
     334  for (molecule::const_iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) {
     335    DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << **iter << "." << endl);
     336    if (!TesselStruct->IsInnerPoint((*iter)->x, LCList)) {
     337      CopyAtoms[(*iter)->nr] = (*iter)->clone();
     338      mol->AddAtom(CopyAtoms[(*iter)->nr]);
    348339      nr++;
    349340    } else {
     
    351342    }
    352343  }
    353   DoLog(1) && (Log() << Verbose(1) << nr << " of " << srcmol->AtomCount << " atoms have been merged.");
     344  DoLog(1) && (Log() << Verbose(1) << nr << " of " << srcmol->getAtomCount() << " atoms have been merged.");
    354345
    355346  // go through all bonds and add as well
     
    384375bool MoleculeListClass::AddHydrogenCorrection(char *path)
    385376{
    386   atom *Walker = NULL;
    387   atom *Runner = NULL;
    388377  bond *Binder = NULL;
    389378  double ***FitConstant = NULL, **correction = NULL;
     
    493482        correction[k][j] = 0.;
    494483    // 2. take every hydrogen that is a saturated one
    495     Walker = (*ListRunner)->start;
    496     while (Walker->next != (*ListRunner)->end) {
    497       Walker = Walker->next;
    498       //Log() << Verbose(1) << "Walker: " << *Walker << " with first bond " << *(Walker->ListOfBonds.begin()) << "." << endl;
    499       if ((Walker->type->Z == 1) && ((Walker->father == NULL)
    500           || (Walker->father->type->Z != 1))) { // if it's a hydrogen
    501         Runner = (*ListRunner)->start;
    502         while (Runner->next != (*ListRunner)->end) {
    503           Runner = Runner->next;
    504           //Log() << Verbose(2) << "Runner: " << *Runner << " with first bond " << *(Walker->ListOfBonds.begin()) << "." << endl;
     484    for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
     485      //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
     486      if (((*iter)->type->Z == 1) && (((*iter)->father == NULL)
     487          || ((*iter)->father->type->Z != 1))) { // if it's a hydrogen
     488        for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) {
     489          //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl;
    505490          // 3. take every other hydrogen that is the not the first and not bound to same bonding partner
    506           Binder = *(Runner->ListOfBonds.begin());
    507           if ((Runner->type->Z == 1) && (Runner->nr > Walker->nr) && (Binder->GetOtherAtom(Runner) != Binder->GetOtherAtom(Walker))) { // (hydrogens have only one bonding partner!)
     491          Binder = *((*runner)->ListOfBonds.begin());
     492          if (((*runner)->type->Z == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!)
    508493            // 4. evaluate the morse potential for each matrix component and add up
    509             distance = Runner->x.distance(Walker->x);
    510             //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *Runner << "<= " << distance << "=>" << *Walker << ":" << endl;
     494            distance = (*runner)->x.distance((*iter)->x);
     495            //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":" << endl;
    511496            for (int k = 0; k < a; k++) {
    512497              for (int j = 0; j < b; j++) {
     
    586571  ofstream ForcesFile;
    587572  stringstream line;
    588   atom *Walker = NULL;
    589573  periodentafel *periode=World::getInstance().getPeriode();
    590574
     
    599583      periodentafel::const_iterator elemIter;
    600584      for(elemIter=periode->begin();elemIter!=periode->end();++elemIter){
    601           if ((*ListRunner)->ElementsInMolecule[(*elemIter).first]) { // if this element got atoms
    602           Walker = (*ListRunner)->start;
    603           while (Walker->next != (*ListRunner)->end) { // go through every atom of this element
    604             Walker = Walker->next;
    605             if (Walker->type->getNumber() == (*elemIter).first) {
    606               if ((Walker->GetTrueFather() != NULL) && (Walker->GetTrueFather() != Walker)) {// if there is a rea
     585        if ((*ListRunner)->ElementsInMolecule[(*elemIter).first]) { // if this element got atoms
     586          for(molecule::iterator atomIter = (*ListRunner)->begin(); atomIter !=(*ListRunner)->end();++atomIter){
     587            if ((*atomIter)->type->getNumber() == (*elemIter).first) {
     588              if (((*atomIter)->GetTrueFather() != NULL) && ((*atomIter)->GetTrueFather() != (*atomIter))) {// if there is a rea
    607589                //Log() << Verbose(0) << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it
    608                 ForcesFile << SortIndex[Walker->GetTrueFather()->nr] << "\t";
     590                ForcesFile << SortIndex[(*atomIter)->GetTrueFather()->nr] << "\t";
    609591              } else
    610592                // otherwise a -1 to indicate an added saturation hydrogen
     
    640622  bool result = true;
    641623  bool intermediateResult = true;
    642   atom *Walker = NULL;
    643624  Vector BoxDimension;
    644625  char *FragmentNumber = NULL;
     
    681662    // list atoms in fragment for debugging
    682663    DoLog(2) && (Log() << Verbose(2) << "Contained atoms: ");
    683     Walker = (*ListRunner)->start;
    684     while (Walker->next != (*ListRunner)->end) {
    685       Walker = Walker->next;
    686       DoLog(0) && (Log() << Verbose(0) << Walker->getName() << " ");
     664    for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) {
     665      DoLog(0) && (Log() << Verbose(0) << (*iter)->getName() << " ");
    687666    }
    688667    DoLog(0) && (Log() << Verbose(0) << endl);
     
    764743{
    765744  molecule *mol = World::getInstance().createMolecule();
    766   atom *Walker = NULL;
    767   atom *Advancer = NULL;
    768745  bond *Binder = NULL;
    769746  bond *Stepper = NULL;
     
    771748  for (MoleculeList::iterator MolRunner = ListOfMolecules.begin(); !ListOfMolecules.empty(); MolRunner = ListOfMolecules.begin()) {
    772749    // shift all atoms to new molecule
    773     Advancer = (*MolRunner)->start->next;
    774     while (Advancer != (*MolRunner)->end) {
    775       Walker = Advancer;
    776       Advancer = Advancer->next;
    777       DoLog(3) && (Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl);
    778       unlink(Walker);
    779       Walker->father = Walker;
    780       mol->AddAtom(Walker);    // counting starts at 1
     750    for (molecule::iterator iter = (*MolRunner)->begin(); (*MolRunner)->empty(); iter = (*MolRunner)->begin()) {
     751      DoLog(3) && (Log() << Verbose(3) << "Re-linking " << (*iter) << "..." << endl);
     752      (*iter)->father = (*iter);
     753      mol->AddAtom((*iter));    // counting starts at 1
     754      (*MolRunner)->erase(iter);
    781755    }
    782756    // remove all bonds
     
    832806  // 4b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1)
    833807  int FragmentCounter = 0;
    834   int *MolMap = new int[mol->AtomCount];
    835   for (int i=0;i<mol->AtomCount;i++)
     808  int *MolMap = new int[mol->getAtomCount()];
     809  for (int i=0;i<mol->getAtomCount();i++)
    836810    MolMap[i] = 0;
    837811  MoleculeLeafClass *MolecularWalker = Subgraphs;
    838   Walker = NULL;
    839812  while (MolecularWalker->next != NULL) {
    840813    MolecularWalker = MolecularWalker->next;
    841     Walker = MolecularWalker->Leaf->start;
    842     while (Walker->next != MolecularWalker->Leaf->end) {
    843       Walker = Walker->next;
    844       MolMap[Walker->GetTrueFather()->nr] = FragmentCounter+1;
     814    for (molecule::const_iterator iter = MolecularWalker->Leaf->begin(); iter != MolecularWalker->Leaf->end(); ++iter) {
     815      MolMap[(*iter)->GetTrueFather()->nr] = FragmentCounter+1;
    845816    }
    846817    FragmentCounter++;
     
    848819
    849820  // 4c. relocate atoms to new molecules and remove from Leafs
    850   Walker = NULL;
    851   while (mol->start->next != mol->end) {
    852     Walker = mol->start->next;
    853     if ((Walker->nr <0) || (Walker->nr >= mol->AtomCount)) {
    854       DoeLog(0) && (eLog()<< Verbose(0) << "Index of atom " << *Walker << " is invalid!" << endl);
     821  for (molecule::iterator iter = mol->begin(); !mol->empty(); iter = mol->begin()) {
     822    if (((*iter)->nr <0) || ((*iter)->nr >= mol->getAtomCount())) {
     823      DoeLog(0) && (eLog()<< Verbose(0) << "Index of atom " << **iter << " is invalid!" << endl);
    855824      performCriticalExit();
    856825    }
    857     FragmentCounter = MolMap[Walker->nr];
     826    FragmentCounter = MolMap[(*iter)->nr];
    858827    if (FragmentCounter != 0) {
    859       DoLog(3) && (Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl);
    860       unlink(Walker);
    861       molecules[FragmentCounter-1]->AddAtom(Walker);    // counting starts at 1
     828      DoLog(3) && (Log() << Verbose(3) << "Re-linking " << **iter << "..." << endl);
     829      molecules[FragmentCounter-1]->AddAtom((*iter));    // counting starts at 1
     830      mol->erase(iter);
    862831    } else {
    863       DoeLog(0) && (eLog()<< Verbose(0) << "Atom " << *Walker << " not associated to molecule!" << endl);
     832      DoeLog(0) && (eLog()<< Verbose(0) << "Atom " << **iter << " not associated to molecule!" << endl);
    864833      performCriticalExit();
    865834    }
     
    869838  while (mol->first->next != mol->last) {
    870839    Binder = mol->first->next;
    871     Walker = Binder->leftatom;
     840    const atom * const Walker = Binder->leftatom;
    872841    unlink(Binder);
    873842    link(Binder,molecules[MolMap[Walker->nr]-1]->last);   // counting starts at 1
     
    891860int MoleculeListClass::CountAllAtoms() const
    892861{
    893   atom *Walker = NULL;
    894862  int AtomNo = 0;
    895863  for (MoleculeList::const_iterator MolWalker = ListOfMolecules.begin(); MolWalker != ListOfMolecules.end(); MolWalker++) {
    896     Walker = (*MolWalker)->start;
    897     while (Walker->next != (*MolWalker)->end) {
    898       Walker = Walker->next;
    899       AtomNo++;
    900     }
     864    AtomNo += (*MolWalker)->size();
    901865  }
    902866  return AtomNo;
     
    10731037bool MoleculeLeafClass::FillBondStructureFromReference(const molecule * const reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList)
    10741038{
    1075   atom *Walker = NULL;
    10761039  atom *OtherWalker = NULL;
    10771040  atom *Father = NULL;
     
    10811044  DoLog(1) && (Log() << Verbose(1) << "Begin of FillBondStructureFromReference." << endl);
    10821045  // fill ListOfLocalAtoms if NULL was given
    1083   if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) {
     1046  if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->getAtomCount(), FreeList)) {
    10841047    DoLog(1) && (Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl);
    10851048    return false;
     
    10971060    }
    10981061
    1099     Walker = Leaf->start;
    1100     while (Walker->next != Leaf->end) {
    1101       Walker = Walker->next;
    1102       Father = Walker->GetTrueFather();
     1062    for(molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end(); ++iter) {
     1063      Father = (*iter)->GetTrueFather();
    11031064      AtomNo = Father->nr; // global id of the current walker
    11041065      for (BondList::const_iterator Runner = Father->ListOfBonds.begin(); Runner != Father->ListOfBonds.end(); (++Runner)) {
    1105         OtherWalker = ListOfLocalAtoms[FragmentCounter][(*Runner)->GetOtherAtom(Walker->GetTrueFather())->nr]; // local copy of current bond partner of walker
     1066        OtherWalker = ListOfLocalAtoms[FragmentCounter][(*Runner)->GetOtherAtom((*iter)->GetTrueFather())->nr]; // local copy of current bond partner of walker
    11061067        if (OtherWalker != NULL) {
    1107           if (OtherWalker->nr > Walker->nr)
    1108             Leaf->AddBond(Walker, OtherWalker, (*Runner)->BondDegree);
     1068          if (OtherWalker->nr > (*iter)->nr)
     1069            Leaf->AddBond((*iter), OtherWalker, (*Runner)->BondDegree);
    11091070        } else {
    1110           DoLog(1) && (Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << (*Runner)->GetOtherAtom(Walker->GetTrueFather())->nr << "] is NULL!" << endl);
     1071          DoLog(1) && (Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << (*Runner)->GetOtherAtom((*iter)->GetTrueFather())->nr << "] is NULL!" << endl);
    11111072          status = false;
    11121073        }
     
    11351096bool MoleculeLeafClass::FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter)
    11361097{
    1137   atom *Walker = NULL, *Father = NULL;
     1098  atom *Father = NULL;
    11381099
    11391100  if (RootStack != NULL) {
     
    11411102    if (&(RootStack[FragmentCounter]) != NULL) {
    11421103      RootStack[FragmentCounter].clear();
    1143       Walker = Leaf->start;
    1144       while (Walker->next != Leaf->end) { // go through all (non-hydrogen) atoms
    1145         Walker = Walker->next;
    1146         Father = Walker->GetTrueFather();
     1104      for(molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end(); ++iter) {
     1105        Father = (*iter)->GetTrueFather();
    11471106        if (AtomMask[Father->nr]) // apply mask
    11481107#ifdef ADDHYDROGEN
    1149           if (Walker->type->Z != 1) // skip hydrogen
     1108          if ((*iter)->type->Z != 1) // skip hydrogen
    11501109#endif
    1151           RootStack[FragmentCounter].push_front(Walker->nr);
     1110          RootStack[FragmentCounter].push_front((*iter)->nr);
    11521111      }
    11531112      if (next != NULL)
     
    11911150
    11921151  if ((ListOfLocalAtoms != NULL) && (ListOfLocalAtoms[FragmentCounter] == NULL)) { // allocate and fill list of this fragment/subgraph
    1193     status = status && CreateFatherLookupTable(Leaf->start, Leaf->end, ListOfLocalAtoms[FragmentCounter], GlobalAtomCount);
     1152    status = status && Leaf->CreateFatherLookupTable(ListOfLocalAtoms[FragmentCounter], GlobalAtomCount);
    11941153    FreeList = FreeList && true;
    11951154  }
     
    12151174  DoLog(1) && (Log() << Verbose(1) << "Begin of AssignKeySetsToFragment." << endl);
    12161175  // fill ListOfLocalAtoms if NULL was given
    1217   if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->AtomCount, FreeList)) {
     1176  if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->getAtomCount(), FreeList)) {
    12181177    DoLog(1) && (Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl);
    12191178    return false;
Note: See TracChangeset for help on using the changeset viewer.