Changeset 61745cc
- Timestamp:
- Jun 10, 2010, 4:17:22 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:
- 198494
- Parents:
- 7e6b00
- Location:
- src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/periodentafel.cpp
r7e6b00 r61745cc 70 70 * \param *pointer element to be removed 71 71 */ 72 voidperiodentafel::RemoveElement(element * const pointer)73 { 74 RemoveElement(pointer->getNumber());72 size_t periodentafel::RemoveElement(element * const pointer) 73 { 74 return RemoveElement(pointer->getNumber()); 75 75 }; 76 76 … … 78 78 * \param Z element to be removed 79 79 */ 80 voidperiodentafel::RemoveElement(atomicNumber_t Z)81 { 82 elements.erase(Z);80 size_t periodentafel::RemoveElement(atomicNumber_t Z) 81 { 82 return elements.erase(Z); 83 83 }; 84 84 … … 233 233 strncat(filename, STANDARDELEMENTSDB, MAXSTRINGSIZE-strlen(filename)); 234 234 input.open(filename); 235 if (!input.fail()) 236 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as elements database." << endl); 235 237 status = status && LoadElementsDatabase(&input); 238 input.close(); 239 input.clear(); 236 240 237 241 // fill valence DB per element … … 240 244 strncat(filename, STANDARDVALENCEDB, MAXSTRINGSIZE-strlen(filename)); 241 245 input.open(filename); 246 if (!input.fail()) 247 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as valence database." << endl); 242 248 otherstatus = otherstatus && LoadValenceDatabase(&input); 249 input.close(); 250 input.clear(); 243 251 244 252 // fill orbitals DB per element … … 247 255 strncat(filename, STANDARDORBITALDB, MAXSTRINGSIZE-strlen(filename)); 248 256 input.open(filename); 257 if (!input.fail()) 258 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as orbitals database." << endl); 249 259 otherstatus = otherstatus && LoadOrbitalsDatabase(&input); 260 input.close(); 261 input.clear(); 250 262 251 263 // fill H-BondAngle DB per element … … 254 266 strncat(filename, STANDARDHBONDANGLEDB, MAXSTRINGSIZE-strlen(filename)); 255 267 input.open(filename); 268 if (!input.fail()) 269 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as H bond angle database." << endl); 256 270 otherstatus = otherstatus && LoadHBondAngleDatabase(&input); 271 input.close(); 272 input.clear(); 257 273 258 274 // fill H-BondDistance DB per element … … 261 277 strncat(filename, STANDARDHBONDDISTANCEDB, MAXSTRINGSIZE-strlen(filename)); 262 278 input.open(filename); 279 if (!input.fail()) 280 DoLog(0) && (Log() << Verbose(0) << "Using " << filename << " as H bond length database." << endl); 263 281 otherstatus = otherstatus && LoadHBondLengthsDatabase(&input); 282 input.close(); 283 input.clear(); 264 284 265 285 if (!otherstatus){ … … 278 298 bool status = true; 279 299 int counter = 0; 300 pair< std::map<atomicNumber_t,element*>::iterator, bool > InserterTest; 280 301 if (!(*input).fail()) { 281 302 (*input).getline(header1, MAXSTRINGSIZE); … … 303 324 //(*input) >> ws; 304 325 (*input) >> ws; 305 if (elements.count(neues->Z)) {// if element already present, remove and delete it306 element * const Elemental = FindElement(neues->Z);307 ASSERT(Elemental != NULL, "element should be present but is not??");308 RemoveElement(Elemental);309 delete(Elemental);310 }311 326 //neues->Output((ofstream *)&cout); 312 if ((neues->Z > 0) && (neues->Z < MAX_ELEMENTS)) { 313 DoLog(0) && (Log() << Verbose(0) << " " << neues->symbol); 314 elements[neues->getNumber()] = neues; 327 if ((neues->getNumber() > 0) && (neues->getNumber() < MAX_ELEMENTS)) { 328 if (elements.count(neues->getNumber())) {// if element already present, remove and delete old one (i.e. replace it) 329 //cout << neues->symbol << " is present already." << endl; 330 element * const Elemental = FindElement(neues->getNumber()); 331 ASSERT(Elemental != NULL, "element should be present but is not??"); 332 *Elemental = *neues; 333 } else { 334 InserterTest = elements.insert(pair <atomicNumber_t,element*> (neues->getNumber(), neues)); 335 ASSERT(InserterTest.second, "Could not insert new element into periodentafel on LoadElementsDatabase()."); 336 } 337 DoLog(0) && (Log() << Verbose(0) << " " << elements[neues->getNumber()]->symbol); 315 338 counter++; 316 339 } else { … … 321 344 } 322 345 DoLog(0) && (Log() << Verbose(0) << endl); 323 } else 346 } else { 347 DoeLog(1) && (eLog() << Verbose(1) << "Could not open the database." << endl); 324 348 status = false; 349 } 325 350 326 351 if (counter == 0) -
src/periodentafel.hpp
r7e6b00 r61745cc 44 44 45 45 iterator AddElement(element * const pointer); 46 voidRemoveElement(element * const pointer);47 voidRemoveElement(atomicNumber_t);46 size_t RemoveElement(element * const pointer); 47 size_t RemoveElement(atomicNumber_t); 48 48 void CleanupPeriodtable(); 49 49 element * const FindElement(atomicNumber_t) const;
Note:
See TracChangeset
for help on using the changeset viewer.