Changeset 461e93 for molecuilder
- Timestamp:
- May 8, 2008, 4:18:07 PM (17 years ago)
- Children:
- a3ff7b2
- Parents:
- d88597
- Location:
- molecuilder/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/molecules.cpp
rd88597 r461e93 2139 2139 * \param &FragmentationToDo return boolean 2140 2140 * \param Order desired Order 2141 * /2142 void molecule::CheckOrderAtSite(ofstream *out, bool &FragmentationToDo, int Order) 2143 { 2144 atom *Walker = NULL; 2145 2146 if (FragmentationToDo) { // check whether OrderAtSite is above Order everywhere2147 FragmentationToDo = false;2148 2149 2150 2141 * \return true - needs further fragmentation, false - does not need fragmentation 2142 */ 2143 bool molecule::CheckOrderAtSite(ofstream *out, int Order) 2144 { 2145 atom *Walker = NULL; 2146 bool status = false; 2147 2148 Walker = start; 2149 while (Walker->next != end) { 2150 Walker = Walker->next; 2151 2151 #ifdef ADDHYDROGEN 2152 2152 if (Walker->type->Z != 1) // skip hydrogen 2153 2153 #endif 2154 2155 FragmentationToDo= true;2156 2157 if (!FragmentationToDo)2158 2159 } else2160 *out << Verbose(1) << "Parsing order at site file failed" << endl;2154 if (Walker->AdaptiveOrder < Order) 2155 status = true; 2156 } 2157 if (!status) 2158 *out << Verbose(1) << "Order at every site is already equal or above desired order " << Order << "." << endl; 2159 2160 return status; 2161 2161 }; 2162 2162 … … 2234 2234 #endif 2235 2235 2236 // ++++++++++++++++++++++++++++ INITIAL STUFF: Bond structure analysis, ... ++++++++++++++++++++++++++++++++++++++++++2236 // ++++++++++++++++++++++++++++ INITIAL STUFF: Bond structure analysis, file parsing, ... ++++++++++++++++++++++++++++++++++++++++++ 2237 2237 2238 2238 // ===== 1. Check whether bond structure is same as stored in files ==== … … 2258 2258 // ===== 4. check globally whether there's something to do actually (first adaptivity check) 2259 2259 FragmentationToDo = FragmentationToDo && ParseOrderAtSiteFromFile(out, configuration->configpath); 2260 CheckOrderAtSite(out, FragmentationToDo, Order);2261 2260 2262 2261 // =================================== Begin of FRAGMENTATION =============================== … … 2265 2264 *out << Verbose(0) << "Bond order " << Order << " greater than or equal to Minimum Ring size of " << MinimumRingSize << " found is not allowed." << endl; 2266 2265 } else { 2267 // ===== 6a. fill RootStack for each subgraph (second adaptivity check) ===== 2268 // NOTE: (keep this extern of following while loop, as lateron we may here look for which site to add to which subgraph) 2269 // fill the root stack 2266 // ===== 6a. assign each keyset to its respective subgraph ===== 2267 Subgraphs->next->AssignKeySetsToFragment(out, this, ParsedFragmentList, ListOfLocalAtoms, FragmentList, (FragmentCounter = 0), false); 2268 delete(ParsedFragmentList); 2269 2270 2270 KeyStack *RootStack = new KeyStack[Subgraphs->next->Count()]; 2271 Subgraphs->next->FillRootStackForSubgraphs(out, RootStack, Order, (FragmentCounter = 0)); 2272 2273 // ===== 6b. assign each keyset to its respective subgraph ===== 2274 Subgraphs->next->AssignKeySetsToFragment(out, this, ParsedFragmentList, ListOfLocalAtoms, FragmentList, (FragmentCounter = 0), false); 2275 2276 // ===== 7. fill the bond fragment list ===== 2277 FragmentCounter = 0; 2278 MolecularWalker = Subgraphs; 2279 while (MolecularWalker->next != NULL) { 2280 MolecularWalker = MolecularWalker->next; 2281 *out << Verbose(1) << "Fragmenting subgraph " << MolecularWalker << "." << endl; 2282 // output ListOfBondsPerAtom for debugging 2283 MolecularWalker->Leaf->OutputListOfBonds(out); 2284 if (MolecularWalker->Leaf->first->next != MolecularWalker->Leaf->last) { 2285 2286 // call BOSSANOVA method 2287 *out << Verbose(0) << endl << " ========== BOND ENERGY of subgraph " << FragmentCounter << " ========================= " << endl; 2288 MolecularWalker->Leaf->FragmentBOSSANOVA(out, FragmentList[FragmentCounter], RootStack[FragmentCounter]); 2289 } else { 2290 cerr << "Subgraph " << MolecularWalker << " has no atoms!" << endl; 2291 } 2292 FragmentCounter++; // next fragment list 2293 } 2271 while (CheckOrderAtSite(out, Order)) { 2272 // ===== 6b. fill RootStack for each subgraph (second adaptivity check) ===== 2273 Subgraphs->next->FillRootStackForSubgraphs(out, RootStack, Order, (FragmentCounter = 0)); 2274 2275 // ===== 7. fill the bond fragment list ===== 2276 FragmentCounter = 0; 2277 MolecularWalker = Subgraphs; 2278 while (MolecularWalker->next != NULL) { 2279 MolecularWalker = MolecularWalker->next; 2280 *out << Verbose(1) << "Fragmenting subgraph " << MolecularWalker << "." << endl; 2281 // output ListOfBondsPerAtom for debugging 2282 MolecularWalker->Leaf->OutputListOfBonds(out); 2283 if (MolecularWalker->Leaf->first->next != MolecularWalker->Leaf->last) { 2284 2285 // call BOSSANOVA method 2286 *out << Verbose(0) << endl << " ========== BOND ENERGY of subgraph " << FragmentCounter << " ========================= " << endl; 2287 MolecularWalker->Leaf->FragmentBOSSANOVA(out, FragmentList[FragmentCounter], RootStack[FragmentCounter]); 2288 } else { 2289 cerr << "Subgraph " << MolecularWalker << " has no atoms!" << endl; 2290 } 2291 FragmentCounter++; // next fragment list 2292 } 2293 } 2294 delete[](RootStack); 2294 2295 } 2295 2296 … … 2305 2306 2306 2307 // free subgraph memory again 2307 delete(ParsedFragmentList);2308 2308 FragmentCounter = 0; 2309 2309 if (Subgraphs != NULL) { -
molecuilder/src/molecules.hpp
rd88597 r461e93 340 340 /// Fragment molecule by two different approaches: 341 341 void FragmentMolecule(ofstream *out, int Order, config *configuration); 342 void CheckOrderAtSite(ofstream *out, bool &FragmentationToDo, int Order);342 bool CheckOrderAtSite(ofstream *out, int Order); 343 343 bool StoreAdjacencyToFile(ofstream *out, char *path); 344 344 bool CheckAdjacencyFileAgainstMolecule(ofstream *out, char *path, atom **ListOfAtoms);
Note:
See TracChangeset
for help on using the changeset viewer.