Skip to content

Commit

Permalink
(Bug Fix) Tutorial for the spectrum calculation did not work after the
Browse files Browse the repository at this point in the history
modification of the file-format change in spectrum function.
  • Loading branch information
mitsuaki1987 committed Feb 1, 2024
1 parent 8de7984 commit 84a1aea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
4 changes: 2 additions & 2 deletions samples/tutorial_4.2/All.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
18 changes: 10 additions & 8 deletions samples/tutorial_4.2/OpticalSpectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
2 changes: 1 addition & 1 deletion src/CalcSpectrum.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down

0 comments on commit 84a1aea

Please sign in to comment.