Changes in src/Parser/XyzParser.cpp [112b09:86cff86]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/XyzParser.cpp
r112b09 r86cff86 27 27 */ 28 28 XyzParser::~XyzParser() { 29 delete(&comment);30 29 } 31 30 … … 58 57 */ 59 58 void XyzParser::save(ostream* file) { 60 *file << World::getInstance().numAtoms() << endl << comment << endl; 59 if (comment == "") { 60 time_t now = time((time_t *)NULL); // Get the system time and put it into 'now' as 'calender time' 61 comment = "Created by molecuilder on "; 62 // ctime ends in \n\0, we have to cut away the newline 63 std::string time(ctime(&now)); 64 size_t pos = time.find('\n'); 65 if (pos != 0) 66 comment += time.substr(0,pos); 67 else 68 comment += time; 69 } 70 *file << World::getInstance().numAtoms() << endl << "\t" << comment << endl; 61 71 62 72 vector<atom*> atoms = World::getInstance().getAllAtoms(); 63 73 for(vector<atom*>::iterator it = atoms.begin(); it != atoms.end(); it++) { 64 *file << fixed<< (*it)->getType()->symbol << "\t" << (*it)->x[0] << "\t" << (*it)->x[1] << "\t" << (*it)->x[2] << endl;74 *file << noshowpoint << (*it)->getType()->symbol << "\t" << (*it)->x[0] << "\t" << (*it)->x[1] << "\t" << (*it)->x[2] << endl; 65 75 } 66 76 }
Note:
See TracChangeset
for help on using the changeset viewer.