Changeset 0e894a
- 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:
- 33af20
- Parents:
- 220d2c
- git-author:
- Frederik Heber <frederik.heber@…> (06/17/17 23:09:19)
- git-committer:
- Frederik Heber <frederik.heber@…> (07/12/17 19:10:07)
- Location:
- src/Parser
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/FormatParser_common.cpp
r220d2c r0e894a 36 36 37 37 #include <iostream> 38 38 #include <limits> 39 40 #include "CodePatterns/Assert.hpp" 39 41 #include "CodePatterns/Observer/Notification.hpp" 40 42 #include "World.hpp" … … 179 181 return iter->second; 180 182 } 183 184 std::pair<size_t, size_t> FormatParser_common::getMinMaxTrajectories( 185 const std::vector<const atom *> &_atoms) const 186 { 187 // get max and min trajectories 188 size_t min_trajectories = std::numeric_limits<size_t>::max(); 189 size_t max_trajectories = std::numeric_limits<size_t>::min(); 190 for (std::vector<const atom *>::const_iterator iter = _atoms.begin(); 191 iter != _atoms.end(); 192 ++iter) { 193 if (max_trajectories < (*iter)->getTrajectorySize()) 194 max_trajectories = (*iter)->getTrajectorySize(); 195 if (min_trajectories > (*iter)->getTrajectorySize()) 196 min_trajectories = (*iter)->getTrajectorySize(); 197 } 198 // no atoms? Then, they all have same amount 199 if (_atoms.size() == 0) 200 min_trajectories = max_trajectories = 1; 201 ASSERT(min_trajectories == max_trajectories, 202 "FormatParser_common::getMinMaxTrajectories() - not all atoms have same number of trajectories: " 203 +toString(min_trajectories)+" != "+toString(max_trajectories)+"."); 204 205 return std::make_pair(min_trajectories, max_trajectories); 206 } -
src/Parser/FormatParser_common.hpp
r220d2c r0e894a 56 56 int getLocalId(const int global) const; 57 57 58 std::pair<size_t, size_t> getMinMaxTrajectories( 59 const std::vector<const atom *> &_atoms) const; 60 58 61 private: 59 62 //!> Output stream to write to when save() is called. -
src/Parser/PdbParser.cpp
r220d2c r0e894a 198 198 199 199 // check for maximum number of time steps 200 size_t max_timesteps = 0; 201 for (vector<const atom *>::const_iterator atomIt = AtomList.begin(); 202 atomIt != AtomList.end(); atomIt++) { 203 const atom * _atom = *atomIt; 204 LOG(4, "INFO: Atom " << _atom->getName() << " " 205 << *dynamic_cast<const AtomInfo *>(_atom) << "."); 206 if (_atom->getTrajectorySize() > max_timesteps) 207 max_timesteps = _atom->getTrajectorySize(); 208 } 209 LOG(2,"INFO: Found a maximum of " << max_timesteps << " time steps to store."); 200 std::pair<size_t, size_t> minmax_trajectories = 201 getMinMaxTrajectories(AtomList); 202 LOG(2, "INFO: There are " << minmax_trajectories.second << " steps to save."); 210 203 211 204 // re-distribute serials … … 222 215 223 216 // store all time steps (always do first step) 224 for (size_t step = 0; (step == 0) || (step < m ax_timesteps); ++step) {217 for (size_t step = 0; (step == 0) || (step < minmax_trajectories.second); ++step) { 225 218 { 226 219 // add initial remark -
src/Parser/XyzParser.cpp
r220d2c r0e894a 169 169 170 170 // get max and min trajectories 171 size_t min_trajectories = std::numeric_limits<size_t>::max(); 172 size_t max_trajectories = std::numeric_limits<size_t>::min(); 173 for (std::vector<const atom *>::const_iterator iter = atoms.begin(); 174 iter != atoms.end(); 175 ++iter) { 176 if (max_trajectories < (*iter)->getTrajectorySize()) 177 max_trajectories = (*iter)->getTrajectorySize(); 178 if (min_trajectories > (*iter)->getTrajectorySize()) 179 min_trajectories = (*iter)->getTrajectorySize(); 180 } 181 // no atoms? Then, they all have same amount 182 if (atoms.size() == 0) 183 min_trajectories = max_trajectories = 1; 184 ASSERT(min_trajectories == max_trajectories, 185 "FormatParser< xyz >::save() - not all atoms have same number of trajectories: " 186 +toString(min_trajectories)+" != "+toString(max_trajectories)+"."); 187 LOG(2, "INFO: There are " << max_trajectories << " steps to save."); 171 std::pair<size_t, size_t> minmax_trajectories = 172 getMinMaxTrajectories(atoms); 173 LOG(2, "INFO: There are " << minmax_trajectories.second << " steps to save."); 188 174 189 175 // always store at least one step 190 for (size_t step = 0; (step < m ax_trajectories) || (step == 0); ++step) {176 for (size_t step = 0; (step < minmax_trajectories.second) || (step == 0); ++step) { 191 177 if (step != 0) 192 178 *file << "\n";
Note:
See TracChangeset
for help on using the changeset viewer.