Page 1 of 1

Silently wrong GGA XC energy with ifx 2022.0 (oneAPI 2022.1) at -O2 -xCORE-AVX2

Posted: Sun Nov 15, 2026 1:48 pm
by weihang_xie

:-[

Summary
VASP 6.5.1 and 6.6.0 built with ifx 2022.0.0 (20211123, oneAPI 2022.1) using the oneapi makefile template (-O2, -xCORE-AVX2 or -xHOST on an AVX2 machine) run without any error message but give wrong total energies for GGA functionals (PBE, PBEsol) and for PBE-based hybrids (HSE06, PBE0). Builds made with ifort 2021.x from the same source are correct.

Symptoms

Only -V(xc)+E(xc) XCENC is wrong. PSCENC, TEWEN, DENC, EBANDS and the PAW double counting are all identical to a correct build.
SrTiO3, PBEsol, ENCUT 520, 8×8×8: TOTEN −119.60691745 eV instead of −39.72954463 eV (XCENC 78.356 instead of 157.784). 6.5.1 and 6.6.0 give identical wrong numbers.
Testsuite (6.6.0, FAST, 4 MPI × 1 OMP): 36 PASS / 65 FAIL. Every GGA = PE test fails, as do the HSE/PBE0 tests. Most LDA tests pass, as do pure HF and SCAN.
Smallest failing test: bulk_BN_PBE_FullDavidson, TOTEN −34.52152947 instead of −18.99466663.


Re: Silently wrong GGA XC energy with ifx 2022.0 (oneAPI 2022.1) at -O2 -xCORE-AVX2

Posted: Mon Nov 16, 2026 12:09 pm
by alexey.tal

Dear weihang_xie,

I was able to reproduce the issue on our system. And the origin of the problem is not the VASP code but the compiler itself.

ifx 2022.0.0 (oneAPI 2022.1) miscompiles a vectorised reduction loop in ldalib.F when built with -O2 and AVX2 code generation (-xCORE-AVX2, or -xHOST on an AVX2 machine). The affected loop computes the LDA part of the exchange-correlation energy for non-spin-polarised calculations. Its energy sums come out exactly half of the correct value while the potential from the same loop is correct, which is why only XCENC and TOTEN are wrong, the SCF converges normally, all other energy terms match, and no warning is printed.

This must be a compiler defect. As far as I understand, it was one of the first released versions of ifx and it still lacked some of the language features supported and had performance issues. When I rebuild the same 6.6.0 source with ifort from oneAPI 2022.1, and with ifx 2023.2.0 and ifx 2024.0.2. All three reproduce the reference energies of the testsuite.

Thus, I would recommend useing ifort from your existing oneAPI or upgrade to ifx 2023.2 or newer. If you have to stay on ifx 2022.0.0, add this line to your makefile.include and rebuild:

Code: Select all

OBJECTS_O1 += ldalib.o

This compiles only that file at -O1, which avoids the miscompiled loop and restores correct energies in our tests.

Best,
Alexey