shankar1729 / jdftx

JDFTx: software for joint density functional theory
http://jdftx.org
82 stars 54 forks source link

Eigenvalues of radon #187

Closed wangenau closed 2 years ago

wangenau commented 2 years ago

Hello,

currently I am trying to calculate eigenvalues of some noble gases. For all prior species tested the calculations worked flawless, but for radon sadly I couldn't get a value. The DFT calculation itself works fine but the eigenvalue calculation finds a positive eigenvalue and aborts with a stacktrace that looks like the following.

IonicMinimize: Iter:   0  Etot: -15.008972859355939  |grad|_K:  0.000e+00  t[s]:     98.35
IonicMinimize: Converged (|grad|_K<1.000000e-04).
Eigenvalue# 0 is non-positive (0.000000e+00) in pow (exponent -0.5)

Stack trace:
     0: /path_to_src/jdftx/build/libjdftx.so(_Z10printStackb+0x3a) [0x1542375d101a]
     1: /path_to_src/jdftx/build/libjdftx.so(_Z14stackTraceExiti+0xd) [0x1542375d157d]
     2: /path_to_src/jdftx/build/libjdftx.so(_Z3powRK6matrixdPS_P10diagMatrixPb+0x7ae) [0x1542375e184e]
     3: /path_to_src/jdftx/build/libjdftx.so(_Z7invsqrtRK6matrixPS_P10diagMatrixPb+0x25) [0x1542375e1955]
     4: /path_to_src/jdftx/build/libjdftx.so(_ZN14IonicMinimizer4stepERK13IonicGradientd+0x8fd) [0x1542376cbbad]
     5: /path_to_src/jdftx/build/libjdftx.so(_ZN14IonicMinimizer8minimizeERK14MinimizeParams+0x2a) [0x1542376cd8ba]
     6: jdftx(main+0xedb) [0x40c03b]
     7: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf0) [0x1542364ce840]
     8: jdftx(_start+0x29) [0x40c459]
Writing 'jdftx-stacktrace' (for use with script printStackTrace): 

My input script looks like the following, but I have already tried multiple different options without success. The pseudopotential file I used was downloaded from Quantum Espresso: https://www.quantum-espresso.org/upf_files/Rn.pz-hgh.UPF

lattice \
            20 0 0 \
            0 20 0 \
            0 0 20
ion Rn    0.00000    0.00000    0.00000 1
coords-type cartesian
elec-ex-corr lda-VWN
wavefunction random
ion-species $ID.pz-hgh.UPF
elec-cutoff 40
dump End EigStats

Do you have an idea what possibly went wrong? Thanks in advance!

shankar1729 commented 2 years ago

This seems to be an issue in the pseudopotential: it has linearly-dependent atomic orbitals, which triggers an unexpected orthonormalization fail during Lowdin analysis at the end of the ionic step.

Same input works fine with other Radon pseudopotentials, for example, from Pseudo Dojo.

Best, Shankar

theonov13 commented 2 years ago

Dear Shankar,

@wangenau is currently limited/ forced (by constraints) to use only GTH/HGH pseudopotentials. PySCF mentioned for the Rn HGH highly diffusive basis function, however, the calculation runs without problems and gives the expected results.

After your comment, I checked the pseudopotential in various codes (PySCF, Octopus, GPAW, DFTK.jl) and formats. It seems to run without problems. Thus I assume it is not a conversion error between HGH format and UPF format.

Is there an 'easy' possibility to skip the step triggering the failure? In principle, @wangenau needs only the total energy and the highest occupied energy level, thus the "ionic step" may not be needed.

Thank you for your time and advice, Sebastian

shankar1729 commented 2 years ago

Hi Sebastian,

I double-checked that the atomic orbitals in this pseudopotential actually are linearly dependent. In fact, the pseudopotential file even has a warning in it's comment that the AOs are not a part of the HGH specification: "Contains atomic orbitals generated by ld1.x - use with care".

JDFTx will skip the step that's causing the error if there are no atomic orbitals available, but it does not check for faulty atomic orbitals. Instead of supporting this corner case by editing the code, the simpler solution is to just remove the broken orbitals. I attach the HGH pseudopotential linked above with the atomic orbitals removed:

Rn.pz-hgh.UPF.zip

If you need to do this for another UPF file, simply delete the entire contents between and including <PP_PSWFC > and </PP_PSWFC> and then set number_of_wfc to 0 in the <PP_HEADER> block at the start of the file.

Best, Shankar

wangenau commented 2 years ago

Hi Shankar,

thanks a lot for your advice. With the pseudopotential you linked the calculation worked as intended. Therefore, I will close this issue. Thanks a lot!

Kind regards.

theonov13 commented 2 years ago

Hi Shankar,

thank you for your quick response and detailed explanation. I have forgotten to have a look inside the file.

To get your adjusted UPF file to work with QE you need to reinsert an empty section

otherwise the QE parser fails to read the file. Best regards, Sebastian
shankar1729 commented 2 years ago

That's good to know: thanks! Right, PP_PSWFC is indeed listed as a required section in the UPF specification. JDFTx treats the section as optional in its XML parsing, so deleting the section also works.

Best, Shankar