- Timestamp:
- Oct 30, 2009, 4:09:29 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:
- fa649a
- Parents:
- b21a64
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/bondgraph.cpp
rb21a64 r34e0013 32 32 33 33 /** Parses the bond lengths in a given file and puts them int a matrix form. 34 * Allocates \a MatrixContainer and uses MatrixContainer::ParseMatrix(). 34 * Allocates \a MatrixContainer for BondGraph::BondLengthMatrix, using MatrixContainer::ParseMatrix(), 35 * but only if parsing is successfull. Otherwise variable is left as NULL. 35 36 * \param *out output stream for debugging 36 37 * \param filename file with bond lengths to parse … … 40 41 { 41 42 bool status = true; 43 MatrixContainer *TempContainer = NULL; 42 44 43 45 // allocate MatrixContainer … … 46 48 delete(BondLengthMatrix); 47 49 } 48 BondLengthMatrix= new MatrixContainer;50 TempContainer = new MatrixContainer; 49 51 50 52 // parse in matrix 51 BondLengthMatrix->ParseMatrix(filename.c_str(), 0, 1, 0);53 status = TempContainer->ParseMatrix(filename.c_str(), 0, 1, 0); 52 54 53 55 // find greatest distance 54 56 max_distance=0; 55 for(int i=0;i<BondLengthMatrix->RowCounter[0];i++) 56 for(int j=i;j<BondLengthMatrix->ColumnCounter[0];j++) 57 if (BondLengthMatrix->Matrix[0][i][j] > max_distance) 58 max_distance = BondLengthMatrix->Matrix[0][i][j]; 57 if (status) { 58 for(int i=0;i<TempContainer->RowCounter[0];i++) 59 for(int j=i;j<TempContainer->ColumnCounter[0];j++) 60 if (TempContainer->Matrix[0][i][j] > max_distance) 61 max_distance = TempContainer->Matrix[0][i][j]; 62 } 59 63 64 if (status) // set to not NULL only if matrix was parsed 65 BondLengthMatrix = TempContainer; 66 else { 67 BondLengthMatrix = NULL; 68 delete(TempContainer); 69 } 60 70 return status; 61 71 }; … … 70 80 bool status = true; 71 81 72 if (BondLengthMatrix == NULL) 73 return false; 74 mol->CreateAdjacencyList(out, max_distance, IsAngstroem, &BondGraph::BondLengthMatrixMinMaxDistance, this); 82 if (mol->start->next == mol->end) // only construct if molecule is not empty 83 return false; 84 85 if (BondLengthMatrix == NULL) // no bond length matrix parsed? 86 mol->CreateAdjacencyList(out, max_distance, IsAngstroem, &BondGraph::CovalentMinMaxDistance, this); 87 else 88 mol->CreateAdjacencyList(out, max_distance, IsAngstroem, &BondGraph::BondLengthMatrixMinMaxDistance, this); 75 89 76 90 return status; … … 84 98 double BondGraph::GetBondLength(int firstZ, int secondZ) 85 99 { 86 return (BondLengthMatrix->Matrix[0][firstZ][secondZ]); 100 if (BondLengthMatrix == NULL) 101 return( -1. ); 102 else 103 return (BondLengthMatrix->Matrix[0][firstZ][secondZ]); 87 104 }; 88 105 … … 113 130 void BondGraph::BondLengthMatrixMinMaxDistance(BondedParticle * const Walker, BondedParticle * const OtherWalker, double &MinDistance, double &MaxDistance, bool IsAngstroem) 114 131 { 115 if (BondLengthMatrix ->Matrix== NULL) {// safety measure if no matrix has been parsed yet132 if (BondLengthMatrix == NULL) {// safety measure if no matrix has been parsed yet 116 133 cerr << Verbose(1) << "WARNING: BondLengthMatrixMinMaxDistance() called without having parsed the bond length matrix yet!" << endl; 117 134 CovalentMinMaxDistance(Walker, OtherWalker, MinDistance, MaxDistance, IsAngstroem); -
src/builder.cpp
rb21a64 r34e0013 1451 1451 return 1; 1452 1452 } 1453 // 3b. Find config file name and parse if possible 1453 // 3b. Find config file name and parse if possible, also BondGraphFileName 1454 1454 if (argv[1][0] != '-') { 1455 1455 // simply create a new molecule, wherein the config file is loaded and the manipulation takes place … … 1479 1479 case 1: 1480 1480 cout << "new syntax." << endl; 1481 configuration.Load(ConfigFileName, periode, mol);1481 configuration.Load(ConfigFileName, BondGraphFileName, periode, mol); 1482 1482 configPresent = present; 1483 1483 break; 1484 1484 case 0: 1485 1485 cout << "old syntax." << endl; 1486 configuration.LoadOld(ConfigFileName, periode, mol);1486 configuration.LoadOld(ConfigFileName, BondGraphFileName, periode, mol); 1487 1487 configPresent = present; 1488 1488 break; … … 1494 1494 } else 1495 1495 configPresent = absent; 1496 // 3c. parse the bond graph file if given1497 configuration.BG = new BondGraph(configuration.GetIsAngstroem());1498 if (configuration.BG->LoadBondLengthTable((ofstream *)&cout, BondGraphFileName)) {1499 cout << Verbose(0) << "Bond length table loaded successfully." << endl;1500 } else {1501 cout << Verbose(0) << "Bond length table loading failed." << endl;1502 return 1;1503 }1504 1496 // 4. parse again through options, now for those depending on elements db and config presence 1505 1497 argptr = 1; -
src/config.cpp
rb21a64 r34e0013 831 831 /** Initializes config file structure by loading elements from a give file. 832 832 * \param *file input file stream being the opened config file 833 * \param BondGraphFileName file name of the bond length table file, if string is left blank, no table is parsed. 833 834 * \param *periode pointer to a periodentafel class with all elements 834 835 * \param *mol pointer to molecule containing all atoms of the molecule 835 836 */ 836 void config::Load(const char * const filename, const periodentafel * const periode, molecule * const &mol)837 void config::Load(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, molecule * const &mol) 837 838 { 838 839 ifstream *file = new ifstream(filename); … … 860 861 /* Namen einlesen */ 861 862 863 // 1. parse in options 862 864 ParseForParameter(verbose,FileBuffer, "mainname", 0, 1, 1, string_type, (config::mainname), 1, critical); 863 865 ParseForParameter(verbose,FileBuffer, "defaultpath", 0, 1, 1, string_type, (config::defaultpath), 1, critical); … … 1040 1042 config::StructOpt = 0; 1041 1043 1044 // 2. parse the bond graph file if given 1045 BG = new BondGraph(IsAngstroem); 1046 if (BG->LoadBondLengthTable((ofstream *)&cout, BondGraphFileName)) { 1047 cout << Verbose(0) << "Bond length table loaded successfully." << endl; 1048 } else { 1049 cout << Verbose(0) << "Bond length table loading failed." << endl; 1050 } 1051 1052 // 3. parse the molecule in 1042 1053 LoadMolecule(mol, FileBuffer, periode, FastParsing); 1054 1055 // 4. dissect the molecule into connected subgraphs 1056 BG->ConstructBondGraph((ofstream *)&cout, mol); 1043 1057 1044 1058 delete(FileBuffer); … … 1047 1061 /** Initializes config file structure by loading elements from a give file with old pcp syntax. 1048 1062 * \param *file input file stream being the opened config file with old pcp syntax 1063 * \param BondGraphFileName file name of the bond length table file, if string is left blank, no table is parsed. 1049 1064 * \param *periode pointer to a periodentafel class with all elements 1050 1065 * \param *mol pointer to molecule containing all atoms of the molecule 1051 1066 */ 1052 void config::LoadOld(const char * const filename, const periodentafel * const periode, molecule * const &mol)1067 void config::LoadOld(const char * const filename, const string &BondGraphFileName, const periodentafel * const periode, molecule * const &mol) 1053 1068 { 1054 1069 ifstream *file = new ifstream(filename); … … 1207 1222 config::StructOpt = 0; 1208 1223 1224 1225 // 2. parse the bond graph file if given 1226 BG = new BondGraph(IsAngstroem); 1227 if (BG->LoadBondLengthTable((ofstream *)&cout, BondGraphFileName)) { 1228 cout << Verbose(0) << "Bond length table loaded successfully." << endl; 1229 } else { 1230 cout << Verbose(0) << "Bond length table loading failed." << endl; 1231 } 1232 1209 1233 // Routine from builder.cpp 1210 1211 1234 1212 1235 for (i=MAX_ELEMENTS;i--;) -
src/config.hpp
rb21a64 r34e0013 135 135 136 136 int TestSyntax(const char * const filename, const periodentafel * const periode, const molecule * const mol) const; 137 void Load(const char * const filename, const periodentafel * const periode, molecule * const &mol);138 void LoadOld(const char * const filename, const periodentafel * const periode, molecule * const &mol);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); 139 139 void RetrieveConfigPathAndName(const string filename); 140 140 bool Save(const char * const filename, const periodentafel * const periode, molecule * const mol) const; -
src/molecule_graph.cpp
rb21a64 r34e0013 122 122 *out << Verbose(1) << "AtomCount " << AtomCount << "." << endl; 123 123 124 if ( AtomCount != 0) {124 if ((AtomCount > 1) && (bonddistance > 1.)) { 125 125 LC = new LinkedCell(this, bonddistance); 126 126
Note:
See TracChangeset
for help on using the changeset viewer.