diff options
Diffstat (limited to 'ep_run/t2fix_freezer.py')
| -rw-r--r-- | ep_run/t2fix_freezer.py | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/ep_run/t2fix_freezer.py b/ep_run/t2fix_freezer.py new file mode 100644 index 0000000..d5d090f --- /dev/null +++ b/ep_run/t2fix_freezer.py @@ -0,0 +1,21 @@ +import time, os, re, shutil +os.chdir("/home/yurenh2/ept/ep_run") +LOG, CK = "runs/ep_t2fix.log", "runs/ep_t2fix.pt" +os.makedirs("runs/t2fix_traj", exist_ok=True) +last_mt=0; t0=time.time() +while time.time()-t0 < 24*3600: + time.sleep(30) + try: ls=[l for l in open(LOG) if l.startswith("step")] + except Exception: continue + if not ls: continue + m=re.search(r"step\s+(\d+)/.*res=([\d.eE+-]+)", ls[-1]) + if not m: continue + step=int(m.group(1)); res=float(m.group(2)) + try: mt=os.path.getmtime(CK) + except Exception: continue + if mt!=last_mt and os.path.getsize(CK)>1e6: + last_mt=mt + try: shutil.copy2(CK, f"runs/t2fix_traj/s{step}.pt"); print(f"froze s{step} res={res:.2e}",flush=True) + except Exception: pass + if res>0.25: print(f"ep_t2fix DIVERGED step {step}",flush=True); break +print("t2fix freezer done") |
