Changeset ce5f05
- Timestamp:
- Mar 1, 2011, 10:16:46 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:
- 3738f0
- Parents:
- 4092c5
- git-author:
- Frederik Heber <heber@…> (02/18/11 16:24:28)
- git-committer:
- Frederik Heber <heber@…> (03/01/11 10:16:46)
- Location:
- src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Helpers/defs.hpp
r4092c5 rce5f05 34 34 35 35 //enum BondOrderScheme { NoScheme, BottomUp, TopDown, ANOVA, Combined }; //!< Fragmentation scheme used in BOSS 36 37 enum EdgeType { Undetermined, TreeEdge, BackEdge }; //!< edge type in a graph after Depth-First-Search analysis.38 39 enum Shading { white, lightgray, darkgray, black }; //!< color in Breadth-First-Search analysis40 36 41 37 -
src/bond.cpp
r4092c5 rce5f05 100 100 * \return bond::Used 101 101 */ 102 enum Shading bond::IsUsed()102 enum bond::Shading bond::IsUsed() 103 103 { 104 104 return Used; … … 158 158 return (leftatom->DistanceSquared(*rightatom)); 159 159 }; 160 161 /** Returns Shading as a char string. 162 * \param color the Shading 163 * \return string of the flag 164 */ 165 string bond::GetColor(enum Shading color) const 166 { 167 switch (color) { 168 case white: 169 return "white"; 170 break; 171 case lightgray: 172 return "lightgray"; 173 break; 174 case darkgray: 175 return "darkgray"; 176 break; 177 case black: 178 return "black"; 179 break; 180 default: 181 return "uncolored"; 182 break; 183 }; 184 } -
src/bond.hpp
r4092c5 rce5f05 34 34 class bond { 35 35 public: 36 atom *leftatom; //!< first bond partner 37 atom *rightatom; //!< second bond partner 38 int HydrogenBond; //!< Number of hydrogen atoms in the bond 39 int BondDegree; //!< single, double, triple, ... bond 40 int nr; //!< unique number in a molecule, updated by molecule::CreateAdjacencyList() 41 bool Cyclic; //!< flag whether bond is part of a cycle or not, given in DepthFirstSearchAnalysis() 42 enum EdgeType Type;//!< whether this is a tree or back edge 36 enum EdgeType { Undetermined, TreeEdge, BackEdge }; //!< edge type in a graph after Depth-First-Search analysis. 37 38 enum Shading { white, lightgray, darkgray, black }; //!< color in Breadth-First-Search analysis 39 40 atom *leftatom; //!< first bond partner 41 atom *rightatom; //!< second bond partner 42 int HydrogenBond; //!< Number of hydrogen atoms in the bond 43 int BondDegree; //!< single, double, triple, ... bond 44 int nr; //!< unique number in a molecule, updated by BondGraph::CreateAdjacencyForList() 45 bool Cyclic; //!< flag whether bond is part of a cycle or not, given in DepthFirstSearchAnalysis() 46 enum EdgeType Type;//!< whether this is a tree or back edge 43 47 44 48 atom * GetOtherAtom(const ParticleInfo * const Atom) const; … … 56 60 ~bond(); 57 61 62 string GetColor(enum Shading color) const; 63 58 64 private: 59 65 enum Shading Used; //!< marker in depth-first search, DepthFirstSearchAnalysis() -
src/molecule.cpp
r4092c5 rce5f05 397 397 Binder = AddBond(BottomOrigin, FirstOtherAtom, 1); 398 398 Binder->Cyclic = false; 399 Binder->Type = TreeEdge;399 Binder->Type = bond::TreeEdge; 400 400 break; 401 401 case 2: … … 493 493 Binder = AddBond(BottomOrigin, FirstOtherAtom, 1); 494 494 Binder->Cyclic = false; 495 Binder->Type = TreeEdge;495 Binder->Type = bond::TreeEdge; 496 496 Binder = AddBond(BottomOrigin, SecondOtherAtom, 1); 497 497 Binder->Cyclic = false; 498 Binder->Type = TreeEdge;498 Binder->Type = bond::TreeEdge; 499 499 break; 500 500 case 3: … … 576 576 Binder = AddBond(BottomOrigin, FirstOtherAtom, 1); 577 577 Binder->Cyclic = false; 578 Binder->Type = TreeEdge;578 Binder->Type = bond::TreeEdge; 579 579 Binder = AddBond(BottomOrigin, SecondOtherAtom, 1); 580 580 Binder->Cyclic = false; 581 Binder->Type = TreeEdge;581 Binder->Type = bond::TreeEdge; 582 582 Binder = AddBond(BottomOrigin, ThirdOtherAtom, 1); 583 583 Binder->Cyclic = false; 584 Binder->Type = TreeEdge;584 Binder->Type = bond::TreeEdge; 585 585 break; 586 586 default: -
src/molecule.hpp
r4092c5 rce5f05 224 224 int CountCyclicBonds(); 225 225 bool CheckForConnectedSubgraph(KeySet *Fragment); 226 string GetColor(enum Shading color) const;227 226 bond * CopyBond(atom *left, atom *right, bond *CopyBond); 228 227 -
src/molecule_fragmentation.cpp
r4092c5 rce5f05 1794 1794 atom *OtherWalker = NULL; 1795 1795 RealSpaceMatrix matrix = World::getInstance().getDomain().getM(); 1796 enum Shading *ColorList = NULL;1796 enum bond::Shading *ColorList = NULL; 1797 1797 double tmp; 1798 1798 //bool LastBond = true; // only needed to due list construct … … 1805 1805 DoLog(2) && (Log() << Verbose(2) << "Begin of ScanForPeriodicCorrection." << endl); 1806 1806 1807 ColorList = new enum Shading[getAtomCount()];1807 ColorList = new enum bond::Shading[getAtomCount()]; 1808 1808 for (int i=0;i<getAtomCount();i++) 1809 ColorList[i] = (enum Shading)0;1809 ColorList[i] = (enum bond::Shading)0; 1810 1810 if (flag) { 1811 1811 // remove bonds that are beyond bonddistance … … 1849 1849 // apply to all atoms of first component via BFS 1850 1850 for (int i=getAtomCount();i--;) 1851 ColorList[i] = white;1851 ColorList[i] = bond::white; 1852 1852 AtomStack->push_front(Binder->leftatom); 1853 1853 while (!AtomStack->empty()) { … … 1855 1855 AtomStack->pop_front(); 1856 1856 //Log() << Verbose (3) << "Current Walker is: " << *Walker << "." << endl; 1857 ColorList[Walker->getNr()] = b lack; // mark as explored1857 ColorList[Walker->getNr()] = bond::black; // mark as explored 1858 1858 *Walker += Translationvector; // translate 1859 1859 const BondList& ListOfBonds = Walker->getListOfBonds(); … … 1863 1863 if ((*Runner) != Binder) { 1864 1864 OtherWalker = (*Runner)->GetOtherAtom(Walker); 1865 if (ColorList[OtherWalker->getNr()] == white) {1865 if (ColorList[OtherWalker->getNr()] == bond::white) { 1866 1866 AtomStack->push_front(OtherWalker); // push if yet unexplored 1867 1867 } -
src/molecule_graph.cpp
r4092c5 rce5f05 48 48 atom **PredecessorList; 49 49 int *ShortestPathList; 50 enum Shading *ColorList;50 enum bond::Shading *ColorList; 51 51 std::deque<atom *> *BFSStack; 52 52 std::deque<atom *> *TouchedStack; … … 308 308 for(molecule::iterator AtomRunner = begin(); AtomRunner != end(); ++AtomRunner) { 309 309 const BondList& ListOfBonds = (*AtomRunner)->getListOfBonds(); 310 if ((!ListOfBonds.empty()) && ((*ListOfBonds.begin())->Type == Undetermined)) {310 if ((!ListOfBonds.empty()) && ((*ListOfBonds.begin())->Type == bond::Undetermined)) { 311 311 DoLog(0) && (Log() << Verbose(0) << "No Depth-First-Search analysis performed so far, calling ..." << endl); 312 312 Subgraphs = DepthFirstSearchAnalysis(BackEdgeStack); … … 334 334 ; 335 335 336 /** Returns Shading as a char string.337 * \param color the Shading338 * \return string of the flag339 */340 string molecule::GetColor(enum Shading color) const341 {342 switch (color) {343 case white:344 return "white";345 break;346 case lightgray:347 return "lightgray";348 break;349 case darkgray:350 return "darkgray";351 break;352 case black:353 return "black";354 break;355 default:356 return "uncolored";357 break;358 };359 }360 ;361 336 362 337 /** Sets atom::GraphNr and atom::LowpointNr to BFSAccounting::CurrentGraphNr. … … 397 372 DoLog(2) && (Log() << Verbose(2) << "Current Unused Bond is " << *Binder << "." << endl); 398 373 // (4) Mark Binder used, ... 399 Binder->MarkUsed(b lack);374 Binder->MarkUsed(bond::black); 400 375 OtherAtom = Binder->GetOtherAtom(Walker); 401 376 DoLog(2) && (Log() << Verbose(2) << "(4) OtherAtom is " << OtherAtom->getName() << "." << endl); 402 377 if (OtherAtom->GraphNr != -1) { 403 378 // (4a) ... if "other" atom has been visited (GraphNr != 0), set lowpoint to minimum of both, go to (3) 404 Binder->Type = BackEdge;379 Binder->Type = bond::BackEdge; 405 380 DFS.BackEdgeStack->push_front(Binder); 406 381 Walker->LowpointNr = (Walker->LowpointNr < OtherAtom->GraphNr) ? Walker->LowpointNr : OtherAtom->GraphNr; … … 408 383 } else { 409 384 // (4b) ... otherwise set OtherAtom as Ancestor of Walker and Walker as OtherAtom, go to (2) 410 Binder->Type = TreeEdge;385 Binder->Type = bond::TreeEdge; 411 386 OtherAtom->Ancestor = Walker; 412 387 Walker = OtherAtom; … … 664 639 if (DoLog(2)) { 665 640 ostream &out = (Log() << Verbose(2)); 666 out << ((Binder->Type == TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <";641 out << ((Binder->Type == bond::TreeEdge) ? "TreeEdge " : "BackEdge ") << *Binder << ": <"; 667 642 out << ((Binder->leftatom->SeparationVertex) ? "SP," : "") << "L" << Binder->leftatom->LowpointNr << " G" << Binder->leftatom->GraphNr << " Comp."; 668 643 Binder->leftatom->OutputComponentNumber(&out); … … 688 663 BFS.PredecessorList = new atom*[AtomCount]; 689 664 BFS.ShortestPathList = new int[AtomCount]; 690 BFS.ColorList = new enum Shading[AtomCount];665 BFS.ColorList = new enum bond::Shading[AtomCount]; 691 666 BFS.BFSStack = new std::deque<atom *> (AtomCount); 692 667 BFS.TouchedStack = new std::deque<atom *> (AtomCount); … … 695 670 BFS.ShortestPathList[i] = -1; 696 671 BFS.PredecessorList[i] = 0; 697 BFS.ColorList[i] = white;672 BFS.ColorList[i] = bond::white; 698 673 } 699 674 }; … … 723 698 BFS.PredecessorList[Walker->getNr()] = NULL; 724 699 BFS.ShortestPathList[Walker->getNr()] = -1; 725 BFS.ColorList[Walker->getNr()] = white;700 BFS.ColorList[Walker->getNr()] = bond::white; 726 701 } 727 702 }; … … 762 737 #endif 763 738 DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl); 764 if (BFS.ColorList[OtherAtom->getNr()] == white) {739 if (BFS.ColorList[OtherAtom->getNr()] == bond::white) { 765 740 BFS.TouchedStack->push_front(OtherAtom); 766 BFS.ColorList[OtherAtom->getNr()] = lightgray;741 BFS.ColorList[OtherAtom->getNr()] = bond::lightgray; 767 742 BFS.PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor 768 743 BFS.ShortestPathList[OtherAtom->getNr()] = BFS.ShortestPathList[Walker->getNr()] + 1; … … 780 755 } else { 781 756 DoLog(2) && (Log() << Verbose(2) << "Skipping hydrogen atom " << *OtherAtom << "." << endl); 782 BFS.ColorList[OtherAtom->getNr()] = b lack;757 BFS.ColorList[OtherAtom->getNr()] = bond::black; 783 758 } 784 759 #endif … … 787 762 } 788 763 } 789 BFS.ColorList[Walker->getNr()] = b lack;764 BFS.ColorList[Walker->getNr()] = bond::black; 790 765 DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->getName() << " black." << endl); 791 766 if (OtherAtom == BFS.Root) { // if we have found the root, check whether this cycle wasn't already found beforehand … … 807 782 BFS.PredecessorList[OtherAtom->getNr()] = NULL; 808 783 BFS.ShortestPathList[OtherAtom->getNr()] = -1; 809 BFS.ColorList[OtherAtom->getNr()] = white;784 BFS.ColorList[OtherAtom->getNr()] = bond::white; 810 785 // rats ... deque has no find() 811 786 std::deque<atom *>::iterator iter = find( … … 894 869 OtherAtom = (*Runner)->GetOtherAtom(Walker); 895 870 //Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->Name << " for bond " << *Binder << "." << endl; 896 if (BFS.ColorList[OtherAtom->getNr()] == white) {871 if (BFS.ColorList[OtherAtom->getNr()] == bond::white) { 897 872 BFS.TouchedStack->push_front(OtherAtom); 898 BFS.ColorList[OtherAtom->getNr()] = lightgray;873 BFS.ColorList[OtherAtom->getNr()] = bond::lightgray; 899 874 BFS.PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor 900 875 BFS.ShortestPathList[OtherAtom->getNr()] = BFS.ShortestPathList[Walker->getNr()] + 1; … … 913 888 } 914 889 } 915 BFS.ColorList[Walker->getNr()] = b lack;890 BFS.ColorList[Walker->getNr()] = bond::black; 916 891 //Log() << Verbose(1) << "Coloring Walker " << Walker->Name << " black." << endl; 917 892 } … … 1041 1016 Runner != ListOfBonds.end(); 1042 1017 ++Runner) 1043 if ((*Runner)->IsUsed() == white)1018 if ((*Runner)->IsUsed() == bond::white) 1044 1019 return ((*Runner)); 1045 1020 return NULL; … … 1304 1279 BFS.PredecessorList = new atom*[AtomCount]; 1305 1280 BFS.ShortestPathList = new int[AtomCount]; 1306 BFS.ColorList = new enum Shading[AtomCount];1281 BFS.ColorList = new enum bond::Shading[AtomCount]; 1307 1282 BFS.BFSStack = new std::deque<atom *> (AtomCount); 1308 1283 … … 1316 1291 BFS.ShortestPathList[i] = -1; 1317 1292 if ((AddedAtomList != NULL) && (AddedAtomList[i] != NULL)) // mark already present atoms (i.e. Root and maybe others) as visited 1318 BFS.ColorList[i] = lightgray;1293 BFS.ColorList[i] = bond::lightgray; 1319 1294 else 1320 BFS.ColorList[i] = white;1295 BFS.ColorList[i] = bond::white; 1321 1296 } 1322 1297 //BFS.ShortestPathList[Root->getNr()] = 0; // done by Calloc … … 1337 1312 { 1338 1313 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) 1339 BFS.ColorList[OtherAtom->getNr()] = lightgray;1314 BFS.ColorList[OtherAtom->getNr()] = bond::lightgray; 1340 1315 BFS.PredecessorList[OtherAtom->getNr()] = Walker; // Walker is the predecessor 1341 1316 BFS.ShortestPathList[OtherAtom->getNr()] = BFS.ShortestPathList[Walker->getNr()] + 1; 1342 DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " " << ((BFS.ColorList[OtherAtom->getNr()] == white) ? "white" : "lightgray") << ", its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->getNr()] << " egde(s) long." << endl);1317 DoLog(2) && (Log() << Verbose(2) << "Coloring OtherAtom " << OtherAtom->getName() << " " << ((BFS.ColorList[OtherAtom->getNr()] == bond::white) ? "white" : "lightgray") << ", its predecessor is " << Walker->getName() << " and its Shortest Path is " << BFS.ShortestPathList[OtherAtom->getNr()] << " egde(s) long." << endl); 1343 1318 if ((((BFS.ShortestPathList[OtherAtom->getNr()] < BFS.BondOrder) && (Binder != Bond)))) { // Check for maximum distance 1344 1319 DoLog(3) && (Log() << Verbose(3)); … … 1360 1335 } else { // out of bond order, then replace 1361 1336 if ((AddedAtomList[OtherAtom->getNr()] == NULL) && (Binder->Cyclic)) 1362 BFS.ColorList[OtherAtom->getNr()] = white; // unmark if it has not been queued/added, to make it available via its other bonds (cyclic)1337 BFS.ColorList[OtherAtom->getNr()] = bond::white; // unmark if it has not been queued/added, to make it available via its other bonds (cyclic) 1363 1338 if (Binder == Bond) 1364 1339 DoLog(3) && (Log() << Verbose(3) << "Not Queueing, is the Root bond"); … … 1438 1413 OtherAtom = (*Runner)->GetOtherAtom(Walker); 1439 1414 DoLog(2) && (Log() << Verbose(2) << "Current OtherAtom is: " << OtherAtom->getName() << " for bond " << *(*Runner) << "." << endl); 1440 if (BFS.ColorList[OtherAtom->getNr()] == white) {1415 if (BFS.ColorList[OtherAtom->getNr()] == bond::white) { 1441 1416 BreadthFirstSearchAdd_UnvisitedNode(Mol, BFS, Walker, OtherAtom, Binder, Bond, AddedAtomList, AddedBondList, IsAngstroem); 1442 1417 } else { … … 1445 1420 } 1446 1421 } 1447 BFS.ColorList[Walker->getNr()] = b lack;1422 BFS.ColorList[Walker->getNr()] = bond::black; 1448 1423 DoLog(1) && (Log() << Verbose(1) << "Coloring Walker " << Walker->getName() << " black." << endl); 1449 1424 }
Note:
See TracChangeset
for help on using the changeset viewer.