From 98d9a9a4d2ae8f2cb78ebb069b299f9d3f152e12 Mon Sep 17 00:00:00 2001 From: Gareth Tribello Date: Sun, 16 Jun 2019 16:09:32 +0100 Subject: [PATCH] Added call to PLUMED with setStopFlag so that PLUMED can stop LAMMPS if it needs to. This would be needed if you were computing committors for example --- src/USER-PLUMED/fix_plumed.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/USER-PLUMED/fix_plumed.cpp b/src/USER-PLUMED/fix_plumed.cpp index 9921747b22..127c22964a 100644 --- a/src/USER-PLUMED/fix_plumed.cpp +++ b/src/USER-PLUMED/fix_plumed.cpp @@ -406,6 +406,8 @@ void FixPlumed::post_force(int /* vflag */) // pass all pointers to plumed: p->cmd("setStep",&step); + int plumedStopCondition=0; + p->cmd("setStopFlag",&plumedStopCondition); p->cmd("setPositions",&atom->x[0][0]); p->cmd("setBox",&box[0][0]); p->cmd("setForces",&atom->f[0][0]); @@ -478,6 +480,8 @@ void FixPlumed::post_force(int /* vflag */) // do the real calculation: p->cmd("performCalc"); + if(plumedStopCondition) error->all(FLERR,"received instruction from PLUMED to stop"); + // retransform virial to lammps representation and assign it to this // fix's virial. If the energy is biased, Plumed is giving back the full // virial and therefore we have to subtract the initial virial i.e. virial_lmp.