Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/moleculelist.cpp

    r1b2aa1 rf23d7d  
    11/** \file MoleculeListClass.cpp
    2  *
     2 * 
    33 * Function implementations for the class MoleculeListClass.
    4  *
     4 * 
    55 */
    66
     
    1313MoleculeListClass::MoleculeListClass()
    1414{
    15   // empty lists
    16   ListOfMolecules.clear();
    17   MaxIndex = 1;
    18 };
     15};
     16
     17/** constructor for MoleculeListClass.
     18 * \param NumMolecules number of molecules to allocate for
     19 * \param NumAtoms number of atoms to allocate for
     20 */
     21MoleculeListClass::MoleculeListClass(int NumMolecules, int NumAtoms)
     22{
     23  ListOfMolecules = (molecule **) Malloc(sizeof(molecule *)*NumMolecules, "MoleculeListClass:MoleculeListClass: **ListOfMolecules");
     24  for (int i=NumMolecules;i--;)
     25    ListOfMolecules[i] = NULL;
     26  NumberOfMolecules = NumMolecules;
     27  NumberOfTopAtoms = NumAtoms;
     28};
     29
    1930
    2031/** Destructor for MoleculeListClass.
     
    2334{
    2435  cout << Verbose(3) << this << ": Freeing ListOfMolcules." << endl;
    25   for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
    26     cout << Verbose(4) << "ListOfMolecules: Freeing " << *ListRunner << "." << endl;
    27     delete (*ListRunner);
     36  for (int i=NumberOfMolecules;i--;) {
     37    if (ListOfMolecules[i] != NULL) { // if NULL don't free
     38      cout << Verbose(4) << "ListOfMolecules: Freeing " << ListOfMolecules[i] << "." << endl;
     39      delete(ListOfMolecules[i]);
     40      ListOfMolecules[i] = NULL;
     41    }
    2842  }
    2943  cout << Verbose(4) << "Freeing ListOfMolecules." << endl;
    30   ListOfMolecules.clear(); // empty list
    31 };
    32 
    33 /** Insert a new molecule into the list and set its number.
    34  * \param *mol molecule to add to list.
    35  * \return true - add successful
    36  */
    37 void MoleculeListClass::insert(molecule *mol)
    38 {
    39   mol->IndexNr = MaxIndex++;
    40   ListOfMolecules.push_back(mol);
     44  Free((void **)&ListOfMolecules, "MoleculeListClass:MoleculeListClass: **ListOfMolecules");
    4145};
    4246
     
    5357  atom *aWalker = NULL;
    5458  atom *bWalker = NULL;
    55 
     59 
    5660  // sort each atom list and put the numbers into a list, then go through
    5761  //cout << "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "." << endl;
    58   if ((**(molecule **) a).AtomCount < (**(molecule **) b).AtomCount) {
     62  if ( (**(molecule **)a).AtomCount < (**(molecule **)b).AtomCount ) {
    5963    return -1;
    60   } else {
    61     if ((**(molecule **) a).AtomCount > (**(molecule **) b).AtomCount)
    62       return +1;
     64  } else { if ((**(molecule **)a).AtomCount > (**(molecule **)b).AtomCount)
     65    return +1;
    6366    else {
    64       Count = (**(molecule **) a).AtomCount;
     67      Count = (**(molecule **)a).AtomCount;
    6568      aList = new int[Count];
    6669      bList = new int[Count];
    67 
     70 
    6871      // fill the lists
    69       aWalker = (**(molecule **) a).start;
    70       bWalker = (**(molecule **) b).start;
     72      aWalker = (**(molecule **)a).start;
     73      bWalker = (**(molecule **)b).start;
    7174      Counter = 0;
    7275      aCounter = 0;
    7376      bCounter = 0;
    74       while ((aWalker->next != (**(molecule **) a).end) && (bWalker->next != (**(molecule **) b).end)) {
     77      while ((aWalker->next != (**(molecule **)a).end) && (bWalker->next != (**(molecule **)b).end)) {
    7578        aWalker = aWalker->next;
    7679        bWalker = bWalker->next;
     
    8790      // check if AtomCount was for real
    8891      flag = 0;
    89       if ((aWalker->next == (**(molecule **) a).end) && (bWalker->next != (**(molecule **) b).end)) {
     92      if ((aWalker->next == (**(molecule **)a).end) && (bWalker->next != (**(molecule **)b).end)) {
    9093        flag = -1;
    9194      } else {
    92         if ((aWalker->next != (**(molecule **) a).end) && (bWalker->next == (**(molecule **) b).end))
     95        if ((aWalker->next != (**(molecule **)a).end) && (bWalker->next == (**(molecule **)b).end))
    9396          flag = 1;
    9497      }
    9598      if (flag == 0) {
    9699        // sort the lists
    97         gsl_heapsort(aList, Count, sizeof(int), CompareDoubles);
    98         gsl_heapsort(bList, Count, sizeof(int), CompareDoubles);
    99         // compare the lists
    100 
     100        gsl_heapsort(aList,Count, sizeof(int), CompareDoubles);
     101        gsl_heapsort(bList,Count, sizeof(int), CompareDoubles);
     102        // compare the lists 
     103       
    101104        flag = 0;
    102         for (int i = 0; i < Count; i++) {
     105        for(int i=0;i<Count;i++) {
    103106          if (aList[i] < bList[i]) {
    104107            flag = -1;
     
    111114        }
    112115      }
    113       delete[] (aList);
    114       delete[] (bList);
     116      delete[](aList);
     117      delete[](bList);
    115118      return flag;
    116119    }
    117120  }
    118   return -1;
    119 };
    120 
    121 /** Output of a list of all molecules.
    122  * \param *out output stream
    123  */
    124 void MoleculeListClass::Enumerate(ofstream *out)
    125 {
    126   int i=1;
    127   element* Elemental = NULL;
    128   atom *Walker = NULL;
    129   int Counts[MAX_ELEMENTS];
    130   double size=0;
    131   Vector Origin;
    132 
    133   // header
    134   *out << "Index\tName\t\tAtoms\tFormula\tCenter\tSize" << endl;
    135   cout << Verbose(0) << "-----------------------------------------------" << endl;
    136   if (ListOfMolecules.size() == 0)
    137     *out << "\tNone" << endl;
    138   else {
    139     Origin.Zero();
    140     for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
    141       // reset element counts
    142       for (int j = 0; j<MAX_ELEMENTS;j++)
    143         Counts[j] = 0;
    144       // count atoms per element and determine size of bounding sphere
    145       size=0.;
    146       Walker = (*ListRunner)->start;
    147       while (Walker->next != (*ListRunner)->end) {
    148         Walker = Walker->next;
    149         Counts[Walker->type->Z]++;
    150         if (Walker->x.DistanceSquared(&Origin) > size)
    151           size = Walker->x.DistanceSquared(&Origin);
    152       }
    153       // output Index, Name, number of atoms, chemical formula
    154       *out << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->AtomCount << "\t";
    155       Elemental = (*ListRunner)->elemente->end;
    156       while(Elemental->previous != (*ListRunner)->elemente->start) {
    157         Elemental = Elemental->previous;
    158         if (Counts[Elemental->Z] != 0)
    159           *out << Elemental->symbol << Counts[Elemental->Z];
    160       }
    161       // Center and size
    162       *out << "\t" << (*ListRunner)->Center << "\t" << sqrt(size) << endl;
    163     }
    164   }
    165 };
    166 
    167 /** Returns the molecule with the given index \a index.
    168  * \param index index of the desired molecule
    169  * \return pointer to molecule structure, NULL if not found
    170  */
    171 molecule * MoleculeListClass::ReturnIndex(int index)
    172 {
    173   for(MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++)
    174     if ((*ListRunner)->IndexNr == index)
    175       return (*ListRunner);
    176   return NULL;
    177 };
    178 
    179 /** Simple merge of two molecules into one.
    180  * \param *mol destination molecule
    181  * \param *srcmol source molecule
    182  * \return true - merge successful, false - merge failed (probably due to non-existant indices
    183  */
    184 bool MoleculeListClass::SimpleMerge(molecule *mol, molecule *srcmol)
    185 {
    186   if (srcmol == NULL)
    187     return false;
    188 
    189   // put all molecules of src into mol
    190   atom *Walker = srcmol->start;
    191   atom *NextAtom = Walker->next;
    192   while (NextAtom != srcmol->end) {
    193     Walker = NextAtom;
    194     NextAtom = Walker->next;
    195     srcmol->UnlinkAtom(Walker);
    196     mol->AddAtom(Walker);
    197   }
    198 
    199   // remove src
    200   ListOfMolecules.remove(srcmol);
    201   delete(srcmol);
    202   return true;
    203 };
    204 
    205 /** Simple add of one molecules into another.
    206  * \param *mol destination molecule
    207  * \param *srcmol source molecule
    208  * \return true - merge successful, false - merge failed (probably due to non-existant indices
    209  */
    210 bool MoleculeListClass::SimpleAdd(molecule *mol, molecule *srcmol)
    211 {
    212   if (srcmol == NULL)
    213     return false;
    214 
    215   // put all molecules of src into mol
    216   atom *Walker = srcmol->start;
    217   atom *NextAtom = Walker->next;
    218   while (NextAtom != srcmol->end) {
    219     Walker = NextAtom;
    220     NextAtom = Walker->next;
    221     Walker = mol->AddCopyAtom(Walker);
    222     Walker->father = Walker;
    223   }
    224 
    225   return true;
    226 };
    227 
    228 /** Simple merge of a given set of molecules into one.
    229  * \param *mol destination molecule
    230  * \param *src index of set of source molecule
    231  * \param N number of source molecules
    232  * \return true - merge successful, false - some merges failed (probably due to non-existant indices)
    233  */
    234 bool MoleculeListClass::SimpleMultiMerge(molecule *mol, int *src, int N)
    235 {
    236   bool status = true;
    237   // check presence of all source molecules
    238   for (int i=0;i<N;i++) {
    239     molecule *srcmol = ReturnIndex(src[i]);
    240     status = status && SimpleMerge(mol, srcmol);
    241   }
    242   return status;
    243 };
    244 
    245 /** Simple add of a given set of molecules into one.
    246  * \param *mol destination molecule
    247  * \param *src index of set of source molecule
    248  * \param N number of source molecules
    249  * \return true - merge successful, false - some merges failed (probably due to non-existant indices)
    250  */
    251 bool MoleculeListClass::SimpleMultiAdd(molecule *mol, int *src, int N)
    252 {
    253   bool status = true;
    254   // check presence of all source molecules
    255   for (int i=0;i<N;i++) {
    256     molecule *srcmol = ReturnIndex(src[i]);
    257     status = status && SimpleAdd(mol, srcmol);
    258   }
    259   return status;
    260 };
    261 
    262 /** Scatter merge of a given set of molecules into one.
    263  * Scatter merge distributes the molecules in such a manner that they don't overlap.
    264  * \param *mol destination molecule
    265  * \param *src index of set of source molecule
    266  * \param N number of source molecules
    267  * \return true - merge successful, false - merge failed (probably due to non-existant indices
    268  * \TODO find scatter center for each src molecule
    269  */
    270 bool MoleculeListClass::ScatterMerge(molecule *mol, int *src, int N)
    271 {
    272   // check presence of all source molecules
    273   for (int i=0;i<N;i++) {
    274     // get pointer to src molecule
    275     molecule *srcmol = ReturnIndex(src[i]);
    276     if (srcmol == NULL)
    277       return false;
    278   }
    279   // adapt each Center
    280   for (int i=0;i<N;i++) {
    281     // get pointer to src molecule
    282     molecule *srcmol = ReturnIndex(src[i]);
    283     //srcmol->Center.Zero();
    284     srcmol->Translate(&srcmol->Center);
    285   }
    286   // perform a simple multi merge
    287   SimpleMultiMerge(mol, src, N);
    288   return true;
    289 };
    290 
    291 /** Embedding merge of a given set of molecules into one.
    292  * Embedding merge inserts one molecule into the other.
    293  * \param *mol destination molecule
    294  * \param *srcmol source molecule
    295  * \return true - merge successful, false - merge failed (probably due to non-existant indices
    296  * \TODO find embedding center
    297  */
    298 bool MoleculeListClass::EmbedMerge(molecule *mol, molecule *srcmol)
    299 {
    300   if (srcmol == NULL)
    301     return false;
    302 
    303   // calculate center for merge
    304   srcmol->Center.CopyVector(mol->FindEmbeddingHole((ofstream *)&cout, srcmol));
    305   srcmol->Center.Zero();
    306 
    307   // perform simple merge
    308   SimpleMerge(mol, srcmol);
    309   return true;
     121  return  -1;
    310122};
    311123
     
    315127void MoleculeListClass::Output(ofstream *out)
    316128{
    317   *out << Verbose(1) << "MoleculeList: ";
    318   for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++)
    319     *out << *ListRunner << "\t";
     129  *out<< Verbose(1) << "MoleculeList: ";
     130  for (int i=0;i<NumberOfMolecules;i++)
     131    *out << ListOfMolecules[i] << "\t";
    320132  *out << endl;
    321133};
     
    333145  atom *Runner = NULL;
    334146  double ***FitConstant = NULL, **correction = NULL;
    335   int a, b;
     147  int a,b;
    336148  ofstream output;
    337149  ifstream input;
     
    353165  input.open(line.c_str());
    354166  if (input == NULL) {
    355     cerr << endl << "Unable to open " << line << ", is the directory correct?"
    356         << endl;
     167    cerr << endl << "Unable to open " << line << ", is the directory correct?" << endl;
    357168    return false;
    358169  }
    359   a = 0;
    360   b = -1; // we overcount by one
     170  a=0;
     171  b=-1; // we overcount by one
    361172  while (!input.eof()) {
    362173    input.getline(ParsedLine, 1023);
    363174    zeile.str(ParsedLine);
    364     int i = 0;
     175    int i=0;
    365176    while (!zeile.eof()) {
    366177      zeile >> distance;
    367178      i++;
    368179    }
    369     if (i > a)
    370       a = i;
     180    if (i > a) 
     181      a = i; 
    371182    b++;
    372183  }
    373184  cout << "I recognized " << a << " columns and " << b << " rows, ";
    374185  input.close();
    375 
     186 
    376187  // 0b. allocate memory for constants
    377   FitConstant = (double ***) Malloc(sizeof(double **) * 3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
    378   for (int k = 0; k < 3; k++) {
    379     FitConstant[k] = (double **) Malloc(sizeof(double *) * a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
    380     for (int i = a; i--;) {
    381       FitConstant[k][i] = (double *) Malloc(sizeof(double) * b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
     188  FitConstant = (double ***) Malloc(sizeof(double **)*3, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
     189  for (int k=0;k<3;k++) {
     190    FitConstant[k] = (double **) Malloc(sizeof(double *)*a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
     191    for (int i=a;i--;) {
     192      FitConstant[k][i] = (double *) Malloc(sizeof(double)*b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
    382193    }
    383194  }
    384195  // 0c. parse in constants
    385   for (int i = 0; i < 3; i++) {
     196  for (int i=0;i<3;i++) {
    386197    line = path;
    387198    line.append("/");
    388199    line += FRAGMENTPREFIX;
    389     sprintf(ParsedLine, "%d", i + 1);
     200    sprintf(ParsedLine, "%d", i+1);
    390201    line += ParsedLine;
    391202    line += FITCONSTANTSUFFIX;
     
    395206      return false;
    396207    }
    397     int k = 0, l;
     208    int k = 0,l;
    398209    while ((!input.eof()) && (k < b)) {
    399210      input.getline(ParsedLine, 1023);
     
    412223    input.close();
    413224  }
    414   for (int k = 0; k < 3; k++) {
     225  for(int k=0;k<3;k++) {
    415226    cout << "Constants " << k << ":" << endl;
    416     for (int j = 0; j < b; j++) {
    417       for (int i = 0; i < a; i++) {
     227    for (int j=0;j<b;j++) {
     228      for (int i=0;i<a;i++) {
    418229        cout << FitConstant[k][i][j] << "\t";
    419230      }
     
    422233    cout << endl;
    423234  }
    424 
     235 
    425236  // 0d. allocate final correction matrix
    426   correction = (double **) Malloc(sizeof(double *) * a, "MoleculeListClass::AddHydrogenCorrection: **correction");
    427   for (int i = a; i--;)
    428     correction[i] = (double *) Malloc(sizeof(double) * b, "MoleculeListClass::AddHydrogenCorrection: *correction[]");
    429 
     237  correction = (double **) Malloc(sizeof(double *)*a, "MoleculeListClass::AddHydrogenCorrection: **correction");
     238  for (int i=a;i--;)
     239    correction[i] = (double *) Malloc(sizeof(double)*b, "MoleculeListClass::AddHydrogenCorrection: *correction[]");
     240       
    430241  // 1a. go through every molecule in the list
    431   for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
     242  for(int i=NumberOfMolecules;i--;) {
    432243    // 1b. zero final correction matrix
    433     for (int k = a; k--;)
    434       for (int j = b; j--;)
     244    for (int k=a;k--;)
     245      for (int j=b;j--;)
    435246        correction[k][j] = 0.;
    436247    // 2. take every hydrogen that is a saturated one
    437     Walker = (*ListRunner)->start;
    438     while (Walker->next != (*ListRunner)->end) {
     248    Walker = ListOfMolecules[i]->start;
     249    while (Walker->next != ListOfMolecules[i]->end) {
    439250      Walker = Walker->next;
    440       //cout << Verbose(1) << "Walker: " << *Walker << " with first bond " << *(*Runner)->ListOfBondsPerAtom[Walker->nr][0] << "." << endl;
    441       if ((Walker->type->Z == 1) && ((Walker->father == NULL)
    442           || (Walker->father->type->Z != 1))) { // if it's a hydrogen
    443         Runner = (*ListRunner)->start;
    444         while (Runner->next != (*ListRunner)->end) {
     251      //cout << Verbose(1) << "Walker: " << *Walker << " with first bond " << *ListOfMolecules[i]->ListOfBondsPerAtom[Walker->nr][0] << "." << endl;
     252      if ((Walker->type->Z == 1) && ((Walker->father == NULL) || (Walker->father->type->Z != 1))) { // if it's a hydrogen
     253        Runner = ListOfMolecules[i]->start;
     254        while (Runner->next != ListOfMolecules[i]->end) {
    445255          Runner = Runner->next;
    446           //cout << Verbose(2) << "Runner: " << *Runner << " with first bond " << *(*Runner)->ListOfBondsPerAtom[Runner->nr][0] << "." << endl;
     256          //cout << Verbose(2) << "Runner: " << *Runner << " with first bond " << *ListOfMolecules[i]->ListOfBondsPerAtom[Runner->nr][0] << "." << endl;
    447257          // 3. take every other hydrogen that is the not the first and not bound to same bonding partner
    448           if ((Runner->type->Z == 1) && (Runner->nr > Walker->nr) && ((*ListRunner)->ListOfBondsPerAtom[Runner->nr][0]->GetOtherAtom(Runner) != (*ListRunner)->ListOfBondsPerAtom[Walker->nr][0]->GetOtherAtom(Walker))) { // (hydrogens have only one bonding partner!)
     258          if ((Runner->type->Z == 1) && (Runner->nr > Walker->nr) && (ListOfMolecules[i]->ListOfBondsPerAtom[Runner->nr][0]->GetOtherAtom(Runner) != ListOfMolecules[i]->ListOfBondsPerAtom[Walker->nr][0]->GetOtherAtom(Walker))) { // (hydrogens have only one bonding partner!)
    449259            // 4. evaluate the morse potential for each matrix component and add up
    450             distance = Runner->x.Distance(&Walker->x);
    451             //cout << "Fragment " << (*ListRunner)->name << ": " << *Runner << "<= " << distance << "=>" << *Walker << ":" << endl;
    452             for (int k = 0; k < a; k++) {
    453               for (int j = 0; j < b; j++) {
    454                 switch (k) {
    455                   case 1:
    456                   case 7:
    457                   case 11:
    458                     tmp = pow(FitConstant[0][k][j] * (1. - exp(-FitConstant[1][k][j] * (distance - FitConstant[2][k][j]))), 2);
    459                     break;
    460                   default:
    461                     tmp = FitConstant[0][k][j] * pow(distance, FitConstant[1][k][j]) + FitConstant[2][k][j];
     260            distance = sqrt(Runner->x.Distance(&Walker->x));
     261            //cout << "Fragment " << i << ": " << *Runner << "<= " << distance << "=>" << *Walker << ":" << endl;
     262            for(int k=0;k<a;k++) {
     263              for (int j=0;j<b;j++) {
     264                switch(k) {
     265                case 1:
     266                case 7:
     267                case 11:
     268                  tmp = pow(FitConstant[0][k][j] * ( 1. - exp(-FitConstant[1][k][j] * (distance - FitConstant[2][k][j]) ) ),2);
     269                  break;
     270                default:
     271                  tmp = FitConstant[0][k][j] * pow( distance, FitConstant[1][k][j]) + FitConstant[2][k][j];
    462272                };
    463                 correction[k][j] -= tmp; // ground state is actually lower (disturbed by additional interaction)
     273                correction[k][j] -= tmp;    // ground state is actually lower (disturbed by additional interaction)
    464274                //cout << tmp << "\t";
    465275              }
     
    475285    line.append("/");
    476286    line += FRAGMENTPREFIX;
    477     FragmentNumber = FixedDigitNumber(ListOfMolecules.size(), (*ListRunner)->IndexNr);
     287    FragmentNumber = FixedDigitNumber(NumberOfMolecules, i);
    478288    line += FragmentNumber;
    479     delete (FragmentNumber);
     289    delete(FragmentNumber);
    480290    line += HCORRECTIONSUFFIX;
    481291    output.open(line.c_str());
    482292    output << "Time\t\tTotal\t\tKinetic\t\tNonLocal\tCorrelation\tExchange\tPseudo\t\tHartree\t\t-Gauss\t\tEwald\t\tIonKin\t\tETotal" << endl;
    483     for (int j = 0; j < b; j++) {
    484       for (int i = 0; i < a; i++)
     293    for (int j=0;j<b;j++) {
     294      for(int i=0;i<a;i++)
    485295        output << correction[i][j] << "\t";
    486296      output << endl;
     
    493303  output.open(line.c_str());
    494304  output << "Time\t\tTotal\t\tKinetic\t\tNonLocal\tCorrelation\tExchange\tPseudo\t\tHartree\t\t-Gauss\t\tEwald\t\tIonKin\t\tETotal" << endl;
    495   for (int j = 0; j < b; j++) {
    496     for (int i = 0; i < a; i++)
     305  for (int j=0;j<b;j++) {
     306    for(int i=0;i<a;i++)
    497307      output << 0 << "\t";
    498308    output << endl;
     
    500310  output.close();
    501311  // 6. free memory of parsed matrices
    502   FitConstant = (double ***) Malloc(sizeof(double **) * a, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
    503   for (int k = 0; k < 3; k++) {
    504     FitConstant[k] = (double **) Malloc(sizeof(double *) * a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
    505     for (int i = a; i--;) {
    506       FitConstant[k][i] = (double *) Malloc(sizeof(double) * b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
     312  FitConstant = (double ***) Malloc(sizeof(double **)*a, "MoleculeListClass::AddHydrogenCorrection: ***FitConstant");
     313  for (int k=0;k<3;k++) {
     314    FitConstant[k] = (double **) Malloc(sizeof(double *)*a, "MoleculeListClass::AddHydrogenCorrection: **FitConstant[]");
     315    for (int i=a;i--;) {
     316      FitConstant[k][i] = (double *) Malloc(sizeof(double)*b, "MoleculeListClass::AddHydrogenCorrection: *FitConstant[][]");
    507317    }
    508318  }
     
    517327 * \return true - file written successfully, false - writing failed
    518328 */
    519 bool MoleculeListClass::StoreForcesFile(ofstream *out, char *path,
    520     int *SortIndex)
     329bool MoleculeListClass::StoreForcesFile(ofstream *out, char *path, int *SortIndex)
    521330{
    522331  bool status = true;
     
    533342    //cout << Verbose(1) << "Final AtomicForcesList: ";
    534343    //output << prefix << "Forces" << endl;
    535     for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
    536       runner = (*ListRunner)->elemente->start;
    537       while (runner->next != (*ListRunner)->elemente->end) { // go through every element
     344    for(int j=0;j<NumberOfMolecules;j++) {
     345      //if (TEList[j] != 0) {
     346      runner = ListOfMolecules[j]->elemente->start;
     347      while (runner->next != ListOfMolecules[j]->elemente->end) { // go through every element
    538348        runner = runner->next;
    539         if ((*ListRunner)->ElementsInMolecule[runner->Z]) { // if this element got atoms
    540           Walker = (*ListRunner)->start;
    541           while (Walker->next != (*ListRunner)->end) { // go through every atom of this element
     349        if (ListOfMolecules[j]->ElementsInMolecule[runner->Z]) { // if this element got atoms
     350          Walker = ListOfMolecules[j]->start;
     351          while (Walker->next != ListOfMolecules[j]->end) { // go through every atom of this element
    542352            Walker = Walker->next;
    543353            if (Walker->type->Z == runner->Z) {
    544354              if ((Walker->GetTrueFather() != NULL) && (Walker->GetTrueFather() != Walker)) {// if there is a rea
    545355                //cout << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it
    546                 ForcesFile << SortIndex[Walker->GetTrueFather()->nr] << "\t";
    547               } else
    548                 // otherwise a -1 to indicate an added saturation hydrogen
    549                 ForcesFile << "-1\t";
     356                ForcesFile <<  SortIndex[Walker->GetTrueFather()->nr] << "\t";
     357                } else  // otherwise a -1 to indicate an added saturation hydrogen
     358                  ForcesFile << "-1\t";
     359              }
    550360            }
    551361          }
    552         }
    553362      }
    554363      ForcesFile << endl;
     
    561370  }
    562371  ForcesFile.close();
    563 
     372 
    564373  return status;
    565374};
     
    571380 * \return true - success (each file was written), false - something went wrong.
    572381 */
    573 bool MoleculeListClass::OutputConfigForListOfFragments(ofstream *out,
    574     config *configuration, int *SortIndex)
     382bool MoleculeListClass::OutputConfigForListOfFragments(ofstream *out, config *configuration, int *SortIndex)
    575383{
    576384  ofstream outputFragment;
     
    585393  int FragmentCounter = 0;
    586394  ofstream output;
    587 
     395  string basis("3-21G");
     396 
    588397  // store the fragments as config and as xyz
    589   for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
     398  for(int i=0;i<NumberOfMolecules;i++) {
    590399    // save default path as it is changed for each fragment
    591400    path = configuration->GetDefaultPath();
     
    596405
    597406    // correct periodic
    598     (*ListRunner)->ScanForPeriodicCorrection(out);
     407    //ListOfMolecules[i]->ScanForPeriodicCorrection(out);
    599408
    600409    // output xyz file
    601     FragmentNumber = FixedDigitNumber(ListOfMolecules.size(), FragmentCounter++);
     410    FragmentNumber = FixedDigitNumber(NumberOfMolecules, FragmentCounter++);
    602411    sprintf(FragmentName, "%s/%s%s.conf.xyz", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
    603412    outputFragment.open(FragmentName, ios::out);
    604     *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as XYZ ...";
    605     if ((intermediateResult = (*ListRunner)->OutputXYZ(&outputFragment)))
     413    *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter-1 << " as XYZ ...";
     414    if ((intermediateResult = ListOfMolecules[i]->OutputXYZ(&outputFragment)))
    606415      *out << " done." << endl;
    607416    else
     
    613422    // list atoms in fragment for debugging
    614423    *out << Verbose(2) << "Contained atoms: ";
    615     Walker = (*ListRunner)->start;
    616     while (Walker->next != (*ListRunner)->end) {
     424    Walker = ListOfMolecules[i]->start;
     425    while (Walker->next != ListOfMolecules[i]->end) {
    617426      Walker = Walker->next;
    618427      *out << Walker->Name << " ";
    619428    }
    620429    *out << endl;
    621 
     430   
    622431    // center on edge
    623     (*ListRunner)->CenterEdge(out, &BoxDimension);
    624     (*ListRunner)->SetBoxDimension(&BoxDimension); // update Box of atoms by boundary
     432    ListOfMolecules[i]->CenterEdge(out, &BoxDimension);
     433    ListOfMolecules[i]->SetBoxDimension(&BoxDimension); // update Box of atoms by boundary
    625434    int j = -1;
    626     for (int k = 0; k < NDIM; k++) {
    627       j += k + 1;
    628       BoxDimension.x[k] = 2.5 * (configuration->GetIsAngstroem() ? 1. : 1. / AtomicLengthToAngstroem);
    629       (*ListRunner)->cell_size[j] += BoxDimension.x[k] * 2.;
    630     }
    631     (*ListRunner)->Translate(&BoxDimension);
     435    for (int k=0;k<NDIM;k++) {
     436      j += k+1;
     437      BoxDimension.x[k] = 2.5* (configuration->GetIsAngstroem() ? 1. : 1./AtomicLengthToAngstroem);
     438      ListOfMolecules[i]->cell_size[j] += BoxDimension.x[k]*2.;
     439    }
     440    ListOfMolecules[i]->Translate(&BoxDimension);
    632441
    633442    // also calculate necessary orbitals
    634     (*ListRunner)->CountElements(); // this is a bugfix, atoms should shoulds actually be added correctly to this fragment
    635     (*ListRunner)->CalculateOrbitals(*configuration);
    636 
     443    ListOfMolecules[i]->CountElements();  // this is a bugfix, atoms should should actually be added correctly to this fragment
     444    ListOfMolecules[i]->CalculateOrbitals(*configuration);
     445   
    637446    // change path in config
    638447    //strcpy(PathBackup, configuration->configpath);
    639448    sprintf(FragmentName, "%s/%s%s/", PathBackup, FRAGMENTPREFIX, FragmentNumber);
    640449    configuration->SetDefaultPath(FragmentName);
    641 
     450   
    642451    // and save as config
    643452    sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
    644     *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as config ...";
    645     if ((intermediateResult = configuration->Save(FragmentName, (*ListRunner)->elemente, (*ListRunner))))
     453    *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter-1 << " as config ...";
     454    if ((intermediateResult = configuration->Save(FragmentName, ListOfMolecules[i]->elemente, ListOfMolecules[i])))
    646455      *out << " done." << endl;
    647456    else
     
    652461    configuration->SetDefaultPath(PathBackup);
    653462
     463
    654464    // and save as mpqc input file
    655465    sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
    656     *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as mpqc input ...";
    657     if ((intermediateResult = configuration->SaveMPQC(FragmentName, (*ListRunner))))
     466    *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter-1 << " as mpqc input ...";
     467    if ((intermediateResult = configuration->SaveMPQC(FragmentName, ListOfMolecules[i])))
    658468      *out << " done." << endl;
    659469    else
    660470      *out << " failed." << endl;
    661 
     471       
    662472    result = result && intermediateResult;
    663473    //outputFragment.close();
    664474    //outputFragment.clear();
    665     delete (FragmentNumber);
     475    delete(FragmentNumber);
    666476    //Free((void **)&FragmentNumber, "MoleculeListClass::OutputConfigForListOfFragments: *FragmentNumber");
    667477  }
    668478  cout << " done." << endl;
    669 
     479 
    670480  // printing final number
    671481  *out << "Final number of fragments: " << FragmentCounter << "." << endl;
    672 
     482     
    673483  return result;
    674484};
    675 
    676 /** Counts the number of molecules with the molecule::ActiveFlag set.
    677  * \return number of molecules with ActiveFlag set to true.
    678  */
    679 int MoleculeListClass::NumberOfActiveMolecules()
    680 {
    681   int count = 0;
    682   for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++)
    683     count += ((*ListRunner)->ActiveFlag ? 1 : 0);
    684   return count;
    685 };
    686 
    687485
    688486/******************************************* Class MoleculeLeafClass ************************************************/
     
    695493MoleculeLeafClass::MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf = NULL)
    696494{
    697   //  if (Up != NULL)
    698   //    if (Up->DownLeaf == NULL) // are we the first down leaf for the upper leaf?
    699   //      Up->DownLeaf = this;
    700   //  UpLeaf = Up;
    701   //  DownLeaf = NULL;
     495//  if (Up != NULL)
     496//    if (Up->DownLeaf == NULL) // are we the first down leaf for the upper leaf?
     497//      Up->DownLeaf = this;
     498//  UpLeaf = Up;
     499//  DownLeaf = NULL;
    702500  Leaf = NULL;
    703501  previous = PreviousLeaf;
     
    715513MoleculeLeafClass::~MoleculeLeafClass()
    716514{
    717   //  if (DownLeaf != NULL) {// drop leaves further down
    718   //    MoleculeLeafClass *Walker = DownLeaf;
    719   //    MoleculeLeafClass *Next;
    720   //    do {
    721   //      Next = Walker->NextLeaf;
    722   //      delete(Walker);
    723   //      Walker = Next;
    724   //    } while (Walker != NULL);
    725   //    // Last Walker sets DownLeaf automatically to NULL
    726   //  }
     515//  if (DownLeaf != NULL) {// drop leaves further down
     516//    MoleculeLeafClass *Walker = DownLeaf;
     517//    MoleculeLeafClass *Next;
     518//    do {
     519//      Next = Walker->NextLeaf;
     520//      delete(Walker);
     521//      Walker = Next;
     522//    } while (Walker != NULL);
     523//    // Last Walker sets DownLeaf automatically to NULL
     524//  }
    727525  // remove the leaf itself
    728526  if (Leaf != NULL) {
    729     delete (Leaf);
     527    delete(Leaf);
    730528    Leaf = NULL;
    731529  }
    732530  // remove this Leaf from level list
    733   if (previous != NULL)
     531  if (previous != NULL)   
    734532    previous->next = next;
    735   //  } else { // we are first in list (connects to UpLeaf->DownLeaf)
    736   //    if ((NextLeaf != NULL) && (NextLeaf->UpLeaf == NULL))
    737   //      NextLeaf->UpLeaf = UpLeaf;  // either null as we are top level or the upleaf of the first node
    738   //    if (UpLeaf != NULL)
    739   //      UpLeaf->DownLeaf = NextLeaf;  // either null as we are only leaf or NextLeaf if we are just the first
    740   //  }
    741   //  UpLeaf = NULL;
     533//  } else { // we are first in list (connects to UpLeaf->DownLeaf)
     534//    if ((NextLeaf != NULL) && (NextLeaf->UpLeaf == NULL))
     535//      NextLeaf->UpLeaf = UpLeaf;  // either null as we are top level or the upleaf of the first node
     536//    if (UpLeaf != NULL)
     537//      UpLeaf->DownLeaf = NextLeaf;  // either null as we are only leaf or NextLeaf if we are just the first
     538//  }
     539//  UpLeaf = NULL;
    742540  if (next != NULL) // are we last in list
    743541    next->previous = previous;
     
    778576    return false;
    779577  }
    780 
     578 
    781579  if (status) {
    782     *out << Verbose(1) << "Creating adjacency list for subgraph " << this
    783         << "." << endl;
     580    *out << Verbose(1) << "Creating adjacency list for subgraph " << this << "." << endl;
    784581    Walker = Leaf->start;
    785582    while (Walker->next != Leaf->end) {
    786583      Walker = Walker->next;
    787       AtomNo = Walker->GetTrueFather()->nr; // global id of the current walker
    788       for (int i = 0; i < reference->NumberOfBondsPerAtom[AtomNo]; i++) { // go through father's bonds and copy them all
     584      AtomNo = Walker->GetTrueFather()->nr;  // global id of the current walker
     585      for(int i=0;i<reference->NumberOfBondsPerAtom[AtomNo];i++) { // go through father's bonds and copy them all
    789586        Binder = reference->ListOfBondsPerAtom[AtomNo][i];
    790         OtherWalker = ListOfLocalAtoms[FragmentCounter][Binder->GetOtherAtom(Walker->GetTrueFather())->nr]; // local copy of current bond partner of walker
     587        OtherWalker = ListOfLocalAtoms[FragmentCounter][Binder->GetOtherAtom(Walker->GetTrueFather())->nr];    // local copy of current bond partner of walker
    791588        if (OtherWalker != NULL) {
    792589          if (OtherWalker->nr > Walker->nr)
    793             Leaf->AddBond(Walker, OtherWalker, Binder->BondDegree);
     590          Leaf->AddBond(Walker, OtherWalker, Binder->BondDegree);
    794591        } else {
    795592          *out << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << Binder->GetOtherAtom(Walker->GetTrueFather())->nr << "] is NULL!" << endl;
     
    804601    FragmentCounter--;
    805602  }
    806 
     603 
    807604  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    808605    // free the index lookup list
    809     Free((void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]");
     606    Free((void **)&ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]");
    810607    if (FragmentCounter == 0) // first fragments frees the initial pointer to list
    811       Free((void **) &ListOfLocalAtoms, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
     608      Free((void **)&ListOfLocalAtoms, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
    812609  }
    813610  FragmentCounter--;
     
    824621 * \return true - stack is non-empty, fragmentation necessary, false - stack is empty, no more sites to update
    825622 */
    826 bool MoleculeLeafClass::FillRootStackForSubgraphs(ofstream *out,
    827     KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter)
     623bool MoleculeLeafClass::FillRootStackForSubgraphs(ofstream *out, KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter)
    828624{
    829625  atom *Walker = NULL, *Father = NULL;
    830626
    831627  if (RootStack != NULL) {
    832     // find first root candidates
     628    // find first root candidates 
    833629    if (&(RootStack[FragmentCounter]) != NULL) {
    834       RootStack[FragmentCounter].clear();
     630      RootStack[FragmentCounter].clear(); 
    835631      Walker = Leaf->start;
    836632      while (Walker->next != Leaf->end) { // go through all (non-hydrogen) atoms
     
    838634        Father = Walker->GetTrueFather();
    839635        if (AtomMask[Father->nr]) // apply mask
    840 #ifdef ADDHYDROGEN
     636    #ifdef ADDHYDROGEN
    841637          if (Walker->type->Z != 1) // skip hydrogen
    842 #endif
    843           RootStack[FragmentCounter].push_front(Walker->nr);
     638    #endif
     639            RootStack[FragmentCounter].push_front(Walker->nr);
    844640      }
    845641      if (next != NULL)
    846642        next->FillRootStackForSubgraphs(out, RootStack, AtomMask, ++FragmentCounter);
    847     } else {
    848       *out << Verbose(1) << "Rootstack[" << FragmentCounter << "] is NULL." << endl;
     643    }  else {
     644      *out << Verbose(1) << "Rootstack[" << FragmentCounter  << "] is NULL." << endl;
    849645      return false;
    850646    }
     
    868664{
    869665  bool status = true;
    870 
     666 
    871667  int Counter = Count();
    872668  if (ListOfLocalAtoms == NULL) { // allocated initial pointer
    873669    // allocate and set each field to NULL
    874     ListOfLocalAtoms = (atom ***) Malloc(sizeof(atom **) * Counter, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
     670    ListOfLocalAtoms = (atom ***) Malloc(sizeof(atom **)*Counter, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
    875671    if (ListOfLocalAtoms != NULL) {
    876       for (int i = Counter; i--;)
     672      for (int i=Counter;i--;)
    877673        ListOfLocalAtoms[i] = NULL;
    878674      FreeList = FreeList && true;
     
    880676      status = false;
    881677  }
    882 
     678 
    883679  if ((ListOfLocalAtoms != NULL) && (ListOfLocalAtoms[FragmentCounter] == NULL)) { // allocate and fill list of this fragment/subgraph
    884680    status = status && CreateFatherLookupTable(out, Leaf->start, Leaf->end, ListOfLocalAtoms[FragmentCounter], GlobalAtomCount);
    885681    FreeList = FreeList && true;
    886682  }
    887 
     683 
    888684  return status;
    889685};
     
    899695 * \retuen true - success, false - failure
    900696 */
    901 bool MoleculeLeafClass::AssignKeySetsToFragment(ofstream *out,
    902     molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms,
    903     Graph **&FragmentList, int &FragmentCounter, bool FreeList)
     697bool MoleculeLeafClass::AssignKeySetsToFragment(ofstream *out, molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList)
    904698{
    905699  bool status = true;
    906700  int KeySetCounter = 0;
    907 
     701 
    908702  *out << Verbose(1) << "Begin of AssignKeySetsToFragment." << endl;
    909703  // fill ListOfLocalAtoms if NULL was given
     
    916710  if (FragmentList == NULL) {
    917711    KeySetCounter = Count();
    918     FragmentList = (Graph **) Malloc(sizeof(Graph *) * KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");
    919     for (int i = KeySetCounter; i--;)
     712    FragmentList = (Graph **) Malloc(sizeof(Graph *)*KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");
     713    for(int i=KeySetCounter;i--;)
    920714      FragmentList[i] = NULL;
    921715    KeySetCounter = 0;
    922716  }
    923 
     717 
    924718  if ((KeySetList != NULL) && (KeySetList->size() != 0)) { // if there are some scanned keysets at all
    925719    // assign scanned keysets
     
    927721      FragmentList[FragmentCounter] = new Graph;
    928722    KeySet *TempSet = new KeySet;
    929     for (Graph::iterator runner = KeySetList->begin(); runner != KeySetList->end(); runner++) { // key sets contain global numbers!
    930       if (ListOfLocalAtoms[FragmentCounter][reference->FindAtom(*((*runner).first.begin()))->nr] != NULL) {// as we may assume that that bond structure is unchanged, we only test the first key in each set
     723    for(Graph::iterator runner = KeySetList->begin();runner != KeySetList->end(); runner++) { // key sets contain global numbers!
     724      if ( ListOfLocalAtoms[FragmentCounter][reference->FindAtom(*((*runner).first.begin()))->nr] != NULL) {// as we may assume that that bond structure is unchanged, we only test the first key in each set
    931725        // translate keyset to local numbers
    932         for (KeySet::iterator sprinter = (*runner).first.begin(); sprinter != (*runner).first.end(); sprinter++)
     726        for(KeySet::iterator sprinter = (*runner).first.begin(); sprinter != (*runner).first.end(); sprinter++)
    933727          TempSet->insert(ListOfLocalAtoms[FragmentCounter][reference->FindAtom(*sprinter)->nr]->nr);
    934728        // insert into FragmentList
    935         FragmentList[FragmentCounter]->insert(GraphPair(*TempSet, pair<int, double> (KeySetCounter++, (*runner).second.second)));
     729        FragmentList[FragmentCounter]->insert(GraphPair (*TempSet, pair<int,double>(KeySetCounter++, (*runner).second.second)));
    936730      }
    937731      TempSet->clear();
    938732    }
    939     delete (TempSet);
     733    delete(TempSet);
    940734    if (KeySetCounter == 0) {// if there are no keysets, delete the list
    941735      *out << Verbose(1) << "KeySetCounter is zero, deleting FragmentList." << endl;
    942       delete (FragmentList[FragmentCounter]);
     736      delete(FragmentList[FragmentCounter]);
    943737    } else
    944738      *out << Verbose(1) << KeySetCounter << " keysets were assigned to subgraph " << FragmentCounter << "." << endl;
     
    949743  } else
    950744    *out << Verbose(1) << "KeySetList is NULL or empty." << endl;
    951 
     745 
    952746  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    953747    // free the index lookup list
    954     Free((void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::AssignKeySetsToFragment - **ListOfLocalAtoms[]");
     748    Free((void **)&ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::AssignKeySetsToFragment - **ListOfLocalAtoms[]");
    955749    if (FragmentCounter == 0) // first fragments frees the initial pointer to list
    956       Free((void **) &ListOfLocalAtoms, "MoleculeLeafClass::AssignKeySetsToFragment - ***ListOfLocalAtoms");
     750      Free((void **)&ListOfLocalAtoms, "MoleculeLeafClass::AssignKeySetsToFragment - ***ListOfLocalAtoms");
    957751  }
    958752  *out << Verbose(1) << "End of AssignKeySetsToFragment." << endl;
     
    966760 * \param &TotalNumberOfKeySets global key set counter
    967761 * \param &TotalGraph Graph to be filled with global numbers
    968  */
    969 void MoleculeLeafClass::TranslateIndicesToGlobalIDs(ofstream *out,
    970     Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets,
    971     Graph &TotalGraph)
     762 */
     763void MoleculeLeafClass::TranslateIndicesToGlobalIDs(ofstream *out, Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph)
    972764{
    973765  *out << Verbose(1) << "Begin of TranslateIndicesToGlobalIDs." << endl;
    974766  KeySet *TempSet = new KeySet;
    975767  if (FragmentList[FragmentCounter] != NULL) {
    976     for (Graph::iterator runner = FragmentList[FragmentCounter]->begin(); runner != FragmentList[FragmentCounter]->end(); runner++) {
    977       for (KeySet::iterator sprinter = (*runner).first.begin(); sprinter != (*runner).first.end(); sprinter++)
     768    for(Graph::iterator runner = FragmentList[FragmentCounter]->begin(); runner != FragmentList[FragmentCounter]->end(); runner++) {
     769      for(KeySet::iterator sprinter = (*runner).first.begin(); sprinter != (*runner).first.end(); sprinter++)
    978770        TempSet->insert((Leaf->FindAtom(*sprinter))->GetTrueFather()->nr);
    979       TotalGraph.insert(GraphPair(*TempSet, pair<int, double> (TotalNumberOfKeySets++, (*runner).second.second)));
     771      TotalGraph.insert(GraphPair(*TempSet, pair<int,double>(TotalNumberOfKeySets++, (*runner).second.second)));
    980772      TempSet->clear();
    981773    }
    982     delete (TempSet);
     774    delete(TempSet);
    983775  } else {
    984776    *out << Verbose(1) << "FragmentList is NULL." << endl;
     
    996788{
    997789  if (next != NULL)
    998     return next->Count() + 1;
     790    return next->Count()+1;
    999791  else
    1000     return 1;
    1001 };
    1002 
     792    return 1;
     793};
Note: See TracChangeset for help on using the changeset viewer.