Changeset 47d041 for src/Element/periodentafel.cpp
- Timestamp:
- Nov 3, 2011, 7:44:01 PM (13 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:
- 41a467
- Parents:
- 50e4e5
- git-author:
- Frederik Heber <heber@…> (10/27/11 11:53:58)
- git-committer:
- Frederik Heber <heber@…> (11/03/11 19:44:01)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Element/periodentafel.cpp
r50e4e5 r47d041 19 19 #include "CodePatterns/MemDebug.hpp" 20 20 21 #include <cstring> 22 #include <fstream> 21 23 #include <iomanip> 22 24 #include <iostream> 23 #include <fstream> 24 #include <cstring> 25 #include <sstream> 25 26 26 27 #include "CodePatterns/Assert.hpp" 28 #include "CodePatterns/Log.hpp" 27 29 #include "element.hpp" 28 30 #include "elements_db.hpp" 29 #include "CodePatterns/Log.hpp"30 31 #include "periodentafel.hpp" 31 #include "CodePatterns/Verbose.hpp"32 32 33 33 using namespace std; … … 63 63 ASSERT(!elements.count(Z), "Element is already present."); 64 64 if (pointer->getNumber() < 1 && pointer->getNumber() >= MAX_ELEMENTS) 65 DoeLog(0) && (eLog() << Verbose(0) << "Invalid Z number!\n");65 ELOG(0, "Invalid Z number!"); 66 66 pair<iterator,bool> res = elements.insert(pair<atomicNumber_t,element*>(Z,pointer)); 67 67 return res.first; … … 130 130 int Z; 131 131 do { 132 DoLog(0) && (Log() << Verbose(0) << "Atomic number Z: ");133 cin >> Z;132 std::cout << "Atomic number Z: "; 133 std::cin >> Z; 134 134 walker = this->FindElement(Z); // give type 135 135 } while (walker == NULL); … … 143 143 { 144 144 atomicNumber_t Z = 0; 145 DoLog(0) && (Log() << Verbose(0) << "Atomic number: " << Z << endl);145 std::cout << "Atomic number: " << Z; 146 146 cin >> Z; 147 147 const element *res = FindElement(Z); 148 148 if (!res) { 149 149 // TODO: make this using the constructor 150 DoLog(0) && (Log() << Verbose(0) << "Element not found in database, please enter." << endl);150 std::cout << "Element not found in database, please enter." << std::endl; 151 151 element *tmp = new element; 152 152 tmp->Z = Z; 153 DoLog(0) && (Log() << Verbose(0) << "Mass: " << endl);153 std::cout << "Mass: "; 154 154 cin >> tmp->mass; 155 DoLog(0) && (Log() << Verbose(0) << "Name [max 64 chars]: " << endl);155 std::cout << "Name [max 64 chars]: "; 156 156 cin >> tmp->name; 157 DoLog(0) && (Log() << Verbose(0) << "Short form [max 3 chars]: " << endl);157 std::cout << "Short form [max 3 chars]: "; 158 158 cin >> tmp->symbol; 159 159 AddElement(tmp); … … 275 275 input.open(filename); 276 276 if (!input.fail()) 277 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as elements database." << endl);277 LOG(0, "Using " << filename << " as elements database."); 278 278 status = status && LoadElementsDatabase(input); 279 279 input.close(); … … 286 286 input.open(filename); 287 287 if (!input.fail()) 288 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as electronegativity database." << endl);288 LOG(0, "Using " << filename << " as electronegativity database."); 289 289 otherstatus = otherstatus && LoadElectronegativityDatabase(input); 290 290 input.close(); … … 297 297 input.open(filename); 298 298 if (!input.fail()) 299 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as valence database." << endl);299 LOG(0, "Using " << filename << " as valence database."); 300 300 otherstatus = otherstatus && LoadValenceDatabase(input); 301 301 input.close(); … … 308 308 input.open(filename); 309 309 if (!input.fail()) 310 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as orbitals database." << endl);310 LOG(0, "Using " << filename << " as orbitals database."); 311 311 otherstatus = otherstatus && LoadOrbitalsDatabase(input); 312 312 input.close(); … … 319 319 input.open(filename); 320 320 if (!input.fail()) 321 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as H bond angle database." << endl);321 LOG(0, "Using " << filename << " as H bond angle database."); 322 322 otherstatus = otherstatus && LoadHBondAngleDatabase(input); 323 323 input.close(); … … 330 330 input.open(filename); 331 331 if (!input.fail()) 332 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as H bond length database." << endl);332 LOG(0, "Using " << filename << " as H bond length database."); 333 333 otherstatus = otherstatus && LoadHBondLengthsDatabase(input); 334 334 input.close(); … … 341 341 input.open(filename); 342 342 if (!input.fail()) 343 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as color database." << endl);343 LOG(0, "Using " << filename << " as color database."); 344 344 otherstatus = otherstatus && LoadColorDatabase(input); 345 345 input.close(); … … 347 347 348 348 if (!otherstatus){ 349 DoeLog(2) && (eLog()<< Verbose(2) << "Something went wrong while parsing the other databases!" << endl);349 ELOG(2, "Something went wrong while parsing the other databases!"); 350 350 } 351 351 … … 361 361 bool status = true; 362 362 string header1tmp,header2tmp; 363 // std::stringstream parsedelements; 363 364 // first parse into a map, so we can revert to old status in case something goes wront 364 365 map<atomicNumber_t,element*> parsedElements; … … 368 369 //cout << "First header: " << header1tmp << endl; 369 370 //cout << "Second header: " << header2tmp << endl; 370 // DoLog(0) && (Log() << Verbose(0)<< "Parsed elements:");371 // parsedelements << "Parsed elements:"); 371 372 while (!input.eof()) { 372 373 element *neues = new element; … … 393 394 if ((neues->getNumber() > 0) && (neues->getNumber() < MAX_ELEMENTS)) { 394 395 parsedElements[neues->Z] = neues; 395 // DoLog(0) && (Log() << Verbose(0)<< " " << *neues);396 // parsedelements << " " << *neues); 396 397 } else { 397 DoeLog(2) && (eLog() << Verbose(2) << "Detected empty line or invalid element in elements db, discarding." << endl);398 DoLog(0) && (Log() << Verbose(0)<< " <?>");398 ELOG(2, "Detected empty line or invalid element in elements db, discarding."); 399 // parsedelements << " <?>"); 399 400 delete(neues); 400 401 } 401 402 // when the input is in failed state, we most likely just read garbage 402 403 if(input.fail()) { 403 DoeLog(2) && (eLog() << Verbose(2) << "Error parsing elements db." << endl);404 ELOG(2, "Error parsing elements db."); 404 405 status = false; 405 406 break; 406 407 } 407 408 } 408 // DoLog(0) && (Log() << Verbose(0) << endl);409 409 } else { 410 DoeLog(1) && (eLog() << Verbose(1) << "Could not open the database." << endl);410 ELOG(1, "Could not open the database."); 411 411 status = false; 412 412 } 413 //LOG(0, parsedElements.str()); 413 414 414 415 if (!parsedElements.size()) … … 456 457 input >> elements[Z]->Electronegativity; 457 458 input >> ws; 458 //DoLog(1) && (Log() << Verbose(1) 459 // << "Element " << Z << " has " << FindElement(Z)->Electronegativity << " valence electrons." << endl); 459 //LOG(1, "INFO: Element " << Z << " has " << FindElement(Z)->Electronegativity << " valence electrons."); 460 460 } 461 461 return true; … … 480 480 input >> elements[Z]->Valence; 481 481 input >> ws; 482 //L og() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->Valence << " valence electrons." << endl;482 //LOG(3, "INFO: Element " << Z << " has " << FindElement(Z)->Valence << " valence electrons."); 483 483 } 484 484 return true; … … 503 503 input >> elements[Z]->NoValenceOrbitals; 504 504 input >> ws; 505 //L og() << Verbose(3) << "Element " << Z << " has " << FindElement(Z)->NoValenceOrbitals << " number of singly occupied valence orbitals." << endl;505 //LOG(3, "Element " << Z << " has " << FindElement(Z)->NoValenceOrbitals << " number of singly occupied valence orbitals."); 506 506 } 507 507 return true; … … 528 528 input >> elements[Z]->HBondAngle[2]; 529 529 input >> ws; 530 //L og() << 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;530 //LOG(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."); 531 531 } 532 532 return true; … … 553 553 input >> elements[Z]->HBondDistance[2]; 554 554 input >> ws; 555 //L og() << Verbose(3) << "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondDistance[0] << " Angstrom typical distance to hydrogen." << endl;555 //LOG(3, "Element " << (int)tmp << " has " << FindElement((int)tmp)->HBondDistance[0] << " Angstrom typical distance to hydrogen."); 556 556 } 557 557 return true;
Note:
See TracChangeset
for help on using the changeset viewer.