Changeset fa649a
- Timestamp:
- Nov 2, 2009, 12:50:57 PM (15 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:
- 7218f8
- Parents:
- 34e0013
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/boundary.cpp
r34e0013 rfa649a 649 649 const double h = x.Norm(); // distance of CoG to triangle 650 650 const double PyramidVolume = (1. / 3.) * G * h; // this formula holds for _all_ pyramids (independent of n-edge base or (not) centered peak) 651 *out << Verbose(2) << "Area of triangle is " << G << " "651 *out << Verbose(2) << "Area of triangle is " << setprecision(10) << G << " " 652 652 << (IsAngstroem ? "angstrom" : "atomiclength") << "^2, height is " 653 653 << h << " and the volume is " << PyramidVolume << " " … … 655 655 volume += PyramidVolume; 656 656 } 657 *out << Verbose(0) << "RESULT: The summed volume is " << setprecision( 10)657 *out << Verbose(0) << "RESULT: The summed volume is " << setprecision(8) 658 658 << volume << " " << (IsAngstroem ? "angstrom" : "atomiclength") << "^3." 659 659 << endl; … … 705 705 void PrepareClustersinWater(ofstream *out, config *configuration, molecule *mol, double ClusterVolume, double celldensity) 706 706 { 707 bool IsAngstroem = NULL;707 bool IsAngstroem = true; 708 708 double *GreatestDiameter = NULL; 709 709 Boundaries *BoundaryPoints = NULL; -
src/builder.cpp
r34e0013 rfa649a 1454 1454 if (argv[1][0] != '-') { 1455 1455 // simply create a new molecule, wherein the config file is loaded and the manipulation takes place 1456 mol = new molecule(periode);1457 mol->ActiveFlag = true;1458 molecules->insert(mol);1459 1460 1456 cout << Verbose(0) << "Config file given." << endl; 1461 1457 test.open(argv[1], ios::in); … … 1476 1472 ConfigFileName = argv[1]; 1477 1473 cout << Verbose(1) << "Specified config file found, parsing ... "; 1478 switch (configuration.TestSyntax(ConfigFileName, periode , mol)) {1474 switch (configuration.TestSyntax(ConfigFileName, periode)) { 1479 1475 case 1: 1480 1476 cout << "new syntax." << endl; 1481 configuration.Load(ConfigFileName, BondGraphFileName, periode, mol );1477 configuration.Load(ConfigFileName, BondGraphFileName, periode, molecules); 1482 1478 configPresent = present; 1483 1479 break; 1484 1480 case 0: 1485 1481 cout << "old syntax." << endl; 1486 configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, mol );1482 configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, molecules); 1487 1483 configPresent = present; 1488 1484 break; … … 1494 1490 } else 1495 1491 configPresent = absent; 1492 // set mol to first active molecule 1493 if (molecules->ListOfMolecules.size() != 0) { 1494 for (MoleculeList::iterator ListRunner = molecules->ListOfMolecules.begin(); ListRunner != molecules->ListOfMolecules.end(); ListRunner++) 1495 if ((*ListRunner)->ActiveFlag) { 1496 mol = *ListRunner; 1497 break; 1498 } 1499 } 1500 if (mol == NULL) { 1501 mol = new molecule(periode); 1502 mol->ActiveFlag = true; 1503 molecules->insert(mol); 1504 } 1505 1496 1506 // 4. parse again through options, now for those depending on elements db and config presence 1497 1507 argptr = 1; -
src/config.cpp
r34e0013 rfa649a 9 9 #include "element.hpp" 10 10 #include "helpers.hpp" 11 #include "lists.hpp" 11 12 #include "molecule.hpp" 12 13 #include "memoryallocator.hpp" … … 565 566 * \param *filename filename of config file to be tested 566 567 * \param *periode pointer to a periodentafel class with all elements 567 * \param *mol pointer to molecule containing all atoms of the molecule568 568 * \return 0 - old syntax, 1 - new syntax, -1 - unknown syntax 569 569 */ 570 int config::TestSyntax(const char * const filename, const periodentafel * const periode , const molecule * const mol) const570 int config::TestSyntax(const char * const filename, const periodentafel * const periode) const 571 571 { 572 572 int test; … … 833 833 * \param BondGraphFileName file name of the bond length table file, if string is left blank, no table is parsed. 834 834 * \param *periode pointer to a periodentafel class with all elements 835 * \param * mol pointer to molecule containing all atoms of the molecule836 */ 837 void config::Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, molecule * const &mol)835 * \param *&MolList pointer to MoleculeListClass, on return containing all parsed molecules in system 836 */ 837 void config::Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList) 838 838 { 839 molecule *mol = new molecule(periode); 839 840 ifstream *file = new ifstream(filename); 840 841 if (file == NULL) { … … 1052 1053 // 3. parse the molecule in 1053 1054 LoadMolecule(mol, FileBuffer, periode, FastParsing); 1055 mol->ActiveFlag = true; 1056 MolList->insert(mol); 1054 1057 1055 1058 // 4. dissect the molecule into connected subgraphs … … 1063 1066 * \param BondGraphFileName file name of the bond length table file, if string is left blank, no table is parsed. 1064 1067 * \param *periode pointer to a periodentafel class with all elements 1065 * \param * mol pointer to molecule containing all atoms of the molecule1066 */ 1067 void config::LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, molecule * const &mol)1068 * \param *&MolList pointer to MoleculeListClass, on return containing all parsed molecules in system 1069 */ 1070 void config::LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList) 1068 1071 { 1072 molecule *mol = new molecule(periode); 1069 1073 ifstream *file = new ifstream(filename); 1070 1074 if (file == NULL) { … … 1091 1095 int verbose = 0; 1092 1096 1097 mol->ActiveFlag = true; 1098 MolList->insert(mol); 1093 1099 /* Namen einlesen */ 1094 1100 -
src/config.hpp
r34e0013 rfa649a 10 10 11 11 using namespace std; 12 13 class MoleculeListClass; 12 14 13 15 /*********************************************** includes ***********************************/ … … 134 136 ~config(); 135 137 136 int TestSyntax(const char * const filename, const periodentafel * const periode , const molecule * const mol) const;137 void Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, molecule * const &mol);138 void LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, molecule * const &mol);138 int TestSyntax(const char * const filename, const periodentafel * const periode) const; 139 void Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList); 140 void LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, MoleculeListClass * const &MolList); 139 141 void RetrieveConfigPathAndName(const string filename); 140 142 bool Save(const char * const filename, const periodentafel * const periode, molecule * const mol) const; -
src/molecule.cpp
r34e0013 rfa649a 26 26 * Initialises molecule list with correctly referenced start and end, and sets molecule::last_atom to zero. 27 27 */ 28 molecule::molecule(periodentafel *teil) 28 molecule::molecule(const periodentafel * const teil) : elemente(teil), start(new atom), end(new atom), 29 first(new bond(start, end, 1, -1)), last(new bond(start, end, 1, -1)), MDSteps(0), AtomCount(0), 30 BondCount(0), ElementCount(0), NoNonHydrogen(0), NoNonBonds(0), NoCyclicBonds(0), BondDistance(0.), 31 ActiveFlag(false), IndexNr(-1), last_atom(0), InternalPointer(start) 29 32 { 30 33 // init atom chain list 31 start = new atom;32 end = new atom;33 34 start->father = NULL; 34 35 end->father = NULL; 35 36 link(start,end); 36 InternalPointer = start; 37 37 38 // init bond chain list 38 first = new bond(start, end, 1, -1);39 last = new bond(start, end, 1, -1);40 39 link(first,last); 40 41 41 // other stuff 42 MDSteps = 0;43 last_atom = 0;44 elemente = teil;45 AtomCount = 0;46 BondCount = 0;47 NoNonBonds = 0;48 NoNonHydrogen = 0;49 NoCyclicBonds = 0;50 ElementCount = 0;51 42 for(int i=MAX_ELEMENTS;i--;) 52 43 ElementsInMolecule[i] = 0; … … 54 45 cell_size[1] = cell_size[3] = cell_size[4]= 0.; 55 46 strcpy(name,"none"); 56 IndexNr = -1;57 ActiveFlag = false;58 47 }; 59 48 … … 555 544 }; 556 545 557 /** Remove bond from bond chain list .546 /** Remove bond from bond chain list and from the both atom::ListOfBonds. 558 547 * \todo Function not implemented yet 559 548 * \param *pointer bond pointer … … 563 552 { 564 553 //cerr << Verbose(1) << "molecule::RemoveBond: Function not implemented yet." << endl; 554 pointer->leftatom->RegisterBond(pointer); 555 pointer->rightatom->RegisterBond(pointer); 565 556 removewithoutcheck(pointer); 566 557 return true; -
src/molecule.hpp
r34e0013 rfa649a 83 83 public: 84 84 double cell_size[6];//!< cell size 85 periodentafel *elemente; //!< periodic table with each element85 const periodentafel * const elemente; //!< periodic table with each element 86 86 atom *start; //!< start of atom list 87 87 atom *end; //!< end of atom list … … 93 93 int ElementCount; //!< how many unique elements are therein 94 94 int ElementsInMolecule[MAX_ELEMENTS]; //!< list whether element (sorted by atomic number) is alread present or not 95 int NoNonHydrogen; //!< number of non-hydrogen atoms in molecule96 int NoNonBonds; //!< number of non-hydrogen bonds in molecule97 int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis()95 mutable int NoNonHydrogen; //!< number of non-hydrogen atoms in molecule 96 mutable int NoNonBonds; //!< number of non-hydrogen bonds in molecule 97 mutable int NoCyclicBonds; //!< number of cyclic bonds in molecule, by DepthFirstSearchAnalysis() 98 98 double BondDistance; //!< typical bond distance used in CreateAdjacencyList() and furtheron 99 99 bool ActiveFlag; //!< in a MoleculeListClass used to discern active from inactive molecules … … 102 102 int IndexNr; //!< index of molecule in a MoleculeListClass 103 103 104 molecule( periodentafel *teil);104 molecule(const periodentafel * const teil); 105 105 virtual ~molecule(); 106 106 … … 241 241 void CreateAdjacencyListFromDbondFile(ofstream *out, ifstream *output); 242 242 void CreateAdjacencyList(ofstream *out, double bonddistance, bool IsAngstroem, void (BondGraph::*f)(BondedParticle * const , BondedParticle * const , double &, double &, bool), BondGraph *BG = NULL); 243 int CorrectBondDegree(ofstream *out) ;244 void OutputBondsList(ofstream *out) ;245 void CyclicBondAnalysis() ;246 void OutputGraphInfoPerAtom(ofstream *out) ;247 void OutputGraphInfoPerBond(ofstream *out) ;243 int CorrectBondDegree(ofstream *out) const; 244 void OutputBondsList(ofstream *out) const; 245 void CyclicBondAnalysis() const; 246 void OutputGraphInfoPerAtom(ofstream *out) const; 247 void OutputGraphInfoPerBond(ofstream *out) const; 248 248 249 249 250 250 // Graph analysis 251 MoleculeLeafClass * DepthFirstSearchAnalysis(ofstream *out, class StackClass<bond *> *&BackEdgeStack); 252 void CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> *BackEdgeStack, int *&MinimumRingSize); 253 bool PickLocalBackEdges(ofstream *out, atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack); 254 bond * FindNextUnused(atom *vertex); 255 void SetNextComponentNumber(atom *vertex, int nr); 256 void InitComponentNumbers(); 257 void ResetAllBondsToUnused(); 251 MoleculeLeafClass * DepthFirstSearchAnalysis(ofstream *out, class StackClass<bond *> *&BackEdgeStack) const; 252 void CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> *BackEdgeStack, int *&MinimumRingSize) const; 253 bool PickLocalBackEdges(ofstream *out, atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack) const; 254 bond * FindNextUnused(atom *vertex) const; 255 void SetNextComponentNumber(atom *vertex, int nr) const; 256 void ResetAllBondsToUnused() const; 258 257 int CountCyclicBonds(ofstream *out); 259 258 bool CheckForConnectedSubgraph(ofstream *out, KeySet *Fragment); 260 string GetColor(enum Shading color) ;259 string GetColor(enum Shading color) const; 261 260 bond * CopyBond(atom *left, atom *right, bond *CopyBond); 262 261 … … 351 350 352 351 bool AddLeaf(molecule *ptr, MoleculeLeafClass *Previous); 353 bool FillBondStructureFromReference(ofstream *out, molecule *reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList = false);352 bool FillBondStructureFromReference(ofstream *out, const molecule * const reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList = false); 354 353 bool FillRootStackForSubgraphs(ofstream *out, KeyStack *&RootStack, bool *AtomMask, int &FragmentCounter); 355 354 bool AssignKeySetsToFragment(ofstream *out, molecule *reference, Graph *KeySetList, atom ***&ListOfLocalAtoms, Graph **&FragmentList, int &FragmentCounter, bool FreeList = false); -
src/molecule_graph.cpp
r34e0013 rfa649a 190 190 * \param output stream 191 191 */ 192 void molecule::OutputBondsList(ofstream *out) 192 void molecule::OutputBondsList(ofstream *out) const 193 193 { 194 194 *out << Verbose(1) << endl << "From contents of bond chain list:"; … … 210 210 * \return number of bonds that could not be corrected 211 211 */ 212 int molecule::CorrectBondDegree(ofstream *out) 212 int molecule::CorrectBondDegree(ofstream *out) const 213 213 { 214 214 int No = 0; … … 265 265 * \return string of the flag 266 266 */ 267 string molecule::GetColor(enum Shading color) 267 string molecule::GetColor(enum Shading color) const 268 268 { 269 269 switch (color) { … … 314 314 * \param &DFS DFS accounting data 315 315 */ 316 void DepthFirstSearchAnalysis_ProbeAlongUnusedBond(ofstream *out, molecule *mol, atom *&Walker, bond *&Binder, struct DFSAccounting &DFS)316 void DepthFirstSearchAnalysis_ProbeAlongUnusedBond(ofstream *out, const molecule * const mol, atom *&Walker, bond *&Binder, struct DFSAccounting &DFS) 317 317 { 318 318 atom *OtherAtom = NULL; … … 357 357 * \param &DFS DFS accounting data 358 358 */ 359 void DepthFirstSearchAnalysis_CheckForaNewComponent(ofstream *out, molecule *mol, atom *&Walker, struct DFSAccounting &DFS, MoleculeLeafClass *&LeafWalker)359 void DepthFirstSearchAnalysis_CheckForaNewComponent(ofstream *out, const molecule * const mol, atom *&Walker, struct DFSAccounting &DFS, MoleculeLeafClass *&LeafWalker) 360 360 { 361 361 atom *OtherAtom = NULL; … … 403 403 * \param &DFS DFS accounting data 404 404 */ 405 void DepthFirstSearchAnalysis_CleanRootStackDownTillWalker(ofstream *out, molecule *mol, atom *&Walker, bond *&Binder, struct DFSAccounting &DFS, MoleculeLeafClass *&LeafWalker)405 void DepthFirstSearchAnalysis_CleanRootStackDownTillWalker(ofstream *out, const molecule * const mol, atom *&Walker, bond *&Binder, struct DFSAccounting &DFS, MoleculeLeafClass *&LeafWalker) 406 406 { 407 407 atom *OtherAtom = NULL; … … 467 467 * \return list of each disconnected subgraph as an individual molecule class structure 468 468 */ 469 MoleculeLeafClass * molecule::DepthFirstSearchAnalysis(ofstream *out, class StackClass<bond *> *&BackEdgeStack) 469 MoleculeLeafClass * molecule::DepthFirstSearchAnalysis(ofstream *out, class StackClass<bond *> *&BackEdgeStack) const 470 470 { 471 471 struct DFSAccounting DFS; … … 548 548 /** Scans through all bonds and set bond::Cyclic to true where atom::LowpointNr of both ends is equal: LP criterion. 549 549 */ 550 void molecule::CyclicBondAnalysis() 550 void molecule::CyclicBondAnalysis() const 551 551 { 552 552 NoCyclicBonds = 0; … … 565 565 * \param *out output stream 566 566 */ 567 void molecule::OutputGraphInfoPerAtom(ofstream *out) 567 void molecule::OutputGraphInfoPerAtom(ofstream *out) const 568 568 { 569 569 *out << Verbose(1) << "Final graph info for each atom is:" << endl; … … 575 575 * \param *out output stream 576 576 */ 577 void molecule::OutputGraphInfoPerBond(ofstream *out) 577 void molecule::OutputGraphInfoPerBond(ofstream *out) const 578 578 { 579 579 *out << Verbose(1) << "Final graph info for each bond is:" << endl; … … 829 829 * \param *mol molecule with atoms 830 830 */ 831 void CyclicStructureAnalysis_AssignRingSizetoNonCycleMembers(ofstream *out, int *&MinimumRingSize, int &MinRingSize, int &NumCycles, molecule *mol)831 void CyclicStructureAnalysis_AssignRingSizetoNonCycleMembers(ofstream *out, int *&MinimumRingSize, int &MinRingSize, int &NumCycles, const molecule * const mol) 832 832 { 833 833 atom *Root = NULL; … … 864 864 * \todo BFS from the not-same-LP to find back to starting point of tributary cycle over more than one bond 865 865 */ 866 void molecule::CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> * BackEdgeStack, int *&MinimumRingSize) 866 void molecule::CyclicStructureAnalysis(ofstream *out, class StackClass<bond *> * BackEdgeStack, int *&MinimumRingSize) const 867 867 { 868 868 struct BFSAccounting BFS; … … 900 900 901 901 CyclicStructureAnalysis_AssignRingSizetoNonCycleMembers(out, MinimumRingSize, MinRingSize, NumCycles, this); 902 903 } 904 ; 902 }; 905 903 906 904 /** Sets the next component number. … … 909 907 * \param nr number to use 910 908 */ 911 void molecule::SetNextComponentNumber(atom *vertex, int nr) 909 void molecule::SetNextComponentNumber(atom *vertex, int nr) const 912 910 { 913 911 size_t i = 0; … … 931 929 * \return bond class or NULL 932 930 */ 933 bond * molecule::FindNextUnused(atom *vertex) 931 bond * molecule::FindNextUnused(atom *vertex) const 934 932 { 935 933 for (BondList::const_iterator Runner = vertex->ListOfBonds.begin(); Runner != vertex->ListOfBonds.end(); (++Runner)) … … 943 941 * \return true - success, false - -failure 944 942 */ 945 void molecule::ResetAllBondsToUnused() 943 void molecule::ResetAllBondsToUnused() const 946 944 { 947 945 bond *Binder = first; … … 1103 1101 * \return true - everything ok, false - ReferenceStack was empty 1104 1102 */ 1105 bool molecule::PickLocalBackEdges(ofstream *out, atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack) 1103 bool molecule::PickLocalBackEdges(ofstream *out, atom **ListOfLocalAtoms, class StackClass<bond *> *&ReferenceStack, class StackClass<bond *> *&LocalStack) const 1106 1104 { 1107 1105 bool status = true; -
src/moleculelist.cpp
r34e0013 rfa649a 814 814 * \return true - success, false - faoilure 815 815 */ 816 bool MoleculeLeafClass::FillBondStructureFromReference(ofstream *out, molecule *reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList)816 bool MoleculeLeafClass::FillBondStructureFromReference(ofstream *out, const molecule * const reference, int &FragmentCounter, atom ***&ListOfLocalAtoms, bool FreeList) 817 817 { 818 818 atom *Walker = NULL;
Note:
See TracChangeset
for help on using the changeset viewer.