9
$\begingroup$

I posted a question previously about why I got different total energy values when I ran a DFT calculation with quantum espresso compared to VASP (link to the question). From what I understood from the responses is that typically absolute or total energy can be sensitive to the choice of algorithm or software. And the suggestion is to use relative or cohesive energy. However, in an extxyz file that often is used in interatomic potential training, the second line looks like:

Lattice="7.10842262195238 0 0 0 7.10842262195238 0 0 0 7.10842262195238 " PBC="1 1 1" Properties=species:S:1:pos:R:3:force:R:3 Energy="-515.36256422"

The energy listed here is the total energy of the configuration, is it not? If this is the case, then how do I decide on which algorithm/software to use if the total energies are different across algorithms/software?

Update: I realized that it would be more helpful if I specify my end goal. So, I am new to DFT calculation and I want to verify my code to generate DFT energy and forces. To do that, I took a diamond configuration from the paper by Wen et al. (link to the paper). Here are the settings they used in their DFT calculation:

  • Use VASP with PBE exchange-correlation function
  • Apply many-body dispersion to capture van der Waals effects
  • Set 500 eV energy cutoff
  • Set $4 \times 4 \times 4$ k-points grid

Unfortunately, I don't have access to VASP and currently, I was using quantum espresso through a wrapper in ASE. See the code below. And this is where I got a different energy value from my calculation and the reference data from the paper. I thought I have applied all those settings in my script, but I still got a different energy value.

Code

from ase.io import read, write
from ase.calculators.espresso import Espresso, EspressoProfile
from ase.units import create_units

units = create_units("2018")  # For unit conversion

# Read the xyz file
orig_config = Path("inst_cubic_diamond_temp300_strain0.0_step0.xyz")
atoms = read(orig_config, format="extxyz")

# Calculator
# ----------

# Set up executable
directory = "test"
pw_loc = "pw.x"
# Parallelization variable
nprocs = 32

# Set how to run pw.x
profile = EspressoProfile(argv=["mpirun", "-np", str(nprocs), pw_loc])

# Set up input parameters
ecut = 500 / units["Ry"]  # Energy cutoff in Ry
ecutrho = 6 * ecut
input_data = {
    "control": {
        "prefix": directory,
        "pseudo_dir": "/data/yonatan/myproject/scripts/indicator_config/EAM/DFT/pseudo",
        "calculation": "scf",
    },
    "system": {"ibrav": 0, "ecutwfc": ecut, "ecutrho": ecutrho, "vdw_corr": "mbd_vdw"},
    # "electrons": {"conv_thr": 1.0e-9, "electron_maxstep": 100, "mixing_beta": 0.7},
}

# Pseudo-potentials
pseudo = {"C": "C.pbe-n-kjpaw_psl.1.0.0.UPF"}

# Create calculator
calc = Espresso(
    profile=profile,
    pseudopotentials=pseudo,
    directory=directory,
    tstress=True,
    tprnfor=True,
    input_data=input_data,
    kpts=(4, 4, 4),
    koffset=True,
)
atoms.calc = calc

# Compute energy and forces
forces = atoms.get_forces()
energy = atoms.get_potential_energy()
print("Energy:", energy)

EXTXYZ file

64
Lattice="7.10842262195238 0 0 0 7.10842262195238 0 0 0 7.10842262195238 " PBC="1 1 1" Properties=species:S:1:pos:R:3:force:R:3 Energy="-512.86187833"
C     2.515720524176340e-02   3.867550579089600e-03   7.089434672581682e+00 -5.37951000e-01  -9.43653100e-01   8.96908860e-01
C     1.776933986593727e+00   1.732049273644261e+00   2.572083207130320e-02  4.26181090e-01   1.51736004e+00   3.81343080e-01
C     7.082577532701300e+00   1.802144789342045e+00   1.769809143517475e+00  1.13683654e+00  -6.10598840e-01   7.06415680e-01
C     1.730755114222064e+00   7.103866760858615e+00   1.834766904598202e+00  5.28662040e-01   3.17688010e-01  -1.12025143e+00
C     8.721281061942280e-01   8.735364979679285e-01   8.966439895472150e-01  1.05603720e-01   2.62228850e-01   5.75211080e-01
C     2.696528798085684e+00   2.679314544279508e+00   9.295221501861438e-01 -7.81283670e-01  -5.78397410e-01  -1.85532276e+00
C     9.346490289165925e-01   2.672186644581529e+00   2.654060735574339e+00 -2.03034942e+00   1.70433750e-01  -3.59527500e-02
C     2.678101420875179e+00   9.199713446381380e-01   2.689016972481999e+00 -6.26726520e-01  -1.33007226e+00   1.56036970e-01
C     3.511187368839771e+00   7.101188022878494e+00   7.107915220793385e+00  9.31579400e-02  -4.02755650e-01   8.05187710e-01
C     5.312681026669824e+00   1.769173081861437e+00   7.067010726921535e+00  6.70675890e-01  -1.36012410e-01   1.35187542e+00
C     3.546168769563506e+00   1.802083870160192e+00   1.830411431890475e+00  8.04017590e-01  -7.92153530e-01  -1.76726650e+00
C     5.379223112984097e+00   3.912248340524160e-02   1.782229477108722e+00 -2.47505791e+00  -2.16700570e-01  -5.76459000e-03
C     4.425585354722698e+00   8.827204378245163e-01   8.970133431865501e-01  2.16665110e-01   8.11297010e-01  -2.73793900e-01
C     6.213865521165564e+00   2.672265050483028e+00   8.666035823024164e-01  2.11940450e-01  -9.71874700e-02  -3.56909090e-01
C     4.454692212824812e+00   2.667208331883838e+00   2.664322099047440e+00  1.78292390e-01   3.44728770e-01   2.32568650e-01
C     6.202805881832237e+00   9.258737522764287e-01   2.730940032231068e+00  4.33003680e-01   5.79964000e-02  -1.57874570e+00
C     3.423771754923000e-03   3.576000047014824e+00   7.096407537582318e+00  7.40474130e-01  -4.69554600e-01   5.82278100e-02
C     1.773121668458395e+00   5.291121536284495e+00   7.096664293807353e+00  5.47373550e-01   2.29641219e+00  -6.93962180e-01
C     7.061366710445481e+00   5.370766791266893e+00   1.766795669916178e+00  1.08575565e+00  -1.16270741e+00  -3.20823180e-01
C     1.783560955749675e+00   3.595632230775192e+00   1.744914310154615e+00 -1.61832200e-02  -1.34411611e+00   6.86037350e-01
C     9.147487865392240e-01   4.470236769241776e+00   8.314481673929444e-01 -1.97196630e+00  -7.49626810e-01   2.35244402e+00
C     2.602983378091007e+00   6.204381819127091e+00   9.149161188076987e-01  1.82101717e+00  -1.18240660e-01  -3.90261780e-01
C     7.917225343283958e-01   6.245417605564732e+00   2.701292578588703e+00  2.03609908e+00  -3.15842450e-01  -7.80305460e-01
C     2.658791177575270e+00   4.409512997926200e+00   2.662736565382049e+00  6.59346630e-01   2.03379123e+00  -1.16759940e+00
C     3.571911211239574e+00   3.541409467366737e+00   7.066099498225877e+00  1.32691510e-01   8.00661400e-02   1.22032686e+00
C     5.332296008047452e+00   5.301607810249293e+00   7.096567761428173e+00 -7.19261300e-01   1.61148671e+00   5.60174190e-01
C     3.599161989111380e+00   5.298915424097742e+00   1.755959945895381e+00 -1.45534256e+00   1.23807627e+00   5.26815840e-01
C     5.343400430443285e+00   3.555400122598969e+00   1.724019670536935e+00 -7.94688100e-02  -1.22034087e+00   1.68260656e+00
C     4.495938763993136e+00   4.410190288433433e+00   8.644839217613586e-01 -1.90959096e+00   6.98633670e-01  -3.14938090e-01
C     6.177803853456268e+00   6.250621184175251e+00   8.693900128852301e-01  1.68162569e+00  -6.84345710e-01   1.99048910e-01
C     4.467966552309626e+00   6.254770441542771e+00   2.656286880286244e+00 -7.57695100e-02  -1.03345062e+00  -3.54654490e-01
C     6.207880087151072e+00   4.401281444532239e+00   2.639561757040551e+00  7.66324170e-01   1.46387162e+00  -1.26064490e-01
C     7.092034222733816e+00   6.469645546521559e-02   3.611905542679158e+00 -3.69020620e-01  -1.32917779e+00  -7.38472440e-01
C     1.813401260897720e+00   1.798810015038325e+00   3.567437312210998e+00 -6.60443250e-01   1.25397500e-01  -5.29906640e-01
C     9.131195360747199e-03   1.777007203346713e+00   5.386779579481836e+00  1.49964985e+00   4.50847890e-01  -1.38667509e+00
C     1.762572342784958e+00   7.084367575685467e+00   5.258194825119071e+00 -1.44468190e-01   4.70378990e-01   2.27251762e+00
C     8.933156128238523e-01   9.138509927623180e-01   4.435922067475571e+00  2.19887730e-01   2.63211500e-01   6.47886620e-01
C     2.734726120286932e+00   2.672868982068823e+00   4.419541631642722e+00 -1.61252743e+00  -8.08281400e-02   1.02152425e+00
C     9.668444966470966e-01   2.659522421010190e+00   6.248003507545436e+00 -2.34920086e+00  -7.79319900e-02  -1.55410930e-01
C     2.621514609355990e+00   8.887661512628261e-01   6.206886542921475e+00  1.00247324e+00  -9.82742760e-01   2.23900990e-01
C     3.560229798179676e+00   1.192011389147800e-02   3.571414759003793e+00 -1.08340810e-01  -6.94958780e-01  -6.32829660e-01
C     5.303243173957251e+00   1.783785084314883e+00   3.608673698334975e+00  6.65906520e-01   1.93424360e-01  -2.00882610e-01
C     3.528356910667667e+00   1.767911834435971e+00   5.347927358304606e+00  7.39111180e-01  -2.47114860e-01  -1.04495492e+00
C     5.329030825201182e+00   7.096177437942109e+00   5.369101643268158e+00 -3.08175260e-01  -1.14381900e-02   1.84117730e-01
C     4.422761249499998e+00   8.668823746375728e-01   4.494489925294728e+00  3.83796370e-01   4.22127430e-01  -5.75045160e-01
C     6.241506267102304e+00   2.679197823980088e+00   4.509426711577681e+00 -9.90742090e-01  -1.47647882e+00  -1.25004513e+00
C     4.432864237317125e+00   2.645875244758956e+00   6.162178971863699e+00  2.14951310e-01   1.37021740e-01   2.03719183e+00
C     6.276550008692416e+00   8.743755050897671e-01   6.235059780796678e+00 -2.36728919e+00   4.92518030e-01  -1.75193300e-01
C     7.065680456712427e+00   3.515117189201012e+00   3.569630900347304e+00  2.01679955e+00   6.47574810e-01  -7.38426790e-01
C     1.744524484258135e+00   5.323755096101070e+00   3.489180474334740e+00 -2.31814270e-01  -5.78952010e-01   2.30748316e+00
C     7.087238738665912e+00   5.312598853304337e+00   5.367801939276317e+00  8.84590350e-01   6.63457880e-01  -2.04867967e+00
C     1.836661512479110e+00   3.526170004448624e+00   5.351513557516396e+00 -1.23618594e+00   5.61918680e-01  -1.49124744e+00
C     8.644019616485500e-01   4.381350493769153e+00   4.431205771235654e+00  6.54489790e-01   1.65426557e+00   5.88371370e-01
C     2.638706329462460e+00   6.199561100158887e+00   4.412298788750978e+00  5.65976410e-01   3.85331420e-01  -6.55854390e-01
C     8.855542105019791e-01   6.193752239362274e+00   6.199043180486793e+00  4.21980700e-01   3.69641240e-01   2.30177540e-01
C     2.676275196019875e+00   4.452567718556373e+00   6.202611111052449e+00  5.14470800e-01  -6.82406950e-01  -3.64222200e-02
C     3.579314420145626e+00   3.572309993748555e+00   3.522390171804665e+00  1.20915900e-02  -5.19302820e-01   8.08118950e-01
C     5.377902368061301e+00   5.343446208684958e+00   3.488438141760533e+00 -1.17684527e+00   1.56643050e-01   2.46875405e+00
C     3.545122765174973e+00   5.343271341488506e+00   5.291750347349461e+00  3.51595720e-01  -8.43737200e-01   5.14030800e-01
C     5.342069378307690e+00   3.526753748114178e+00   5.351913690625676e+00 -3.28223650e-01   2.01570343e+00  -1.31587457e+00
C     4.480059756291901e+00   4.450995690893960e+00   4.393124174154658e+00 -6.06505570e-01   2.54363480e-01   8.42964100e-01
C     6.221970331384210e+00   6.256644790419212e+00   4.501010623532506e+00  3.77290300e-02  -1.34160519e+00  -1.84268948e+00
C     4.403452996558423e+00   6.178451075335819e+00   6.250501549422556e+00  6.40125260e-01   1.35140560e+00  -1.06078985e+00
C     6.211810831607253e+00   4.482924592776214e+00   6.216467417097163e+00  8.36191500e-02  -2.43405957e+00   4.62511060e-01
$\endgroup$
4
  • 5
    $\begingroup$ You cannot compare absolute energies calculated using totally different methods, but you can compare energies calculated with the same method. $\endgroup$
    – Greg
    Apr 30 at 16:48
  • 1
    $\begingroup$ Based on your edits: if you are not doing the same DFT algorithm, it makes no sense to compare the absolute energies. QE and VASP are two very different programs, they will never give same absolute energies (and you shouldn’t focus on it in your test) $\endgroup$
    – Greg
    May 1 at 3:32
  • 1
    $\begingroup$ @Greg I see. Even if I think that the other settings are the same, such as the exchange-correlation function, etc., we shouldn't expect them to give the same absolute energy? If we want to publish the result, does that mean we also need to encourage anybody who wants to reproduce the result to use the same software? $\endgroup$ May 1 at 3:41
  • 1
    $\begingroup$ @YonatanKurniawan force sensitivity can be asked in a new question. $\endgroup$ May 1 at 16:48

1 Answer 1

10
$\begingroup$

"how do I decide on which algorithm/software to use if the total energies are different across algorithms/software?"

You can use any algorithm or software to calculate your total energies, as long as you say precisely which algorithm and software version that you used, and as long as you stay consistent when calculating relative energies (for example, it's not recommended to use software A to calculate the neutral energy and software B to calculate the cation energy if you're calculating the ionization energy as an energy difference, unless you're confident that both programs are consistent).

$\endgroup$
8
  • $\begingroup$ Thanks for the comment. In the case that I'm trying to do, I am actually new to DFT calculation and I want to verify my script. To do that, I have a reference extxyz file with DFT calculated energy and forces that other people did, and I tried to use the atomic position data and calculate the energy and forces, and compare my results to this "reference" data. Although the forces that I got are comparable, but the energy values are completely different (-16000eV (mine) vs -500 eV). Do you have any suggestions on how I can fix/check the bug? $\endgroup$ Apr 30 at 21:04
  • 1
    $\begingroup$ @YonatanKurniawan do you know what software, functional, and basis set was used to calculate the reference data? If your calculation had anything different, this could be the reason for the discrepancy. $\endgroup$ Apr 30 at 22:18
  • 1
    $\begingroup$ @NikeDattani QE and VASP is using different pseudo-potentials and the formulation of the wave-function is different. There is no such thing as “using the same settings” for the same calculation using these two programs. Finding OK forces but completely different absolute energy is the expected behavior. $\endgroup$
    – Greg
    May 1 at 3:37
  • 1
    $\begingroup$ @Greg no problem! I had seen your comments on the OP's previous question too. I'm basically saying in my answer that it's ok to compare energies if everything is consistent, and that it's not recommended to use one software for one energy and another software for the other energy. $\endgroup$ May 1 at 15:40
  • 2
    $\begingroup$ I am sorry to you two if I created some confusion. From what I learned from your comments, we shouldn't compare energy computed with VASP and QE (specific to my problem), even if I think that the other settings that I can tune are the same. However, would you say that the forces are less sensitive to the choice of software? $\endgroup$ May 1 at 16:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .