Page 1 of 1

LORBIT=12: Bug, intended behavior, or my mistake?

Posted: Fri Aug 30, 2013 10:26 pm
by bmalone
Hi,

It seems to me that there might possibly be a bug in the calculation of the phase with LORBIT=12. If this is simply from me misunderstanding the source code I apologize in advance.

From looking at the source the calculation of the PHAS for LORBIT=12 seems rather simple, occurring in the block of code below (from sphpro.F)

Code: Select all

??????IF?(LORBIT==12?.AND.?LFINAL)?THEN
?????????DO?ISP=1,WDES%ISPIN
?????????DO?II=0,WDES%NRSPINORS-1
?????????DO?L?=LOW,LHI
?????????DO?M=1,MMAX
?????????LM=LL*LL+M
?????????DO?NK=1,WDES%NKPTS
#ifdef?MPI
?????????IF?(MOD(NK-1,WDES%COMM_KINTER%NCPU).NE.WDES%COMM_KINTER%NODE_ME-1)?CYCLE
#endif
?????????DO?NB=1,WDES%NB_TOT
????????????NB_=NB_LOCAL(NB,WDES_1K)
????????????IF(NB_==0)?CYCLE
????????????CTMP=?W%CPROJ(LMBASE+M,NB_,NK,ISP+II)
????????????PHAS(LM,NI,NK,NB,ISP)=PHAS(LM,NI,NK,NB,ISP)+CTMP
?????????ENDDO
?????????ENDDO
?????????ENDDO
?????????ENDDO
?????????ENDDO
?????????ENDDO
??????ENDIF


As can be seen, PHAS is calculated simply as a sum of the W%CPROJ terms, which I take are the projections of the PAW projectors onto the wavefunctions. The place where I think a bug might occur is related to the DO loop

Code: Select all

DO?L=LOW,LHI

This L is never used explicitly inside the DO loop. For the Pb PAW pseudo, there are 2 s projectors, 2 p projectors, and 1 d projector. Thus when the code enters this block for the s-state (LL=0), it simply computes PHAS as twice the projection value of the lowest s-projector (because then LOW=1 and LHI=2). Similarly, for p-projector (LL=1), it computes twice the value (because LOW=3 and LHI=4). When it gets to the d-projector (LL=2), it computes just the value (since LOW=LHI=5).

Is this the intended behavior? It seems the a more natural thing to do would be to either compute the sum (or average) of the projectors with the same angular momentum, or actually write to file the phase information for all the projectors independently (thus increasing the number of output lines to PROCAR).

If I'm not mistaken on the contents of CPROJ, having PHAS be the sum of the projectors with the same angular momentum could be done by simply changing the DO loop on L to be

Code: Select all

DO L=0,LHI-LOW


and changing the CTMP assignment to be

Code: Select all

CTMP=W%CPROJ(LMBASE+M+MMAX*L,NB_,NK,ISP+II)
Does this seem correct, and is this a bug? Or is this what was intended originally? Thanks for the help.




<span class='smallblacktext'>[ Edited ]</span>

LORBIT=12: Bug, intended behavior, or my mistake?

Posted: Fri Aug 30, 2013 10:44 pm
by bmalone
Sorry about the extra question marks where there should just be whitespace. The forum added that automatically.

LORBIT=12: Bug, intended behavior, or my mistake?

Posted: Mon Sep 09, 2013 1:50 pm
by admin
we have fixed the bug, the corrected version will be included in the next vasp release (5.3.4)