Skip to content

Commit

Permalink
Spin symmetric MTOs with --phispinsym.
Browse files Browse the repository at this point in the history
With --phispinsym option for lmf,lmf-MPIK, we can use spin-averages pnu and V0.
Use job_ham_phispinsym instead of job_ham.

From V0 and pnu, we calculate radial funcitons phi and phidot.
   pnu corresponding to energies of radial schrodinger eq.
   V0 is the spherical potential, ssite(ib)%rv_a_ov0.


Search --phispinsym in the console output. It shows
----
 bndfp: --phispinsym use spin-averaged potential for phi and phidot
  ibas l=  1  0 pnu=   4.58531   4.57791 -->   4.58161
  ibas l=  1  1 pnu=   4.40324   4.38211 -->   4.39268
.... (this is symmetrization of pnu) at the begining of bndfp
----
 locpot: --phispinsym mode: use spin-averaged potential for phi and phidot
  ibas l=  1  0 pnu(1:nsp) pnz(1:nsp)=   4.58161   4.58161   0.00000   0.00000
  ibas l=  1  1 pnu(1:nsp) pnz(1:nsp)=   4.39268   4.39268   3.94432   3.94432
... (this shows pnu used in locpot).

What we can do are

1. self-consistent calculations can be performed with --phispinsym
   
2. Even if the self-consistency is spin-dependent phi,phidot,
   job_ham_phispinsym (see --phispinsym option) gives Hamiltonian, based on the spin-symmetric radial functions.
   Then the radial functions are calculated from the spin-averaged V0 and pnu.
---
I think we can perfrom QSGW calculation if we use the option for lmf,lmfgw
   (not tested yet). We may need to insert --phispinsym in gwsc script (not yet).
I think we can give Hamiltonian based on the spin-averaged phi,phidot
   even in QSGW self-consistent results without --phispinsym.


=====================================================================
MEMO for development:
=====================================================================

At first, note that we have lmf subroutines;
--------
fp/bndfp.F (main one-iteration loop of band calculation)
  -mkpot (potential generation)
  --locpot (MT parts)
  ---augmat (augmentation matrix: MT-part of Hamiltonian and overlap matrix).
Note mkpot is called even in bndfp-sugw-mkpot

locpot: gives ov0. ov0 is symmetrized.
pnunew: renew pnu---so pnu should symmetrized.
bndfp:  pnu is symmetrized at the begining befor mkpot-locpot
  • Loading branch information
tkotani committed Aug 27, 2019
1 parent 3299b18 commit c81819c
Show file tree
Hide file tree
Showing 6 changed files with 111 additions and 13 deletions.
7 changes: 1 addition & 6 deletions MATERIALS/Fe_HamMTO/bandplot.isp1.all.glt
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ plot \
"bnd004.spin1" u ($2):($3) lt 1 pt 1 w lp,\
"bnd005.spin1" u ($2):($3) lt 1 pt 1 w lp,\
"bnd006.spin1" u ($2):($3) lt 1 pt 1 w lp,\
"BANDPMT/bnd001.spin1" u ($2):($3) lt 2 pt 2 w lp,\
"BANDPMT/bnd002.spin1" u ($2):($3) lt 2 pt 2 w lp,\
"BANDPMT/bnd003.spin1" u ($2):($3) lt 2 pt 2 w lp,\
"BANDPMT/bnd004.spin1" u ($2):($3) lt 2 pt 2 w lp,\
"BANDPMT/bnd005.spin1" u ($2):($3) lt 2 pt 2 w lp,\
"BANDPMT/bnd006.spin1" u ($2):($3) lt 2 pt 2 w lp
"band_lmfham1.dat" u ($1):($2-0.019853916)*13.605 pt 2 w p
pause -1

2 changes: 1 addition & 1 deletion MATERIALS/Fe_HamMTO/ctrl.fe
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ SPEC



% const pwemax=3 nk1=5 nk2=5 nk3=5 nit=30 gmax=12 nspin=2 metal=3 so=0 xcfun=1 ssig=1.0
% const pwemax=3 nk1=8 nk2=8 nk3=8 nit=30 gmax=12 nspin=2 metal=3 so=0 xcfun=1 ssig=1.0
BZ NKABC={nk1} {nk2} {nk3} # division of BZ for q points.
METAL={metal}
# METAL=3 is safe setting (double path method but not repeat diagonalization),
Expand Down
35 changes: 35 additions & 0 deletions lm7K/fp/bndfp.F
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,9 @@ subroutine bndfp(nbas,nsp,nlibu,lmaxu,lldau, ssite,sspec,slat,sctrl,sham,spot,sb
complex(8):: aaaa,img=(0d0,1d0)
character*4:: cccx
real(8):: pnu(n0,2),pnz(n0,2),pmean
integer:: i_copy_size
logical:: lpz,phispinsym
!! ----------------------------
call tcn ('bndfp')
stdo = lgunit(1)
Expand Down Expand Up @@ -809,6 +812,38 @@ subroutine bndfp(nbas,nsp,nlibu,lmaxu,lldau, ssite,sspec,slat,sctrl,sham,spot,sb
endif
endif

!! spin-symmetrized pnu. aug2019. See also in pnunew and locpot
phispinsym= cmdopt('--phispinsym',12,0,strn)
if(phispinsym) then
if(master_mpi()) write(6,*) 'bndfp: --phispinsym use spin-averaged potential for phi and phidot'
do ib = 1,nbas
i_copy_size=size(ssite(ib)%pnu)
call dcopy(i_copy_size,ssite(ib)%pnu,1,pnu,1)
i_copy_size=size(ssite(ib)%pz)
call dcopy(i_copy_size,ssite(ib)%pz,1,pnz,1)
is = int(ssite(ib)%spec)
lmxa = sspec(is)%lmxa
do l=0,lmxa
pmean = sum(pnu(l+1,1:nsp))/nsp
if(master_mpi().and.nsp==2) write(6,"(' ibas l=',2i3,' pnu=',2f10.5,' -->',f10.5)")
& ib,l,pnu(l+1,1:nsp),pmean
pnu(l+1,1:nsp) = pmean
lpz = pnz(l+1,1) /= 0
if (lpz) then
pmean = sum(pnz(l+1,1:nsp))/nsp
if(master_mpi().and.nsp==2) write(6,"(' ibas l=',2i3,' pnz=',2f10.5,' -->',f10.5)")
& ib,l,pnz(l+1,1:nsp),pmean
pnz(l+1,1:nsp) = pmean
endif
enddo
i_copy_size=size(ssite(ib)%pnu)
call dcopy(i_copy_size,pnu,1,ssite(ib)%pnu,1)
i_copy_size=size(ssite(ib)%pz)
call dcopy(i_copy_size,pnz,1,ssite(ib)%pz,1)
enddo
endif



!! jan2018kaist
writeham= cmdopt('--writeham',10,0,strn)
Expand Down
27 changes: 26 additions & 1 deletion lm7K/fp/locpot.F
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ subroutine locpot ( nbas , nsp , lso , lcplxp , ssite , sspec
integer,parameter:: nbasmx=1000
logical:: master_mpi,master_mpiset
logical,save:: secondcall(1:nbasmx)=.false.
logical :: cmdopt
logical :: cmdopt,phispinsym
character*20::strib
character strn*120
real(8):: ov0mean,pmean
C --- Setup ---
call tcn('locpot')
stdo = globalvariables%stdo ! stdo = nglob('stdo')
Expand Down Expand Up @@ -347,6 +348,30 @@ subroutine locpot ( nbas , nsp , lso , lcplxp , ssite , sspec
call dpscop ( v1 , ssite(ib)%rv_a_ov0 , nr , 1 + nr * nlml * i , 1 + nr * i , y0 )
enddo
endif
!! spin averaged oV0 to generate phi and phidot. takaoAug2019
phispinsym= cmdopt('--phispinsym',12,0,strn)
if(phispinsym) then
if(master_mpi().and.nsp==2) then
write(6,*) 'locpot: --phispinsym mode: use spin-averaged potential for phi and phidot'
endif
do ir=1,nr
ov0mean = 0d0
do isp=1,nsp
ov0mean = ov0mean + ssite(ib)%rv_a_ov0( ir + nr*(isp-1) )
enddo
ov0mean = ov0mean/nsp
do isp=1,nsp
ssite(ib)%rv_a_ov0(ir + nr*(isp-1))= ov0mean
enddo
enddo
if(master_mpi().and.nsp==2)then
do l=0,lmxa
write(6,"(' ibas l=',2i3,' pnu(1:nsp) pnz(1:nsp)=',4f10.5)") ib,l,pnu(l+1,1:nsp),pnz(l+1,1:nsp)
enddo
endif
endif
C ... Store the potential used in mkrout to calculate the core
do i = 0, nsp-1
call dpscop ( v1 , ssite(ib)%rv_a_ov1, nr , 1 + nr * nlml * i , 1 + nr* i , y0 )
Expand Down
24 changes: 19 additions & 5 deletions lm7K/fp/pnunew.F
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,10 @@ subroutine pnunew(nbas,nsp,ssite,sspec,pmin,pmax,lfrzw,hab,sab,
integer ::iwdummy ,i_copy_size,nnz,nnv
real(8):: eferm,eee
logical:: lsemicorepz
logical:: lsemicorepz,phispinsym,cmdopt,master_mpi
real(8):: pmean
character strn*120
pi = 4d0*datan(1d0)
stdo = lgunit(1)
Expand Down Expand Up @@ -339,10 +342,21 @@ subroutine pnunew(nbas,nsp,ssite,sspec,pmin,pmax,lfrzw,hab,sab,
elseif (lpz) then
endif
enddo
enddo
enddo !end of spin loop
!! spin averaged pnu takaoAug2019
phispinsym= cmdopt('--phispinsym',12,0,strn)
if(phispinsym) then
if(master_mpi().and.m==lmxa+1) write(6,*)'pnunew: --phispinsym enforces spin-averaged pnu'
pmean = sum(pnu(m,1:nsp))/nsp
pnu(m,1:nsp) = pmean
if (lpz) then
pmean = sum(pnz(m,1:nsp))/nsp
pnz(m,1:nsp) = pmean
endif
endif
enddo !l loop
i_copy_size=size(ssite(ib)%pnu)
call dcopy(i_copy_size,pnu,1,ssite(ib)%pnu,1)
Expand Down
29 changes: 29 additions & 0 deletions lm7K/job_ham_phispinsym
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/bash
echo $0
echo $@
echo $1
if [ $# -le 2 ] || [ $2 != "-np" ]; then
echo "An example of usage: job_ham si -np 4 [options for lmf]"
echo " CAUTION: We need PWMODE={pwmode}, where const pwmode=11 (or somegthing) given in ctrl file as follows."
echo " %const pwmode=11"
echo " PWMODE={pwmode} "
exit
else
MPI_SIZE=$3
fi

# We introduced {pwmode}. as PWMODE={pwmode}
rm HamiltonianMTO*
#Get efermi.lmf
echo 'runnnig efermi determination for pwmode=0'
mpirun -np $3 ~/ecalj/lm7K/lmf-MPIK $1 --quit=band -vpwmode=0 --phispinsym > lmf_efermi
echo 'runnnig hamiltonian generation for pwmode=0'
mpirun -np $3 ~/ecalj/lm7K/lmf-MPIK $1 --writeham --mkprocar --fullmesh -vpwmode=0 --phispinsym

# Get Hamiltonian file, namded as HamiltonianMTO
cat HamiltonianMTO.* >HamiltonianMTO
rm HamiltonianMTO.*

# Read HamiltonianMTO.
~/ecalj/lm7K/lmfham

0 comments on commit c81819c

Please sign in to comment.