Changeset 735b1c for src/molecule_fragmentation.cpp
- Timestamp:
- Mar 1, 2011, 10:16:39 AM (14 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, 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:
- 5309ba
- Parents:
- a479fa
- git-author:
- Frederik Heber <heber@…> (02/22/11 00:15:33)
- git-committer:
- Frederik Heber <heber@…> (03/01/11 10:16:39)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule_fragmentation.cpp
ra479fa r735b1c 425 425 No = (*runner).second.first; 426 426 Walker = mol->FindAtom(No); 427 //if (Walker->AdaptiveOrder < MinimumRingSize[Walker-> ParticleInfo_nr]) {427 //if (Walker->AdaptiveOrder < MinimumRingSize[Walker->getNr()]) { 428 428 DoLog(2) && (Log() << Verbose(2) << "Root " << No << " is still above threshold (10^{" << Order <<"}: " << runner->first << ", setting entry " << No << " of Atom mask to true." << endl); 429 429 AtomMask[No] = true; 430 430 status = true; 431 431 //} else 432 //Log() << Verbose(2) << "Root " << No << " is still above threshold (10^{" << Order <<"}: " << runner->first << ", however MinimumRingSize of " << MinimumRingSize[Walker-> ParticleInfo_nr] << " does not allow further adaptive increase." << endl;432 //Log() << Verbose(2) << "Root " << No << " is still above threshold (10^{" << Order <<"}: " << runner->first << ", however MinimumRingSize of " << MinimumRingSize[Walker->getNr()] << " does not allow further adaptive increase." << endl; 433 433 } 434 434 return status; … … 488 488 #endif 489 489 { 490 AtomMask[(*iter)-> ParticleInfo_nr] = true; // include all (non-hydrogen) atoms490 AtomMask[(*iter)->getNr()] = true; // include all (non-hydrogen) atoms 491 491 status = true; 492 492 } … … 508 508 #endif 509 509 { 510 AtomMask[(*iter)-> ParticleInfo_nr] = true; // include all (non-hydrogen) atoms511 if ((Order != 0) && ((*iter)->AdaptiveOrder < Order)) // && ((*iter)->AdaptiveOrder < MinimumRingSize[(*iter)-> ParticleInfo_nr]))510 AtomMask[(*iter)->getNr()] = true; // include all (non-hydrogen) atoms 511 if ((Order != 0) && ((*iter)->AdaptiveOrder < Order)) // && ((*iter)->AdaptiveOrder < MinimumRingSize[(*iter)->getNr()])) 512 512 status = true; 513 513 } … … 546 546 int AtomNo = 0; 547 547 for(internal_iterator iter=atoms.begin();iter!=atoms.end();++iter){ 548 ASSERT(SortIndex[(*iter)-> ParticleInfo_nr]==-1,"Same SortIndex set twice");549 SortIndex[(*iter)-> ParticleInfo_nr] = AtomNo++;548 ASSERT(SortIndex[(*iter)->getNr()]==-1,"Same SortIndex set twice"); 549 SortIndex[(*iter)->getNr()] = AtomNo++; 550 550 } 551 551 … … 575 575 if (count == 0) { 576 576 for (molecule::iterator iter = begin(); iter != end(); ++iter) { // create a lookup table (Atom::ParticleInfo_nr -> atom) used as a marker table lateron 577 count = (count < (*iter)->GetTrueFather()-> ParticleInfo_nr) ? (*iter)->GetTrueFather()->ParticleInfo_nr: count;577 count = (count < (*iter)->GetTrueFather()->getNr()) ? (*iter)->GetTrueFather()->getNr() : count; 578 578 } 579 579 } … … 593 593 LookupTable[i] = NULL; 594 594 for (molecule::iterator iter = begin(); iter != end(); ++iter) { 595 AtomNo = (*iter)->GetTrueFather()-> ParticleInfo_nr;595 AtomNo = (*iter)->GetTrueFather()->getNr(); 596 596 if ((AtomNo >= 0) && (AtomNo < count)) { 597 597 //*out << "Setting LookupTable[" << AtomNo << "] to " << *(*iter) << endl; … … 917 917 // set atom values 918 918 for(internal_iterator iter=atoms.begin();iter!=atoms.end();++iter){ 919 (*iter)->AdaptiveOrder = OrderArray[(*iter)-> ParticleInfo_nr];920 (*iter)->MaxOrder = MaxArray[(*iter)-> ParticleInfo_nr];921 } 922 //SetAtomValueToIndexedArray( OrderArray, &atom:: ParticleInfo_nr, &atom::AdaptiveOrder );923 //SetAtomValueToIndexedArray( MaxArray, &atom:: ParticleInfo_nr, &atom::MaxOrder );919 (*iter)->AdaptiveOrder = OrderArray[(*iter)->getNr()]; 920 (*iter)->MaxOrder = MaxArray[(*iter)->getNr()]; 921 } 922 //SetAtomValueToIndexedArray( OrderArray, &atom::getNr(), &atom::AdaptiveOrder ); 923 //SetAtomValueToIndexedArray( MaxArray, &atom::getNr(), &atom::MaxOrder ); 924 924 925 925 DoLog(1) && (Log() << Verbose(1) << "\t ... done." << endl); … … 981 981 for(KeySet::iterator runner = Leaflet.begin(); runner != Leaflet.end(); runner++) { 982 982 FatherOfRunner = mol->FindAtom((*runner)); // find the id 983 SonList[FatherOfRunner-> ParticleInfo_nr] = Leaf->AddCopyAtom(FatherOfRunner);983 SonList[FatherOfRunner->getNr()] = Leaf->AddCopyAtom(FatherOfRunner); 984 984 size++; 985 985 } … … 1008 1008 FatherOfRunner = (*iter)->father; 1009 1009 ASSERT(FatherOfRunner,"Atom without father found"); 1010 if (SonList[FatherOfRunner-> ParticleInfo_nr] != NULL) { // check if this, our father, is present in list1010 if (SonList[FatherOfRunner->getNr()] != NULL) { // check if this, our father, is present in list 1011 1011 // create all bonds 1012 1012 const BondList& ListOfBonds = FatherOfRunner->getListOfBonds(); … … 1015 1015 ++BondRunner) { 1016 1016 OtherFather = (*BondRunner)->GetOtherAtom(FatherOfRunner); 1017 // Log() << Verbose(2) << "Father " << *FatherOfRunner << " of son " << *SonList[FatherOfRunner-> ParticleInfo_nr] << " is bound to " << *OtherFather;1018 if (SonList[OtherFather-> ParticleInfo_nr] != NULL) {1019 // Log() << Verbose(0) << ", whose son is " << *SonList[OtherFather-> ParticleInfo_nr] << "." << endl;1020 if (OtherFather-> ParticleInfo_nr > FatherOfRunner->ParticleInfo_nr) { // add bond (ParticleInfo_nr check is for adding only one of both variants: ab, ba)1017 // Log() << Verbose(2) << "Father " << *FatherOfRunner << " of son " << *SonList[FatherOfRunner->getNr()] << " is bound to " << *OtherFather; 1018 if (SonList[OtherFather->getNr()] != NULL) { 1019 // Log() << Verbose(0) << ", whose son is " << *SonList[OtherFather->getNr()] << "." << endl; 1020 if (OtherFather->getNr() > FatherOfRunner->getNr()) { // add bond (ParticleInfo_nr check is for adding only one of both variants: ab, ba) 1021 1021 // Log() << Verbose(3) << "Adding Bond: "; 1022 1022 // Log() << Verbose(0) << 1023 Leaf->AddBond((*iter), SonList[OtherFather-> ParticleInfo_nr], (*BondRunner)->BondDegree);1023 Leaf->AddBond((*iter), SonList[OtherFather->getNr()], (*BondRunner)->BondDegree); 1024 1024 // Log() << Verbose(0) << "." << endl; 1025 //NumBonds[(*iter)-> ParticleInfo_nr]++;1025 //NumBonds[(*iter)->getNr()]++; 1026 1026 } else { 1027 1027 // Log() << Verbose(3) << "Not adding bond, labels in wrong order." << endl; … … 1035 1035 exit(1); 1036 1036 #endif 1037 //NumBonds[(*iter)-> ParticleInfo_nr] += Binder->BondDegree;1037 //NumBonds[(*iter)->getNr()] += Binder->BondDegree; 1038 1038 } 1039 1039 } 1040 1040 } else { 1041 DoeLog(1) && (eLog()<< Verbose(1) << "Son " << (*iter)->getName() << " has father " << FatherOfRunner->getName() << " but its entry in SonList is " << SonList[FatherOfRunner-> ParticleInfo_nr] << "!" << endl);1041 DoeLog(1) && (eLog()<< Verbose(1) << "Son " << (*iter)->getName() << " has father " << FatherOfRunner->getName() << " but its entry in SonList is " << SonList[FatherOfRunner->getNr()] << "!" << endl); 1042 1042 } 1043 1043 if ((LonelyFlag) && (Leaf->getAtomCount() > 1)) { … … 1121 1121 OtherWalker = BondsSet[j]->rightatom; // rightatom is always the one more distant, i.e. the one to add 1122 1122 //Log() << Verbose(1+verbosity) << "Current Bond is " << BondsSet[j] << ", checking on " << *OtherWalker << "." << endl; 1123 Log() << Verbose(2+verbosity) << "Adding " << *OtherWalker << " with nr " << OtherWalker-> ParticleInfo_nr<< "." << endl;1124 TestKeySetInsert = FragmentSet->insert(OtherWalker-> ParticleInfo_nr);1123 Log() << Verbose(2+verbosity) << "Adding " << *OtherWalker << " with nr " << OtherWalker->getNr() << "." << endl; 1124 TestKeySetInsert = FragmentSet->insert(OtherWalker->getNr()); 1125 1125 if (TestKeySetInsert.second) { 1126 TouchedList[TouchedIndex++] = OtherWalker-> ParticleInfo_nr; // note as added1126 TouchedList[TouchedIndex++] = OtherWalker->getNr(); // note as added 1127 1127 Added++; 1128 1128 } else { … … 1172 1172 ++Binder) { 1173 1173 for (int k=0;k<TouchedIndex;k++) { 1174 if ((*Binder)->leftatom-> ParticleInfo_nr== TouchedList[k]) // leftatom is always the closer one1174 if ((*Binder)->leftatom->getNr() == TouchedList[k]) // leftatom is always the closer one 1175 1175 BondsList[SetDimension++] = (*Binder); 1176 1176 } … … 1330 1330 { 1331 1331 // prepare Label and SP arrays of the BFS search 1332 FragmentSearch.ShortestPathList[FragmentSearch.Root-> ParticleInfo_nr] = 0;1332 FragmentSearch.ShortestPathList[FragmentSearch.Root->getNr()] = 0; 1333 1333 1334 1334 // prepare root level (SP = 0) and a loop bond denoting Root … … 1354 1354 iter != FragmentSearch.BondsPerSPList[i].end(); 1355 1355 ++iter) { 1356 // Log() << Verbose(0) << "Removing atom " << Binder->leftatom-> ParticleInfo_nr << " and " << Binder->rightatom->ParticleInfo_nr<< "." << endl; // make sure numbers are local1357 FragmentSearch.ShortestPathList[(*iter)->leftatom-> ParticleInfo_nr] = -1;1358 FragmentSearch.ShortestPathList[(*iter)->rightatom-> ParticleInfo_nr] = -1;1356 // Log() << Verbose(0) << "Removing atom " << Binder->leftatom->getNr() << " and " << Binder->rightatom->getNr() << "." << endl; // make sure numbers are local 1357 FragmentSearch.ShortestPathList[(*iter)->leftatom->getNr()] = -1; 1358 FragmentSearch.ShortestPathList[(*iter)->rightatom->getNr()] = -1; 1359 1359 } 1360 1360 // delete added bonds … … 1391 1391 atom *Predecessor = NULL; 1392 1392 bond *Binder = NULL; 1393 int RootKeyNr = FragmentSearch.Root->GetTrueFather()-> ParticleInfo_nr;1393 int RootKeyNr = FragmentSearch.Root->GetTrueFather()->getNr(); 1394 1394 int RemainingWalkers = -1; 1395 1395 int SP = -1; … … 1411 1411 Walker = (*CurrentEdge)->rightatom; // rightatom is always the one more distant 1412 1412 Predecessor = (*CurrentEdge)->leftatom; // ... and leftatom is predecessor 1413 AtomKeyNr = Walker-> ParticleInfo_nr;1414 DoLog(0) && (Log() << Verbose(0) << "Current Walker is: " << *Walker << " with nr " << Walker-> ParticleInfo_nr<< " and SP of " << SP << ", with " << RemainingWalkers << " remaining walkers on this level." << endl);1413 AtomKeyNr = Walker->getNr(); 1414 DoLog(0) && (Log() << Verbose(0) << "Current Walker is: " << *Walker << " with nr " << Walker->getNr() << " and SP of " << SP << ", with " << RemainingWalkers << " remaining walkers on this level." << endl); 1415 1415 // check for new sp level 1416 1416 // go through all its bonds … … 1421 1421 ++Runner) { 1422 1422 OtherWalker = (*Runner)->GetOtherAtom(Walker); 1423 if ((RestrictedKeySet.find(OtherWalker-> ParticleInfo_nr) != RestrictedKeySet.end())1423 if ((RestrictedKeySet.find(OtherWalker->getNr()) != RestrictedKeySet.end()) 1424 1424 #ifdef ADDHYDROGEN 1425 1425 && (OtherWalker->getType()->getAtomicNumber() != 1) 1426 1426 #endif 1427 1427 ) { // skip hydrogens and restrict to fragment 1428 DoLog(2) && (Log() << Verbose(2) << "Current partner is " << *OtherWalker << " with nr " << OtherWalker-> ParticleInfo_nr<< " in bond " << *(*Runner) << "." << endl);1428 DoLog(2) && (Log() << Verbose(2) << "Current partner is " << *OtherWalker << " with nr " << OtherWalker->getNr() << " in bond " << *(*Runner) << "." << endl); 1429 1429 // set the label if not set (and push on root stack as well) 1430 if ((OtherWalker != Predecessor) && (OtherWalker->GetTrueFather()-> ParticleInfo_nr> RootKeyNr)) { // only pass through those with label bigger than Root's1431 FragmentSearch.ShortestPathList[OtherWalker-> ParticleInfo_nr] = SP+1;1432 DoLog(3) && (Log() << Verbose(3) << "Set Shortest Path to " << FragmentSearch.ShortestPathList[OtherWalker-> ParticleInfo_nr] << "." << endl);1430 if ((OtherWalker != Predecessor) && (OtherWalker->GetTrueFather()->getNr() > RootKeyNr)) { // only pass through those with label bigger than Root's 1431 FragmentSearch.ShortestPathList[OtherWalker->getNr()] = SP+1; 1432 DoLog(3) && (Log() << Verbose(3) << "Set Shortest Path to " << FragmentSearch.ShortestPathList[OtherWalker->getNr()] << "." << endl); 1433 1433 // add the bond in between to the SP list 1434 1434 Binder = new bond(Walker, OtherWalker); // create a new bond in such a manner, that bond::rightatom is always the one more distant … … 1438 1438 } else { 1439 1439 if (OtherWalker != Predecessor) 1440 DoLog(3) && (Log() << Verbose(3) << "Not passing on, as index of " << *OtherWalker << " " << OtherWalker->GetTrueFather()-> ParticleInfo_nr<< " is smaller than that of Root " << RootKeyNr << "." << endl);1440 DoLog(3) && (Log() << Verbose(3) << "Not passing on, as index of " << *OtherWalker << " " << OtherWalker->GetTrueFather()->getNr() << " is smaller than that of Root " << RootKeyNr << "." << endl); 1441 1441 else 1442 1442 DoLog(3) && (Log() << Verbose(3) << "This is my predecessor " << *Predecessor << "." << endl); … … 1519 1519 if (SP >= (Order-1)) { 1520 1520 // start with root (push on fragment stack) 1521 DoLog(0) && (Log() << Verbose(0) << "Starting fragment generation with " << *FragmentSearch.Root << ", local nr is " << FragmentSearch.Root-> ParticleInfo_nr<< "." << endl);1521 DoLog(0) && (Log() << Verbose(0) << "Starting fragment generation with " << *FragmentSearch.Root << ", local nr is " << FragmentSearch.Root->getNr() << "." << endl); 1522 1522 FragmentSearch.FragmentSet->clear(); 1523 1523 DoLog(0) && (Log() << Verbose(0) << "Preparing subset for this root and calling generator." << endl); … … 1538 1538 // remove root from stack 1539 1539 DoLog(0) && (Log() << Verbose(0) << "Removing root again from stack." << endl); 1540 FragmentSearch.FragmentSet->erase(FragmentSearch.Root-> ParticleInfo_nr);1540 FragmentSearch.FragmentSet->erase(FragmentSearch.Root->getNr()); 1541 1541 1542 1542 // free'ing the bonds lists … … 1609 1609 } 1610 1610 } 1611 RootStack.push_back(Walker-> ParticleInfo_nr);1611 RootStack.push_back(Walker->getNr()); 1612 1612 RootNr++; 1613 1613 } while (RootKeyNr != StartNr); … … 1700 1700 KeySet CompleteMolecule; 1701 1701 for (molecule::const_iterator iter = begin(); iter != end(); ++iter) { 1702 CompleteMolecule.insert((*iter)->GetTrueFather()-> ParticleInfo_nr);1702 CompleteMolecule.insert((*iter)->GetTrueFather()->getNr()); 1703 1703 } 1704 1704 … … 1713 1713 atom *Walker = FindAtom(RootKeyNr); 1714 1714 // check cyclic lengths 1715 //if ((MinimumRingSize[Walker->GetTrueFather()-> ParticleInfo_nr] != -1) && (Walker->GetTrueFather()->AdaptiveOrder+1 > MinimumRingSize[Walker->GetTrueFather()->ParticleInfo_nr])) {1715 //if ((MinimumRingSize[Walker->GetTrueFather()->getNr()] != -1) && (Walker->GetTrueFather()->AdaptiveOrder+1 > MinimumRingSize[Walker->GetTrueFather()->getNr()])) { 1716 1716 // Log() << Verbose(0) << "Bond order " << Walker->GetTrueFather()->AdaptiveOrder << " of Root " << *Walker << " greater than or equal to Minimum Ring size of " << MinimumRingSize << " found is not allowed." << endl; 1717 1717 //} else … … 1849 1849 AtomStack->pop_front(); 1850 1850 //Log() << Verbose (3) << "Current Walker is: " << *Walker << "." << endl; 1851 ColorList[Walker-> ParticleInfo_nr] = black; // mark as explored1851 ColorList[Walker->getNr()] = black; // mark as explored 1852 1852 *Walker += Translationvector; // translate 1853 1853 const BondList& ListOfBonds = Walker->getListOfBonds(); … … 1857 1857 if ((*Runner) != Binder) { 1858 1858 OtherWalker = (*Runner)->GetOtherAtom(Walker); 1859 if (ColorList[OtherWalker-> ParticleInfo_nr] == white) {1859 if (ColorList[OtherWalker->getNr()] == white) { 1860 1860 AtomStack->push_front(OtherWalker); // push if yet unexplored 1861 1861 }
Note:
See TracChangeset
for help on using the changeset viewer.