diff --git a/Python/pywarpx/callbacks.py b/Python/pywarpx/callbacks.py index 45c9b63a082..02e62c1e722 100644 --- a/Python/pywarpx/callbacks.py +++ b/Python/pywarpx/callbacks.py @@ -280,6 +280,7 @@ def callfuncsinlist(self, *args, **kw): "loadExternalFields": {}, "beforeInitEsolve": {}, "afterInitEsolve": {}, + "afterInitatRestart": {}, "afterinit": {}, "beforecollisions": {}, "aftercollisions": {}, @@ -405,6 +406,13 @@ def callfromafterInitEsolve(f): def installafterInitEsolve(f): installcallback("afterInitEsolve", f) +# ---------------------------------------------------------------------------- +def callfromafterInitatRestart(f): + installcallback("afterInitatRestart", f) + return f + +def installafterInitatRestart(f): + installcallback("afterInitatRestart", f) # ---------------------------------------------------------------------------- def callfromafterinit(f): diff --git a/Source/Initialization/WarpXInitData.cpp b/Source/Initialization/WarpXInitData.cpp index 71c773c0669..5de8912be6a 100644 --- a/Source/Initialization/WarpXInitData.cpp +++ b/Source/Initialization/WarpXInitData.cpp @@ -610,6 +610,9 @@ WarpX::InitData () AddExternalFields(lev); } } + else { + ExecutePythonCallback("afterInitatRestart"); + } if (restart_chkfile.empty() || write_diagnostics_on_restart) { // Write full diagnostics before the first iteration.