Changeset 255d13 for molecuilder
- Timestamp:
- May 8, 2008, 12:41:47 PM (17 years ago)
- Children:
- 7b80a5
- Parents:
- 9c3496
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
molecuilder/src/moleculelist.cpp
r9c3496 r255d13 411 411 if (FreeList) { 412 412 // free the index lookup list 413 for (int i=0;i<FragmentCounter;i++) 414 Free((void **)&ListOfLocalAtoms[i], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]"); 415 if (previous == NULL) // if we are the first in this chain list, empty initial pointer 413 Free((void **)&ListOfLocalAtoms[FragmentCounter], "MoleculeLeafClass::FillBondStructureFromReference - **ListOfLocalAtoms[]"); 414 if (ListOfLocalAtoms[FragmentCounter] == NULL) 416 415 Free((void **)&ListOfLocalAtoms, "MoleculeLeafClass::FillBondStructureFromReference - ***ListOfLocalAtoms"); 417 416 } 418 417 FragmentCounter--; 419 418 return status; 420 419 }; 421 420 422 421 /** Fills the root stack for sites to be used as root in fragmentation depending on order or adaptivity criteria 422 * Again, as in \sa FillBondStructureFromReference steps recursively through each Leaf in this chain list of molecule's. 423 * \param *out output stream for debugging 424 * \param *&RootStack stack to be filled 425 * \param Order desired bond order for all sites 426 * \param &FragmentCounter counts through the fragments in this MoleculeLeafClass 427 * \return true - stack is non-empty, fragmentation necessary, false - stack is empty, no more sites to update 428 */ 429 bool MoleculeLeafClass::FillRootStackForSubgraphs(ofstream *out, KeyStack *&RootStack, int Order, int &FragmentCounter) 430 { 431 atom *Walker = NULL; 432 433 if (RootStack != NULL) { 434 if (Order == -1) { // means we want to increase order adaptively 435 cerr << "Adaptive chosing of sites not yet implemented!" << endl; 436 } else { // means we just want to increase it at every site by one 437 // find first root candidates 438 if (&(RootStack[FragmentCounter]) != NULL) { 439 RootStack[FragmentCounter].clear(); 440 Walker = Leaf->start; 441 while (Walker->next != Leaf->end) { // go through all (non-hydrogen) atoms 442 Walker = Walker->next; 443 #ifdef ADDHYDROGEN 444 if (Walker->type->Z != 1) // skip hydrogen 445 #endif 446 if (Walker->GetTrueFather()->AdaptiveOrder < Order) // only if Order is still greater 447 RootStack[FragmentCounter].push_front(Walker->nr); 448 } 449 if (next != NULL) 450 next->FillRootStackForSubgraphs(out, RootStack, Order, ++FragmentCounter); 451 } else 452 return false; 453 } 454 return true; 455 } else 456 return false; 457 }; 458 459 /** Simply counts the number of items in the list, from given MoleculeLeafClass. 460 * \return number of items 461 */ 462 int MoleculeLeafClass::Count() 463 { 464 if (next != NULL) 465 return next->Count()+1; 466 else 467 return 1; 468 };
Note:
See TracChangeset
for help on using the changeset viewer.