Skip to content

Commit

Permalink
output temperature in Kelvin (revert to old behavior)
Browse files Browse the repository at this point in the history
  • Loading branch information
yomichi committed Oct 22, 2024
1 parent 1ae0bf9 commit 4e8e865
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 9 deletions.
5 changes: 3 additions & 2 deletions abics/sampling/pamc.py
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ def postproc(
obsnames,
isamples_offsets,
comm,
E2T:float=1.0,
):
procs = comm.Get_size()
rank = comm.Get_rank()
Expand Down Expand Up @@ -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")
Expand All @@ -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()
12 changes: 7 additions & 5 deletions abics/sampling/rxmc.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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()
6 changes: 4 additions & 2 deletions abics/sampling/simple_parallel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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")
Expand Down
4 changes: 4 additions & 0 deletions abics/scripts/postproc_dft_latgas.py
Original file line number Diff line number Diff line change
Expand Up @@ -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":
Expand All @@ -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":
Expand All @@ -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":
Expand All @@ -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()))

0 comments on commit 4e8e865

Please sign in to comment.