Skip to content

Commit

Permalink
Merge branch 'fix-timestep-pass'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gareth Aneurin Tribello committed Jun 4, 2024
2 parents d2158d1 + 418902a commit 877fc1b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/Action.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ Action::Action(const ActionOptions&ao):
keywords(ao.keys)
{
// Retrieve the timestep and save it
ActionWithValue* ts = plumed.getActionSet().selectWithLabel<ActionWithValue*>("timestep");
if( ts ) timestep = (ts->copyOutput(0))->get();
resetStoredTimestep();

line.erase(line.begin());
if( !keywords.exists("NO_ACTION_LOG") ) {
Expand Down Expand Up @@ -116,6 +115,11 @@ Action::Action(const ActionOptions&ao):
}
}

void Action::resetStoredTimestep() {
ActionWithValue* ts = plumed.getActionSet().selectWithLabel<ActionWithValue*>("timestep");
if( ts ) timestep = (ts->copyOutput(0))->get();
}

Action::~Action() {
if(files.size()!=0) {
std::cerr<<"WARNING: some files open in action "+getLabel()+" where not properly closed. This could lead to data loss!!\n";
Expand Down
3 changes: 3 additions & 0 deletions src/core/Action.h
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ class Action {
/// Get the defaults
std::string getDefaultString() const ;

/// Set the timestep that is stored in the action to the correct value
void resetStoredTimestep();

/// Get the info on what to calculate
virtual std::string writeInGraph() const ;
/// Specialized casts, to make PlumedMain run faster
Expand Down
1 change: 1 addition & 0 deletions src/core/PlumedMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1406,6 +1406,7 @@ void PlumedMain::setUnits( const bool& natural, const Units& u ) {
passtools->usingNaturalUnits = natural; passtools->units=u;
std::vector<ActionToPutData*> idata = actionSet.select<ActionToPutData*>();
for(const auto & ip : idata) ip->updateUnits( passtools.get() );
for(const auto & p : actionSet ) p->resetStoredTimestep();
}

void PlumedMain::startStep() {
Expand Down

1 comment on commit 877fc1b

@PlumedBot
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Found broken examples in automatic/ANGLES.tmp
Found broken examples in automatic/ANN.tmp
Found broken examples in automatic/CAVITY.tmp
Found broken examples in automatic/CLASSICAL_MDS.tmp
Found broken examples in automatic/CLUSTER_DIAMETER.tmp
Found broken examples in automatic/CLUSTER_DISTRIBUTION.tmp
Found broken examples in automatic/CLUSTER_PROPERTIES.tmp
Found broken examples in automatic/CONSTANT.tmp
Found broken examples in automatic/CONTACT_MATRIX.tmp
Found broken examples in automatic/CONTACT_MATRIX_PROPER.tmp
Found broken examples in automatic/COORDINATIONNUMBER.tmp
Found broken examples in automatic/DFSCLUSTERING.tmp
Found broken examples in automatic/DISTANCE_FROM_CONTOUR.tmp
Found broken examples in automatic/EDS.tmp
Found broken examples in automatic/EMMI.tmp
Found broken examples in automatic/ENVIRONMENTSIMILARITY.tmp
Found broken examples in automatic/FIND_CONTOUR.tmp
Found broken examples in automatic/FIND_CONTOUR_SURFACE.tmp
Found broken examples in automatic/FIND_SPHERICAL_CONTOUR.tmp
Found broken examples in automatic/FOURIER_TRANSFORM.tmp
Found broken examples in automatic/FUNCPATHGENERAL.tmp
Found broken examples in automatic/FUNCPATHMSD.tmp
Found broken examples in automatic/FUNNEL.tmp
Found broken examples in automatic/FUNNEL_PS.tmp
Found broken examples in automatic/GHBFIX.tmp
Found broken examples in automatic/GPROPERTYMAP.tmp
Found broken examples in automatic/HBOND_MATRIX.tmp
Found broken examples in automatic/INCLUDE.tmp
Found broken examples in automatic/INCYLINDER.tmp
Found broken examples in automatic/INENVELOPE.tmp
Found broken examples in automatic/INTERPOLATE_GRID.tmp
Found broken examples in automatic/LOCAL_AVERAGE.tmp
Found broken examples in automatic/MAZE_OPTIMIZER_BIAS.tmp
Found broken examples in automatic/MAZE_RANDOM_ACCELERATION_MD.tmp
Found broken examples in automatic/MAZE_SIMULATED_ANNEALING.tmp
Found broken examples in automatic/MAZE_STEERED_MD.tmp
Found broken examples in automatic/MULTICOLVARDENS.tmp
Found broken examples in automatic/OUTPUT_CLUSTER.tmp
Found broken examples in automatic/PAMM.tmp
Found broken examples in automatic/PCA.tmp
Found broken examples in automatic/PCAVARS.tmp
Found broken examples in automatic/PIV.tmp
Found broken examples in automatic/PLUMED.tmp
Found broken examples in automatic/PYCVINTERFACE.tmp
Found broken examples in automatic/PYTHONFUNCTION.tmp
Found broken examples in automatic/Q3.tmp
Found broken examples in automatic/Q4.tmp
Found broken examples in automatic/Q6.tmp
Found broken examples in automatic/QUATERNION.tmp
Found broken examples in automatic/SIZESHAPE_POSITION_LINEAR_PROJ.tmp
Found broken examples in automatic/SIZESHAPE_POSITION_MAHA_DIST.tmp
Found broken examples in automatic/SPRINT.tmp
Found broken examples in automatic/TETRAHEDRALPORE.tmp
Found broken examples in automatic/TORSIONS.tmp
Found broken examples in automatic/WHAM_WEIGHTS.tmp
Found broken examples in AnalysisPP.md
Found broken examples in CollectiveVariablesPP.md
Found broken examples in MiscelaneousPP.md

Please sign in to comment.