From 84a1aea4b5bb839f440b5d9b4e5bd8480d63293f Mon Sep 17 00:00:00 2001 From: Mitsuaki Kawamura Date: Thu, 1 Feb 2024 17:22:21 +0900 Subject: [PATCH] (Bug Fix) Tutorial for the spectrum calculation did not work after the modification of the file-format change in spectrum function. --- samples/tutorial_4.2/All.sh | 4 ++-- samples/tutorial_4.2/OpticalSpectrum.py | 18 ++++++++++-------- src/CalcSpectrum.c | 2 +- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/samples/tutorial_4.2/All.sh b/samples/tutorial_4.2/All.sh index b09b39d48..b022d5b31 100644 --- a/samples/tutorial_4.2/All.sh +++ b/samples/tutorial_4.2/All.sh @@ -17,7 +17,7 @@ cp *.def ./DG_M #[e] for negative omega #[s] sorting -sort -r -n DG_P/zvo_DynamicalGreen.dat > tmp_P -cat DG_M/zvo_DynamicalGreen.dat > tmp_M +sort -r -n DG_P/zvo_DynamicalGreen_0.dat > tmp_P +cat DG_M/zvo_DynamicalGreen_0.dat > tmp_M paste tmp_P tmp_M > optical.dat #[e] sorting diff --git a/samples/tutorial_4.2/OpticalSpectrum.py b/samples/tutorial_4.2/OpticalSpectrum.py index 575983a35..b873e7fec 100755 --- a/samples/tutorial_4.2/OpticalSpectrum.py +++ b/samples/tutorial_4.2/OpticalSpectrum.py @@ -135,14 +135,16 @@ def get_energies(self): list_trans = [0, 0, 0, 0] # x,y,z,orb with open("Current.def", 'w') as f: print("======optical conductivity ", file=f) - print("NCurrent %4d " % (4*All_N), file=f) + print("NCurrent 2 ", file=f) print("======optical conductivity ", file=f) print("======optical conductivity ", file=f) print("======optical conductivity ", file=f) - for spin_i in range(0,2): - for all_i in range(0,All_N): - list_trans[0] = 1 # only +1 for x direction - list_site = lattice.func_site(all_i, list_org) - all_j = lattice.func_strans(list_trans, list_site, list_org) - print("%4d %4d %4d %4d 1 0 1 " % (all_i, spin_i, all_j, spin_i), file=f) - print("%4d %4d %4d %4d 1 0 -1 " % (all_j, spin_i, all_i, spin_i), file=f) + for leftright in range(2): + print("%4d" % (4*All_N), file=f) + for spin_i in range(0,2): + for all_i in range(0,All_N): + list_trans[0] = 1 # only +1 for x direction + list_site = lattice.func_site(all_i, list_org) + all_j = lattice.func_strans(list_trans, list_site, list_org) + print("%4d %4d %4d %4d 1 0 1 " % (all_i, spin_i, all_j, spin_i), file=f) + print("%4d %4d %4d %4d 1 0 -1 " % (all_j, spin_i, all_i, spin_i), file=f) diff --git a/src/CalcSpectrum.c b/src/CalcSpectrum.c index c831fde18..c5e1011fb 100644 --- a/src/CalcSpectrum.c +++ b/src/CalcSpectrum.c @@ -579,7 +579,7 @@ int CalcSpectrum( fprintf(stdoutMPI, " Start: An Eigenvector is inputted in CalcSpectrum.\n"); TimeKeeper(&(X->Bind), cFileNameTimeKeep, c_InputEigenVectorStart, "a"); for (istate = 0; istate < nstate; istate++) { - sprintf(sdt, cFileNameInputEigen, nstate, istate, myrank); + sprintf(sdt, cFileNameInputEigen, X->Bind.Def.CDataFileHead, istate, myrank); childfopenALL(sdt, "rb", &fp); if (fp == NULL) { fprintf(stderr, "Error: Inputvector file is not found.\n");