Changeset fac58f for src/Parser


Ignore:
Timestamp:
Jul 24, 2015, 4:44:35 PM (9 years ago)
Author:
Frederik Heber <heber@…>
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)
Message:

Converted FormatParser::save() to using vector of const atom ptrs.

  • required to change all save() functions in all parsers.
Location:
src/Parser
Files:
26 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/FormatParser.hpp

    r99db9b rfac58f  
    7676    ASSERT(0, "FormatParser<>::load() - unspecialized function cannot be called.");
    7777  }
    78   void save(std::ostream *file, const std::vector<atom *> &atoms)
     78  void save(std::ostream *file, const std::vector<const atom *> &atoms)
    7979  {
    8080    ASSERT(0, "FormatParser<>::save() - unspecialized function cannot be called.");
  • src/Parser/FormatParserInterface.hpp

    r99db9b rfac58f  
    3434  FormatParserInterface() {}
    3535  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;
    3737  virtual void load(std::istream* file)=0;
    3838  virtual void setOstream(std::ostream* file)=0;
  • src/Parser/FormatParserStorage.cpp

    r99db9b rfac58f  
    317317bool FormatParserStorage::saveSelectedAtoms(std::ostream &output, std::string suffix)
    318318{
    319   std::vector<atom *> atoms = World::getInstance().getSelectedAtoms();
     319  const std::vector<const atom *> atoms =
     320      const_cast<const World &>(World::getInstance()).getSelectedAtoms();
    320321  return save(output, suffix, atoms);
    321322}
     
    333334bool FormatParserStorage::saveSelectedMolecules(std::ostream &output, std::string suffix)
    334335{
    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();
    338340      MolIter != molecules.end();
    339341      ++MolIter) {
    340     for(molecule::iterator AtomIter = (*MolIter)->begin();
     342    for(molecule::const_iterator AtomIter = (*MolIter)->begin();
    341343        AtomIter != (*MolIter)->end();
    342344        ++AtomIter) {
     
    344346    }
    345347  }
    346   std::vector<atom *> atoms;
     348  std::vector<const atom *> atoms;
    347349  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();
    349351      iter != IdAtoms.end();
    350352      ++iter) {
     
    361363bool FormatParserStorage::saveWorld(std::ostream &output, std::string suffix)
    362364{
    363   std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     365  const std::vector<const atom *> atoms =
     366      const_cast<const World &>(World::getInstance()).getAllAtoms();
    364367  return save(output, suffix, atoms);
    365368}
     
    370373 * \return true - storing ok, false - suffix unknown
    371374 */
    372 bool FormatParserStorage::save(std::ostream &output, std::string suffix, const std::vector<atom *> &atoms)
     375bool FormatParserStorage::save(
     376    std::ostream &output,
     377    std::string suffix,
     378    const std::vector<const atom *> &atoms)
    373379{
    374380  enum ParserTypes type = getTypeFromSuffix(suffix);
  • src/Parser/FormatParserStorage.hpp

    r99db9b rfac58f  
    4040  bool load(std::string &filename);
    4141  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);
    4343  bool saveSelectedAtoms(std::ostream &output, std::string suffix);
    4444  bool saveSelectedMolecules(std::ostream &output, std::string suffix);
  • src/Parser/FormatParser_common.cpp

    r99db9b rfac58f  
    8484void FormatParser_common::update(Observable *publisher) {
    8585  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();
    8788    save(saveStream, atoms);
    8889  }
  • src/Parser/MpqcParser.cpp

    r99db9b rfac58f  
    291291 * \param atoms atoms to store
    292292 */
    293 void FormatParser< mpqc >::save(ostream *file, const std::vector<atom *> &atoms)
     293void FormatParser< mpqc >::save(ostream *file, const std::vector<const atom *> &atoms)
    294294{
    295295  Vector center;
  • src/Parser/MpqcParser.hpp

    r99db9b rfac58f  
    5252
    5353  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);
    5555
    5656  /** Getter for parameter set.
  • src/Parser/PcpParser.cpp

    r99db9b rfac58f  
    402402 * \param atoms atoms to store
    403403 */
    404 void FormatParser< pcp >::save(std::ostream* file, const std::vector<atom *> &atoms)
     404void FormatParser< pcp >::save(std::ostream* file, const std::vector<const atom *> &atoms)
    405405{
    406406  LOG(2, "DEBUG: Saving changes to pcp.");
     
    509509 * \param &allatoms all atoms to store away
    510510 */
    511 void FormatParser< pcp >::CalculateOrbitals(const std::vector<atom *> &allatoms)
     511void FormatParser< pcp >::CalculateOrbitals(const std::vector<const atom *> &allatoms)
    512512{
    513513  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) {
    515515    PlaneWaveSpecifics.MaxPsiDouble += (*runner)->getType()->getNoValenceOrbitals();
    516516  }
     
    542542 * \param &ZtoIndexMap map of which atoms belong to which ion number
    543543 */
    544 void FormatParser< pcp >::OutputElements(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)
     544void FormatParser< pcp >::OutputElements(
     545    ostream *file,
     546    const std::vector<const atom *> &allatoms,
     547    map<int, int> &ZtoIndexMap)
    545548{
    546549  map<int, int> PresentElements;
    547550  pair <   map<int, int>::iterator, bool > Inserter;
    548551  // 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) {
    550553    Inserter = PresentElements.insert(pair<int, int>((*AtomRunner)->getType()->getAtomicNumber(), 1));
    551554    if (!Inserter.second) // increase if present
     
    572575 * \param &ZtoIndexMap map of which atoms belong to which ion number
    573576 */
    574 void FormatParser< pcp >::OutputAtoms(ostream *file, const std::vector<atom *> &allatoms, map<int, int> &ZtoIndexMap)
     577void FormatParser< pcp >::OutputAtoms(
     578    ostream *file,
     579    const std::vector<const atom *> &allatoms,
     580    map<int, int> &ZtoIndexMap)
    575581{
    576582  *file << "#Ion_TypeNr._Nr.R[0]    R[1]    R[2]    MoveType (0 MoveIon, 1 FixedIon)" << endl;
    577583  map<int, int> ZtoCountMap;
    578   map<atom *, int> AtomtoCountMap;
     584  map<const atom *, int> AtomtoCountMap;
    579585  pair <   map<int, int>::iterator, bool > Inserter;
    580586  bool ContinueStatus = true;
     
    584590    int nr = 0;
    585591    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) {
    587593      if ((*AtomRunner)->getTrajectorySize() > step) {
    588594        if (step == 0) {  // fill list only on first step
  • src/Parser/PcpParser.hpp

    r99db9b rfac58f  
    4949  virtual ~FormatParser();
    5050  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);
    5252
    5353  bool operator==(const FormatParser< pcp >& b) const;
     
    5656
    5757  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);
    6168
    6269  class StructParallelization {
  • src/Parser/PdbParser.cpp

    r99db9b rfac58f  
    194194 * \param atoms atoms to store
    195195 */
    196 void FormatParser< pdb >::save(ostream* file, const std::vector<atom *> &AtomList)
     196void FormatParser< pdb >::save(
     197    ostream* file,
     198    const std::vector<const atom *> &AtomList)
    197199{
    198200  LOG(2, "DEBUG: Saving changes to pdb.");
     
    211213  // (new atoms might have been added)
    212214  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++) {
    214216    PdbAtomInfoContainer &atomInfo = getadditionalAtomData(*atomIt);
    215217    associateLocaltoGlobalId(AtomNo, (*atomIt)->getId());
     
    238240      std::map<size_t,size_t> MolIdMap;
    239241      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++) {
    241243        const molecule *mol = (*atomIt)->getMolecule();
    242244        if ((mol != NULL) && (MolIdMap.find(mol->getId()) == MolIdMap.end())) {
     
    254256
    255257      // 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++) {
    257259        PdbAtomInfoContainer &atomInfo = getadditionalAtomData(*atomIt);
    258260        // gather info about residue
     
    298300
    299301      // 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++) {
    301303        writeNeighbors(file, 4, *atomIt);
    302304      }
     
    357359 * @return
    358360 */
    359 PdbAtomInfoContainer& FormatParser< pdb >::getadditionalAtomData(atom *_atom)
     361PdbAtomInfoContainer& FormatParser< pdb >::getadditionalAtomData(const atom * const _atom)
    360362{
    361363  if (additionalAtomData.find(_atom->getId()) != additionalAtomData.end()) {
     
    498500 * \param *currentAtom to the atom of which to take the neighbor information
    499501 */
    500 void FormatParser< pdb >::writeNeighbors(ostream* file, int MaxnumberOfNeighbors, atom* currentAtom) {
     502void FormatParser< pdb >::writeNeighbors(
     503    ostream* file,
     504    int MaxnumberOfNeighbors,
     505    const atom * const currentAtom) {
    501506  int MaxNo = MaxnumberOfNeighbors;
    502507  int charsleft = 80;
  • src/Parser/PdbParser.hpp

    r99db9b rfac58f  
    5353  virtual ~FormatParser();
    5454  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);
    5656
    5757  bool operator==(const FormatParser< pdb>& b) const;
    58   void printAtomInfo(const atom *newAtom) const;
     58  void printAtomInfo(const atom * const newAtom) const;
    5959
    6060protected:
     
    7171//  std::string adaptIdDependentDataString(std::string data);
    7272  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);
    7474  void saveLine(std::ostream* file, const PdbAtomInfoContainer &atomInfo);
    7575
    7676  // internal getter and setter
    7777  bool isPresentadditionalAtomData(const atomId_t _id) const;
    78   PdbAtomInfoContainer& getadditionalAtomData(atom *_atom);
     78  PdbAtomInfoContainer& getadditionalAtomData(const atom *_atom);
    7979
    8080  // internal helper functions
  • src/Parser/Psi3Parser.cpp

    r99db9b rfac58f  
    183183 * \param atoms atoms to store
    184184 */
    185 void FormatParser< psi3 >::save(ostream *file, const std::vector<atom *> &atoms)
     185void FormatParser< psi3 >::save(ostream *file, const std::vector<const atom *> &atoms)
    186186{
    187187  Vector center;
     
    189189
    190190  // 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)
    192192    center += (*runner)->getPosition();
    193193  center.Scale(1./(double)atoms.size());
     
    258258}
    259259
    260 unsigned int FormatParser< psi3 >::calculateMultiplicity(const std::vector<atom *> &atoms) const
     260unsigned int FormatParser< psi3 >::calculateMultiplicity(
     261    const std::vector<const atom *> &atoms) const
    261262{
    262263  // add up the number of electrons
    263264  double valencies = 0.;
    264   BOOST_FOREACH(atom *_atom, atoms) {
     265  BOOST_FOREACH(const atom *_atom, atoms) {
    265266    valencies += _atom->getType()->getAtomicNumber();
    266267  }
     
    268269  // add doubly up all bond degrees (two electrons per bond)
    269270  unsigned int degrees = 0;
    270   BOOST_FOREACH(atom *_atom, atoms) {
     271  BOOST_FOREACH(const atom *_atom, atoms) {
    271272    BOOST_FOREACH(bond::ptr _bond, _atom->getListOfBonds()) {
    272273      degrees += 2*_bond->getDegree();
  • src/Parser/Psi3Parser.hpp

    r99db9b rfac58f  
    5252
    5353  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);
    5555
    5656  /** Getter for parameter set.
     
    7474   * \return mulitplicity
    7575   */
    76   unsigned int calculateMultiplicity(const std::vector<atom *> &atoms) const;
     76  unsigned int calculateMultiplicity(const std::vector<const atom *> &atoms) const;
    7777
    7878  static ConvertTo<bool> Converter;
  • src/Parser/TremoloParser.cpp

    r99db9b rfac58f  
    178178 * \param atoms atoms to store
    179179 */
    180 void FormatParser< tremolo >::save(std::ostream* file, const std::vector<atom *> &AtomList) {
     180void FormatParser< tremolo >::save(
     181    std::ostream* file,
     182    const std::vector<const atom *> &AtomList) {
    181183  LOG(2, "DEBUG: Saving changes to tremolo.");
    182184
     
    203205
    204206  // store particles
    205   for (std::vector<atom*>::const_iterator  atomIt = AtomList.begin();
     207  for (std::vector<const atom*>::const_iterator  atomIt = AtomList.begin();
    206208      atomIt != AtomList.end(); ++atomIt)
    207209    saveLine(file, *atomIt);
     
    297299 * \param atoms atoms to store
    298300 */
    299 void FormatParser< tremolo >::distributeContinuousIds(const std::vector<atom *> &AtomList)
     301void FormatParser< tremolo >::distributeContinuousIds(
     302    const std::vector<const atom *> &AtomList)
    300303{
    301304  resetIdAssociations();
    302305  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();
    304307      atomIt != AtomList.end(); ++atomIt)
    305308    associateLocaltoGlobalId(++lastid, (*atomIt)->getId());
     
    368371 * \param reference to the atom of which information should be written
    369372 */
    370 void FormatParser< tremolo >::saveLine(std::ostream* file, const atom* currentAtom)
     373void FormatParser< tremolo >::saveLine(
     374    std::ostream* file,
     375    const atom * const currentAtom)
    371376{
    372377  TremoloKey::atomDataKey currentField;
     
    495500 * \param reference to the atom of which to take the neighbor information
    496501 */
    497 void FormatParser< tremolo >::writeNeighbors(std::ostream* file, const int numberOfNeighbors, const atom* currentAtom) {
     502void FormatParser< tremolo >::writeNeighbors(
     503    std::ostream* file,
     504    const int numberOfNeighbors,
     505    const atom * const currentAtom) {
    498506  const BondList& ListOfBonds = currentAtom->getListOfBonds();
    499507  // sort bonded indices
     
    752760 * \param atomid world id of the atom the information belongs to
    753761 */
    754 void FormatParser< tremolo >::readNeighbors(std::stringstream* line, const int numberOfNeighbors, const int atomId) {
     762void FormatParser< tremolo >::readNeighbors(
     763    std::stringstream* line,
     764    const int numberOfNeighbors,
     765    const int atomId) {
    755766  int neighborId = 0;
    756767  for (int i = 0; i < numberOfNeighbors; i++) {
     
    772783 * \return true if the field name is used
    773784 */
    774 bool FormatParser< tremolo >::isUsedField(const usedFields_t &fields, const std::string &fieldName) const
     785bool FormatParser< tremolo >::isUsedField(
     786    const usedFields_t &fields,
     787    const std::string &fieldName) const
    775788{
    776789  bool fieldNameExists = false;
     
    792805 * @param atoms vector with all newly added (global) atomic ids
    793806 */
    794 void FormatParser< tremolo >::processNeighborInformation(const std::vector<atomId_t> &atoms) {
     807void FormatParser< tremolo >::processNeighborInformation(
     808    const std::vector<atomId_t> &atoms) {
    795809  if (!isUsedField(usedFields_load, "neighbors")) {
    796810    return;
  • src/Parser/TremoloParser.hpp

    r99db9b rfac58f  
    5353  virtual ~FormatParser();
    5454  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);
    5656  std::string getAtomData() const;
    5757  void setAtomData(const std::string &atomdata_string);
     
    107107  std::string adaptIdDependentDataString(const std::string &data, const boost::function<int (const int)> &idgetter);
    108108  bool isUsedField(const usedFields_t &fields, const std::string &fieldName) const;
    109   void writeNeighbors(std::ostream* file, const int numberOfNeighbors, const atom* currentAtom);
    110   void saveLine(std::ostream* file, const atom* currentAtom);
     109  void writeNeighbors(std::ostream* file, const int numberOfNeighbors, const atom* const currentAtom);
     110  void saveLine(std::ostream* file, const atom* const currentAtom);
    111111  void save_AtomDataLine(std::ostream* file) const;
    112112  void save_BoxLine(std::ostream* file) const;
    113   void distributeContinuousIds(const std::vector<atom *> &AtomList);
     113  void distributeContinuousIds(const std::vector<const atom *> &AtomList);
    114114  void makeUsedFieldsUnique(usedFields_t &fields) const;
    115115
  • src/Parser/XmlParser.cpp

    r99db9b rfac58f  
    215215 * \param atoms atoms to store
    216216 */
    217 void FormatParser< xml >::save(std::ostream* file, const std::vector<atom *> &atoms) {
     217void FormatParser< xml >::save(
     218    std::ostream* file,
     219    const std::vector<const atom *> &atoms) {
    218220  LOG(2, "DEBUG: Saving changes to xml.");
    219221
     
    224226    data.config.periodicity[i] = domain.getCondition(i) == BoundaryConditions::Wrap;
    225227  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++) {
    227229    struct scafacos::configuration::particle p;
    228230    const additionalAtomInfo &atomInfo = getAtomData(*(*it));
     
    301303}
    302304
    303 const FormatParser< xml >::additionalAtomInfo& FormatParser< xml >::getAtomData(const atom &_atom) const
     305const FormatParser< xml >::additionalAtomInfo&
     306FormatParser< xml >::getAtomData(const atom &_atom) const
    304307{
    305308  {
  • src/Parser/XmlParser.hpp

    r99db9b rfac58f  
    5454  virtual ~FormatParser();
    5555  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);
    5757
    5858protected:
  • src/Parser/XyzParser.cpp

    r99db9b rfac58f  
    166166 * \param atoms atoms to store
    167167 */
    168 void FormatParser< xyz >::save(ostream* file, const std::vector<atom *> &atoms) {
     168void FormatParser< xyz >::save(
     169    ostream* file,
     170    const std::vector<const atom *> &atoms) {
    169171  LOG(2, "DEBUG: Saving changes to xyz.");
    170172
     
    172174  size_t min_trajectories = std::numeric_limits<size_t>::max();
    173175  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();
    175177      iter != atoms.end();
    176178      ++iter) {
     
    206208    *file << atoms.size() << endl << "\t" << comment << endl;
    207209
    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++) {
    209211      *file << (*it)->getType()->getSymbol();
    210212      *file << "\t" << printCoordinate((*it)->atStep(0, step));
  • src/Parser/XyzParser.hpp

    r99db9b rfac58f  
    4545  virtual ~FormatParser();
    4646  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);
    4848
    4949private:
  • src/Parser/unittests/ParserMpqcUnitTest.cpp

    r99db9b rfac58f  
    296296  // create two stringstreams, one stored, one created
    297297
    298   std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     298  std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()).
     299      getAllAtoms();
    299300  {
    300301    // compare both configs for CLHF
  • src/Parser/unittests/ParserPcpUnitTest.cpp

    r99db9b rfac58f  
    161161  input.clear();
    162162
    163   CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
     163  CPPUNIT_ASSERT_EQUAL(3, const_cast<const World &>(World::getInstance()).numAtoms());
    164164
    165165  // check that equality function is ok
     
    167167
    168168  stringstream output;
    169   std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     169  std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()).
     170      getAllAtoms();
    170171  parser->save(&output, atoms);
    171172
  • src/Parser/unittests/ParserPdbUnitTest.cpp

    r99db9b rfac58f  
    106106  input.clear();
    107107
    108   CPPUNIT_ASSERT_EQUAL(6, World::getInstance().numAtoms());
     108  CPPUNIT_ASSERT_EQUAL(6, const_cast<const World &>(World::getInstance()).numAtoms());
    109109
    110110  stringstream output;
    111   std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     111  std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()).
     112      getAllAtoms();
    112113  parser->save(&output, atoms);
    113114
  • src/Parser/unittests/ParserPsi3UnitTest.cpp

    r99db9b rfac58f  
    340340
    341341  // 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();
    343344  {
    344345    // compare both configs for RHF
  • src/Parser/unittests/ParserTremoloUnitTest.cpp

    r99db9b rfac58f  
    136136    input << Tremolo_Atomdata1;
    137137    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();
    139140    parser->save(&output, atoms);
    140141//    std::cout << output.str() << std::endl;
     
    149150    input << Tremolo_Atomdata2;
    150151    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();
    152154    parser->save(&output, atoms);
    153155//    std::cout << output.str() << std::endl;
     
    227229    input << Tremolo_improper;
    228230    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());
    232235//    std::cout << output.str() << std::endl;
    233236    CPPUNIT_ASSERT(output.str().find("3-1,1-3") != string::npos);
     
    244247    input << Tremolo_torsion;
    245248    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());
    249253//    std::cout << output.str() << std::endl;
    250254    CPPUNIT_ASSERT(output.str().find("3-1,1-3") != string::npos);
     
    262266    newAtom->setType(1);
    263267    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();
    265270    parser->save(&output, atoms);
    266271//    std::cout << output.str() << std::endl;
  • src/Parser/unittests/ParserXmlUnitTest.cpp

    r99db9b rfac58f  
    100100  input.clear();
    101101
    102   CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
     102  CPPUNIT_ASSERT_EQUAL(3, const_cast<const World &>(World::getInstance()).numAtoms());
    103103
    104104  // store and parse in again
     
    107107//    std::string second;
    108108    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();
    110111    parser->save(&output, atoms);
    111112    std::cout << output.str();
  • src/Parser/unittests/ParserXyzUnitTest.cpp

    r99db9b rfac58f  
    106106  input.clear();
    107107
    108   CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
     108  CPPUNIT_ASSERT_EQUAL(3, const_cast<const World &>(World::getInstance()).numAtoms());
    109109
    110110  // store and parse in again
    111111  {
    112112    stringstream output;
    113     std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     113    std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()).
     114        getAllAtoms();
    114115    parser->save(&output, atoms);
    115116    input << output.str();
     
    157158
    158159  // 3 not 6 atoms!
    159   CPPUNIT_ASSERT_EQUAL(3, World::getInstance().numAtoms());
     160  CPPUNIT_ASSERT_EQUAL(3, const_cast<const World &>(World::getInstance()).numAtoms());
    160161
    161162  // store and parse in again
    162163  {
    163164    stringstream output;
    164     std::vector<atom *> atoms = World::getInstance().getAllAtoms();
     165    std::vector<const atom *> atoms = const_cast<const World &>(World::getInstance()).
     166        getAllAtoms();
    165167    parser->save(&output, atoms);
    166168    input << output.str();
Note: See TracChangeset for help on using the changeset viewer.