Skip to content

Commit 3613e2d

Browse files
authored
fixing energy calculation. (#307)
1 parent 729c174 commit 3613e2d

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

contents/quantum_systems/code/julia/energy.jl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# We are calculating the energy to check <Psi|H|Psi>
22
function calculate_energy(wfc, H_k, H_r, dx)
33
# Creating momentum and conjugate wavefunctions
4-
wfc_k = fft(wfc_r)
5-
wfc_c = conj(wfc_r)
4+
wfc_k = fft(wfc)
5+
wfc_c = conj(wfc)
66

77
# Finding the momentum and real-space energy terms
88
energy_k = wfc_c.*ifft((H_k) .* wfc_k)
9-
energy_r = wfc_c.* H_r .* wfc_r
9+
energy_r = wfc_c.* H_r .* wfc
1010

1111
# Integrating over all space
1212
energy_final = 0

0 commit comments

Comments
 (0)