TRIQS / dft_tools

Interface to DFT codes
https://triqs.github.io/dft_tools
Other
40 stars 38 forks source link

locproj.F #164

Closed viridibang closed 3 years ago

viridibang commented 3 years ago

Hi, all.

I'm trying to perform the DFT+DMFT calculations with VASP interface(VASP5.4.4). Where can I find the details about the modification of locproj.F file for the fermi energy?

I already changed the line 695 as below.

WRITE(99,'(4I6,F12.7," # of spin, # of k-points, # of bands, # of proj, Efermi" )') W%WDES%NCDIJ,NK,NB,NF,EFERMI

However, when I try to recompile the VASP code, the error came out.

locproj.F(695): error #6404: This name does not have a type, and must have an explicit type. [EFERMI] WRITE(99,'(4I6,F12.7," # of spin, # of k-points, # of bands, # of proj, Efermi" )') W%WDES%NCDIJ,NK,NB,NF,EFERMI

I think that the EFERMI should be specified in somewhere, however I don't know how to do it.

Best, Bang

the-hampel commented 3 years ago

Hi, yes, indeed the instructions are not complete. Sorry for that. I will add the missing pieces. What you need to do is to pass EFERMI to the subroutine itself in locproj.F in line 560 or so:

SUBROUTINE LPRJ_WRITE(IU6,IU0,W,EFERMI)

and then add in the header of the subroutine also:

REAL(q) :: EFERMI

to define the variable type. Now the subroutine should be aware of the variable EFERMI To make this then successful you also need to change the call to the function in electron.F in line 650:

CALL LPRJ_WRITE(IO%IU6, IO%IU0, W,EFERMI)

I hope thats it. Give it a try please. If this works I will update the instructions.

Best, Alex

viridibang commented 3 years ago

Dear Alex,

Thank you very much for your prompt response.

I successfully recompiled the VASP 5.4.4 following your advice. However, after the DFT self-consistent calculation, the EFERMI value in the first line of the LOCPROC file was 0.0000000. I think that we just defined EFERMI variable (REAL(q) :: EFERMI), however, there is no given number for it, thus we should set the EFERMI variable as similar to other variables like below.

  NB=SIZE(LPRJ_COVL,1)
  NK=SIZE(LPRJ_COVL,2)
  NS=SIZE(LPRJ_COVL,3)
  NF=SIZE(LPRJ_COVL,4)
  EFERMI= ??????
the-hampel commented 3 years ago

Hi, did you perform all 4 changes as written? I checked again and I cannot find any other changes that I made. You need to change the call to LPRJ_WRITE by adding EFERMI as variable in electron.F. This is in the function ELMIN, which knows the values of EFERMI, so this should set the value of EFERMI. Then we need to change the subroutine header LPRJ_WRITE by adding EFERMI. Now the function got the value of Efermi. Next we need to init the variable, but the value of it is already set here in fortran. So there is no need to specify it, and if you would do it, it would be overwritten. Then last you need to change the line:

WRITE(99,'(4I6,F12.7," # of spin, # of k-points, # of bands, # of proj, Efermi" )')W%WDES%NCDIJ,NK,NB,NF,EFERMI

Thats it. I made a diff between my files and the original version and could not find any other changes. How many SCF steps did Vasp made before writing the projectors? Where the wavefunctions converged? The fact that you see there the value 0.0 looks to me more like another problem. Can you crosscheck the value of Efermi from the Outcar? It is written in each SCF step.

To crosscheck you should be able to also do a normal SCF calculation without any changes to Vasp, including the LOCPROJ flag. Then the converter should grep the Fermi level from the file DOSCAR. Does this work? Only for charge self-consistent calculations those changes to the LOCPROJ file are necessary.

If all this does not work, I can try to create a patch file which does all the changes to your vasp src files automatically.

Best, Alex

viridibang commented 3 years ago

Dear Alex,

Thank you again for your advice.

I think I did all that you suggested. I modified electrons.F and locproj.F files in the src folder, and the recompile the VASP 5.4.4 using "make all" command.

However, the problem does not disappear. I checked E-fermi in OUTCAR file and confirmed that the number is reasonable. However, the first line in the LOCPROJ file still shows the zero Fermi energy.

If possible, could you check my attached electron.F and locproj.F files?

Best,

files.zip Bang

opeil commented 3 years ago

Dear Bang,

You might need to check that LPRJ_WRITE in main.F also passes EFERMI in the last argument.

Below, I provide relevant diffs (the exact line numbers could differ from your version, do not try to apply it as a patch!). You can ignore the change of NS to W%WDES%NCDIJ.

locproj.F

449c449
<       SUBROUTINE LPRJ_WRITE(IU6,IU0,W)
---
>       SUBROUTINE LPRJ_WRITE(IU6,IU0,W,EFERMI)
454a455
>       REAL(q) :: EFERMI
560c561
<          WRITE(99,'(4I6,"  # of spin, # of k-points, # of bands, # of proj" )') NS,NK,NB,NF
---
>          WRITE(99,'(4I6,F12.7,"  # NCDIJ, # of k-points, # of bands, # of proj" )') W%WDES%NCDIJ,NK,NB,NF,EFERMI

electron.F

649c649
<          CALL LPRJ_WRITE(IO%IU6, IO%IU0, W)
---
>          CALL LPRJ_WRITE(IO%IU6, IO%IU0, W, EFERMI)

main.F

4688c4692
<       CALL LPRJ_WRITE(IO%IU6, IO%IU0, W)
---
>       CALL LPRJ_WRITE(IO%IU6, IO%IU0, W, EFERMI)

Best, Oleg

viridibang commented 3 years ago

Dear Oleg,

Thank you for your kind instruction. The problem was solved!!

The main reason is the main.F file. We should change the main.F file in addition to the other files.

Thank you very much.

Best, Bang

the-hampel commented 3 years ago

Good morning, thanks @opeil I somehow forgot about this one. I will change the instructions.