Changeset a479fa for src/molecule_graph.cpp
- Timestamp:
- Mar 1, 2011, 10:16:38 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:
- 735b1c
- Parents:
- 5702cdb
- git-author:
- Frederik Heber <heber@…> (02/21/11 23:50:41)
- git-committer:
- Frederik Heber <heber@…> (03/01/11 10:16:38)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/molecule_graph.cpp
r5702cdb ra479fa 165 165 LC = new LinkedCell(cloud, bonddistance); 166 166 167 // create a list to map Tesselpoint:: nr to atom *167 // create a list to map Tesselpoint::ParticleInfo_nr to atom * 168 168 DoLog(2) && (Log() << Verbose(2) << "Creating TesselPoint to atom map ... " << endl); 169 169 … … 171 171 int i=0; 172 172 for(internal_iterator iter = atoms.begin();iter!= atoms.end(); ++iter){ 173 (*iter)-> nr = i++;173 (*iter)->setNr(i++); 174 174 } 175 175 … … 194 194 Log() << Verbose(2) << "Current relative cell is " << LC->n[0] << ", " << LC->n[1] << ", " << LC->n[2] << " with No. " << LC->index << " containing " << List->size() << " points." << endl; 195 195 for (TesselPointSTLList::const_iterator OtherRunner = OtherList->begin(); OtherRunner != OtherList->end(); OtherRunner++) { 196 if ((*OtherRunner)-> nr > Walker->nr) {196 if ((*OtherRunner)->ParticleInfo_nr > Walker->ParticleInfo_nr) { 197 197 OtherWalker = dynamic_cast<atom*>(*OtherRunner); 198 198 ASSERT(OtherWalker,"TesselPoint that was not an atom retrieved from LinkedNode"); … … 202 202 const bool status = (distance <= MaxDistance * MaxDistance) && (distance >= MinDistance * MinDistance); 203 203 Log() << Verbose(1) << "MinDistance is " << MinDistance << " and MaxDistance is " << MaxDistance << "." << endl; 204 if (OtherWalker->father-> nr > Walker->father->nr) {204 if (OtherWalker->father->ParticleInfo_nr > Walker->father->ParticleInfo_nr) { 205 205 if (status) { // create bond if distance is smaller 206 206 Log() << Verbose(1) << "Adding Bond between " << *Walker << " and " << *OtherWalker << " in distance " << sqrt(distance) << "." << endl; … … 740 740 Walker = BFS.TouchedStack->front(); 741 741 BFS.TouchedStack->pop_front(); 742 BFS.PredecessorList[Walker-> nr] = NULL;743 BFS.ShortestPathList[Walker-> nr] = -1;744 BFS.ColorList[Walker-> nr] = white;742 BFS.PredecessorList[Walker->ParticleInfo_nr] = NULL; 743 BFS.ShortestPathList[Walker->ParticleInfo_nr] = -1; 744 BFS.ColorList[Walker->ParticleInfo_nr] = white; 745 745 } 746 746 }; … … 752 752 void ResetBFSAccounting(atom *&Walker, struct BFSAccounting &BFS) 753 753 { 754 BFS.ShortestPathList[Walker-> nr] = 0;754 BFS.ShortestPathList[Walker->ParticleInfo_nr] = 0; 755 755 BFS.BFSStack->clear(); // start with empty BFS stack 756 756 BFS.BFSStack->push_front(Walker); … … 781 781 #endif 782 782 DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl); 783 if (BFS.ColorList[OtherAtom-> nr] == white) {783 if (BFS.ColorList[OtherAtom->ParticleInfo_nr] == white) { 784 784 BFS.TouchedStack->push_front(OtherAtom); 785 BFS.ColorList[OtherAtom-> nr] = lightgray;786 BFS.PredecessorList[OtherAtom-> nr] = Walker; // Walker is the predecessor787 BFS.ShortestPathList[OtherAtom-> nr] = BFS.ShortestPathList[Walker->nr] + 1;788 DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " lightgray, its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom-> nr] << " egde(s) long." << endl);789 //if (BFS.ShortestPathList[OtherAtom-> nr] < MinimumRingSize[Walker->GetTrueFather()->nr]) { // Check for maximum distance785 BFS.ColorList[OtherAtom->ParticleInfo_nr] = lightgray; 786 BFS.PredecessorList[OtherAtom->ParticleInfo_nr] = Walker; // Walker is the predecessor 787 BFS.ShortestPathList[OtherAtom->ParticleInfo_nr] = BFS.ShortestPathList[Walker->ParticleInfo_nr] + 1; 788 DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " lightgray, its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->ParticleInfo_nr] << " egde(s) long." << endl); 789 //if (BFS.ShortestPathList[OtherAtom->ParticleInfo_nr] < MinimumRingSize[Walker->GetTrueFather()->nr]) { // Check for maximum distance 790 790 DoLog(3) && (Log() << Verbose(3) << "Putting OtherAtom into queue." << endl); 791 791 BFS.BFSStack->push_front(OtherAtom); … … 799 799 } else { 800 800 DoLog(2) && (Log() << Verbose(2) << "Skipping hydrogen atom " << *OtherAtom << "." << endl); 801 BFS.ColorList[OtherAtom-> nr] = black;801 BFS.ColorList[OtherAtom->ParticleInfo_nr] = black; 802 802 } 803 803 #endif … … 806 806 } 807 807 } 808 BFS.ColorList[Walker-> nr] = black;808 BFS.ColorList[Walker->ParticleInfo_nr] = black; 809 809 DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->getName() << " black." << endl); 810 810 if (OtherAtom == BFS.Root) { // if we have found the root, check whether this cycle wasn't already found beforehand … … 814 814 break; 815 815 else 816 OtherAtom = BFS.PredecessorList[OtherAtom-> nr];816 OtherAtom = BFS.PredecessorList[OtherAtom->ParticleInfo_nr]; 817 817 } 818 818 if (OtherAtom == BackEdge->rightatom) { // if each atom in found cycle is cyclic, loop's been found before already … … 822 822 OtherAtom = BFS.TouchedStack->front(); 823 823 BFS.TouchedStack->pop_front(); 824 if (BFS.PredecessorList[OtherAtom-> nr] == Walker) {824 if (BFS.PredecessorList[OtherAtom->ParticleInfo_nr] == Walker) { 825 825 DoLog(4) && (Log() << Verbose(4) << "Removing " << *OtherAtom << " from lists and stacks." << endl); 826 BFS.PredecessorList[OtherAtom-> nr] = NULL;827 BFS.ShortestPathList[OtherAtom-> nr] = -1;828 BFS.ColorList[OtherAtom-> nr] = white;826 BFS.PredecessorList[OtherAtom->ParticleInfo_nr] = NULL; 827 BFS.ShortestPathList[OtherAtom->ParticleInfo_nr] = -1; 828 BFS.ColorList[OtherAtom->ParticleInfo_nr] = white; 829 829 // rats ... deque has no find() 830 830 std::deque<atom *>::iterator iter = find( … … 836 836 BFS.BFSStack->erase(iter); 837 837 } 838 } while ((!BFS.TouchedStack->empty()) && (BFS.PredecessorList[OtherAtom-> nr] == NULL));838 } while ((!BFS.TouchedStack->empty()) && (BFS.PredecessorList[OtherAtom->ParticleInfo_nr] == NULL)); 839 839 BFS.TouchedStack->push_front(OtherAtom); // last was wrongly popped 840 840 OtherAtom = BackEdge->rightatom; // set to not Root … … 842 842 OtherAtom = BFS.Root; 843 843 } 844 } while ((!BFS.BFSStack->empty()) && (OtherAtom != BFS.Root) && (OtherAtom != NULL)); // || (ShortestPathList[OtherAtom-> nr] < MinimumRingSize[Walker->GetTrueFather()->nr])));844 } while ((!BFS.BFSStack->empty()) && (OtherAtom != BFS.Root) && (OtherAtom != NULL)); // || (ShortestPathList[OtherAtom->ParticleInfo_nr] < MinimumRingSize[Walker->GetTrueFather()->ParticleInfo_nr]))); 845 845 }; 846 846 … … 867 867 while (Walker != BackEdge->rightatom) { 868 868 DoLog(0) && (Log() << Verbose(0) << Walker->getName() << " <-> "); 869 Walker = BFS.PredecessorList[Walker-> nr];869 Walker = BFS.PredecessorList[Walker->ParticleInfo_nr]; 870 870 Walker->GetTrueFather()->IsCyclic = true; 871 871 RingSize++; … … 874 874 // walk through all and set MinimumRingSize 875 875 Walker = BFS.Root; 876 MinimumRingSize[Walker->GetTrueFather()-> nr] = RingSize;876 MinimumRingSize[Walker->GetTrueFather()->ParticleInfo_nr] = RingSize; 877 877 while (Walker != BackEdge->rightatom) { 878 Walker = BFS.PredecessorList[Walker-> nr];879 if (RingSize < MinimumRingSize[Walker->GetTrueFather()-> nr])880 MinimumRingSize[Walker->GetTrueFather()-> nr] = RingSize;878 Walker = BFS.PredecessorList[Walker->ParticleInfo_nr]; 879 if (RingSize < MinimumRingSize[Walker->GetTrueFather()->ParticleInfo_nr]) 880 MinimumRingSize[Walker->GetTrueFather()->ParticleInfo_nr] = RingSize; 881 881 } 882 882 if ((RingSize < MinRingSize) || (MinRingSize == -1)) 883 883 MinRingSize = RingSize; 884 884 } else { 885 DoLog(1) && (Log() << Verbose(1) << "No ring containing " << *BFS.Root << " with length equal to or smaller than " << MinimumRingSize[BFS.Root->GetTrueFather()-> nr] << " found." << endl);885 DoLog(1) && (Log() << Verbose(1) << "No ring containing " << *BFS.Root << " with length equal to or smaller than " << MinimumRingSize[BFS.Root->GetTrueFather()->ParticleInfo_nr] << " found." << endl); 886 886 } 887 887 }; … … 913 913 OtherAtom = (*Runner)->GetOtherAtom(Walker); 914 914 //Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *Binder << "." << endl; 915 if (BFS.ColorList[OtherAtom-> nr] == white) {915 if (BFS.ColorList[OtherAtom->ParticleInfo_nr] == white) { 916 916 BFS.TouchedStack->push_front(OtherAtom); 917 BFS.ColorList[OtherAtom-> nr] = lightgray;918 BFS.PredecessorList[OtherAtom-> nr] = Walker; // Walker is the predecessor919 BFS.ShortestPathList[OtherAtom-> nr] = BFS.ShortestPathList[Walker->nr] + 1;920 //Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << ShortestPathList[OtherAtom-> nr] << " egde(s) long." << endl;917 BFS.ColorList[OtherAtom->ParticleInfo_nr] = lightgray; 918 BFS.PredecessorList[OtherAtom->ParticleInfo_nr] = Walker; // Walker is the predecessor 919 BFS.ShortestPathList[OtherAtom->ParticleInfo_nr] = BFS.ShortestPathList[Walker->ParticleInfo_nr] + 1; 920 //Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->Name << " lightgray, its predecessor is " << Walker->Name << " and its Shortest Path is " << ShortestPathList[OtherAtom->ParticleInfo_nr] << " egde(s) long." << endl; 921 921 if (OtherAtom->GetTrueFather()->IsCyclic) { // if the other atom is connected to a ring 922 MinimumRingSize[Root->GetTrueFather()-> nr] = BFS.ShortestPathList[OtherAtom->nr] + MinimumRingSize[OtherAtom->GetTrueFather()->nr];922 MinimumRingSize[Root->GetTrueFather()->ParticleInfo_nr] = BFS.ShortestPathList[OtherAtom->ParticleInfo_nr] + MinimumRingSize[OtherAtom->GetTrueFather()->ParticleInfo_nr]; 923 923 OtherAtom = NULL; //break; 924 924 break; … … 932 932 } 933 933 } 934 BFS.ColorList[Walker-> nr] = black;934 BFS.ColorList[Walker->ParticleInfo_nr] = black; 935 935 //Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl; 936 936 } … … 956 956 Root = *iter; 957 957 958 if (MinimumRingSize[Root->GetTrueFather()-> nr] == mol->getAtomCount()) { // check whether MinimumRingSize is set, if not BFS to next where it is958 if (MinimumRingSize[Root->GetTrueFather()->ParticleInfo_nr] == mol->getAtomCount()) { // check whether MinimumRingSize is set, if not BFS to next where it is 959 959 Walker = Root; 960 960 … … 963 963 964 964 } 965 DoLog(1) && (Log() << Verbose(1) << "Minimum ring size of " << *Root << " is " << MinimumRingSize[Root->GetTrueFather()-> nr] << "." << endl);965 DoLog(1) && (Log() << Verbose(1) << "Minimum ring size of " << *Root << " is " << MinimumRingSize[Root->GetTrueFather()->ParticleInfo_nr] << "." << endl); 966 966 } 967 967 DoLog(1) && (Log() << Verbose(1) << "Minimum ring size is " << MinRingSize << ", over " << NumCycles << " cycles total." << endl); … … 1025 1025 * This is O(N) as the number of bonds per atom is bound. 1026 1026 * \param *vertex atom whose next atom::*ComponentNr is to be set 1027 * \param nr number to use1027 * \param ParticleInfo_nr number to use 1028 1028 */ 1029 1029 void molecule::SetNextComponentNumber(atom *vertex, int nr) const … … 1095 1095 1096 1096 /** Storing the bond structure of a molecule to file. 1097 * Simply stores Atom:: nr and then the Atom::nr of all bond partners per line.1097 * Simply stores Atom::ParticleInfo_nr and then the Atom::ParticleInfo_nr of all bond partners per line. 1098 1098 * \param &filename name of file 1099 1099 * \param path path to file, defaults to empty … … 1127 1127 1128 1128 /** Storing the bond structure of a molecule to file. 1129 * Simply stores Atom:: nr and then the Atom::nr of all bond partners, one per line.1129 * Simply stores Atom::ParticleInfo_nr and then the Atom::ParticleInfo_nr of all bond partners, one per line. 1130 1130 * \param &filename name of file 1131 1131 * \param path path to file, defaults to empty … … 1194 1194 Runner != ListOfBonds.end(); 1195 1195 ++Runner) { 1196 id = (*Runner)->GetOtherAtom(Walker)-> nr;1196 id = (*Runner)->GetOtherAtom(Walker)->ParticleInfo_nr; 1197 1197 j = 0; 1198 1198 for (; (j < CurrentBondsOfAtom) && (CurrentBonds[j++] != id);) … … 1217 1217 /** Checks contents of adjacency file against bond structure in structure molecule. 1218 1218 * \param *path path to file 1219 * \param **ListOfAtoms allocated (molecule::AtomCount) and filled lookup table for ids (Atom:: nr) to *Atom1219 * \param **ListOfAtoms allocated (molecule::AtomCount) and filled lookup table for ids (Atom::ParticleInfo_nr) to *Atom 1220 1220 * \return true - structure is equal, false - not equivalence 1221 1221 */ … … 1273 1273 1274 1274 /** Picks from a global stack with all back edges the ones in the fragment. 1275 * \param **ListOfLocalAtoms array of father atom:: nr to local atom::nr (reverse of atom::father)1275 * \param **ListOfLocalAtoms array of father atom::ParticleInfo_nr to local atom::ParticleInfo_nr (reverse of atom::father) 1276 1276 * \param *ReferenceStack stack with all the back egdes 1277 1277 * \param *LocalStack stack to be filled … … 1292 1292 1293 1293 do { // go through all bonds and push local ones 1294 Walker = ListOfLocalAtoms[Binder->leftatom-> nr]; // get one atom in the reference molecule1294 Walker = ListOfLocalAtoms[Binder->leftatom->ParticleInfo_nr]; // get one atom in the reference molecule 1295 1295 if (Walker != NULL) { // if this Walker exists in the subgraph ... 1296 1296 const BondList& ListOfBonds = Walker->getListOfBonds(); … … 1299 1299 ++Runner) { 1300 1300 OtherAtom = (*Runner)->GetOtherAtom(Walker); 1301 if (OtherAtom == ListOfLocalAtoms[(*Runner)->rightatom-> nr]) { // found the bond1301 if (OtherAtom == ListOfLocalAtoms[(*Runner)->rightatom->ParticleInfo_nr]) { // found the bond 1302 1302 LocalStack->push_front((*Runner)); 1303 1303 DoLog(3) && (Log() << Verbose(3) << "Found local edge " << *(*Runner) << "." << endl); … … 1339 1339 BFS.ColorList[i] = white; 1340 1340 } 1341 //BFS.ShortestPathList[Root-> nr] = 0; // done by Calloc1341 //BFS.ShortestPathList[Root->ParticleInfo_nr] = 0; // done by Calloc 1342 1342 } 1343 1343 ; … … 1356 1356 { 1357 1357 if (Binder != Bond) // let other atom white if it's via Root bond. In case it's cyclic it has to be reached again (yet Root is from OtherAtom already black, thus no problem) 1358 BFS.ColorList[OtherAtom-> nr] = lightgray;1359 BFS.PredecessorList[OtherAtom-> nr] = Walker; // Walker is the predecessor1360 BFS.ShortestPathList[OtherAtom-> nr] = BFS.ShortestPathList[Walker->nr] + 1;1361 DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " " << ((BFS.ColorList[OtherAtom-> nr] == white) ? "white" : "lightgray") << ", its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->nr] << " egde(s) long." << endl);1362 if ((((BFS.ShortestPathList[OtherAtom-> nr] < BFS.BondOrder) && (Binder != Bond)))) { // Check for maximum distance1358 BFS.ColorList[OtherAtom->ParticleInfo_nr] = lightgray; 1359 BFS.PredecessorList[OtherAtom->ParticleInfo_nr] = Walker; // Walker is the predecessor 1360 BFS.ShortestPathList[OtherAtom->ParticleInfo_nr] = BFS.ShortestPathList[Walker->ParticleInfo_nr] + 1; 1361 DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " " << ((BFS.ColorList[OtherAtom->ParticleInfo_nr] == white) ? "white" : "lightgray") << ", its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->ParticleInfo_nr] << " egde(s) long." << endl); 1362 if ((((BFS.ShortestPathList[OtherAtom->ParticleInfo_nr] < BFS.BondOrder) && (Binder != Bond)))) { // Check for maximum distance 1363 1363 DoLog(3) && (Log() << Verbose(3)); 1364 if (AddedAtomList[OtherAtom-> nr] == NULL) { // add if it's not been so far1365 AddedAtomList[OtherAtom-> nr] = Mol->AddCopyAtom(OtherAtom);1364 if (AddedAtomList[OtherAtom->ParticleInfo_nr] == NULL) { // add if it's not been so far 1365 AddedAtomList[OtherAtom->ParticleInfo_nr] = Mol->AddCopyAtom(OtherAtom); 1366 1366 DoLog(0) && (Log() << Verbose(0) << "Added OtherAtom " << OtherAtom->getName()); 1367 AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker-> nr], AddedAtomList[OtherAtom->nr], Binder);1367 AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->ParticleInfo_nr], AddedAtomList[OtherAtom->ParticleInfo_nr], Binder); 1368 1368 DoLog(0) && (Log() << Verbose(0) << " and bond " << *(AddedBondList[Binder->nr]) << ", "); 1369 1369 } else { // this code should actually never come into play (all white atoms are not yet present in BondMolecule, that's why they are white in the first place) 1370 1370 DoLog(0) && (Log() << Verbose(0) << "Not adding OtherAtom " << OtherAtom->getName()); 1371 1371 if (AddedBondList[Binder->nr] == NULL) { 1372 AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker-> nr], AddedAtomList[OtherAtom->nr], Binder);1372 AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->ParticleInfo_nr], AddedAtomList[OtherAtom->ParticleInfo_nr], Binder); 1373 1373 DoLog(0) && (Log() << Verbose(0) << ", added Bond " << *(AddedBondList[Binder->nr])); 1374 1374 } else … … 1378 1378 BFS.BFSStack->push_front(OtherAtom); 1379 1379 } else { // out of bond order, then replace 1380 if ((AddedAtomList[OtherAtom-> nr] == NULL) && (Binder->Cyclic))1381 BFS.ColorList[OtherAtom-> nr] = white; // unmark if it has not been queued/added, to make it available via its other bonds (cyclic)1380 if ((AddedAtomList[OtherAtom->ParticleInfo_nr] == NULL) && (Binder->Cyclic)) 1381 BFS.ColorList[OtherAtom->ParticleInfo_nr] = white; // unmark if it has not been queued/added, to make it available via its other bonds (cyclic) 1382 1382 if (Binder == Bond) 1383 1383 DoLog(3) && (Log() << Verbose(3) << "Not Queueing, is the Root bond"); 1384 else if (BFS.ShortestPathList[OtherAtom-> nr] >= BFS.BondOrder)1384 else if (BFS.ShortestPathList[OtherAtom->ParticleInfo_nr] >= BFS.BondOrder) 1385 1385 DoLog(3) && (Log() << Verbose(3) << "Not Queueing, is out of Bond Count of " << BFS.BondOrder); 1386 1386 if (!Binder->Cyclic) 1387 1387 DoLog(0) && (Log() << Verbose(0) << ", is not part of a cyclic bond, saturating bond with Hydrogen." << endl); 1388 1388 if (AddedBondList[Binder->nr] == NULL) { 1389 if ((AddedAtomList[OtherAtom-> nr] != NULL)) { // .. whether we add or saturate1390 AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker-> nr], AddedAtomList[OtherAtom->nr], Binder);1389 if ((AddedAtomList[OtherAtom->ParticleInfo_nr] != NULL)) { // .. whether we add or saturate 1390 AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->ParticleInfo_nr], AddedAtomList[OtherAtom->ParticleInfo_nr], Binder); 1391 1391 } else { 1392 1392 #ifdef ADDHYDROGEN 1393 if (!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker-> nr], Walker, OtherAtom, IsAngstroem))1393 if (!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->ParticleInfo_nr], Walker, OtherAtom, IsAngstroem)) 1394 1394 exit(1); 1395 1395 #endif … … 1405 1405 // This has to be a cyclic bond, check whether it's present ... 1406 1406 if (AddedBondList[Binder->nr] == NULL) { 1407 if ((Binder != Bond) && (Binder->Cyclic) && (((BFS.ShortestPathList[Walker-> nr] + 1) < BFS.BondOrder))) {1408 AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker-> nr], AddedAtomList[OtherAtom->nr], Binder);1407 if ((Binder != Bond) && (Binder->Cyclic) && (((BFS.ShortestPathList[Walker->ParticleInfo_nr] + 1) < BFS.BondOrder))) { 1408 AddedBondList[Binder->nr] = Mol->CopyBond(AddedAtomList[Walker->ParticleInfo_nr], AddedAtomList[OtherAtom->ParticleInfo_nr], Binder); 1409 1409 } else { // if it's root bond it has to broken (otherwise we would not create the fragments) 1410 1410 #ifdef ADDHYDROGEN 1411 if(!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker-> nr], Walker, OtherAtom, IsAngstroem))1411 if(!Mol->AddHydrogenReplacementAtom(Binder, AddedAtomList[Walker->ParticleInfo_nr], Walker, OtherAtom, IsAngstroem)) 1412 1412 exit(1); 1413 1413 #endif … … 1435 1435 1436 1436 // add Root if not done yet 1437 if (AddedAtomList[Root-> nr] == NULL) // add Root if not yet present1438 AddedAtomList[Root-> nr] = Mol->AddCopyAtom(Root);1437 if (AddedAtomList[Root->ParticleInfo_nr] == NULL) // add Root if not yet present 1438 AddedAtomList[Root->ParticleInfo_nr] = Mol->AddCopyAtom(Root); 1439 1439 1440 1440 BreadthFirstSearchAdd_Init(BFS, Root, BondOrder, getAtomCount(), AddedAtomList); … … 1457 1457 OtherAtom = (*Runner)->GetOtherAtom(Walker); 1458 1458 DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl); 1459 if (BFS.ColorList[OtherAtom-> nr] == white) {1459 if (BFS.ColorList[OtherAtom->ParticleInfo_nr] == white) { 1460 1460 BreadthFirstSearchAdd_UnvisitedNode(Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem); 1461 1461 } else { … … 1464 1464 } 1465 1465 } 1466 BFS.ColorList[Walker-> nr] = black;1466 BFS.ColorList[Walker->ParticleInfo_nr] = black; 1467 1467 DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->getName() << " black." << endl); 1468 1468 } … … 1501 1501 DoLog(3) && (Log() << Verbose(3) << "Filling Parent List." << endl); 1502 1502 for (molecule::const_iterator iter = mol->begin(); iter != mol->end(); ++iter) { 1503 ParentList[(*iter)->father-> nr] = (*iter);1503 ParentList[(*iter)->father->ParticleInfo_nr] = (*iter); 1504 1504 // Outputting List for debugging 1505 DoLog(4) && (Log() << Verbose(4) << "Son[" << (*iter)->father-> nr << "] of " << (*iter)->father << " is " << ParentList[(*iter)->father->nr] << "." << endl);1505 DoLog(4) && (Log() << Verbose(4) << "Son[" << (*iter)->father->ParticleInfo_nr << "] of " << (*iter)->father << " is " << ParentList[(*iter)->father->ParticleInfo_nr] << "." << endl); 1506 1506 } 1507 1507 }; … … 1520 1520 DoLog(3) && (Log() << Verbose(3) << "Creating bonds." << endl); 1521 1521 for (molecule::const_iterator iter = Father->begin(); iter != Father->end(); ++iter) { 1522 if (ParentList[(*iter)-> nr] != NULL) {1523 if (ParentList[(*iter)-> nr]->father != (*iter)) {1522 if (ParentList[(*iter)->ParticleInfo_nr] != NULL) { 1523 if (ParentList[(*iter)->ParticleInfo_nr]->father != (*iter)) { 1524 1524 status = false; 1525 1525 } else { … … 1529 1529 ++Runner) { 1530 1530 OtherAtom = (*Runner)->GetOtherAtom((*iter)); 1531 if (ParentList[OtherAtom-> nr] != NULL) { // if otheratom is also a father of an atom on this molecule, create the bond1532 DoLog(4) && (Log() << Verbose(4) << "Endpoints of Bond " << (*Runner) << " are both present: " << ParentList[(*iter)-> nr]->getName() << " and " << ParentList[OtherAtom->nr]->getName() << "." << endl);1533 mol->AddBond(ParentList[(*iter)-> nr], ParentList[OtherAtom->nr], (*Runner)->BondDegree);1531 if (ParentList[OtherAtom->ParticleInfo_nr] != NULL) { // if otheratom is also a father of an atom on this molecule, create the bond 1532 DoLog(4) && (Log() << Verbose(4) << "Endpoints of Bond " << (*Runner) << " are both present: " << ParentList[(*iter)->ParticleInfo_nr]->getName() << " and " << ParentList[OtherAtom->ParticleInfo_nr]->getName() << "." << endl); 1533 mol->AddBond(ParentList[(*iter)->ParticleInfo_nr], ParentList[OtherAtom->ParticleInfo_nr], (*Runner)->BondDegree); 1534 1534 } 1535 1535 }
Note:
See TracChangeset
for help on using the changeset viewer.