Ignore:
Timestamp:
May 2, 2008, 1:25:48 PM (17 years ago)
Author:
Frederik Heber <heber@…>
Children:
30fda2
Parents:
e936b3
Message:

HUGE REWRITE to allow for adaptive increase of the bond order, first working commit

Lots of code was thrown out:
-BottomUp, TopDown and GetAtomicFragments
-TEFactors are now used as "CreationCounters", i.e. the count how often a fragment as been created (ideal would be only once)
-ReduceToUniqueOnes and stuff all thrown out, since they are out-dated since use of hash table
Other changes:
-CreateListofUniqueFragments renamed to PowerSetGenerator
-PowerSetGenerator goes not over all reachable roots, but one given by calling function FragmentBOSSANOVA
-FragmentBOSSANOVA loops over all possible root sites and hands this over to PowerSetGenerator
-by the virtue of the hash table it is not important anymore whether created keysets are unique or not, as this is recognized in log(n). Hence, the label < label is not important anymore (and not applicable in an adaptive scheme with old, parsed keysets and unknown labels) (THIS IS HOWEVER NOT DONE YET!)
The setup is then as follows:

  1. FragmentMolecule
    1. parses adjacency, keysets and orderatsite files
    2. performs DFS to find connected subgraphs (to leave this in was a design decision: might be useful later)
    3. a RootStack is created for every subgraph (here, later we implement the "update 10 sites with highest energy contribution", and that's why this consciously not done in the following loop)
    4. in a loop over all subgraphs

d1. calls FragmentBOSSANOVA with this RootStack and within the subgraph molecule structure
d2. creates molecule (fragment)s from the returned keysets (StoreFragmentFromKeySet)

  1. combines the generated molecule lists from all subgraphs
  2. saves to disk: fragment configs, adjacency, orderatsite, keyset files
  1. FragmentBOSSANOVA
    1. constructs a complete keyset of the molecule
    2. In a loop over all possible roots from the given rootstack

b1. increases order of root site
b2. calls PowerSetGenerator with this order, the complete keyset and the rootkeynr
b3. for all consecutive lower levels PowerSetGenerator is called with the suborder, the higher order keyset as the restricted one and each site in the set as the root)
b4. these are merged into a fragment list of keysets

  1. All fragment lists (for all orders, i.e. from all destination fields) are merged into one list for return
  1. PowerSetGenerator
    1. initialises UniqueFragments structure
    2. fills edge list via BFS
    3. creates the fragment by calling recursive function SPFragmentGenerator with UniqueFragments structure, 0 as root distance, the edge set, its dimension and the current suborder
    4. Free'ing structure
  2. SPFragmentGenerator (nothing much has changed here)
    1. loops over every possible combination (2dimension of edge set)

a1. inserts current set, if there's still space left

a11. yes: calls SPFragmentGenerator with structure, created new edge list and size respective to root distance+1
a12. no: stores fragment into keyset list by calling InsertFragmentIntoGraph

a2. removes all items added into the snake stack (in UniqueFragments structure) added during level (root distance) and current set

File:
1 edited

Legend:

Unmodified
Added
Removed
  • molecuilder/src/parser.cpp

    re936b3 rc75363  
    4343  stringstream line;
    4444
    45   line << argv[1] << FRAGMENTPREFIX << TEFACTORSFILE;
     45  //line << argv[1] << FRAGMENTPREFIX << TEFACTORSFILE;
    4646  return FilePresent(line.str().c_str());
    4747};
     
    106106  // count the number of matrices
    107107  MatrixCounter = -1; // we count one too much
    108   line << name << FRAGMENTPREFIX << TEFACTORSFILE;
     108  line << name << FRAGMENTPREFIX << KEYSETFILE;
    109109  input.open(line.str().c_str(), ios::in);
    110110  if (input == NULL) {
     
    417417bool ForceMatrix::ParseIndices(char *name)
    418418{
    419   ifstream input;
    420   char *FragmentNumber = NULL;
    421   char filename[1023];
    422   stringstream line;
    423  
    424419  cout << "Parsing force indices." << endl;
    425420  Indices = (int **) Malloc(sizeof(int *)*(MatrixCounter+1), "ForceMatrix::ParseIndices: **Indices");
    426   line << name << FRAGMENTPREFIX << FORCESFILE;
    427   input.open(line.str().c_str(), ios::in);
    428   //cout << "Opening " << line.str() << " ... "  << input << endl;
    429   if (input == NULL) {
    430     cout << endl << "Unable to open " << line.str() << ", is the directory correct?" << endl;
    431     return false;
    432   }
    433   for (int i=0;(i<MatrixCounter) && (!input.eof());i++) {
    434     // get the number of atoms for this fragment
    435     stringstream line;
    436     input.getline(filename, 1023);
    437     line.str(filename);
    438     // parse the values
     421  for (int i=0;i<MatrixCounter;i++) {
    439422    Indices[i] = (int *) Malloc(sizeof(int)*RowCounter[i], "ForceMatrix::ParseIndices: *Indices[]");
    440     FragmentNumber = FixedDigitNumber(MatrixCounter, i);
    441     cout << FRAGMENTPREFIX << FragmentNumber << "[" << RowCounter[i] << "]:";
    442     Free((void **)&FragmentNumber, "ForceMatrix::ParseIndices: *FragmentNumber");
    443     for(int j=0;(j<RowCounter[i]) && (!line.eof());j++) {
    444       line >> Indices[i][j];
    445       cout << " " << Indices[i][j];
    446     }
    447     cout << endl;
     423    for(int j=0;j<RowCounter[i];j++)
     424      Indices[i][j] = j;
    448425  }
    449426  Indices[MatrixCounter] = (int *) Malloc(sizeof(int)*RowCounter[MatrixCounter], "ForceMatrix::ParseIndices: *Indices[]");
     
    451428    Indices[MatrixCounter][j] = j;
    452429  }
    453   input.close();
    454430  return true;
    455431};
Note: See TracChangeset for help on using the changeset viewer.