Ignore:
Timestamp:
May 5, 2008, 4:19:05 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
8449ed
Parents:
38fc0d
Message:

ForcesFile and TEFactors are _needed_, reincorporated. UniqueFragments structure is now in BOSSANOVA

ForcesFile is again written, as we need it for the hydrogen not coming saturation (forces!)
TEFactors are back, as despite my notion they are needed in the evaluation
UniqueFragments structure is shifted from PowerSetGenerator to FragmentBOSSANOVA. Actually only for the labels - however, the if was changed to test the real indices (which are also always the same, which is better for adaptive runs) - but might be more useful there still.
analyzer and joiner again parse indices.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/moleculelist.cpp

    r38fc0d r115bf4  
    133133};
    134134
     135
     136/** Store force indices, i.e. the connection between the nuclear index in the total molecule config and the respective atom in fragment config.
     137 * \param *out output stream for debugging
     138 * \param *path path to file
     139 * \param *SortIndex Index to map from the BFS labeling to the sequence how of Ion_Type in the config
     140 * \return true - file written successfully, false - writing failed
     141 */
     142bool MoleculeListClass::StoreForcesFile(ofstream *out, char *path, int *SortIndex)
     143{
     144  bool status = true;
     145  ofstream ForcesFile;
     146  stringstream line;
     147  atom *Walker = NULL;
     148  element *runner = NULL;
     149
     150  // open file for the force factors
     151  *out << Verbose(1) << "Saving  force factors ... ";
     152  line << path << "/" << FRAGMENTPREFIX << FORCESFILE;
     153  ForcesFile.open(line.str().c_str(), ios::out);
     154  if (ForcesFile != NULL) {
     155    //cout << Verbose(1) << "Final AtomicForcesList: ";
     156    //output << prefix << "Forces" << endl;
     157    for(int j=0;j<NumberOfMolecules;j++) {
     158      //if (TEList[j] != 0) {
     159      runner = ListOfMolecules[j]->elemente->start;
     160      while (runner->next != ListOfMolecules[j]->elemente->end) { // go through every element
     161        runner = runner->next;
     162        if (ListOfMolecules[j]->ElementsInMolecule[runner->Z]) { // if this element got atoms
     163          Walker = ListOfMolecules[j]->start;
     164          while (Walker->next != ListOfMolecules[j]->end) { // go through every atom of this element
     165            Walker = Walker->next;
     166            if (Walker->type->Z == runner->Z) {
     167              if ((Walker->GetTrueFather() != NULL) && (Walker->GetTrueFather() != Walker)) {// if there is a rea
     168                //cout << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it
     169                ForcesFile <<  SortIndex[Walker->GetTrueFather()->nr] << "\t";
     170                } else  // otherwise a -1 to indicate an added saturation hydrogen
     171                  ForcesFile << "-1\t";
     172              }
     173            }
     174          }
     175      }
     176      ForcesFile << endl;
     177    }
     178    ForcesFile.close();
     179    *out << Verbose(1) << "done." << endl;
     180  } else {
     181    status = false;
     182    *out << Verbose(1) << "failed to open file " << line.str() << "." << endl;
     183  }
     184  ForcesFile.close();
     185 
     186  return status;
     187};
     188
    135189/** Writes a config file for each molecule in the given \a **FragmentList.
    136190 * \param *out output stream for debugging
     
    216270    Free((void **)&FragmentNumber, "MoleculeListClass::OutputConfigForListOfFragments: *FragmentNumber");
    217271  }
    218 
    219   // open KeySet file
    220   sprintf(FragmentName, "%s/%s%s", configuration->configpath,  FRAGMENTPREFIX , KEYSETFILE);
    221   output.open(FragmentName, ios::out);
    222   *out << Verbose(2) << "Saving " << FRAGMENTPREFIX << " key sets of each subgraph ...";
    223   for(int j=0;j<NumberOfMolecules;j++) {
    224     Walker = ListOfMolecules[j]->start;
    225     while(Walker->next != ListOfMolecules[j]->end) {
    226       Walker = Walker->next;       
    227 #ifdef ADDHYDROGEN
    228       if ((Walker->GetTrueFather() != NULL) && (Walker->type->Z != 1)) // if there is a real father, prints its index
    229 #else
    230       if ((Walker->GetTrueFather() != NULL)) // if there is a real father, prints its index
    231 #endif
    232         output <<  Walker->GetTrueFather()->nr << "\t";
    233 #ifdef ADDHYDROGEN
    234       else  // otherwise a -1 to indicate an added saturation hydrogen
    235         output << "-1\t";
    236 #endif
    237     }
    238     output << endl;
    239   }
    240   output.close();
    241   *out << " done." << endl;
     272  cout << " done." << endl;
    242273 
    243274  // printing final number
Note: See TracChangeset for help on using the changeset viewer.