Ignore:
Timestamp:
Apr 11, 2018, 6:30:51 AM (7 years ago)
Author:
Frederik Heber <frederik.heber@…>
Branches:
Candidate_v1.6.1, ChemicalSpaceEvaluator, TremoloParser_IncreasedPrecision
Children:
4fc0ea
Parents:
cd91bd
git-author:
Frederik Heber <frederik.heber@…> (09/06/17 12:08:30)
git-committer:
Frederik Heber <frederik.heber@…> (04/11/18 06:30:51)
Message:

Increased output precision in tremolo's data files to 10 digits.

  • this allows to safely use tremolo as writer for system states without loosing too much accuracy, i.e. w.r.t total energy, unlike others such as PDB.
  • TESTS: Marked many test as XFAIL because of changed tremolo output precision.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TremoloParser.cpp

    rcd91bd rfba720  
    510510      << currentAtom->GetTrueFather()->getId() << " at time step " << _timestep);
    511511
     512  // note down default precision
     513  std::streamsize defaultprecision=file->precision();
     514  std::streamsize highprecision=10;
     515
    512516  for (usedFields_t::iterator it = usedFields_save.begin(); it != usedFields_save.end(); it++) {
    513517    currentField = knownKeys[it->substr(0, it->find("="))];
     
    516520        // for the moment, assume there are always three dimensions
    517521        LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getPositionAtStep(_timestep));
     522        file->precision(highprecision);
    518523        *file << currentAtom->atStep(0, _timestep) << "\t";
    519524        *file << currentAtom->atStep(1, _timestep) << "\t";
    520525        *file << currentAtom->atStep(2, _timestep) << "\t";
     526        file->precision(defaultprecision);
    521527        break;
    522528      case TremoloKey::u :
    523529        // for the moment, assume there are always three dimensions
    524530        LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getAtomicVelocityAtStep(_timestep));
     531        file->precision(highprecision);
    525532        *file << currentAtom->getAtomicVelocityAtStep(_timestep)[0] << "\t";
    526533        *file << currentAtom->getAtomicVelocityAtStep(_timestep)[1] << "\t";
    527534        *file << currentAtom->getAtomicVelocityAtStep(_timestep)[2] << "\t";
     535        file->precision(defaultprecision);
    528536        break;
    529537      case TremoloKey::F :
    530538        // for the moment, assume there are always three dimensions
    531539        LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getAtomicForceAtStep(_timestep));
     540        file->precision(highprecision);
    532541        *file << currentAtom->getAtomicForceAtStep(_timestep)[0] << "\t";
    533542        *file << currentAtom->getAtomicForceAtStep(_timestep)[1] << "\t";
    534543        *file << currentAtom->getAtomicForceAtStep(_timestep)[2] << "\t";
     544        file->precision(defaultprecision);
    535545        break;
    536546      case TremoloKey::type :
Note: See TracChangeset for help on using the changeset viewer.