Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/XyzParser.cpp

    r112b09 r86cff86  
    2727 */
    2828XyzParser::~XyzParser() {
    29   delete(&comment);
    3029}
    3130
     
    5857 */
    5958void 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;
    6171
    6272  vector<atom*> atoms = World::getInstance().getAllAtoms();
    6373  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;
    6575  }
    6676}
Note: See TracChangeset for help on using the changeset viewer.