Skip to content

fixing energy calculation. #307

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions contents/quantum_systems/code/julia/energy.jl
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
# We are calculating the energy to check <Psi|H|Psi>
function calculate_energy(wfc, H_k, H_r, dx)
# Creating momentum and conjugate wavefunctions
wfc_k = fft(wfc_r)
wfc_c = conj(wfc_r)
wfc_k = fft(wfc)
wfc_c = conj(wfc)

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

# Integrating over all space
energy_final = 0
Expand Down