Changeset 67c92b
- Timestamp:
- Feb 3, 2011, 9:51:18 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:
- be945c
- Parents:
- ea430a
- git-author:
- Frederik Heber <heber@…> (12/17/10 18:51:30)
- git-committer:
- Frederik Heber <heber@…> (02/03/11 09:51:18)
- Location:
- src
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Helpers/defs.cpp
rea430a r67c92b 54 54 const char *STANDARDCONFIG = "unknown.conf"; //!< default filename of standard config file 55 55 const char *STANDARDELEMENTSDB = "elements.db"; //!< default filename of elements data base with masses, Z, VanDerWaals radii, ... 56 const char *STANDARDELECTRONEGATIVITYDB = "electronegativity.db"; //!< default filename of electronegativity per element number data base 56 57 const char *STANDARDVALENCEDB = "valence.db"; //!< default filename of valence number per element database 57 58 const char *STANDARDORBITALDB = "orbitals.db"; //!< default filename of orbitals per element database -
src/Helpers/defs.hpp
rea430a r67c92b 72 72 extern "C" const char *FRAGMENTPREFIX; //!< default filename prefix of BOSSANOVA fragment config and directories 73 73 extern "C" const char *STANDARDCONFIG; //!< default filename of standard config file 74 extern "C" const char *STANDARDELECTRONEGATIVITYDB; //!< default filename of electronegativity per element data base 74 75 extern "C" const char *STANDARDELEMENTSDB; //!< default filename of elements data base with masses, Z, VanDerWaals radii, ... 75 76 extern "C" const char *STANDARDVALENCEDB; //!< default filename of valence number per element database -
src/element.cpp
rea430a r67c92b 118 118 } 119 119 120 double element::getElectronegativity() const 121 { 122 return Electronegativity; 123 } 124 120 125 double element::getVanDerWaalsRadius() const 121 126 { -
src/element.hpp
rea430a r67c92b 42 42 double getMass() const; 43 43 double getCovalentRadius() const; 44 double getElectronegativity() const; 44 45 double getVanDerWaalsRadius() const; 45 46 int getAtomicNumber() const; … … 64 65 double mass; //!< mass in g/mol 65 66 double CovalentRadius; //!< covalent radius 67 double Electronegativity; //!< electronegativity in Pauling units 66 68 double VanDerWaalsRadius; //!< can-der-Waals radius 67 69 int Z; //!< atomic number -
src/elements_db.cpp
rea430a r67c92b 135 135 "; 136 136 137 const char *ElectronegativitiesDB =\ 138 "#atomic number\tEN [Pauling units], taken from http://en.wikipedia.org/wiki/Electronegativities_of_the_elements_%28data_page%29\n\ 139 1 2.2\n\ 140 2 -1\n\ 141 3 0.98\n\ 142 4 1.57\n\ 143 5 2.04\n\ 144 6 2.55\n\ 145 7 3.04\n\ 146 8 3.44\n\ 147 9 3.98\n\ 148 10 -1\n\ 149 11 0.93\n\ 150 12 1.31\n\ 151 13 1.61\n\ 152 14 1.90\n\ 153 15 2.19\n\ 154 16 2.58\n\ 155 17 3.16\n\ 156 18 -1\n\ 157 19 0.82\n\ 158 20 1.00\n\ 159 21 1.36\n\ 160 22 1.54\n\ 161 23 1.63\n\ 162 24 1.66\n\ 163 25 1.55\n\ 164 26 1.83\n\ 165 27 1.88\n\ 166 28 1.91\n\ 167 29 1.90\n\ 168 30 1.65\n\ 169 31 1.81\n\ 170 32 2.01\n\ 171 33 2.18\n\ 172 34 2.55\n\ 173 35 2.96\n\ 174 36 3.00\n\ 175 37 0.82\n\ 176 38 0.95\n\ 177 39 1.22\n\ 178 40 1.33\n\ 179 41 1.6\n\ 180 42 2.16\n\ 181 43 1.9\n\ 182 44 2.2\n\ 183 45 2.28\n\ 184 46 2.20\n\ 185 47 1.93\n\ 186 48 1.69\n\ 187 49 1.78\n\ 188 50 1.96\n\ 189 51 2.05\n\ 190 52 2.1\n\ 191 53 2.66\n\ 192 54 2.6\n\ 193 55 0.79\n\ 194 56 0.89\n\ 195 57 1.10\n\ 196 58 1.12\n\ 197 59 1.13\n\ 198 60 1.14\n\ 199 61 -1\n\ 200 62 1.17\n\ 201 63 -1\n\ 202 64 1.20\n\ 203 65 -1\n\ 204 66 1.22\n\ 205 67 1.23\n\ 206 68 1.24\n\ 207 69 1.25\n\ 208 70 -1\n\ 209 71 1.27\n\ 210 72 1.3\n\ 211 73 1.5\n\ 212 74 2.36\n\ 213 75 1.9\n\ 214 76 2.2\n\ 215 77 2.20\n\ 216 78 2.28\n\ 217 79 2.54\n\ 218 80 2.00\n\ 219 81 1.62\n\ 220 82 2.33\n\ 221 83 2.02\n\ 222 84 2.0\n\ 223 85 2.2\n\ 224 86 -1\n\ 225 87 0.7\n\ 226 88 0.9\n\ 227 89 1.1\n\ 228 90 1.3\n\ 229 91 1.5\n\ 230 92 1.38\n\ 231 93 1.36\n\ 232 94 1.28\n\ 233 95 1.3\n\ 234 96 1.3\n\ 235 97 1.3\n\ 236 98 1.3\n\ 237 99 1.3\n\ 238 100 1.3\n\ 239 101 1.3\n\ 240 102 1.3\n\ 241 "; 242 137 243 const char *HbonddistanceDB =\ 138 244 "#atomic number bond distances for single, double and triple bond (-1 no bond)\n\ -
src/elements_db.hpp
rea430a r67c92b 16 16 17 17 extern const char *elementsDB; 18 extern const char *ElectronegativitiesDB; 18 19 extern const char *HbonddistanceDB; 19 20 extern const char *HbondangleDB; -
src/periodentafel.cpp
rea430a r67c92b 28 28 #include "elements_db.hpp" 29 29 #include "Helpers/helpers.hpp" 30 #include "lists.hpp"31 30 #include "CodePatterns/Log.hpp" 31 //#include "lists.hpp" 32 32 #include "periodentafel.hpp" 33 33 #include "CodePatterns/Verbose.hpp" … … 51 51 } 52 52 { 53 stringstream input(ElectronegativitiesDB,ios_base::in); 54 #ifndef NDEBUG 55 bool status = 56 #endif 57 LoadElectronegativityDatabase(input); 58 ASSERT(status, "Electronegativities entry of element initialization failed"); 59 } 60 { 53 61 stringstream input(valenceDB,ios_base::in); 54 62 #ifndef NDEBUG 55 63 bool status = 56 64 #endif 57 LoadValenceDatabase( &input);65 LoadValenceDatabase(input); 58 66 ASSERT(status, "Valence entry of element initialization failed"); 59 67 } … … 63 71 bool status = 64 72 #endif 65 LoadOrbitalsDatabase( &input);73 LoadOrbitalsDatabase(input); 66 74 ASSERT(status, "Orbitals entry of element initialization failed"); 67 75 } … … 71 79 bool status = 72 80 #endif 73 LoadHBondAngleDatabase( &input);81 LoadHBondAngleDatabase(input); 74 82 ASSERT(status, "HBond angle entry of element initialization failed"); 75 83 } … … 79 87 bool status = 80 88 #endif 81 LoadHBondLengthsDatabase( &input);89 LoadHBondLengthsDatabase(input); 82 90 ASSERT(status, "HBond distance entry of element initialization failed"); 83 91 } … … 259 267 strncpy(filename, path, MAXSTRINGSIZE); 260 268 strncat(filename, "/", MAXSTRINGSIZE-strlen(filename)); 269 strncat(filename, STANDARDELECTRONEGATIVITYDB, MAXSTRINGSIZE-strlen(filename)); 270 input.open(filename); 271 if (!input.fail()) 272 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as electronegativity database." << endl); 273 otherstatus = otherstatus && LoadElectronegativityDatabase(input); 274 input.close(); 275 input.clear(); 276 277 // fill valence DB per element 278 strncpy(filename, path, MAXSTRINGSIZE); 279 strncat(filename, "/", MAXSTRINGSIZE-strlen(filename)); 261 280 strncat(filename, STANDARDVALENCEDB, MAXSTRINGSIZE-strlen(filename)); 262 281 input.open(filename); 263 282 if (!input.fail()) 264 283 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as valence database." << endl); 265 otherstatus = otherstatus && LoadValenceDatabase( &input);284 otherstatus = otherstatus && LoadValenceDatabase(input); 266 285 input.close(); 267 286 input.clear(); … … 274 293 if (!input.fail()) 275 294 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as orbitals database." << endl); 276 otherstatus = otherstatus && LoadOrbitalsDatabase( &input);295 otherstatus = otherstatus && LoadOrbitalsDatabase(input); 277 296 input.close(); 278 297 input.clear(); … … 285 304 if (!input.fail()) 286 305 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as H bond angle database." << endl); 287 otherstatus = otherstatus && LoadHBondAngleDatabase( &input);306 otherstatus = otherstatus && LoadHBondAngleDatabase(input); 288 307 input.close(); 289 308 input.clear(); … … 296 315 if (!input.fail()) 297 316 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as H bond length database." << endl); 298 otherstatus = otherstatus && LoadHBondLengthsDatabase( &input);317 otherstatus = otherstatus && LoadHBondLengthsDatabase(input); 299 318 input.close(); 300 319 input.clear(); … … 326 345 element *neues = new element; 327 346 input >> neues->name; 328 // (*input)>> ws;347 //input >> ws; 329 348 input >> neues->symbol; 330 // (*input)>> ws;349 //input >> ws; 331 350 input >> neues->period; 332 // (*input)>> ws;351 //input >> ws; 333 352 input >> neues->group; 334 // (*input)>> ws;353 //input >> ws; 335 354 input >> neues->block; 336 // (*input)>> ws;355 //input >> ws; 337 356 input >> neues->Z; 338 // (*input)>> ws;357 //input >> ws; 339 358 input >> neues->mass; 340 // (*input)>> ws;359 //input >> ws; 341 360 input >> neues->CovalentRadius; 342 // (*input)>> ws;361 //input >> ws; 343 362 input >> neues->VanDerWaalsRadius; 344 // (*input)>> ws;363 //input >> ws; 345 364 input >> ws; 346 365 //neues->Output((ofstream *)&cout); … … 394 413 } 395 414 415 /** load the electronegativity info. 416 * \param *input stream to parse from 417 * \return true - parsing successful, false - something went wrong 418 */ 419 bool periodentafel::LoadElectronegativityDatabase(std::istream &input) 420 { 421 char dummy[MAXSTRINGSIZE]; 422 if (!input.fail()) { 423 input.getline(dummy, MAXSTRINGSIZE); 424 while (!input.eof()) { 425 atomicNumber_t Z; 426 input >> Z; 427 ASSERT(elements.count(Z), "Element not present"); 428 input >> ws; 429 input >> elements[Z]->Electronegativity; 430 input >> ws; 431 DoLog(1) && (Log() << Verbose(1) 432 << "Element " << Z << " has " << FindElement(Z)->Electronegativity << " valence electrons." << endl); 433 } 434 return true; 435 } else 436 return false; 437 } 438 396 439 /** load the valence info. 397 440 * \param *input stream to parse from 398 441 * \return true - parsing successful, false - something went wrong 399 442 */ 400 bool periodentafel::LoadValenceDatabase(istream *input)443 bool periodentafel::LoadValenceDatabase(istream &input) 401 444 { 402 445 char dummy[MAXSTRINGSIZE]; 403 if (! (*input).fail()) {404 (*input).getline(dummy, MAXSTRINGSIZE);405 while (! (*input).eof()) {446 if (!input.fail()) { 447 input.getline(dummy, MAXSTRINGSIZE); 448 while (!input.eof()) { 406 449 atomicNumber_t Z; 407 (*input)>> Z;450 input >> Z; 408 451 ASSERT(elements.count(Z), "Element not present"); 409 (*input)>> ws;410 (*input)>> elements[Z]->Valence;411 (*input)>> ws;452 input >> ws; 453 input >> elements[Z]->Valence; 454 input >> ws; 412 455 //Log() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->Valence << " valence electrons." << endl; 413 456 } … … 421 464 * \return true - parsing successful, false - something went wrong 422 465 */ 423 bool periodentafel::LoadOrbitalsDatabase(istream *input)466 bool periodentafel::LoadOrbitalsDatabase(istream &input) 424 467 { 425 468 char dummy[MAXSTRINGSIZE]; 426 if (! (*input).fail()) {427 (*input).getline(dummy, MAXSTRINGSIZE);428 while (! (*input).eof()) {469 if (!input.fail()) { 470 input.getline(dummy, MAXSTRINGSIZE); 471 while (!input.eof()) { 429 472 atomicNumber_t Z; 430 (*input)>> Z;473 input >> Z; 431 474 ASSERT(elements.count(Z), "Element not present"); 432 (*input)>> ws;433 (*input)>> elements[Z]->NoValenceOrbitals;434 (*input)>> ws;475 input >> ws; 476 input >> elements[Z]->NoValenceOrbitals; 477 input >> ws; 435 478 //Log() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl; 436 479 } … … 444 487 * \return true - parsing successful, false - something went wrong 445 488 */ 446 bool periodentafel::LoadHBondAngleDatabase(istream *input)489 bool periodentafel::LoadHBondAngleDatabase(istream &input) 447 490 { 448 491 char dummy[MAXSTRINGSIZE]; 449 if (! (*input).fail()) {450 (*input).getline(dummy, MAXSTRINGSIZE);451 while (! (*input).eof()) {492 if (!input.fail()) { 493 input.getline(dummy, MAXSTRINGSIZE); 494 while (!input.eof()) { 452 495 atomicNumber_t Z; 453 (*input)>> Z;496 input >> Z; 454 497 ASSERT(elements.count(Z), "Element not present"); 455 (*input)>> ws;456 (*input)>> elements[Z]->HBondAngle[0];457 (*input)>> elements[Z]->HBondAngle[1];458 (*input)>> elements[Z]->HBondAngle[2];459 (*input)>> ws;498 input >> ws; 499 input >> elements[Z]->HBondAngle[0]; 500 input >> elements[Z]->HBondAngle[1]; 501 input >> elements[Z]->HBondAngle[2]; 502 input >> ws; 460 503 //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondAngle[0] << ", " << FindElement((int)tmp)->HBondAngle[1] << ", " << FindElement((int)tmp)->HBondAngle[2] << " degrees bond angle for one, two, three connected hydrogens." << endl; 461 504 } … … 469 512 * \return true - parsing successful, false - something went wrong 470 513 */ 471 bool periodentafel::LoadHBondLengthsDatabase(istream *input)514 bool periodentafel::LoadHBondLengthsDatabase(istream &input) 472 515 { 473 516 char dummy[MAXSTRINGSIZE]; 474 if (! (*input).fail()) {475 (*input).getline(dummy, MAXSTRINGSIZE);476 while (! (*input).eof()) {517 if (!input.fail()) { 518 input.getline(dummy, MAXSTRINGSIZE); 519 while (!input.eof()) { 477 520 atomicNumber_t Z; 478 (*input)>> Z;521 input >> Z; 479 522 ASSERT(elements.count(Z), "Element not present"); 480 (*input)>> ws;481 (*input)>> elements[Z]->HBondDistance[0];482 (*input)>> elements[Z]->HBondDistance[1];483 (*input)>> elements[Z]->HBondDistance[2];484 (*input)>> ws;523 input >> ws; 524 input >> elements[Z]->HBondDistance[0]; 525 input >> elements[Z]->HBondDistance[1]; 526 input >> elements[Z]->HBondDistance[2]; 527 input >> ws; 485 528 //Log() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondDistance[0] << " Angstrom typical distance to hydrogen." << endl; 486 529 } -
src/periodentafel.hpp
rea430a r67c92b 63 63 64 64 bool LoadElementsDatabase(std::istream &input); 65 bool LoadValenceDatabase(std::istream *input); 66 bool LoadOrbitalsDatabase(std::istream *input); 67 bool LoadHBondAngleDatabase(std::istream *input); 68 bool LoadHBondLengthsDatabase(std::istream *input); 65 bool LoadElectronegativityDatabase(std::istream &input); 66 bool LoadValenceDatabase(std::istream &input); 67 bool LoadOrbitalsDatabase(std::istream &input); 68 bool LoadHBondAngleDatabase(std::istream &input); 69 bool LoadHBondLengthsDatabase(std::istream &input); 69 70 70 71 elementSet elements; -
src/unittests/PeriodentafelUnitTest.cpp
rea430a r67c92b 84 84 // reload all databases 85 85 stringstream elementsDBstream(elementsDB,ios_base::in); 86 stringstream ElectronegativityDBstream(ElectronegativitiesDB,ios_base::in); 87 stringstream valenceDBstream(valenceDB,ios_base::in); 88 stringstream orbitalsDBstream(orbitalsDB,ios_base::in); 89 stringstream HbondangleDBstream(HbondangleDB,ios_base::in); 90 stringstream HbonddistanceDBstream(HbonddistanceDB,ios_base::in); 86 91 CPPUNIT_ASSERT(tafel->LoadElementsDatabase(elementsDBstream) && "General element initialization failed"); 87 CPPUNIT_ASSERT(tafel->LoadValenceDatabase(new stringstream(valenceDB,ios_base::in)) && "Valence entry of element initialization failed"); 88 CPPUNIT_ASSERT(tafel->LoadOrbitalsDatabase(new stringstream(orbitalsDB,ios_base::in)) && "Orbitals entry of element initialization failed"); 89 CPPUNIT_ASSERT(tafel->LoadHBondAngleDatabase(new stringstream(HbondangleDB,ios_base::in)) && "HBond angle entry of element initialization failed"); 90 CPPUNIT_ASSERT(tafel->LoadHBondLengthsDatabase(new stringstream(HbonddistanceDB,ios_base::in)) && "HBond distance entry of element initialization failed"); 92 CPPUNIT_ASSERT(tafel->LoadElectronegativityDatabase(ElectronegativityDBstream) && "Electronegativity entry of element initialization failed"); 93 CPPUNIT_ASSERT(tafel->LoadValenceDatabase(valenceDBstream) && "Valence entry of element initialization failed"); 94 CPPUNIT_ASSERT(tafel->LoadOrbitalsDatabase(orbitalsDBstream) && "Orbitals entry of element initialization failed"); 95 CPPUNIT_ASSERT(tafel->LoadHBondAngleDatabase(HbondangleDBstream) && "HBond angle entry of element initialization failed"); 96 CPPUNIT_ASSERT(tafel->LoadHBondLengthsDatabase(HbonddistanceDBstream) && "HBond distance entry of element initialization failed"); 91 97 // check presence of elements 92 98 atomicNumber_t Z = 1;
Note:
See TracChangeset
for help on using the changeset viewer.