I’m using LAMMPS Python package, this is basically what I do:
for idx in range(self.nsims):
lmp = lammps(comm=comm)
run_cascade(lmp, idx)
lmp.close()
lmp.finalize()
Inside the run_cascade
, these commands are executed:
compute ke all ke/atom
compute kemax thermoboundary reduce max c_ke
variable kemaxboundary equal c_kemax
fix bordercheck thermoboundary halt 100 v_kemaxboundary > 10.0 error hard message yes
When an atom in thermoboundary
has a kinetic energy higher than 10 eV, the simulation stops. This is what I want, but that causes the full code to abort. I wonder if there is some way to catch the exception and simply skip that simulation in the loop, without aborting the full program.