Dear all,

I am working on my own code to carry out simple density functional theory on simple systems using Julia (https://github.com/f-fathurrahman/PWDFT.jl) and also (simple) Fortran (https://github.com/f-fathurrahman/PWDFT.jl). The Fortran code development is however lagging behind the Julia one.

I started from Practical DFT course of Prof. Arias (http://jdftx.org/PracticalDFT.html) and then adding several functionalities until I can use GTH pseudopotential to calculate total energy.

I initially used PWSCF for comparison due to my previous experience using it on my research. However, PWSCF uses different formula (total energy decomposition) from what my code calculate. Later, I realized that ABINIT uses the same total energy decomposition (Ekin+EHartree+Exc+Eewald+EPsloc+Epsnloc), with the exception of PspCore energy.

For several simple systems, such as H atom and H2, I got quite good agreement of total energy values between my code and ABINIT, which is due to small PspCore energy. However, I got quite different total energy value for Si fcc, which has quite large PspCore energy.

From reading the code I found that PspCore energy is calculated in 64_psp/pspcor.F90 and related to epsatm which is 64_psp/psp2lo.F90. Using this, I tried to calculate PspCore and added it to the total energy, however I could not get better agreement of total energy value for Si fcc. I am suspecting that the difference is in treatment of EHartree and EPsloc, because their values are quite off from ABINIT values while other terms are in good agreement.

What I want to ask is are there any reference about PspCore energy and their relation to EHartree and EPsloc ?

Also, in PWSCF, the value of epsatm is assigned to Vpsloc(G=0), is this OK ? I also use epsatm for value of Vpsloc at G=0.

Any help is appreciated,

Thank you very much.

PS: I am doing this without any supervision of someone who is more experienced than me in implementing a DFT code.

So, forgive me I am making silly mistakes in my explanation.