Changeset 73916f for src/Parser/PcpParser.cpp
- Timestamp:
- Dec 16, 2010, 5:32: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, Candidate_v1.7.0, 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:
- fc5c3a
- Parents:
- 512f85
- git-author:
- Frederik Heber <heber@…> (12/11/10 15:57:00)
- git-committer:
- Frederik Heber <heber@…> (12/16/10 17:32:22)
- File:
-
- 1 edited
-
src/Parser/PcpParser.cpp (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/PcpParser.cpp
r512f85 r73916f 368 368 } 369 369 370 /** Saves the World into a PCP config file. 371 * \param *file output stream to save to 372 */ 373 void PcpParser::save(std::ostream* file) 370 /** 371 * Saves the \a atoms into as a PCP file. 372 * 373 * \param file where to save the state 374 * \param atoms atoms to store 375 */ 376 void PcpParser::save(std::ostream* file, const std::vector<atom *> &atoms) 374 377 { 375 378 DoLog(0) && (Log() << Verbose(0) << "Saving changes to pcp." << std::endl); … … 379 382 if (!file->fail()) { 380 383 // calculate number of Psis 381 vector<atom *> allatoms = World::getInstance().getAllAtoms(); 382 CalculateOrbitals(allatoms); 384 CalculateOrbitals(atoms); 383 385 *file << "# ParallelCarParinello - main configuration file - created with molecuilder" << endl; 384 386 *file << endl; … … 468 470 *file << "RelativeCoord\t" << RelativeCoord << "\t# whether ion coordinates are relative (1) or absolute (0)" << endl; 469 471 map<int, int> ZtoIndexMap; 470 OutputElements(file, a llatoms, ZtoIndexMap);471 OutputAtoms(file, a llatoms, ZtoIndexMap);472 OutputElements(file, atoms, ZtoIndexMap); 473 OutputAtoms(file, atoms, ZtoIndexMap); 472 474 } else { 473 475 DoeLog(1) && (eLog()<< Verbose(1) << "Cannot open output file." << endl); … … 479 481 * \param &allatoms all atoms to store away 480 482 */ 481 void PcpParser::CalculateOrbitals( vector<atom *> &allatoms)483 void PcpParser::CalculateOrbitals(const std::vector<atom *> &allatoms) 482 484 { 483 485 PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0; 484 for (vector<atom *>:: iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) {486 for (vector<atom *>::const_iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) { 485 487 PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()->getNoValenceOrbitals(); 486 488 } … … 512 514 * \param &ZtoIndexMap map of which atoms belong to which ion number 513 515 */ 514 void PcpParser::OutputElements(ostream *file, vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)516 void PcpParser::OutputElements(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap) 515 517 { 516 518 map<int, int> PresentElements; 517 519 pair < map<int, int>::iterator, bool > Inserter; 518 520 // insert all found elements into the map 519 for (vector<atom *>:: iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {521 for (vector<atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) { 520 522 Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1)); 521 523 if (!Inserter.second) // increase if present … … 542 544 * \param &ZtoIndexMap map of which atoms belong to which ion number 543 545 */ 544 void PcpParser::OutputAtoms(ostream *file, vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)546 void PcpParser::OutputAtoms(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap) 545 547 { 546 548 *file << "#Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon)" << endl; … … 548 550 pair < map<int, int>::iterator, bool > Inserter; 549 551 int nr = 0; 550 for (vector<atom *>:: iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {552 for (vector<atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) { 551 553 Inserter = ZtoCountMap.insert( pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1) ); 552 554 if (!Inserter.second)
Note:
See TracChangeset
for help on using the changeset viewer.
