Changeset 1024cb for src/moleculelist.cpp
- Timestamp:
- May 31, 2010, 5:32:27 PM (16 years ago)
- Branches:
- Action_Thermostats, Add_AtomRandomPerturbation, Add_FitFragmentPartialChargesAction, Add_RotateAroundBondAction, Add_SelectAtomByNameAction, Added_ParseSaveFragmentResults, AddingActions_SaveParseParticleParameters, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_ParticleName_to_Atom, Adding_StructOpt_integration_tests, AtomFragments, Automaking_mpqc_open, AutomationFragmentation_failures, Candidate_v1.5.4, Candidate_v1.6.0, Candidate_v1.6.1, Candidate_v1.7.0, ChangeBugEmailaddress, ChangingTestPorts, ChemicalSpaceEvaluator, CombiningParticlePotentialParsing, Combining_Subpackages, Debian_Package_split, Debian_package_split_molecuildergui_only, Disabling_MemDebug, Docu_Python_wait, EmpiricalPotential_contain_HomologyGraph, EmpiricalPotential_contain_HomologyGraph_documentation, Enable_parallel_make_install, Enhance_userguide, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, FitPartialCharges_GlobalError, Fix_BoundInBox_CenterInBox_MoleculeActions, Fix_ChargeSampling_PBC, Fix_ChronosMutex, Fix_FitPartialCharges, Fix_FitPotential_needs_atomicnumbers, Fix_ForceAnnealing, Fix_IndependentFragmentGrids, Fix_ParseParticles, Fix_ParseParticles_split_forward_backward_Actions, Fix_PopActions, Fix_QtFragmentList_sorted_selection, Fix_Restrictedkeyset_FragmentMolecule, Fix_StatusMsg, Fix_StepWorldTime_single_argument, Fix_Verbose_Codepatterns, Fix_fitting_potentials, Fixes, ForceAnnealing_goodresults, ForceAnnealing_oldresults, ForceAnnealing_tocheck, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, FragmentAction_writes_AtomFragments, FragmentMolecule_checks_bonddegrees, GeometryObjects, Gui_Fixes, Gui_displays_atomic_force_velocity, ImplicitCharges, IndependentFragmentGrids, IndependentFragmentGrids_IndividualZeroInstances, IndependentFragmentGrids_IntegrationTest, IndependentFragmentGrids_Sole_NN_Calculation, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, JobMarket_unresolvable_hostname_fix, MoreRobust_FragmentAutomation, ODR_violation_mpqc_open, PartialCharges_OrthogonalSummation, PdbParser_setsAtomName, PythonUI_with_named_parameters, QtGui_reactivate_TimeChanged_changes, Recreated_GuiChecks, Rewrite_FitPartialCharges, RotateToPrincipalAxisSystem_UndoRedo, SaturateAtoms_findBestMatching, SaturateAtoms_singleDegree, StoppableMakroAction, Subpackage_CodePatterns, Subpackage_JobMarket, Subpackage_LinearAlgebra, Subpackage_levmar, Subpackage_mpqc_open, Subpackage_vmg, Switchable_LogView, ThirdParty_MPQC_rebuilt_buildsystem, TrajectoryDependenant_MaxOrder, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps, TremoloParser_setsAtomName, Ubuntu_1604_changes, stable
- Children:
- e08c46
- Parents:
- 42af9e (diff), a7b761b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - git-author:
- Frederik Heber <heber@…> (05/31/10 17:29:30)
- git-committer:
- Frederik Heber <heber@…> (05/31/10 17:32:27)
- File:
-
- 1 edited
-
src/moleculelist.cpp (modified) (27 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/moleculelist.cpp
r42af9e r1024cb 20 20 #include "memoryallocator.hpp" 21 21 #include "periodentafel.hpp" 22 #include " World.hpp"22 #include "Helpers/Assert.hpp" 23 23 24 24 #include "Helpers/Assert.hpp" … … 71 71 int Count, Counter, aCounter, bCounter; 72 72 int flag; 73 atom *aWalker = NULL;74 atom *bWalker = NULL;75 73 76 74 // sort each atom list and put the numbers into a list, then go through 77 75 //Log() << Verbose(0) << "Comparing fragment no. " << *(molecule **)a << " to " << *(molecule **)b << "." << endl; 78 if ((**(molecule **) a).AtomCount < (**(molecule **) b).AtomCount) { 76 // Yes those types are awkward... but check it for yourself it checks out this way 77 molecule *const *mol1_ptr= static_cast<molecule *const *>(a); 78 molecule *mol1 = *mol1_ptr; 79 molecule *const *mol2_ptr= static_cast<molecule *const *>(b); 80 molecule *mol2 = *mol2_ptr; 81 if (mol1->getAtomCount() < mol2->getAtomCount()) { 79 82 return -1; 80 83 } else { 81 if ( (**(molecule **) a).AtomCount > (**(molecule **) b).AtomCount)84 if (mol1->getAtomCount() > mol2->getAtomCount()) 82 85 return +1; 83 86 else { 84 Count = (**(molecule **) a).AtomCount;87 Count = mol1->getAtomCount(); 85 88 aList = new int[Count]; 86 89 bList = new int[Count]; 87 90 88 91 // fill the lists 89 aWalker = (**(molecule **) a).start;90 bWalker = (**(molecule **) b).start;91 92 Counter = 0; 92 93 aCounter = 0; 93 94 bCounter = 0; 94 while ((aWalker->next != (**(molecule **) a).end) && (bWalker->next != (**(molecule **) b).end)) { 95 aWalker = aWalker->next; 96 bWalker = bWalker->next; 97 if (aWalker->GetTrueFather() == NULL) 95 molecule::const_iterator aiter = mol1->begin(); 96 molecule::const_iterator biter = mol2->begin(); 97 for (;(aiter != mol1->end()) && (biter != mol2->end()); 98 ++aiter, ++biter) { 99 if ((*aiter)->GetTrueFather() == NULL) 98 100 aList[Counter] = Count + (aCounter++); 99 101 else 100 aList[Counter] = aWalker->GetTrueFather()->nr;101 if ( bWalker->GetTrueFather() == NULL)102 aList[Counter] = (*aiter)->GetTrueFather()->nr; 103 if ((*biter)->GetTrueFather() == NULL) 102 104 bList[Counter] = Count + (bCounter++); 103 105 else 104 bList[Counter] = bWalker->GetTrueFather()->nr;106 bList[Counter] = (*biter)->GetTrueFather()->nr; 105 107 Counter++; 106 108 } 107 109 // check if AtomCount was for real 108 110 flag = 0; 109 if ((a Walker->next == (**(molecule **) a).end) && (bWalker->next != (**(molecule **) b).end)) {111 if ((aiter == mol1->end()) && (biter != mol2->end())) { 110 112 flag = -1; 111 113 } else { 112 if ((a Walker->next != (**(molecule **) a).end) && (bWalker->next == (**(molecule **) b).end))114 if ((aiter != mol1->end()) && (biter == mol2->end())) 113 115 flag = 1; 114 116 } … … 144 146 void MoleculeListClass::Enumerate(ostream *out) 145 147 { 146 atom *Walker = NULL;147 148 periodentafel *periode = World::getInstance().getPeriode(); 148 149 std::map<atomicNumber_t,unsigned int> counts; … … 160 161 // count atoms per element and determine size of bounding sphere 161 162 size=0.; 162 Walker = (*ListRunner)->start; 163 while (Walker->next != (*ListRunner)->end) { 164 Walker = Walker->next; 165 counts[Walker->type->getNumber()]++; 166 if (Walker->x.DistanceSquared(Origin) > size) 167 size = Walker->x.DistanceSquared(Origin); 163 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 164 counts[(*iter)->type->getNumber()]++; 165 if ((*iter)->x.DistanceSquared(Origin) > size) 166 size = (*iter)->x.DistanceSquared(Origin); 168 167 } 169 168 // output Index, Name, number of atoms, chemical formula 170 (*out) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)-> AtomCount<< "\t";169 (*out) << ((*ListRunner)->ActiveFlag ? "*" : " ") << (*ListRunner)->IndexNr << "\t" << (*ListRunner)->name << "\t\t" << (*ListRunner)->getAtomCount() << "\t"; 171 170 172 171 std::map<atomicNumber_t,unsigned int>::reverse_iterator iter; … … 204 203 205 204 // put all molecules of src into mol 206 atom *Walker = srcmol->start; 207 atom *NextAtom = Walker->next; 208 while (NextAtom != srcmol->end) { 209 Walker = NextAtom; 210 NextAtom = Walker->next; 211 srcmol->UnlinkAtom(Walker); 212 mol->AddAtom(Walker); 205 molecule::iterator runner; 206 for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) { 207 runner = iter++; 208 srcmol->UnlinkAtom((*runner)); 209 mol->AddAtom((*runner)); 213 210 } 214 211 … … 230 227 231 228 // put all molecules of src into mol 232 atom *Walker = srcmol->start; 233 atom *NextAtom = Walker->next; 234 while (NextAtom != srcmol->end) { 235 Walker = NextAtom; 236 NextAtom = Walker->next; 237 Walker = mol->AddCopyAtom(Walker); 229 atom *Walker = NULL; 230 for (molecule::iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) { 231 Walker = mol->AddCopyAtom((*iter)); 238 232 Walker->father = Walker; 239 233 } … … 332 326 333 327 // prepare index list for bonds 334 srcmol->CountAtoms(); 335 atom ** CopyAtoms = new atom*[srcmol->AtomCount]; 336 for(int i=0;i<srcmol->AtomCount;i++) 328 atom ** CopyAtoms = new atom*[srcmol->getAtomCount()]; 329 for(int i=0;i<srcmol->getAtomCount();i++) 337 330 CopyAtoms[i] = NULL; 338 331 339 332 // for each of the source atoms check whether we are in- or outside and add copy atom 340 atom *Walker = srcmol->start;341 333 int nr=0; 342 while (Walker->next != srcmol->end) { 343 Walker = Walker->next; 344 DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << *Walker << "." << endl); 345 if (!TesselStruct->IsInnerPoint(Walker->x, LCList)) { 346 CopyAtoms[Walker->nr] = Walker->clone(); 347 mol->AddAtom(CopyAtoms[Walker->nr]); 334 for (molecule::const_iterator iter = srcmol->begin(); iter != srcmol->end(); ++iter) { 335 DoLog(2) && (Log() << Verbose(2) << "INFO: Current Walker is " << **iter << "." << endl); 336 if (!TesselStruct->IsInnerPoint((*iter)->x, LCList)) { 337 CopyAtoms[(*iter)->nr] = (*iter)->clone(); 338 mol->AddAtom(CopyAtoms[(*iter)->nr]); 348 339 nr++; 349 340 } else { … … 351 342 } 352 343 } 353 DoLog(1) && (Log() << Verbose(1) << nr << " of " << srcmol-> AtomCount<< " atoms have been merged.");344 DoLog(1) && (Log() << Verbose(1) << nr << " of " << srcmol->getAtomCount() << " atoms have been merged."); 354 345 355 346 // go through all bonds and add as well … … 384 375 bool MoleculeListClass::AddHydrogenCorrection(char *path) 385 376 { 386 atom *Walker = NULL;387 atom *Runner = NULL;388 377 bond *Binder = NULL; 389 378 double ***FitConstant = NULL, **correction = NULL; … … 493 482 correction[k][j] = 0.; 494 483 // 2. take every hydrogen that is a saturated one 495 Walker = (*ListRunner)->start; 496 while (Walker->next != (*ListRunner)->end) { 497 Walker = Walker->next; 498 //Log() << Verbose(1) << "Walker: " << *Walker << " with first bond " << *(Walker->ListOfBonds.begin()) << "." << endl; 499 if ((Walker->type->Z == 1) && ((Walker->father == NULL) 500 || (Walker->father->type->Z != 1))) { // if it's a hydrogen 501 Runner = (*ListRunner)->start; 502 while (Runner->next != (*ListRunner)->end) { 503 Runner = Runner->next; 504 //Log() << Verbose(2) << "Runner: " << *Runner << " with first bond " << *(Walker->ListOfBonds.begin()) << "." << endl; 484 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 485 //Log() << Verbose(1) << "(*iter): " << *(*iter) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl; 486 if (((*iter)->type->Z == 1) && (((*iter)->father == NULL) 487 || ((*iter)->father->type->Z != 1))) { // if it's a hydrogen 488 for (molecule::const_iterator runner = (*ListRunner)->begin(); runner != (*ListRunner)->end(); ++runner) { 489 //Log() << Verbose(2) << "Runner: " << *(*runner) << " with first bond " << *((*iter)->ListOfBonds.begin()) << "." << endl; 505 490 // 3. take every other hydrogen that is the not the first and not bound to same bonding partner 506 Binder = *( Runner->ListOfBonds.begin());507 if (( Runner->type->Z == 1) && (Runner->nr > Walker->nr) && (Binder->GetOtherAtom(Runner) != Binder->GetOtherAtom(Walker))) { // (hydrogens have only one bonding partner!)491 Binder = *((*runner)->ListOfBonds.begin()); 492 if (((*runner)->type->Z == 1) && ((*runner)->nr > (*iter)->nr) && (Binder->GetOtherAtom((*runner)) != Binder->GetOtherAtom((*iter)))) { // (hydrogens have only one bonding partner!) 508 493 // 4. evaluate the morse potential for each matrix component and add up 509 distance = Runner->x.distance(Walker->x);510 //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << * Runner << "<= " << distance << "=>" << *Walker<< ":" << endl;494 distance = (*runner)->x.distance((*iter)->x); 495 //Log() << Verbose(0) << "Fragment " << (*ListRunner)->name << ": " << *(*runner) << "<= " << distance << "=>" << *(*iter) << ":" << endl; 511 496 for (int k = 0; k < a; k++) { 512 497 for (int j = 0; j < b; j++) { … … 586 571 ofstream ForcesFile; 587 572 stringstream line; 588 atom *Walker = NULL;589 573 periodentafel *periode=World::getInstance().getPeriode(); 590 574 … … 599 583 periodentafel::const_iterator elemIter; 600 584 for(elemIter=periode->begin();elemIter!=periode->end();++elemIter){ 601 if ((*ListRunner)->ElementsInMolecule[(*elemIter).first]) { // if this element got atoms 602 Walker = (*ListRunner)->start; 603 while (Walker->next != (*ListRunner)->end) { // go through every atom of this element 604 Walker = Walker->next; 605 if (Walker->type->getNumber() == (*elemIter).first) { 606 if ((Walker->GetTrueFather() != NULL) && (Walker->GetTrueFather() != Walker)) {// if there is a rea 585 if ((*ListRunner)->ElementsInMolecule[(*elemIter).first]) { // if this element got atoms 586 for(molecule::iterator atomIter = (*ListRunner)->begin(); atomIter !=(*ListRunner)->end();++atomIter){ 587 if ((*atomIter)->type->getNumber() == (*elemIter).first) { 588 if (((*atomIter)->GetTrueFather() != NULL) && ((*atomIter)->GetTrueFather() != (*atomIter))) {// if there is a rea 607 589 //Log() << Verbose(0) << "Walker is " << *Walker << " with true father " << *( Walker->GetTrueFather()) << ", it 608 ForcesFile << SortIndex[ Walker->GetTrueFather()->nr] << "\t";590 ForcesFile << SortIndex[(*atomIter)->GetTrueFather()->nr] << "\t"; 609 591 } else 610 592 // otherwise a -1 to indicate an added saturation hydrogen … … 640 622 bool result = true; 641 623 bool intermediateResult = true; 642 atom *Walker = NULL;643 624 Vector BoxDimension; 644 625 char *FragmentNumber = NULL; … … 681 662 // list atoms in fragment for debugging 682 663 DoLog(2) && (Log() << Verbose(2) << "Contained atoms: "); 683 Walker = (*ListRunner)->start; 684 while (Walker->next != (*ListRunner)->end) { 685 Walker = Walker->next; 686 DoLog(0) && (Log() << Verbose(0) << Walker->getName() << " "); 664 for (molecule::const_iterator iter = (*ListRunner)->begin(); iter != (*ListRunner)->end(); ++iter) { 665 DoLog(0) && (Log() << Verbose(0) << (*iter)->getName() << " "); 687 666 } 688 667 DoLog(0) && (Log() << Verbose(0) << endl); … … 764 743 { 765 744 molecule *mol = World::getInstance().createMolecule(); 766 atom *Walker = NULL;767 atom *Advancer = NULL;768 745 bond *Binder = NULL; 769 746 bond *Stepper = NULL; … … 771 748 for (MoleculeList::iterator MolRunner = ListOfMolecules.begin(); !ListOfMolecules.empty(); MolRunner = ListOfMolecules.begin()) { 772 749 // shift all atoms to new molecule 773 Advancer = (*MolRunner)->start->next; 774 while (Advancer != (*MolRunner)->end) { 775 Walker = Advancer; 776 Advancer = Advancer->next; 777 DoLog(3) && (Log() << Verbose(3) << "Re-linking " << *Walker << "..." << endl); 778 unlink(Walker); 779 Walker->father = Walker; 780 mol->AddAtom(Walker); // counting starts at 1 750 for (molecule::iterator iter = (*MolRunner)->begin(); (*MolRunner)->empty(); iter = (*MolRunner)->begin()) { 751 DoLog(3) && (Log() << Verbose(3) << "Re-linking " << (*iter) << "..." << endl); 752 (*iter)->father = (*iter); 753 mol->AddAtom((*iter)); // counting starts at 1 754 (*MolRunner)->erase(iter); 781 755 } 782 756 // remove all bonds … … 832 806 // 4b. create and fill map of which atom is associated to which connected molecule (note, counting starts at 1) 833 807 int FragmentCounter = 0; 834 int *MolMap = new int[mol-> AtomCount];835 for (int i=0;i<mol-> AtomCount;i++)808 int *MolMap = new int[mol->getAtomCount()]; 809 for (int i=0;i<mol->getAtomCount();i++) 836 810 MolMap[i] = 0; 837 811 MoleculeLeafClass *MolecularWalker = Subgraphs; 838 Walker = NULL;839 812 while (MolecularWalker->next != NULL) { 840 813 MolecularWalker = MolecularWalker->next; 841 Walker = MolecularWalker->Leaf->start; 842 while (Walker->next != MolecularWalker->Leaf->end) { 843 Walker = Walker->next; 844 MolMap[Walker->GetTrueFather()->nr] = FragmentCounter+1; 814 for (molecule::const_iterator iter = MolecularWalker->Leaf->begin(); iter != MolecularWalker->Leaf->end(); ++iter) { 815 MolMap[(*iter)->GetTrueFather()->nr] = FragmentCounter+1; 845 816 } 846 817 FragmentCounter++; … … 848 819 849 820 // 4c. relocate atoms to new molecules and remove from Leafs 850 Walker = NULL; 851 while (mol->start->next != mol->end) { 852 Walker = mol->start->next; 853 if ((Walker->nr <0) || (Walker->nr >= mol->AtomCount)) { 854 DoeLog(0) && (eLog()<< Verbose(0) << "Index of atom " << *Walker << " is invalid!" << endl); 821 for (molecule::iterator iter = mol->begin(); !mol->empty(); iter = mol->begin()) { 822 if (((*iter)->nr <0) || ((*iter)->nr >= mol->getAtomCount())) { 823 DoeLog(0) && (eLog()<< Verbose(0) << "Index of atom " << **iter << " is invalid!" << endl); 855 824 performCriticalExit(); 856 825 } 857 FragmentCounter = MolMap[ Walker->nr];826 FragmentCounter = MolMap[(*iter)->nr]; 858 827 if (FragmentCounter != 0) { 859 DoLog(3) && (Log() << Verbose(3) << "Re-linking " << * Walker << "..." << endl);860 unlink(Walker);861 mol ecules[FragmentCounter-1]->AddAtom(Walker); // counting starts at 1828 DoLog(3) && (Log() << Verbose(3) << "Re-linking " << **iter << "..." << endl); 829 molecules[FragmentCounter-1]->AddAtom((*iter)); // counting starts at 1 830 mol->erase(iter); 862 831 } else { 863 DoeLog(0) && (eLog()<< Verbose(0) << "Atom " << * Walker << " not associated to molecule!" << endl);832 DoeLog(0) && (eLog()<< Verbose(0) << "Atom " << **iter << " not associated to molecule!" << endl); 864 833 performCriticalExit(); 865 834 } … … 869 838 while (mol->first->next != mol->last) { 870 839 Binder = mol->first->next; 871 Walker = Binder->leftatom;840 const atom * const Walker = Binder->leftatom; 872 841 unlink(Binder); 873 842 link(Binder,molecules[MolMap[Walker->nr]-1]->last); // counting starts at 1 … … 891 860 int MoleculeListClass::CountAllAtoms() const 892 861 { 893 atom *Walker = NULL;894 862 int AtomNo = 0; 895 863 for (MoleculeList::const_iterator MolWalker = ListOfMolecules.begin(); MolWalker != ListOfMolecules.end(); MolWalker++) { 896 Walker = (*MolWalker)->start; 897 while (Walker->next != (*MolWalker)->end) { 898 Walker = Walker->next; 899 AtomNo++; 900 } 864 AtomNo += (*MolWalker)->size(); 901 865 } 902 866 return AtomNo; … … 1073 1037 bool MoleculeLeafClass::FillBondStructureFromReference(const molecule * const reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList) 1074 1038 { 1075 atom *Walker = NULL;1076 1039 atom *OtherWalker = NULL; 1077 1040 atom *Father = NULL; … … 1081 1044 DoLog(1) && (Log() << Verbose(1) << "Begin of FillBondStructureFromReference." << endl); 1082 1045 // fill ListOfLocalAtoms if NULL was given 1083 if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference-> AtomCount, FreeList)) {1046 if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->getAtomCount(), FreeList)) { 1084 1047 DoLog(1) && (Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl); 1085 1048 return false; … … 1097 1060 } 1098 1061 1099 Walker = Leaf->start; 1100 while (Walker->next != Leaf->end) { 1101 Walker = Walker->next; 1102 Father = Walker->GetTrueFather(); 1062 for(molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end(); ++iter) { 1063 Father = (*iter)->GetTrueFather(); 1103 1064 AtomNo = Father->nr; // global id of the current walker 1104 1065 for (BondList::const_iterator Runner = Father->ListOfBonds.begin(); Runner != Father->ListOfBonds.end(); (++Runner)) { 1105 OtherWalker = ListOfLocalAtoms[FragmentCounter][(*Runner)->GetOtherAtom( Walker->GetTrueFather())->nr]; // local copy of current bond partner of walker1066 OtherWalker = ListOfLocalAtoms[FragmentCounter][(*Runner)->GetOtherAtom((*iter)->GetTrueFather())->nr]; // local copy of current bond partner of walker 1106 1067 if (OtherWalker != NULL) { 1107 if (OtherWalker->nr > Walker->nr)1108 Leaf->AddBond( Walker, OtherWalker, (*Runner)->BondDegree);1068 if (OtherWalker->nr > (*iter)->nr) 1069 Leaf->AddBond((*iter), OtherWalker, (*Runner)->BondDegree); 1109 1070 } else { 1110 DoLog(1) && (Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << (*Runner)->GetOtherAtom( Walker->GetTrueFather())->nr << "] is NULL!" << endl);1071 DoLog(1) && (Log() << Verbose(1) << "OtherWalker = ListOfLocalAtoms[" << FragmentCounter << "][" << (*Runner)->GetOtherAtom((*iter)->GetTrueFather())->nr << "] is NULL!" << endl); 1111 1072 status = false; 1112 1073 } … … 1135 1096 bool MoleculeLeafClass::FillRootStackForSubgraphs(KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter) 1136 1097 { 1137 atom * Walker = NULL, *Father = NULL;1098 atom *Father = NULL; 1138 1099 1139 1100 if (RootStack != NULL) { … … 1141 1102 if (&(RootStack[FragmentCounter]) != NULL) { 1142 1103 RootStack[FragmentCounter].clear(); 1143 Walker = Leaf->start; 1144 while (Walker->next != Leaf->end) { // go through all (non-hydrogen) atoms 1145 Walker = Walker->next; 1146 Father = Walker->GetTrueFather(); 1104 for(molecule::const_iterator iter = Leaf->begin(); iter != Leaf->end(); ++iter) { 1105 Father = (*iter)->GetTrueFather(); 1147 1106 if (AtomMask[Father->nr]) // apply mask 1148 1107 #ifdef ADDHYDROGEN 1149 if ( Walker->type->Z != 1) // skip hydrogen1108 if ((*iter)->type->Z != 1) // skip hydrogen 1150 1109 #endif 1151 RootStack[FragmentCounter].push_front( Walker->nr);1110 RootStack[FragmentCounter].push_front((*iter)->nr); 1152 1111 } 1153 1112 if (next != NULL) … … 1191 1150 1192 1151 if ((ListOfLocalAtoms != NULL) && (ListOfLocalAtoms[FragmentCounter] == NULL)) { // allocate and fill list of this fragment/subgraph 1193 status = status && CreateFatherLookupTable(Leaf->start, Leaf->end,ListOfLocalAtoms[FragmentCounter], GlobalAtomCount);1152 status = status && Leaf->CreateFatherLookupTable(ListOfLocalAtoms[FragmentCounter], GlobalAtomCount); 1194 1153 FreeList = FreeList && true; 1195 1154 } … … 1215 1174 DoLog(1) && (Log() << Verbose(1) << "Begin of AssignKeySetsToFragment." << endl); 1216 1175 // fill ListOfLocalAtoms if NULL was given 1217 if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference-> AtomCount, FreeList)) {1176 if (!FillListOfLocalAtoms(ListOfLocalAtoms, FragmentCounter, reference->getAtomCount(), FreeList)) { 1218 1177 DoLog(1) && (Log() << Verbose(1) << "Filling of ListOfLocalAtoms failed." << endl); 1219 1178 return false;
Note:
See TracChangeset
for help on using the changeset viewer.
