Changeset fac58f for src/Parser
- Timestamp:
- Jul 24, 2015, 4:44:35 PM (9 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:
- f3b597
- Parents:
- 99db9b
- git-author:
- Frederik Heber <heber@…> (06/02/15 08:52:11)
- git-committer:
- Frederik Heber <heber@…> (07/24/15 16:44:35)
- Location:
- src/Parser
- Files:
-
- 26 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/FormatParser.hpp
r99db9b rfac58f 76 76 ASSERT(0, "FormatParser<>::load() - unspecialized function cannot be called."); 77 77 } 78 void save(std::ostream *file, const std::vector< atom *> &atoms)78 void save(std::ostream *file, const std::vector<const atom *> &atoms) 79 79 { 80 80 ASSERT(0, "FormatParser<>::save() - unspecialized function cannot be called."); -
src/Parser/FormatParserInterface.hpp
r99db9b rfac58f 34 34 FormatParserInterface() {} 35 35 virtual ~FormatParserInterface() {} 36 virtual void save(std::ostream* file, const std::vector< atom *> &atoms)=0;36 virtual void save(std::ostream* file, const std::vector<const atom *> &atoms)=0; 37 37 virtual void load(std::istream* file)=0; 38 38 virtual void setOstream(std::ostream* file)=0; -
src/Parser/FormatParserStorage.cpp
r99db9b rfac58f 317 317 bool FormatParserStorage::saveSelectedAtoms(std::ostream &output, std::string suffix) 318 318 { 319 std::vector<atom *> atoms = World::getInstance().getSelectedAtoms(); 319 const std::vector<const atom *> atoms = 320 const_cast<const World &>(World::getInstance()).getSelectedAtoms(); 320 321 return save(output, suffix, atoms); 321 322 } … … 333 334 bool FormatParserStorage::saveSelectedMolecules(std::ostream &output, std::string suffix) 334 335 { 335 std::vector<molecule *> molecules = World::getInstance().getSelectedMolecules(); 336 std::map<size_t, atom *> IdAtoms; 337 for (std::vector<molecule *>::const_iterator MolIter = molecules.begin(); 336 const std::vector<const molecule *> molecules = 337 const_cast<const World &>(World::getInstance()).getSelectedMolecules(); 338 std::map<size_t, const atom *> IdAtoms; 339 for (std::vector<const molecule *>::const_iterator MolIter = molecules.begin(); 338 340 MolIter != molecules.end(); 339 341 ++MolIter) { 340 for(molecule:: iterator AtomIter = (*MolIter)->begin();342 for(molecule::const_iterator AtomIter = (*MolIter)->begin(); 341 343 AtomIter != (*MolIter)->end(); 342 344 ++AtomIter) { … … 344 346 } 345 347 } 346 std::vector< atom *> atoms;348 std::vector<const atom *> atoms; 347 349 atoms.reserve(IdAtoms.size()); 348 for (std::map<size_t, atom *>::const_iterator iter = IdAtoms.begin();350 for (std::map<size_t, const atom *>::const_iterator iter = IdAtoms.begin(); 349 351 iter != IdAtoms.end(); 350 352 ++iter) { … … 361 363 bool FormatParserStorage::saveWorld(std::ostream &output, std::string suffix) 362 364 { 363 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 365 const std::vector<const atom *> atoms = 366 const_cast<const World &>(World::getInstance()).getAllAtoms(); 364 367 return save(output, suffix, atoms); 365 368 } … … 370 373 * \return true - storing ok, false - suffix unknown 371 374 */ 372 bool FormatParserStorage::save(std::ostream &output, std::string suffix, const std::vector<atom *> &atoms) 375 bool FormatParserStorage::save( 376 std::ostream &output, 377 std::string suffix, 378 const std::vector<const atom *> &atoms) 373 379 { 374 380 enum ParserTypes type = getTypeFromSuffix(suffix); -
src/Parser/FormatParserStorage.hpp
r99db9b rfac58f 40 40 bool load(std::string &filename); 41 41 bool load(std::istream &input, std::string &suffix); 42 bool save(std::ostream &output, std::string suffix, const std::vector< atom *> &atoms);42 bool save(std::ostream &output, std::string suffix, const std::vector<const atom *> &atoms); 43 43 bool saveSelectedAtoms(std::ostream &output, std::string suffix); 44 44 bool saveSelectedMolecules(std::ostream &output, std::string suffix); -
src/Parser/FormatParser_common.cpp
r99db9b rfac58f 84 84 void FormatParser_common::update(Observable *publisher) { 85 85 if (saveStream != NULL) { // only store when a saveStream is given 86 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 86 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 87 getAllAtoms(); 87 88 save(saveStream, atoms); 88 89 } -
src/Parser/MpqcParser.cpp
r99db9b rfac58f 291 291 * \param atoms atoms to store 292 292 */ 293 void FormatParser< mpqc >::save(ostream *file, const std::vector< atom *> &atoms)293 void FormatParser< mpqc >::save(ostream *file, const std::vector<const atom *> &atoms) 294 294 { 295 295 Vector center; -
src/Parser/MpqcParser.hpp
r99db9b rfac58f 52 52 53 53 void load(std::istream *file); 54 void save(std::ostream *file, const std::vector< atom *> &atoms);54 void save(std::ostream *file, const std::vector<const atom *> &atoms); 55 55 56 56 /** Getter for parameter set. -
src/Parser/PcpParser.cpp
r99db9b rfac58f 402 402 * \param atoms atoms to store 403 403 */ 404 void FormatParser< pcp >::save(std::ostream* file, const std::vector< atom *> &atoms)404 void FormatParser< pcp >::save(std::ostream* file, const std::vector<const atom *> &atoms) 405 405 { 406 406 LOG(2, "DEBUG: Saving changes to pcp."); … … 509 509 * \param &allatoms all atoms to store away 510 510 */ 511 void FormatParser< pcp >::CalculateOrbitals(const std::vector< atom *> &allatoms)511 void FormatParser< pcp >::CalculateOrbitals(const std::vector<const atom *> &allatoms) 512 512 { 513 513 PlaneWaveSpecifics.MaxPsiDouble = PlaneWaveSpecifics.PsiMaxNoDown = PlaneWaveSpecifics.PsiMaxNoUp = PlaneWaveSpecifics.PsiType = 0; 514 for (vector< atom *>::const_iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) {514 for (vector<const atom *>::const_iterator runner = allatoms.begin(); runner != allatoms.end(); ++runner) { 515 515 PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()->getNoValenceOrbitals(); 516 516 } … … 542 542 * \param &ZtoIndexMap map of which atoms belong to which ion number 543 543 */ 544 void FormatParser< pcp >::OutputElements(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap) 544 void FormatParser< pcp >::OutputElements( 545 ostream *file, 546 const std::vector<const atom *> &allatoms, 547 map<int, int> &ZtoIndexMap) 545 548 { 546 549 map<int, int> PresentElements; 547 550 pair < map<int, int>::iterator, bool > Inserter; 548 551 // insert all found elements into the map 549 for (vector< atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {552 for (vector<const atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) { 550 553 Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1)); 551 554 if (!Inserter.second) // increase if present … … 572 575 * \param &ZtoIndexMap map of which atoms belong to which ion number 573 576 */ 574 void FormatParser< pcp >::OutputAtoms(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap) 577 void FormatParser< pcp >::OutputAtoms( 578 ostream *file, 579 const std::vector<const atom *> &allatoms, 580 map<int, int> &ZtoIndexMap) 575 581 { 576 582 *file << "#Ion_TypeNr._Nr.R[0] R[1] R[2] MoveType (0 MoveIon, 1 FixedIon)" << endl; 577 583 map<int, int> ZtoCountMap; 578 map< atom *, int> AtomtoCountMap;584 map<const atom *, int> AtomtoCountMap; 579 585 pair < map<int, int>::iterator, bool > Inserter; 580 586 bool ContinueStatus = true; … … 584 590 int nr = 0; 585 591 ContinueStatus = false; 586 for (vector< atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) {592 for (vector<const atom *>::const_iterator AtomRunner = allatoms.begin();AtomRunner != allatoms.end();++AtomRunner) { 587 593 if ((*AtomRunner)->getTrajectorySize() > step) { 588 594 if (step == 0) { // fill list only on first step -
src/Parser/PcpParser.hpp
r99db9b rfac58f 49 49 virtual ~FormatParser(); 50 50 void load(std::istream* file); 51 void save(std::ostream* file, const std::vector< atom *> &atoms);51 void save(std::ostream* file, const std::vector<const atom *> &atoms); 52 52 53 53 bool operator==(const FormatParser< pcp >& b) const; … … 56 56 57 57 void ParseThermostats(class ConfigFileBuffer * const fb); 58 void OutputAtoms(std::ostream *file, const std::vector<atom *> &allatoms, std::map<int, int> &ZtoIndexMap); 59 void OutputElements(std::ostream *file, const std::vector<atom *> &allatoms, std::map<int, int> &ZtoIndexMap); 60 void CalculateOrbitals(const std::vector<atom *> &allatoms); 58 void OutputAtoms( 59 std::ostream *file, 60 const std::vector<const atom *> &allatoms, 61 std::map<int, int> &ZtoIndexMap); 62 void OutputElements( 63 std::ostream *file, 64 const std::vector<const atom *> &allatoms, 65 std::map<int, int> &ZtoIndexMap); 66 void CalculateOrbitals( 67 const std::vector<const atom *> &allatoms); 61 68 62 69 class StructParallelization { -
src/Parser/PdbParser.cpp
r99db9b rfac58f 194 194 * \param atoms atoms to store 195 195 */ 196 void FormatParser< pdb >::save(ostream* file, const std::vector<atom *> &AtomList) 196 void FormatParser< pdb >::save( 197 ostream* file, 198 const std::vector<const atom *> &AtomList) 197 199 { 198 200 LOG(2, "DEBUG: Saving changes to pdb."); … … 211 213 // (new atoms might have been added) 212 214 int AtomNo = 1; // serial number starts at 1 in pdb 213 for (vector< atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {215 for (vector<const atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) { 214 216 PdbAtomInfoContainer &atomInfo = getadditionalAtomData(*atomIt); 215 217 associateLocaltoGlobalId(AtomNo, (*atomIt)->getId()); … … 238 240 std::map<size_t,size_t> MolIdMap; 239 241 size_t MolNo = 1; // residue number starts at 1 in pdb 240 for (vector< atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {242 for (vector<const atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) { 241 243 const molecule *mol = (*atomIt)->getMolecule(); 242 244 if ((mol != NULL) && (MolIdMap.find(mol->getId()) == MolIdMap.end())) { … … 254 256 255 257 // write ATOMs 256 for (vector< atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {258 for (vector<const atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) { 257 259 PdbAtomInfoContainer &atomInfo = getadditionalAtomData(*atomIt); 258 260 // gather info about residue … … 298 300 299 301 // write CONECTs 300 for (vector< atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) {302 for (vector<const atom *>::const_iterator atomIt = AtomList.begin(); atomIt != AtomList.end(); atomIt++) { 301 303 writeNeighbors(file, 4, *atomIt); 302 304 } … … 357 359 * @return 358 360 */ 359 PdbAtomInfoContainer& FormatParser< pdb >::getadditionalAtomData( atom *_atom)361 PdbAtomInfoContainer& FormatParser< pdb >::getadditionalAtomData(const atom * const _atom) 360 362 { 361 363 if (additionalAtomData.find(_atom->getId()) != additionalAtomData.end()) { … … 498 500 * \param *currentAtom to the atom of which to take the neighbor information 499 501 */ 500 void FormatParser< pdb >::writeNeighbors(ostream* file, int MaxnumberOfNeighbors, atom* currentAtom) { 502 void FormatParser< pdb >::writeNeighbors( 503 ostream* file, 504 int MaxnumberOfNeighbors, 505 const atom * const currentAtom) { 501 506 int MaxNo = MaxnumberOfNeighbors; 502 507 int charsleft = 80; -
src/Parser/PdbParser.hpp
r99db9b rfac58f 53 53 virtual ~FormatParser(); 54 54 void load(std::istream* file); 55 void save(std::ostream* file, const std::vector< atom *> &atoms);55 void save(std::ostream* file, const std::vector<const atom *> &atoms); 56 56 57 57 bool operator==(const FormatParser< pdb>& b) const; 58 void printAtomInfo(const atom * newAtom) const;58 void printAtomInfo(const atom * const newAtom) const; 59 59 60 60 protected: … … 71 71 // std::string adaptIdDependentDataString(std::string data); 72 72 bool isUsedField(std::string fieldName); 73 void writeNeighbors(std::ostream* file, int numberOfNeighbors, atom* currentAtom);73 void writeNeighbors(std::ostream* file, int numberOfNeighbors, const atom* currentAtom); 74 74 void saveLine(std::ostream* file, const PdbAtomInfoContainer &atomInfo); 75 75 76 76 // internal getter and setter 77 77 bool isPresentadditionalAtomData(const atomId_t _id) const; 78 PdbAtomInfoContainer& getadditionalAtomData( atom *_atom);78 PdbAtomInfoContainer& getadditionalAtomData(const atom *_atom); 79 79 80 80 // internal helper functions -
src/Parser/Psi3Parser.cpp
r99db9b rfac58f 183 183 * \param atoms atoms to store 184 184 */ 185 void FormatParser< psi3 >::save(ostream *file, const std::vector< atom *> &atoms)185 void FormatParser< psi3 >::save(ostream *file, const std::vector<const atom *> &atoms) 186 186 { 187 187 Vector center; … … 189 189 190 190 // calculate center 191 for (std::vector< atom *>::const_iterator runner = atoms.begin();runner != atoms.end(); ++runner)191 for (std::vector<const atom *>::const_iterator runner = atoms.begin();runner != atoms.end(); ++runner) 192 192 center += (*runner)->getPosition(); 193 193 center.Scale(1./(double)atoms.size()); … … 258 258 } 259 259 260 unsigned int FormatParser< psi3 >::calculateMultiplicity(const std::vector<atom *> &atoms) const 260 unsigned int FormatParser< psi3 >::calculateMultiplicity( 261 const std::vector<const atom *> &atoms) const 261 262 { 262 263 // add up the number of electrons 263 264 double valencies = 0.; 264 BOOST_FOREACH( atom *_atom, atoms) {265 BOOST_FOREACH(const atom *_atom, atoms) { 265 266 valencies += _atom->getType()->getAtomicNumber(); 266 267 } … … 268 269 // add doubly up all bond degrees (two electrons per bond) 269 270 unsigned int degrees = 0; 270 BOOST_FOREACH( atom *_atom, atoms) {271 BOOST_FOREACH(const atom *_atom, atoms) { 271 272 BOOST_FOREACH(bond::ptr _bond, _atom->getListOfBonds()) { 272 273 degrees += 2*_bond->getDegree(); -
src/Parser/Psi3Parser.hpp
r99db9b rfac58f 52 52 53 53 void load(std::istream *file); 54 void save(std::ostream *file, const std::vector< atom *> &atoms);54 void save(std::ostream *file, const std::vector<const atom *> &atoms); 55 55 56 56 /** Getter for parameter set. … … 74 74 * \return mulitplicity 75 75 */ 76 unsigned int calculateMultiplicity(const std::vector< atom *> &atoms) const;76 unsigned int calculateMultiplicity(const std::vector<const atom *> &atoms) const; 77 77 78 78 static ConvertTo<bool> Converter; -
src/Parser/TremoloParser.cpp
r99db9b rfac58f 178 178 * \param atoms atoms to store 179 179 */ 180 void FormatParser< tremolo >::save(std::ostream* file, const std::vector<atom *> &AtomList) { 180 void FormatParser< tremolo >::save( 181 std::ostream* file, 182 const std::vector<const atom *> &AtomList) { 181 183 LOG(2, "DEBUG: Saving changes to tremolo."); 182 184 … … 203 205 204 206 // store particles 205 for (std::vector< atom*>::const_iterator atomIt = AtomList.begin();207 for (std::vector<const atom*>::const_iterator atomIt = AtomList.begin(); 206 208 atomIt != AtomList.end(); ++atomIt) 207 209 saveLine(file, *atomIt); … … 297 299 * \param atoms atoms to store 298 300 */ 299 void FormatParser< tremolo >::distributeContinuousIds(const std::vector<atom *> &AtomList) 301 void FormatParser< tremolo >::distributeContinuousIds( 302 const std::vector<const atom *> &AtomList) 300 303 { 301 304 resetIdAssociations(); 302 305 atomId_t lastid = 0; 303 for (std::vector< atom*>::const_iterator atomIt = AtomList.begin();306 for (std::vector<const atom*>::const_iterator atomIt = AtomList.begin(); 304 307 atomIt != AtomList.end(); ++atomIt) 305 308 associateLocaltoGlobalId(++lastid, (*atomIt)->getId()); … … 368 371 * \param reference to the atom of which information should be written 369 372 */ 370 void FormatParser< tremolo >::saveLine(std::ostream* file, const atom* currentAtom) 373 void FormatParser< tremolo >::saveLine( 374 std::ostream* file, 375 const atom * const currentAtom) 371 376 { 372 377 TremoloKey::atomDataKey currentField; … … 495 500 * \param reference to the atom of which to take the neighbor information 496 501 */ 497 void FormatParser< tremolo >::writeNeighbors(std::ostream* file, const int numberOfNeighbors, const atom* currentAtom) { 502 void FormatParser< tremolo >::writeNeighbors( 503 std::ostream* file, 504 const int numberOfNeighbors, 505 const atom * const currentAtom) { 498 506 const BondList& ListOfBonds = currentAtom->getListOfBonds(); 499 507 // sort bonded indices … … 752 760 * \param atomid world id of the atom the information belongs to 753 761 */ 754 void FormatParser< tremolo >::readNeighbors(std::stringstream* line, const int numberOfNeighbors, const int atomId) { 762 void FormatParser< tremolo >::readNeighbors( 763 std::stringstream* line, 764 const int numberOfNeighbors, 765 const int atomId) { 755 766 int neighborId = 0; 756 767 for (int i = 0; i < numberOfNeighbors; i++) { … … 772 783 * \return true if the field name is used 773 784 */ 774 bool FormatParser< tremolo >::isUsedField(const usedFields_t &fields, const std::string &fieldName) const 785 bool FormatParser< tremolo >::isUsedField( 786 const usedFields_t &fields, 787 const std::string &fieldName) const 775 788 { 776 789 bool fieldNameExists = false; … … 792 805 * @param atoms vector with all newly added (global) atomic ids 793 806 */ 794 void FormatParser< tremolo >::processNeighborInformation(const std::vector<atomId_t> &atoms) { 807 void FormatParser< tremolo >::processNeighborInformation( 808 const std::vector<atomId_t> &atoms) { 795 809 if (!isUsedField(usedFields_load, "neighbors")) { 796 810 return; -
src/Parser/TremoloParser.hpp
r99db9b rfac58f 53 53 virtual ~FormatParser(); 54 54 void load(std::istream* file); 55 void save(std::ostream* file, const std::vector< atom *> &atoms);55 void save(std::ostream* file, const std::vector<const atom *> &atoms); 56 56 std::string getAtomData() const; 57 57 void setAtomData(const std::string &atomdata_string); … … 107 107 std::string adaptIdDependentDataString(const std::string &data, const boost::function<int (const int)> &idgetter); 108 108 bool isUsedField(const usedFields_t &fields, const std::string &fieldName) const; 109 void writeNeighbors(std::ostream* file, const int numberOfNeighbors, const atom* c urrentAtom);110 void saveLine(std::ostream* file, const atom* c urrentAtom);109 void writeNeighbors(std::ostream* file, const int numberOfNeighbors, const atom* const currentAtom); 110 void saveLine(std::ostream* file, const atom* const currentAtom); 111 111 void save_AtomDataLine(std::ostream* file) const; 112 112 void save_BoxLine(std::ostream* file) const; 113 void distributeContinuousIds(const std::vector< atom *> &AtomList);113 void distributeContinuousIds(const std::vector<const atom *> &AtomList); 114 114 void makeUsedFieldsUnique(usedFields_t &fields) const; 115 115 -
src/Parser/XmlParser.cpp
r99db9b rfac58f 215 215 * \param atoms atoms to store 216 216 */ 217 void FormatParser< xml >::save(std::ostream* file, const std::vector<atom *> &atoms) { 217 void FormatParser< xml >::save( 218 std::ostream* file, 219 const std::vector<const atom *> &atoms) { 218 220 LOG(2, "DEBUG: Saving changes to xml."); 219 221 … … 224 226 data.config.periodicity[i] = domain.getCondition(i) == BoundaryConditions::Wrap; 225 227 data.config.p.clear(); 226 for(std::vector< atom*>::const_iterator it = atoms.begin(); it != atoms.end(); it++) {228 for(std::vector<const atom*>::const_iterator it = atoms.begin(); it != atoms.end(); it++) { 227 229 struct scafacos::configuration::particle p; 228 230 const additionalAtomInfo &atomInfo = getAtomData(*(*it)); … … 301 303 } 302 304 303 const FormatParser< xml >::additionalAtomInfo& FormatParser< xml >::getAtomData(const atom &_atom) const 305 const FormatParser< xml >::additionalAtomInfo& 306 FormatParser< xml >::getAtomData(const atom &_atom) const 304 307 { 305 308 { -
src/Parser/XmlParser.hpp
r99db9b rfac58f 54 54 virtual ~FormatParser(); 55 55 void load(std::istream* file); 56 void save(std::ostream* file, const std::vector< atom *> &atoms);56 void save(std::ostream* file, const std::vector<const atom *> &atoms); 57 57 58 58 protected: -
src/Parser/XyzParser.cpp
r99db9b rfac58f 166 166 * \param atoms atoms to store 167 167 */ 168 void FormatParser< xyz >::save(ostream* file, const std::vector<atom *> &atoms) { 168 void FormatParser< xyz >::save( 169 ostream* file, 170 const std::vector<const atom *> &atoms) { 169 171 LOG(2, "DEBUG: Saving changes to xyz."); 170 172 … … 172 174 size_t min_trajectories = std::numeric_limits<size_t>::max(); 173 175 size_t max_trajectories = std::numeric_limits<size_t>::min(); 174 for (std::vector< atom *>::const_iterator iter = atoms.begin();176 for (std::vector<const atom *>::const_iterator iter = atoms.begin(); 175 177 iter != atoms.end(); 176 178 ++iter) { … … 206 208 *file << atoms.size() << endl << "\t" << comment << endl; 207 209 208 for(vector< atom*>::const_iterator it = atoms.begin(); it != atoms.end(); it++) {210 for(vector<const atom*>::const_iterator it = atoms.begin(); it != atoms.end(); it++) { 209 211 *file << (*it)->getType()->getSymbol(); 210 212 *file << "\t" << printCoordinate((*it)->atStep(0, step)); -
src/Parser/XyzParser.hpp
r99db9b rfac58f 45 45 virtual ~FormatParser(); 46 46 void load(std::istream* file); 47 void save(std::ostream* file, const std::vector< atom *> &atoms);47 void save(std::ostream* file, const std::vector<const atom *> &atoms); 48 48 49 49 private: -
src/Parser/unittests/ParserMpqcUnitTest.cpp
r99db9b rfac58f 296 296 // create two stringstreams, one stored, one created 297 297 298 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 298 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 299 getAllAtoms(); 299 300 { 300 301 // compare both configs for CLHF -
src/Parser/unittests/ParserPcpUnitTest.cpp
r99db9b rfac58f 161 161 input.clear(); 162 162 163 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());163 CPPUNIT_ASSERT_EQUAL(3, const_cast<const World &>(World::getInstance()).numAtoms()); 164 164 165 165 // check that equality function is ok … … 167 167 168 168 stringstream output; 169 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 169 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 170 getAllAtoms(); 170 171 parser->save(&output, atoms); 171 172 -
src/Parser/unittests/ParserPdbUnitTest.cpp
r99db9b rfac58f 106 106 input.clear(); 107 107 108 CPPUNIT_ASSERT_EQUAL(6, World::getInstance().numAtoms());108 CPPUNIT_ASSERT_EQUAL(6, const_cast<const World &>(World::getInstance()).numAtoms()); 109 109 110 110 stringstream output; 111 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 111 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 112 getAllAtoms(); 112 113 parser->save(&output, atoms); 113 114 -
src/Parser/unittests/ParserPsi3UnitTest.cpp
r99db9b rfac58f 340 340 341 341 // create two stringstreams, one stored, one created 342 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 342 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 343 getAllAtoms(); 343 344 { 344 345 // compare both configs for RHF -
src/Parser/unittests/ParserTremoloUnitTest.cpp
r99db9b rfac58f 136 136 input << Tremolo_Atomdata1; 137 137 parser->load(&input); 138 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 138 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 139 getAllAtoms(); 139 140 parser->save(&output, atoms); 140 141 // std::cout << output.str() << std::endl; … … 149 150 input << Tremolo_Atomdata2; 150 151 parser->load(&input); 151 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 152 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 153 getAllAtoms(); 152 154 parser->save(&output, atoms); 153 155 // std::cout << output.str() << std::endl; … … 227 229 input << Tremolo_improper; 228 230 parser->load(&input); 229 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 230 parser->save(&output, atoms); 231 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms()); 231 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 232 getAllAtoms(); 233 parser->save(&output, atoms); 234 CPPUNIT_ASSERT_EQUAL(3, const_cast<const World &>(World::getInstance()).numAtoms()); 232 235 // std::cout << output.str() << std::endl; 233 236 CPPUNIT_ASSERT(output.str().find("3-1,1-3") != string::npos); … … 244 247 input << Tremolo_torsion; 245 248 parser->load(&input); 246 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 247 parser->save(&output, atoms); 248 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms()); 249 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 250 getAllAtoms(); 251 parser->save(&output, atoms); 252 CPPUNIT_ASSERT_EQUAL(3, const_cast<const World &>(World::getInstance()).numAtoms()); 249 253 // std::cout << output.str() << std::endl; 250 254 CPPUNIT_ASSERT(output.str().find("3-1,1-3") != string::npos); … … 262 266 newAtom->setType(1); 263 267 parser->setAtomData("x=3 u=3 F=3 stress Id neighbors=5 imprData GroupMeasureTypeNo type extType name resName chainID resSeq occupancy tempFactor segID Charge charge GrpTypeNo torsion"); 264 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 268 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 269 getAllAtoms(); 265 270 parser->save(&output, atoms); 266 271 // std::cout << output.str() << std::endl; -
src/Parser/unittests/ParserXmlUnitTest.cpp
r99db9b rfac58f 100 100 input.clear(); 101 101 102 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());102 CPPUNIT_ASSERT_EQUAL(3, const_cast<const World &>(World::getInstance()).numAtoms()); 103 103 104 104 // store and parse in again … … 107 107 // std::string second; 108 108 std::stringstream output; 109 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 109 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 110 getAllAtoms(); 110 111 parser->save(&output, atoms); 111 112 std::cout << output.str(); -
src/Parser/unittests/ParserXyzUnitTest.cpp
r99db9b rfac58f 106 106 input.clear(); 107 107 108 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());108 CPPUNIT_ASSERT_EQUAL(3, const_cast<const World &>(World::getInstance()).numAtoms()); 109 109 110 110 // store and parse in again 111 111 { 112 112 stringstream output; 113 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 113 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 114 getAllAtoms(); 114 115 parser->save(&output, atoms); 115 116 input << output.str(); … … 157 158 158 159 // 3 not 6 atoms! 159 CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());160 CPPUNIT_ASSERT_EQUAL(3, const_cast<const World &>(World::getInstance()).numAtoms()); 160 161 161 162 // store and parse in again 162 163 { 163 164 stringstream output; 164 std::vector<atom *> atoms = World::getInstance().getAllAtoms(); 165 std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()). 166 getAllAtoms(); 165 167 parser->save(&output, atoms); 166 168 input << output.str();
Note:
See TracChangeset
for help on using the changeset viewer.