Changes in src/Parser/XyzParser.cpp [dddbfe:d74077]
- File:
-
- 1 edited
-
src/Parser/XyzParser.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/XyzParser.cpp
rdddbfe rd74077 8 8 #include "Helpers/MemDebug.hpp" 9 9 10 #include "Helpers/Log.hpp"11 #include "Helpers/Verbose.hpp"12 10 #include "XyzParser.hpp" 13 11 #include "World.hpp" 14 12 #include "atom.hpp" 15 #include "molecule.hpp"16 13 #include "element.hpp" 17 14 #include "periodentafel.hpp" … … 38 35 */ 39 36 void XyzParser::load(istream* file) { 40 atom* newAtom = NULL; 41 molecule* newmol = NULL; 37 atom* newAtom; 42 38 int numberOfAtoms; 43 39 char commentBuffer[512], type[3]; 40 double tmp; 44 41 45 42 // the first line tells number of atoms, the second line is always a comment … … 48 45 comment = commentBuffer; 49 46 50 newmol = World::getInstance().createMolecule();51 newmol->ActiveFlag = true;52 World::getInstance().getMolecules()->insert(newmol);53 47 for (int i = 0; i < numberOfAtoms; i++) { 54 48 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 } 56 54 newAtom->setType(World::getInstance().getPeriode()->FindElement(type)); 57 newmol->AddAtom(newAtom);58 55 } 59 56 } … … 65 62 */ 66 63 void XyzParser::save(ostream* file) { 67 DoLog(0) && (Log() << Verbose(0) << "Saving changes to xyz." << std::endl);68 64 if (comment == "") { 69 65 time_t now = time((time_t *)NULL); // Get the system time and put it into 'now' as 'calender time' … … 81 77 vector<atom*> atoms = World::getInstance().getAllAtoms(); 82 78 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; 84 80 } 85 81 }
Note:
See TracChangeset
for help on using the changeset viewer.
