Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/moleculelist.cpp

    r2746be r437922  
    11/** \file MoleculeListClass.cpp
    2  * 
     2 *
    33 * Function implementations for the class MoleculeListClass.
    4  * 
     4 *
    55 */
    66
     
    1313MoleculeListClass::MoleculeListClass()
    1414{
    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  */
    21 MoleculeListClass::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 
     15  // empty lists
     16  ListOfMolecules.clear();
     17  MaxIndex = 1;
     18};
    3019
    3120/** Destructor for MoleculeListClass.
     
    3423{
    3524  cout << Verbose(3) << this << ": Freeing ListOfMolcules." << endl;
    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     }
     25  for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
     26    cout << Verbose(4) << "ListOfMolecules: Freeing " << *ListRunner << "." << endl;
     27    delete (*ListRunner);
    4228  }
    4329  cout << Verbose(4) << "Freeing ListOfMolecules." << endl;
    44   Free((void **)&ListOfMolecules, "MoleculeListClass:MoleculeListClass: **ListOfMolecules");
     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 */
     37void MoleculeListClass::insert(molecule *mol)
     38{
     39  mol->IndexNr = MaxIndex++;
     40  ListOfMolecules.push_back(mol);
    4541};
    4642
     
    5753  atom *aWalker = NULL;
    5854  atom *bWalker = NULL;
    59  
     55
    6056  // sort each atom list and put the numbers into a list, then go through
    6157  //cout << "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "." << endl;
    62   if ( (**(molecule **)a).AtomCount < (**(molecule **)b).AtomCount ) {
     58  if ((**(molecule **) a).AtomCount < (**(molecule **) b).AtomCount) {
    6359    return -1;
    64   } else { if ((**(molecule **)a).AtomCount > (**(molecule **)b).AtomCount)
    65     return +1;
     60  } else {
     61    if ((**(molecule **) a).AtomCount > (**(molecule **) b).AtomCount)
     62      return +1;
    6663    else {
    67       Count = (**(molecule **)a).AtomCount;
     64      Count = (**(molecule **) a).AtomCount;
    6865      aList = new int[Count];
    6966      bList = new int[Count];
    70  
     67
    7168      // fill the lists
    72       aWalker = (**(molecule **)a).start;
    73       bWalker = (**(molecule **)b).start;
     69      aWalker = (**(molecule **) a).start;
     70      bWalker = (**(molecule **) b).start;
    7471      Counter = 0;
    7572      aCounter = 0;
    7673      bCounter = 0;
    77       while ((aWalker->next != (**(molecule **)a).end) && (bWalker->next != (**(molecule **)b).end)) {
     74      while ((aWalker->next != (**(molecule **) a).end) && (bWalker->next != (**(molecule **) b).end)) {
    7875        aWalker = aWalker->next;
    7976        bWalker = bWalker->next;
     
    9087      // check if AtomCount was for real
    9188      flag = 0;
    92       if ((aWalker->next == (**(molecule **)a).end) && (bWalker->next != (**(molecule **)b).end)) {
     89      if ((aWalker->next == (**(molecule **) a).end) && (bWalker->next != (**(molecule **) b).end)) {
    9390        flag = -1;
    9491      } else {
    95         if ((aWalker->next != (**(molecule **)a).end) && (bWalker->next == (**(molecule **)b).end))
     92        if ((aWalker->next != (**(molecule **) a).end) && (bWalker->next == (**(molecule **) b).end))
    9693          flag = 1;
    9794      }
    9895      if (flag == 0) {
    9996        // sort the lists
    100         gsl_heapsort(aList,Count, sizeof(int), CompareDoubles);
    101         gsl_heapsort(bList,Count, sizeof(int), CompareDoubles);
    102         // compare the lists 
    103        
     97        gsl_heapsort(aList, Count, sizeof(int), CompareDoubles);
     98        gsl_heapsort(bList, Count, sizeof(int), CompareDoubles);
     99        // compare the lists
     100
    104101        flag = 0;
    105         for(int i=0;i<Count;i++) {
     102        for (int i = 0; i < Count; i++) {
    106103          if (aList[i] < bList[i]) {
    107104            flag = -1;
     
    114111        }
    115112      }
    116       delete[](aList);
    117       delete[](bList);
     113      delete[] (aList);
     114      delete[] (bList);
    118115      return flag;
    119116    }
    120117  }
    121   return  -1;
     118  return -1;
     119};
     120
     121/** Output of a list of all molecules.
     122 * \param *out output stream
     123 */
     124void 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 */
     171molecule * 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 */
     184bool 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 */
     210bool 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 */
     234bool 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 */
     251bool 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 */
     270bool 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 */
     298bool 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;
    122310};
    123311
     
    127315void MoleculeListClass::Output(ofstream *out)
    128316{
    129   *out<< Verbose(1) << "MoleculeList: ";
    130   for (int i=0;i<NumberOfMolecules;i++)
    131     *out << ListOfMolecules[i] << "\t";
     317  *out << Verbose(1) << "MoleculeList: ";
     318  for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++)
     319    *out << *ListRunner << "\t";
    132320  *out << endl;
    133321};
     
    145333  atom *Runner = NULL;
    146334  double ***FitConstant = NULL, **correction = NULL;
    147   int a,b;
     335  int a, b;
    148336  ofstream output;
    149337  ifstream input;
     
    165353  input.open(line.c_str());
    166354  if (input == NULL) {
    167     cerr << endl << "Unable to open " << line << ", is the directory correct?" << endl;
     355    cerr << endl << "Unable to open " << line << ", is the directory correct?"
     356        << endl;
    168357    return false;
    169358  }
    170   a=0;
    171   b=-1; // we overcount by one
     359  a = 0;
     360  b = -1; // we overcount by one
    172361  while (!input.eof()) {
    173362    input.getline(ParsedLine, 1023);
    174363    zeile.str(ParsedLine);
    175     int i=0;
     364    int i = 0;
    176365    while (!zeile.eof()) {
    177366      zeile >> distance;
    178367      i++;
    179368    }
    180     if (i > a) 
    181       a = i; 
     369    if (i > a)
     370      a = i;
    182371    b++;
    183372  }
    184373  cout << "I recognized " << a << " columns and " << b << " rows, ";
    185374  input.close();
    186  
     375
    187376  // 0b. allocate memory for constants
    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[][]");
     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[][]");
    193382    }
    194383  }
    195384  // 0c. parse in constants
    196   for (int i=0;i<3;i++) {
     385  for (int i = 0; i < 3; i++) {
    197386    line = path;
    198387    line.append("/");
    199388    line += FRAGMENTPREFIX;
    200     sprintf(ParsedLine, "%d", i+1);
     389    sprintf(ParsedLine, "%d", i + 1);
    201390    line += ParsedLine;
    202391    line += FITCONSTANTSUFFIX;
     
    206395      return false;
    207396    }
    208     int k = 0,l;
     397    int k = 0, l;
    209398    while ((!input.eof()) && (k < b)) {
    210399      input.getline(ParsedLine, 1023);
     
    223412    input.close();
    224413  }
    225   for(int k=0;k<3;k++) {
     414  for (int k = 0; k < 3; k++) {
    226415    cout << "Constants " << k << ":" << endl;
    227     for (int j=0;j<b;j++) {
    228       for (int i=0;i<a;i++) {
     416    for (int j = 0; j < b; j++) {
     417      for (int i = 0; i < a; i++) {
    229418        cout << FitConstant[k][i][j] << "\t";
    230419      }
     
    233422    cout << endl;
    234423  }
    235  
     424
    236425  // 0d. allocate final correction matrix
    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        
     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
    241430  // 1a. go through every molecule in the list
    242   for(int i=NumberOfMolecules;i--;) {
     431  for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
    243432    // 1b. zero final correction matrix
    244     for (int k=a;k--;)
    245       for (int j=b;j--;)
     433    for (int k = a; k--;)
     434      for (int j = b; j--;)
    246435        correction[k][j] = 0.;
    247436    // 2. take every hydrogen that is a saturated one
    248     Walker = ListOfMolecules[i]->start;
    249     while (Walker->next != ListOfMolecules[i]->end) {
     437    Walker = (*ListRunner)->start;
     438    while (Walker->next != (*ListRunner)->end) {
    250439      Walker = Walker->next;
    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) {
     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) {
    255445          Runner = Runner->next;
    256           //cout << Verbose(2) << "Runner: " << *Runner << " with first bond " << *ListOfMolecules[i]->ListOfBondsPerAtom[Runner->nr][0] << "." << endl;
     446          //cout << Verbose(2) << "Runner: " << *Runner << " with first bond " << *(*Runner)->ListOfBondsPerAtom[Runner->nr][0] << "." << endl;
    257447          // 3. take every other hydrogen that is the not the first and not bound to same 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!)
     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!)
    259449            // 4. evaluate the morse potential for each matrix component and add up
    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];
     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];
    272462                };
    273                 correction[k][j] -= tmp;    // ground state is actually lower (disturbed by additional interaction)
     463                correction[k][j] -= tmp; // ground state is actually lower (disturbed by additional interaction)
    274464                //cout << tmp << "\t";
    275465              }
     
    285475    line.append("/");
    286476    line += FRAGMENTPREFIX;
    287     FragmentNumber = FixedDigitNumber(NumberOfMolecules, i);
     477    FragmentNumber = FixedDigitNumber(ListOfMolecules.size(), (*ListRunner)->IndexNr);
    288478    line += FragmentNumber;
    289     delete(FragmentNumber);
     479    delete (FragmentNumber);
    290480    line += HCORRECTIONSUFFIX;
    291481    output.open(line.c_str());
    292482    output << "Time\t\tTotal\t\tKinetic\t\tNonLocal\tCorrelation\tExchange\tPseudo\t\tHartree\t\t-Gauss\t\tEwald\t\tIonKin\t\tETotal" << endl;
    293     for (int j=0;j<b;j++) {
    294       for(int i=0;i<a;i++)
     483    for (int j = 0; j < b; j++) {
     484      for (int i = 0; i < a; i++)
    295485        output << correction[i][j] << "\t";
    296486      output << endl;
     
    303493  output.open(line.c_str());
    304494  output << "Time\t\tTotal\t\tKinetic\t\tNonLocal\tCorrelation\tExchange\tPseudo\t\tHartree\t\t-Gauss\t\tEwald\t\tIonKin\t\tETotal" << endl;
    305   for (int j=0;j<b;j++) {
    306     for(int i=0;i<a;i++)
     495  for (int j = 0; j < b; j++) {
     496    for (int i = 0; i < a; i++)
    307497      output << 0 << "\t";
    308498    output << endl;
     
    310500  output.close();
    311501  // 6. free memory of parsed matrices
    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[][]");
     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[][]");
    317507    }
    318508  }
     
    327517 * \return true - file written successfully, false - writing failed
    328518 */
    329 bool MoleculeListClass::StoreForcesFile(ofstream *out, char *path, int *SortIndex)
     519bool MoleculeListClass::StoreForcesFile(ofstream *out, char *path,
     520    int *SortIndex)
    330521{
    331522  bool status = true;
     
    342533    //cout << Verbose(1) << "Final AtomicForcesList: ";
    343534    //output << prefix << "Forces" << endl;
    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
     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
    348538        runner = runner->next;
    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
     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
    352542            Walker = Walker->next;
    353543            if (Walker->type->Z == runner->Z) {
    354544              if ((Walker->GetTrueFather() != NULL) && (Walker->GetTrueFather() != Walker)) {// if there is a rea
    355545                //cout << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it
    356                 ForcesFile <<  SortIndex[Walker->GetTrueFather()->nr] << "\t";
    357                 } else  // otherwise a -1 to indicate an added saturation hydrogen
    358                   ForcesFile << "-1\t";
    359               }
     546                ForcesFile << SortIndex[Walker->GetTrueFather()->nr] << "\t";
     547              } else
     548                // otherwise a -1 to indicate an added saturation hydrogen
     549                ForcesFile << "-1\t";
    360550            }
    361551          }
     552        }
    362553      }
    363554      ForcesFile << endl;
     
    370561  }
    371562  ForcesFile.close();
    372  
     563
    373564  return status;
    374565};
     
    380571 * \return true - success (each file was written), false - something went wrong.
    381572 */
    382 bool MoleculeListClass::OutputConfigForListOfFragments(ofstream *out, config *configuration, int *SortIndex)
     573bool MoleculeListClass::OutputConfigForListOfFragments(ofstream *out,
     574    config *configuration, int *SortIndex)
    383575{
    384576  ofstream outputFragment;
     
    393585  int FragmentCounter = 0;
    394586  ofstream output;
    395   string basis("3-21G");
    396  
     587
    397588  // store the fragments as config and as xyz
    398   for(int i=0;i<NumberOfMolecules;i++) {
     589  for (MoleculeList::iterator ListRunner = ListOfMolecules.begin(); ListRunner != ListOfMolecules.end(); ListRunner++) {
    399590    // save default path as it is changed for each fragment
    400591    path = configuration->GetDefaultPath();
     
    405596
    406597    // correct periodic
    407     //ListOfMolecules[i]->ScanForPeriodicCorrection(out);
     598    (*ListRunner)->ScanForPeriodicCorrection(out);
    408599
    409600    // output xyz file
    410     FragmentNumber = FixedDigitNumber(NumberOfMolecules, FragmentCounter++);
     601    FragmentNumber = FixedDigitNumber(ListOfMolecules.size(), FragmentCounter++);
    411602    sprintf(FragmentName, "%s/%s%s.conf.xyz", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
    412603    outputFragment.open(FragmentName, ios::out);
    413     *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter-1 << " as XYZ ...";
    414     if ((intermediateResult = ListOfMolecules[i]->OutputXYZ(&outputFragment)))
     604    *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as XYZ ...";
     605    if ((intermediateResult = (*ListRunner)->OutputXYZ(&outputFragment)))
    415606      *out << " done." << endl;
    416607    else
     
    422613    // list atoms in fragment for debugging
    423614    *out << Verbose(2) << "Contained atoms: ";
    424     Walker = ListOfMolecules[i]->start;
    425     while (Walker->next != ListOfMolecules[i]->end) {
     615    Walker = (*ListRunner)->start;
     616    while (Walker->next != (*ListRunner)->end) {
    426617      Walker = Walker->next;
    427618      *out << Walker->Name << " ";
    428619    }
    429620    *out << endl;
    430    
     621
    431622    // center on edge
    432     ListOfMolecules[i]->CenterEdge(out, &BoxDimension);
    433     ListOfMolecules[i]->SetBoxDimension(&BoxDimension); // update Box of atoms by boundary
     623    (*ListRunner)->CenterEdge(out, &BoxDimension);
     624    (*ListRunner)->SetBoxDimension(&BoxDimension); // update Box of atoms by boundary
    434625    int j = -1;
    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);
     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);
    441632
    442633    // also calculate necessary orbitals
    443     ListOfMolecules[i]->CountElements();  // this is a bugfix, atoms should should actually be added correctly to this fragment
    444     ListOfMolecules[i]->CalculateOrbitals(*configuration);
    445    
     634    (*ListRunner)->CountElements(); // this is a bugfix, atoms should shoulds actually be added correctly to this fragment
     635    (*ListRunner)->CalculateOrbitals(*configuration);
     636
    446637    // change path in config
    447638    //strcpy(PathBackup, configuration->configpath);
    448639    sprintf(FragmentName, "%s/%s%s/", PathBackup, FRAGMENTPREFIX, FragmentNumber);
    449640    configuration->SetDefaultPath(FragmentName);
    450    
     641
    451642    // and save as config
    452643    sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
    453     *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter-1 << " as config ...";
    454     if ((intermediateResult = configuration->Save(FragmentName, ListOfMolecules[i]->elemente, ListOfMolecules[i])))
     644    *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as config ...";
     645    if ((intermediateResult = configuration->Save(FragmentName, (*ListRunner)->elemente, (*ListRunner))))
    455646      *out << " done." << endl;
    456647    else
     
    461652    configuration->SetDefaultPath(PathBackup);
    462653
    463 
    464654    // and save as mpqc input file
    465655    sprintf(FragmentName, "%s/%s%s.conf", configuration->configpath, FRAGMENTPREFIX, FragmentNumber);
    466     *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter-1 << " as mpqc input ...";
    467     if ((intermediateResult = configuration->SaveMPQC(FragmentName, ListOfMolecules[i])))
     656    *out << Verbose(2) << "Saving bond fragment No. " << FragmentNumber << "/" << FragmentCounter - 1 << " as mpqc input ...";
     657    if ((intermediateResult = configuration->SaveMPQC(FragmentName, (*ListRunner))))
    468658      *out << " done." << endl;
    469659    else
    470660      *out << " failed." << endl;
    471        
     661
    472662    result = result && intermediateResult;
    473663    //outputFragment.close();
    474664    //outputFragment.clear();
    475     delete(FragmentNumber);
     665    delete (FragmentNumber);
    476666    //Free((void **)&FragmentNumber, "MoleculeListClass::OutputConfigForListOfFragments: *FragmentNumber");
    477667  }
    478668  cout << " done." << endl;
    479  
     669
    480670  // printing final number
    481671  *out << "Final number of fragments: " << FragmentCounter << "." << endl;
    482      
     672
    483673  return result;
    484674};
     675
     676/** Counts the number of molecules with the molecule::ActiveFlag set.
     677 * \return number of molecules with ActiveFlag set to true.
     678 */
     679int 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
    485687
    486688/******************************************* Class MoleculeLeafClass ************************************************/
     
    493695MoleculeLeafClass::MoleculeLeafClass(MoleculeLeafClass *PreviousLeaf = NULL)
    494696{
    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;
     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;
    500702  Leaf = NULL;
    501703  previous = PreviousLeaf;
     
    513715MoleculeLeafClass::~MoleculeLeafClass()
    514716{
    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 //  }
     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  //  }
    525727  // remove the leaf itself
    526728  if (Leaf != NULL) {
    527     delete(Leaf);
     729    delete (Leaf);
    528730    Leaf = NULL;
    529731  }
    530732  // remove this Leaf from level list
    531   if (previous != NULL)   
     733  if (previous != NULL)
    532734    previous->next = next;
    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;
     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;
    540742  if (next != NULL) // are we last in list
    541743    next->previous = previous;
     
    576778    return false;
    577779  }
    578  
     780
    579781  if (status) {
    580     *out << Verbose(1) << "Creating adjacency list for subgraph " << this << "." << endl;
     782    *out << Verbose(1) << "Creating adjacency list for subgraph " << this
     783        << "." << endl;
    581784    Walker = Leaf->start;
    582785    while (Walker->next != Leaf->end) {
    583786      Walker = Walker->next;
    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
     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
    586789        Binder = reference->ListOfBondsPerAtom[AtomNo][i];
    587         OtherWalker = ListOfLocalAtoms[FragmentCounter][Binder->GetOtherAtom(Walker->GetTrueFather())->nr];    // local copy of current bond partner of walker
     790        OtherWalker = ListOfLocalAtoms[FragmentCounter][Binder->GetOtherAtom(Walker->GetTrueFather())->nr]; // local copy of current bond partner of walker
    588791        if (OtherWalker != NULL) {
    589792          if (OtherWalker->nr > Walker->nr)
    590           Leaf->AddBond(Walker, OtherWalker, Binder->BondDegree);
     793            Leaf->AddBond(Walker, OtherWalker, Binder->BondDegree);
    591794        } else {
    592795          *out << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << Binder->GetOtherAtom(Walker->GetTrueFather())->nr << "] is NULL!" << endl;
     
    601804    FragmentCounter--;
    602805  }
    603  
     806
    604807  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    605808    // free the index lookup list
    606     Free((void **)&ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]");
     809    Free((void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]");
    607810    if (FragmentCounter == 0) // first fragments frees the initial pointer to list
    608       Free((void **)&ListOfLocalAtoms, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
     811      Free((void **) &ListOfLocalAtoms, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
    609812  }
    610813  FragmentCounter--;
     
    621824 * \return true - stack is non-empty, fragmentation necessary, false - stack is empty, no more sites to update
    622825 */
    623 bool MoleculeLeafClass::FillRootStackForSubgraphs(ofstream *out, KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter)
     826bool MoleculeLeafClass::FillRootStackForSubgraphs(ofstream *out,
     827    KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter)
    624828{
    625829  atom *Walker = NULL, *Father = NULL;
    626830
    627831  if (RootStack != NULL) {
    628     // find first root candidates 
     832    // find first root candidates
    629833    if (&(RootStack[FragmentCounter]) != NULL) {
    630       RootStack[FragmentCounter].clear(); 
     834      RootStack[FragmentCounter].clear();
    631835      Walker = Leaf->start;
    632836      while (Walker->next != Leaf->end) { // go through all (non-hydrogen) atoms
     
    634838        Father = Walker->GetTrueFather();
    635839        if (AtomMask[Father->nr]) // apply mask
    636     #ifdef ADDHYDROGEN
     840#ifdef ADDHYDROGEN
    637841          if (Walker->type->Z != 1) // skip hydrogen
    638     #endif
    639             RootStack[FragmentCounter].push_front(Walker->nr);
     842#endif
     843          RootStack[FragmentCounter].push_front(Walker->nr);
    640844      }
    641845      if (next != NULL)
    642846        next->FillRootStackForSubgraphs(out, RootStack, AtomMask, ++FragmentCounter);
    643     }  else {
    644       *out << Verbose(1) << "Rootstack[" << FragmentCounter  << "] is NULL." << endl;
     847    } else {
     848      *out << Verbose(1) << "Rootstack[" << FragmentCounter << "] is NULL." << endl;
    645849      return false;
    646850    }
     
    664868{
    665869  bool status = true;
    666  
     870
    667871  int Counter = Count();
    668872  if (ListOfLocalAtoms == NULL) { // allocated initial pointer
    669873    // allocate and set each field to NULL
    670     ListOfLocalAtoms = (atom ***) Malloc(sizeof(atom **)*Counter, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
     874    ListOfLocalAtoms = (atom ***) Malloc(sizeof(atom **) * Counter, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms");
    671875    if (ListOfLocalAtoms != NULL) {
    672       for (int i=Counter;i--;)
     876      for (int i = Counter; i--;)
    673877        ListOfLocalAtoms[i] = NULL;
    674878      FreeList = FreeList && true;
     
    676880      status = false;
    677881  }
    678  
     882
    679883  if ((ListOfLocalAtoms != NULL) && (ListOfLocalAtoms[FragmentCounter] == NULL)) { // allocate and fill list of this fragment/subgraph
    680884    status = status && CreateFatherLookupTable(out, Leaf->start, Leaf->end, ListOfLocalAtoms[FragmentCounter], GlobalAtomCount);
    681885    FreeList = FreeList && true;
    682886  }
    683  
     887
    684888  return status;
    685889};
     
    695899 * \retuen true - success, false - failure
    696900 */
    697 bool MoleculeLeafClass::AssignKeySetsToFragment(ofstream *out, molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList)
     901bool MoleculeLeafClass::AssignKeySetsToFragment(ofstream *out,
     902    molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms,
     903    Graph **&FragmentList, int &FragmentCounter, bool FreeList)
    698904{
    699905  bool status = true;
    700906  int KeySetCounter = 0;
    701  
     907
    702908  *out << Verbose(1) << "Begin of AssignKeySetsToFragment." << endl;
    703909  // fill ListOfLocalAtoms if NULL was given
     
    710916  if (FragmentList == NULL) {
    711917    KeySetCounter = Count();
    712     FragmentList = (Graph **) Malloc(sizeof(Graph *)*KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");
    713     for(int i=KeySetCounter;i--;)
     918    FragmentList = (Graph **) Malloc(sizeof(Graph *) * KeySetCounter, "MoleculeLeafClass::AssignKeySetsToFragment - **FragmentList");
     919    for (int i = KeySetCounter; i--;)
    714920      FragmentList[i] = NULL;
    715921    KeySetCounter = 0;
    716922  }
    717  
     923
    718924  if ((KeySetList != NULL) && (KeySetList->size() != 0)) { // if there are some scanned keysets at all
    719925    // assign scanned keysets
     
    721927      FragmentList[FragmentCounter] = new Graph;
    722928    KeySet *TempSet = new KeySet;
    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
     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
    725931        // translate keyset to local numbers
    726         for(KeySet::iterator sprinter = (*runner).first.begin(); sprinter != (*runner).first.end(); sprinter++)
     932        for (KeySet::iterator sprinter = (*runner).first.begin(); sprinter != (*runner).first.end(); sprinter++)
    727933          TempSet->insert(ListOfLocalAtoms[FragmentCounter][reference->FindAtom(*sprinter)->nr]->nr);
    728934        // insert into FragmentList
    729         FragmentList[FragmentCounter]->insert(GraphPair (*TempSet, pair<int,double>(KeySetCounter++, (*runner).second.second)));
     935        FragmentList[FragmentCounter]->insert(GraphPair(*TempSet, pair<int, double> (KeySetCounter++, (*runner).second.second)));
    730936      }
    731937      TempSet->clear();
    732938    }
    733     delete(TempSet);
     939    delete (TempSet);
    734940    if (KeySetCounter == 0) {// if there are no keysets, delete the list
    735941      *out << Verbose(1) << "KeySetCounter is zero, deleting FragmentList." << endl;
    736       delete(FragmentList[FragmentCounter]);
     942      delete (FragmentList[FragmentCounter]);
    737943    } else
    738944      *out << Verbose(1) << KeySetCounter << " keysets were assigned to subgraph " << FragmentCounter << "." << endl;
     
    743949  } else
    744950    *out << Verbose(1) << "KeySetList is NULL or empty." << endl;
    745  
     951
    746952  if ((FreeList) && (ListOfLocalAtoms != NULL)) {
    747953    // free the index lookup list
    748     Free((void **)&ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::AssignKeySetsToFragment - **ListOfLocalAtoms[]");
     954    Free((void **) &ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::AssignKeySetsToFragment - **ListOfLocalAtoms[]");
    749955    if (FragmentCounter == 0) // first fragments frees the initial pointer to list
    750       Free((void **)&ListOfLocalAtoms, "MoleculeLeafClass::AssignKeySetsToFragment - ***ListOfLocalAtoms");
     956      Free((void **) &ListOfLocalAtoms, "MoleculeLeafClass::AssignKeySetsToFragment - ***ListOfLocalAtoms");
    751957  }
    752958  *out << Verbose(1) << "End of AssignKeySetsToFragment." << endl;
     
    760966 * \param &TotalNumberOfKeySets global key set counter
    761967 * \param &TotalGraph Graph to be filled with global numbers
    762  */
    763 void MoleculeLeafClass::TranslateIndicesToGlobalIDs(ofstream *out, Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets, Graph &TotalGraph)
     968 */
     969void MoleculeLeafClass::TranslateIndicesToGlobalIDs(ofstream *out,
     970    Graph **FragmentList, int &FragmentCounter, int &TotalNumberOfKeySets,
     971    Graph &TotalGraph)
    764972{
    765973  *out << Verbose(1) << "Begin of TranslateIndicesToGlobalIDs." << endl;
    766974  KeySet *TempSet = new KeySet;
    767975  if (FragmentList[FragmentCounter] != NULL) {
    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++)
     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++)
    770978        TempSet->insert((Leaf->FindAtom(*sprinter))->GetTrueFather()->nr);
    771       TotalGraph.insert(GraphPair(*TempSet, pair<int,double>(TotalNumberOfKeySets++, (*runner).second.second)));
     979      TotalGraph.insert(GraphPair(*TempSet, pair<int, double> (TotalNumberOfKeySets++, (*runner).second.second)));
    772980      TempSet->clear();
    773981    }
    774     delete(TempSet);
     982    delete (TempSet);
    775983  } else {
    776984    *out << Verbose(1) << "FragmentList is NULL." << endl;
     
    788996{
    789997  if (next != NULL)
    790     return next->Count()+1;
     998    return next->Count() + 1;
    791999  else
    792     return 1;
    793 };
     1000    return 1;
     1001};
     1002
Note: See TracChangeset for help on using the changeset viewer.