Changeset 33af20
- Timestamp:
- Jul 12, 2017, 7:10:07 PM (7 years ago)
- Branches:
- Action_Thermostats, Adding_Graph_to_ChangeBondActions, Adding_MD_integration_tests, Adding_StructOpt_integration_tests, AutomationFragmentation_failures, Candidate_v1.6.1, ChemicalSpaceEvaluator, Enhanced_StructuralOptimization, Enhanced_StructuralOptimization_continued, Example_ManyWaysToTranslateAtom, Exclude_Hydrogens_annealWithBondGraph, Fix_Verbose_Codepatterns, ForceAnnealing_with_BondGraph, ForceAnnealing_with_BondGraph_continued, ForceAnnealing_with_BondGraph_continued_betteresults, ForceAnnealing_with_BondGraph_contraction-expansion, Gui_displays_atomic_force_velocity, JobMarket_RobustOnKillsSegFaults, JobMarket_StableWorkerPool, PythonUI_with_named_parameters, Recreated_GuiChecks, StoppableMakroAction, TremoloParser_IncreasedPrecision, TremoloParser_MultipleTimesteps
- Children:
- 70f2a1
- Parents:
- 0e894a
- git-author:
- Frederik Heber <frederik.heber@…> (06/17/17 23:09:44)
- git-committer:
- Frederik Heber <frederik.heber@…> (07/12/17 19:10:07)
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/TremoloParser.cpp
r0e894a r33af20 146 146 size_t timestep = 0; 147 147 atom *addedatom = NULL; 148 std:: vector<atom *> addedatoms;149 std:: vector<atom *>::iterator atomiter = addedatoms.begin();148 std::list<atom *> addedatoms; 149 std::list<atom *>::iterator atomiter = addedatoms.begin(); 150 150 while (file->good()) { 151 151 std::getline(*file, line, '\n'); … … 226 226 distributeContinuousIds(AtomList); 227 227 228 // store atomdata 229 save_AtomDataLine(file); 230 231 // store box 232 save_BoxLine(file); 233 234 // store particles 235 for (std::vector<const atom*>::const_iterator atomIt = AtomList.begin(); 236 atomIt != AtomList.end(); ++atomIt) 237 saveLine(file, *atomIt); 228 std::pair<size_t, size_t> minmax_trajectories = 229 getMinMaxTrajectories(AtomList); 230 LOG(2, "INFO: There are " << minmax_trajectories.second << " steps to save."); 231 232 for (size_t step = 0; (step < minmax_trajectories.second) || (step == 0); ++step) { 233 // store atomdata 234 save_AtomDataLine(file); 235 236 // store box only on first step 237 if (step == 0) 238 save_BoxLine(file); 239 240 // store particles 241 for (std::vector<const atom*>::const_iterator atomIt = AtomList.begin(); 242 atomIt != AtomList.end(); ++atomIt) 243 saveLine(file, *atomIt, step); 244 } 238 245 } 239 246 … … 495 502 void FormatParser< tremolo >::saveLine( 496 503 std::ostream* file, 497 const atom * const currentAtom) 504 const atom * const currentAtom, 505 const size_t _timestep) 498 506 { 499 507 TremoloKey::atomDataKey currentField; 500 508 501 LOG(4, "INFO: Saving atom " << *currentAtom << ", its father id is " << currentAtom->GetTrueFather()->getId()); 509 LOG(4, "INFO: Saving atom " << *currentAtom << ", its father id is " 510 << currentAtom->GetTrueFather()->getId() << " at time step " << _timestep); 502 511 503 512 for (usedFields_t::iterator it = usedFields_save.begin(); it != usedFields_save.end(); it++) { … … 506 515 case TremoloKey::x : 507 516 // for the moment, assume there are always three dimensions 508 LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getPosition ());509 *file << currentAtom->at (0) << "\t";510 *file << currentAtom->at (1) << "\t";511 *file << currentAtom->at (2) << "\t";517 LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getPositionAtStep(_timestep)); 518 *file << currentAtom->atStep(0, _timestep) << "\t"; 519 *file << currentAtom->atStep(1, _timestep) << "\t"; 520 *file << currentAtom->atStep(2, _timestep) << "\t"; 512 521 break; 513 522 case TremoloKey::u : 514 523 // for the moment, assume there are always three dimensions 515 LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getAtomicVelocity ());516 *file << currentAtom->getAtomicVelocity ()[0] << "\t";517 *file << currentAtom->getAtomicVelocity ()[1] << "\t";518 *file << currentAtom->getAtomicVelocity ()[2] << "\t";524 LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getAtomicVelocityAtStep(_timestep)); 525 *file << currentAtom->getAtomicVelocityAtStep(_timestep)[0] << "\t"; 526 *file << currentAtom->getAtomicVelocityAtStep(_timestep)[1] << "\t"; 527 *file << currentAtom->getAtomicVelocityAtStep(_timestep)[2] << "\t"; 519 528 break; 520 529 case TremoloKey::F : 521 530 // for the moment, assume there are always three dimensions 522 LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getAtomicForce ());523 *file << currentAtom->getAtomicForce ()[0] << "\t";524 *file << currentAtom->getAtomicForce ()[1] << "\t";525 *file << currentAtom->getAtomicForce ()[2] << "\t";531 LOG(3, "Writing for type " << knownKeyNames[currentField] << ": " << currentAtom->getAtomicForceAtStep(_timestep)); 532 *file << currentAtom->getAtomicForceAtStep(_timestep)[0] << "\t"; 533 *file << currentAtom->getAtomicForceAtStep(_timestep)[1] << "\t"; 534 *file << currentAtom->getAtomicForceAtStep(_timestep)[2] << "\t"; 526 535 break; 527 536 case TremoloKey::type : -
src/Parser/TremoloParser.hpp
r0e894a r33af20 94 94 bool isUsedField(const usedFields_t &fields, const std::string &fieldName) const; 95 95 void writeNeighbors(std::ostream* file, const int numberOfNeighbors, const atom* const currentAtom); 96 void saveLine(std::ostream* file, const atom* const currentAtom); 96 void saveLine( 97 std::ostream* file, 98 const atom* const currentAtom, 99 const size_t _timestep); 97 100 void save_AtomDataLine(std::ostream* file) const; 98 101 void save_BoxLine(std::ostream* file) const; -
tests/regression/Parser/Tremolo/testsuite-parser-tremolo-load-multiple-timesteps.at
r0e894a r33af20 21 21 AT_SETUP([Parser - loading tremolo file with multiple timesteps]) 22 22 AT_KEYWORDS([parser load tremolo timesteps]) 23 # ::save() does not yet support multiple time steps24 AT_XFAIL_IF([/bin/true])25 23 26 24 file=water_multipletimesteps.data … … 33 31 AT_SETUP([Parser - loading tremolo file with multiple timesteps with Undo]) 34 32 AT_KEYWORDS([parser load tremolo timesteps undo]) 35 # with undo we don't notice missing save() implementation36 AT_XFAIL_IF([/bin/false])37 33 38 34 file=water_multipletimesteps.data … … 45 41 AT_SETUP([Parser - loading tremolo file with multiple timesteps with Redo]) 46 42 AT_KEYWORDS([parser load tremolo redo]) 47 # ::save() does not yet support multiple time steps48 AT_XFAIL_IF([/bin/true])49 43 50 44 file=water_multipletimesteps.data
Note:
See TracChangeset
for help on using the changeset viewer.