From 4e8e865d6068f1f5b9a4268797c5f715b4960d2c Mon Sep 17 00:00:00 2001 From: Yuichi Motoyama Date: Tue, 22 Oct 2024 11:22:59 +0900 Subject: [PATCH] output temperature in Kelvin (revert to old behavior) --- abics/sampling/pamc.py | 5 +++-- abics/sampling/rxmc.py | 12 +++++++----- abics/sampling/simple_parallel.py | 6 ++++-- abics/scripts/postproc_dft_latgas.py | 4 ++++ 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/abics/sampling/pamc.py b/abics/sampling/pamc.py index 42dd800a..0b351bf6 100644 --- a/abics/sampling/pamc.py +++ b/abics/sampling/pamc.py @@ -433,6 +433,7 @@ def postproc( obsnames, isamples_offsets, comm, + E2T:float=1.0, ): procs = comm.Get_size() rank = comm.Get_rank() @@ -505,7 +506,7 @@ def postproc( f.write(f"# $7: ERROR of <{oname}^2> - <{oname}>^2\n") for iT in range(nT): - f.write(f"{kTs[iT]}") + f.write(f"{E2T*kTs[iT]}") for j in range(3): f.write(f" {o_mean[iT, 3*iobs+j]} {o_err[iT, 3*iobs+j]}") f.write("\n") @@ -523,5 +524,5 @@ def postproc( for i, (dlz, dlz_e) in enumerate(zip(dlogZ, dlogZ_err)): F += dlz dF += dlz_e - f.write(f"{kTs[i]} {F} {dF} {dlz} {dlz_e}\n") + f.write(f"{E2T*kTs[i]} {F} {dF} {dlz} {dlz_e}\n") comm.Barrier() diff --git a/abics/sampling/rxmc.py b/abics/sampling/rxmc.py index 72208f03..cb77a8f0 100644 --- a/abics/sampling/rxmc.py +++ b/abics/sampling/rxmc.py @@ -427,7 +427,9 @@ def jackknife(X: np.ndarray) -> np.ndarray: def postproc(obs_save, Trank_hist, kT_hist, kTs, comm, - obsnames, throw_out: int | float): + obsnames, throw_out: int | float, + E2T: float = 1.0, + ): assert throw_out >= 0 rank = comm.Get_rank() nT = comm.Get_size() @@ -527,17 +529,17 @@ def postproc(obs_save, Trank_hist, kT_hist, kTs, comm, F = 0.0 dF = 0.0 if kTs[0] <= kTs[-1]: - f.write(f"{kTs[-1]} {F} {dF} {0.0} {0.0}\n") + f.write(f"{E2T*kTs[-1]} {F} {dF} {0.0} {0.0}\n") for iT in np.arange(1, nT)[::-1]: dlz, dlz_e = dlogz[iT] F += dlz dF += dlz_e - f.write(f"{kTs[iT-1]} {F} {dF} {dlz} {dlz_e}\n") + f.write(f"{E2T*kTs[iT-1]} {F} {dF} {dlz} {dlz_e}\n") else: - f.write(f"{kTs[0]} {F} {dF} {0.0} {0.0}\n") + f.write(f"{E2T*kTs[0]} {F} {dF} {0.0} {0.0}\n") for iT in np.arange(0, nT - 1): dlz, dlz_e = dlogz[iT] F += dlz dF += dlz_e - f.write(f"{kTs[iT+1]} {F} {dF} {dlz} {dlz_e}\n") + f.write(f"{E2T*kTs[iT+1]} {F} {dF} {dlz} {dlz_e}\n") comm.Barrier() diff --git a/abics/sampling/simple_parallel.py b/abics/sampling/simple_parallel.py index 024a5637..0eb67c20 100644 --- a/abics/sampling/simple_parallel.py +++ b/abics/sampling/simple_parallel.py @@ -415,7 +415,9 @@ def __init__( def postproc(obs_save, kTs, comm, - obsnames, throw_out: int | float): + obsnames, throw_out: int | float, + E2T: float = 1.0, + ): assert throw_out >= 0 rank = comm.Get_rank() nT = comm.Get_size() @@ -456,7 +458,7 @@ def postproc(obs_save, kTs, comm, f.write(f"# $6: <{oname}^2> - <{oname}>^2\n") f.write(f"# $7: ERROR of <{oname}^2> - <{oname}>^2\n") for iT in range(nT): - f.write(f"{kTs[iT]}") + f.write(f"{E2T*kTs[iT]}") for itype in range(ntype): f.write(f" {obs_all[iT, itype, iobs]}") f.write("\n") diff --git a/abics/scripts/postproc_dft_latgas.py b/abics/scripts/postproc_dft_latgas.py index cda40cd7..109df8e4 100644 --- a/abics/scripts/postproc_dft_latgas.py +++ b/abics/scripts/postproc_dft_latgas.py @@ -387,6 +387,7 @@ def postproc_dft_latgas(params_root: MutableMapping): comm=comm, obsnames=obsnames, throw_out=throw_out, + E2T=1.0/kB, ) elif sampler_type == "PAMC": @@ -410,6 +411,7 @@ def postproc_dft_latgas(params_root: MutableMapping): obsnames=obsnames, isamples_offsets=isamples_offsets, comm=comm, + E2T=1.0/kB, ) elif sampler_type == "parallelRand": @@ -420,6 +422,7 @@ def postproc_dft_latgas(params_root: MutableMapping): comm=comm, obsnames=obsnames, throw_out=throw_out, + E2T=1.0/kB, ) elif sampler_type == "parallelMC": @@ -430,6 +433,7 @@ def postproc_dft_latgas(params_root: MutableMapping): comm=comm, obsnames=obsnames, throw_out=throw_out, + E2T=1.0/kB, ) logger.info("--Sampling completed sucessfully.") logger.info("Exiting normally on {}\n".format(datetime.datetime.now()))