Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/XyzParser.cpp

    rdddbfe rd74077  
    88#include "Helpers/MemDebug.hpp"
    99
    10 #include "Helpers/Log.hpp"
    11 #include "Helpers/Verbose.hpp"
    1210#include "XyzParser.hpp"
    1311#include "World.hpp"
    1412#include "atom.hpp"
    15 #include "molecule.hpp"
    1613#include "element.hpp"
    1714#include "periodentafel.hpp"
     
    3835 */
    3936void XyzParser::load(istream* file) {
    40   atom* newAtom = NULL;
    41   molecule* newmol = NULL;
     37  atom* newAtom;
    4238  int numberOfAtoms;
    4339  char commentBuffer[512], type[3];
     40  double tmp;
    4441
    4542  // the first line tells number of atoms, the second line is always a comment
     
    4845  comment = commentBuffer;
    4946
    50   newmol = World::getInstance().createMolecule();
    51   newmol->ActiveFlag = true;
    52   World::getInstance().getMolecules()->insert(newmol);
    5347  for (int i = 0; i < numberOfAtoms; i++) {
    5448    newAtom = World::getInstance().createAtom();
    55     *file >> type >> ws >> newAtom->x[0] >> ws >> newAtom->x[1] >> ws >> newAtom->x[2];
     49    *file >> type;
     50    for (int j=0;j<NDIM;j++) {
     51      *file >> tmp;
     52      newAtom->set(j, tmp);
     53    }
    5654    newAtom->setType(World::getInstance().getPeriode()->FindElement(type));
    57     newmol->AddAtom(newAtom);
    5855  }
    5956}
     
    6562 */
    6663void XyzParser::save(ostream* file) {
    67   DoLog(0) && (Log() << Verbose(0) << "Saving changes to xyz." << std::endl);
    6864  if (comment == "") {
    6965    time_t now = time((time_t *)NULL);   // Get the system time and put it into 'now' as 'calender time'
     
    8177  vector<atom*> atoms = World::getInstance().getAllAtoms();
    8278  for(vector<atom*>::iterator it = atoms.begin(); it != atoms.end(); it++) {
    83     *file << noshowpoint << (*it)->getType()->symbol << "\t" << (*it)->x[0] << "\t" << (*it)->x[1] << "\t" << (*it)->x[2] << endl;
     79    *file << noshowpoint << (*it)->getType()->symbol << "\t" << (*it)->at(0) << "\t" << (*it)->at(1) << "\t" << (*it)->at(2) << endl;
    8480  }
    8581}
Note: See TracChangeset for help on using the changeset viewer.