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/builder.cpp

    re936b3 rc75363  
    559559void FragmentAtoms(molecule *mol, config *configuration)
    560560{
    561   enum BondOrderScheme Scheme = NoScheme;
    562   enum CutCyclicBond CutCyclic;
    563   char schema;
    564   int Order1, Order2;
     561  int Order1;
    565562  clock_t start, end;
    566563 
     
    568565  cout << Verbose(0) << "What's the desired bond order: ";
    569566  cin >> Order1;
    570   cout << Verbose(0) << "What's the desired bond scheme [(B)ottomUp/(T)opDown/(A)NOVA/(C)ombined]: ";
    571   cin >> schema;
    572   CutCyclic = SaturateBond;
    573   switch (schema) {
    574     default:
    575         Scheme = NoScheme;
    576       break;
    577     case 'B':
    578         CutCyclic = KeepBond;
    579     case 'b':
    580         Scheme = BottomUp;
    581         Order2 = 0;
    582       break;
    583     case 'T':
    584         CutCyclic = KeepBond;
    585     case 't':
    586         Scheme = TopDown;
    587         Order2 = Order1;
    588         Order1 = 0;
    589       break;
    590     case 'A':
    591         CutCyclic = KeepBond;
    592     case 'a':
    593         Scheme = ANOVA;
    594         Order2 = 0;
    595       break;
    596     case 'C':
    597         CutCyclic = KeepBond;
    598     case 'c':
    599         cout << Verbose(0) << "Combined first selects subgraphs by BottomUp of bond order " << Order1 << " then TopDown to fragment these." << endl;
    600         cout << Verbose(0) << "What's the desired bond order for TopDown: ";
    601         cin >> Order2;
    602         Scheme = Combined;
    603       break;
    604   };
    605567  if (mol->first->next != mol->last) {  // there are bonds
    606568    start = clock();
    607     mol->FragmentMolecule((ofstream *)&cout, Order1, Order2, Scheme, configuration, CutCyclic);
     569    mol->FragmentMolecule((ofstream *)&cout, Order1, configuration);
    608570    end = clock();
    609571    cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
     
    759721  int j, axis, count, faktor;
    760722  int MinimumRingSize = -1;
    761   enum BondOrderScheme Scheme = NoScheme;
    762   enum CutCyclicBond CutCyclic;
    763723  enum ConfigStatus config_present = absent;
    764724  MoleculeLeafClass *Subgraphs = NULL;
     
    781741          case '?':
    782742            cout << "MoleCuilder suite" << endl << "==================" << endl << endl;
    783             cout << "Usage: " << argv[0] << "[config file] [-{acepsthH?vfrp}] [further arguments]" << endl;
     743            cout << "Usage: " << argv[0] << "[config file] [-{acefpsthH?vfrp}] [further arguments]" << endl;
    784744            cout << "or simply " << argv[0] << " without arguments for interactive session." << endl;
    785745            cout << "\t-a Z x1 x2 x3\tAdd new atom of element Z at coordinates (x1,x2,x3)." << endl;
    786746            cout << "\t-c x1 x2 x3\tCenter atoms in domain with a minimum distance to boundary of (x1,x2,x3)." << endl;
    787747            cout << "\t-e <file>\tSets the element database to be parsed from this file (default: elements.db in same dir as " << argv[0] << ")." << endl;
     748            cout << "\t-e <dist> <order>\tFragments the molecule in BOSSANOVA manner and stores config files in same dir as config." << endl;
    788749            cout << "\t-h/-H/-?\tGive this help screen." << endl;
    789750            cout << "\t-p <file>\tParse given xyz file and create raw config file from it." << endl;
     
    954915                break;
    955916              case 'f':
    956                 int i,j;
    957917                if (flag ==0) flag = 2;  // only set if not already by other command line switch
    958                 cout << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << " and type " << argv[argptr+2] << "." << endl;
    959                 if (argc >= argptr+3) {
     918                cout << "Fragmenting molecule with bond distance " << argv[argptr] << " angstroem, order of " << argv[argptr+1] << "." << endl;
     919                if (argc >= argptr+2) {
    960920                  cout << Verbose(0) << "Creating connection matrix..." << endl;
    961921                  start = clock();
    962922                  mol->CreateAdjacencyList((ofstream *)&cout, atof(argv[argptr++]));
    963923                  cout << Verbose(0) << "Fragmenting molecule with current connection matrix ..." << endl;
    964                   cout << Verbose(0) << "What's the desired bond scheme [(B)ottomUp/(T)opDown/(A)NOVA/(C)ombined]: ";
    965                   CutCyclic = SaturateBond;
    966                   switch (argv[argptr+1][0]) {
    967                     default:
    968                         Scheme = NoScheme;
    969                       break;
    970                     case 'B':
    971                       CutCyclic = KeepBond;
    972                     case 'b':
    973                         Scheme = BottomUp;
    974                         i = atoi(argv[argptr]);
    975                         j = 0;
    976                       break;
    977                     case 'T':
    978                       CutCyclic = KeepBond;
    979                     case 't':
    980                         Scheme = TopDown;
    981                         i = 0;
    982                         j = atoi(argv[argptr]);
    983                       break;
    984                     case 'A':
    985                       CutCyclic = KeepBond;
    986                     case 'a':
    987                         Scheme = ANOVA;
    988                         i = atoi(argv[argptr]);
    989                         j = 0;
    990                       break;
    991     //                case 'C':
    992     //                  CutCyclic = KeepBond;
    993     //                case 'c':
    994     //                    if (argc > 5) {
    995     //                      i = atoi(argv[4]);
    996     //                      j = atoi(argv[6]);
    997     //                      Scheme = Combined;
    998     //                    }
    999     //                    else
    1000     //                      cerr << "Missing second bond order for TopDown fragmentation in combined approach." << endl;
    1001     //                  break;
    1002                   };
    1003924                  if (mol->first->next != mol->last) {
    1004                     mol->FragmentMolecule((ofstream *)&cout, i, j, Scheme, &configuration, CutCyclic);
     925                    mol->FragmentMolecule((ofstream *)&cout, atoi(argv[argptr]), &configuration);
    1005926                  }
    1006927                  end = clock();
    1007928                  cout << Verbose(0) << "Clocks for this operation: " << (end-start) << ", time: " << ((double)(end-start)/CLOCKS_PER_SEC) << "s." << endl;
    1008                   argptr+=2;
     929                  argptr+=1;
    1009930                } else {
    1010                   cerr << "Not enough arguments for fragmentation: -f <max. bond distance> <bond order> <type>" << endl;
     931                  cerr << "Not enough arguments for fragmentation: -f <max. bond distance> <bond order>" << endl;
    1011932                }
    1012933                break;
Note: See TracChangeset for help on using the changeset viewer.