Commit 3718050c authored by Alexander Neukirchen's avatar Alexander Neukirchen

inital

parent 9b505ff7
......@@ -97,7 +97,7 @@ CONTAINS
TYPE(t_coreSpecInput) :: coreSpecInput
TYPE(t_wann) :: wann
TYPE(t_potden) :: vTot, vx, vCoul, vTemp
TYPE(t_potden) :: inDen, outDen, EnergyDen
TYPE(t_potden) :: inDen, outDen, EnergyDen, xcB
CLASS(t_xcpot), ALLOCATABLE :: xcpot
CLASS(t_forcetheo), ALLOCATABLE :: forcetheo
......@@ -138,6 +138,7 @@ CONTAINS
! Initialize and load inDen density (start)
CALL inDen%init(stars,atoms,sphhar,vacuum,noco,input%jspins,POTDEN_TYPE_DEN)
CALL xcB%init(stars,atoms,sphhar,vacuum,noco,input%jspins,POTDEN_TYPE_POTTOT)
archiveType = CDN_ARCHIVE_TYPE_CDN1_const
IF (noco%l_noco) archiveType = CDN_ARCHIVE_TYPE_NOCO_const
IF(mpi%irank.EQ.0) THEN
......@@ -237,7 +238,7 @@ CONTAINS
CALL timestart("generation of potential")
CALL vgen(hybrid,field,input,xcpot,DIMENSION,atoms,sphhar,stars,vacuum,sym,&
obsolete,cell,oneD,sliceplot,mpi,results,noco,EnergyDen,inDen,vTot,vx,vCoul)
obsolete,cell,oneD,sliceplot,mpi,results,noco,EnergyDen,inDen,vTot,vx,vCoul,xcB)
CALL timestop("generation of potential")
#ifdef CPP_MPI
......@@ -399,7 +400,7 @@ CONTAINS
!!$ input%total = .FALSE.
!!$ CALL timestart("generation of potential (total)")
!!$ CALL vgen(hybrid,reap,input,xcpot,DIMENSION, atoms,sphhar,stars,vacuum,sym,&
!!$ obsolete,cell,oneD,sliceplot,mpi, results,noco,outDen,inDenRot,vTot,vx,vCoul)
!!$ obsolete,cell,oneD,sliceplot,mpi, results,noco,outDen,inDenRot,vTot,vx,vCoul,xcB)
!!$ CALL timestop("generation of potential (total)")
!!$
!!$ CALL potdis(stars,vacuum,atoms,sphhar, input,cell,sym)
......
......@@ -20,7 +20,7 @@ CONTAINS
!! TE_EXC : charge density-ex-corr.energy density integral
SUBROUTINE vgen(hybrid,field,input,xcpot,DIMENSION,atoms,sphhar,stars,vacuum,sym,&
obsolete,cell,oneD,sliceplot,mpi,results,noco,EnergyDen,den,vTot,vx,vCoul)
obsolete,cell,oneD,sliceplot,mpi,results,noco,EnergyDen,den,vTot,vx,vCoul,xcB)
USE m_types
USE m_rotate_int_den_to_local
......@@ -53,7 +53,7 @@ CONTAINS
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_potden), INTENT(IN) :: EnergyDen
TYPE(t_potden), INTENT(INOUT) :: den
TYPE(t_potden), INTENT(INOUT) :: vTot,vx,vCoul
TYPE(t_potden), INTENT(INOUT) :: vTot,vx,vCoul,xcB
TYPE(t_potden) :: workden,denRot
......@@ -94,7 +94,7 @@ CONTAINS
obsolete,cell,oneD,sliceplot,mpi,noco,den,denRot,EnergyDen,vTot,vx,results)
!ToDo, check if this is needed for more potentials as well...
CALL vgen_finalize(atoms,stars,vacuum,sym,noco,input,sphhar,vTot,vCoul,denRot)
CALL vgen_finalize(atoms,stars,vacuum,sym,noco,input,sphhar,vTot,vCoul,denRot,xcB)
!DEALLOCATE(vcoul%pw_w)
CALL bfield(input,noco,atoms,field,vTot)
......
......@@ -21,7 +21,7 @@ CONTAINS
TYPE(t_xcpot_inbuild) :: xcpot !local xcpot that is LDA to indicate we do not need gradients
TYPE(t_gradients) :: grad
INTEGER :: n,nsp,imesh,i
INTEGER :: n,nsp,imesh,i,b_ind
REAL :: rho_11,rho_22,rho_21r,rho_21i,mx,my,mz,magmom
REAL :: rhotot,rho_up,rho_down,theta,phi
REAL,ALLOCATABLE :: ch(:,:)
......@@ -89,12 +89,12 @@ CONTAINS
CALL finish_mt_grid()
END SUBROUTINE rotate_mt_den_to_local
SUBROUTINE rotate_mt_den_from_local(atoms,sphhar,sym,den,vtot)
SUBROUTINE rotate_mt_den_from_local(atoms,sphhar,sym,den,vtot,xcB)
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_sym),INTENT(IN) :: sym
TYPE(t_potden),INTENT(IN) :: den
TYPE(t_potden),INTENT(INOUT) :: vtot
TYPE(t_potden),INTENT(INOUT) :: vtot,xcB
TYPE(t_xcpot_inbuild) :: xcpot !local xcpot that is LDA to indicate we do not need gradients
......@@ -103,7 +103,7 @@ CONTAINS
INTEGER :: n,nsp,imesh,i
REAL :: vup,vdown,veff,beff
REAL :: theta,phi
REAL,ALLOCATABLE :: ch(:,:)
REAL,ALLOCATABLE :: ch(:,:),b_xc(:,:)
nsp=atoms%nsp()
ALLOCATE(ch(nsp*atoms%jmtd,4))
......@@ -119,13 +119,18 @@ CONTAINS
phi = den%phi_mt(imesh,n)
veff = (vup + vdown)/2.0
beff = (vup - vdown)/2.0
ch(imesh,1) = veff + beff*COS(theta)
ch(imesh,2) = veff - beff*COS(theta)
ch(imesh,3) = beff*SIN(theta)*COS(phi)
ch(imesh,4) = beff*SIN(theta)*SIN(phi)
b_xc(imesh,1) = beff*SIN(theta)*COS(phi)
b_xc(imesh,2) = beff*SIN(theta)*SIN(phi)
b_xc(imesh,3) = beff*COS(theta)
ch(imesh,1) = veff + b_xc(imesh,3)
ch(imesh,2) = veff - b_xc(imesh,3)
ch(imesh,3) = b_xc(imesh,1)
ch(imesh,4) = b_xc(imesh,2)
ENDDO
vtot%mt(:,0:,n,:)=0.0
xcB%mt(:,0:,n,:)=0.0
CALL mt_from_grid(atoms,sphhar,n,4,ch,vtot%mt(:,0:,n,:))
CALL mt_from_grid(atoms,sphhar,n,3,b_xc,xcB%mt(:,0:,n,:))
DO i=1,atoms%jri(n)
vtot%mt(i,:,n,:)=vtot%mt(i,:,n,:)*atoms%rmsh(i,n)**2
ENDDO
......
......@@ -6,7 +6,7 @@
MODULE m_vgen_finalize
USE m_juDFT
CONTAINS
SUBROUTINE vgen_finalize(atoms,stars,vacuum,sym,noco,input,sphhar,vTot,vCoul,denRot)
SUBROUTINE vgen_finalize(atoms,stars,vacuum,sym,noco,input,sphhar,vTot,vCoul,denRot,xcB)
! ***********************************************************
! FLAPW potential generator *
! ***********************************************************
......@@ -26,7 +26,7 @@ CONTAINS
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_input),INTENT(IN) :: input
TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_potden),INTENT(INOUT) :: vTot,vCoul,denRot
TYPE(t_potden),INTENT(INOUT) :: vTot,vCoul,denRot,xcB
! ..
! .. Local Scalars ..
INTEGER i,js,n
......@@ -47,8 +47,8 @@ CONTAINS
END DO
END DO
ELSEIF(noco%l_noco) THEN
CALL vmatgen(stars,atoms,vacuum,sym,input,denRot,vTot)
IF (noco%l_mtnocoPot) CALL rotate_mt_den_from_local(atoms,sphhar,sym,denRot,vtot)
CALL vmatgen(stars,atoms,vacuum,sym,input,denRot,vTot,xcB)
IF (noco%l_mtnocoPot) CALL rotate_mt_den_from_local(atoms,sphhar,sym,denRot,vtot,xcB)
ENDIF
! Rescale vCoul%pw_w with number of stars
......@@ -61,10 +61,13 @@ CONTAINS
!Copy first vacuum into second vacuum if this was not calculated before
IF (vacuum%nvac==1) THEN
vTot%vacz(:,2,:) = vTot%vacz(:,1,:)
xcB%vacz(:,2,:) = xcB%vacz(:,1,:)
IF (sym%invs) THEN
vTot%vacxy(:,:,2,:) = CMPLX(vTot%vacxy(:,:,1,:))
xcB%vacxy(:,:,2,:) = CMPLX(xcB%vacxy(:,:,1,:))
ELSE
vTot%vacxy(:,:,2,:) = vTot%vacxy(:,:,1,:)
xcB%vacxy(:,:,2,:) = xcB%vacxy(:,:,1,:)
ENDIF
ENDIF
......
......@@ -21,9 +21,15 @@ MODULE m_vmatgen
! stars and written to file potmat.
!
! Philipp Kurz 99/11/01
!
! Extended for the investigation of the exch-corr B-field, which is
! analogously saved as a potden type with 3 integers (i.e. in com-
! ponent space.
!
! A.Neukirchen 05.09.2019
!**********************************************************************
CONTAINS
SUBROUTINE vmatgen(stars,atoms,vacuum,sym,input,den,vTot)
SUBROUTINE vmatgen(stars,atoms,vacuum,sym,input,den,vTot,xcB)
!******** ABBREVIATIONS ***********************************************
! ifft3 : size of the 3d real space mesh
......@@ -48,23 +54,27 @@ CONTAINS
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_potden),INTENT(IN) :: den
TYPE(t_potden),INTENT(INOUT):: vTot
TYPE(t_potden),INTENT(INOUT):: vTot,xcB
! ..
! .. Local Scalars ..
INTEGER imeshpt,ipot,jspin,ig2 ,ig3,ivac,ifft2,ifft3,imz,iter
INTEGER imeshpt,ipot,jspin,ig2 ,ig3,ivac,ifft2,ifft3,imz,iter,b_ind
REAL vup,vdown,veff,beff,vziw,theta,phi
! ..
! .. Local Arrays ..
REAL, ALLOCATABLE :: vvacxy(:,:,:,:),vis(:,:),fftwork(:)
REAL, ALLOCATABLE :: vvacxy(:,:,:,:),vis(:,:),fftwork(:),b_xc(:,:),b_xc_vacxy(:,:,:,:)
ifft3 = 27*stars%mx1*stars%mx2*stars%mx3
IF (ifft3.NE.SIZE(den%theta_pw)) CALL judft_error("Wrong size of angles")
ifft2 = SIZE(den%phi_vacxy,1)
xcB%pw_w(:,:)=0.0
xcB%vacxy(:,:,:,:)=0.0
xcB%vacz(:,:,:)=0.0
ALLOCATE ( vis(ifft3,4),fftwork(ifft3))
ALLOCATE (b_xc(ifft3,3))
!---> fouriertransform the spin up and down potential
......@@ -80,23 +90,29 @@ CONTAINS
vdown = vis(imeshpt,2)
theta = den%theta_pw(imeshpt)
phi = den%phi_pw(imeshpt)
!---> at first determine the effective potential and magnetic field
!---> at first determine the effective potential and magnetic fields
veff = (vup + vdown)/2.0
beff = (vup - vdown)/2.0
b_xc(imeshpt,1)=beff*SIN(theta)*COS(phi)
b_xc(imeshpt,2)=beff*SIN(theta)*SIN(phi)
b_xc(imeshpt,3)=beff*COS(theta)
!---> now calculate the matrix potential, which is hermitian.
!---> thus calculate the diagonal elements:
!---> V_11
vis(imeshpt,1) = veff + beff*COS(theta)
vis(imeshpt,1) = veff + b_xc(imeshpt,3)
!---> V_22
vis(imeshpt,2) = veff - beff*COS(theta)
vis(imeshpt,2) = veff - b_xc(imeshpt,3)
!---> the real part of V_21
vis(imeshpt,3) = beff*SIN(theta)*COS(phi)
vis(imeshpt,3) = b_xc(imeshpt,1)
!---> and the imaginary part of V_21
vis(imeshpt,4) = beff*SIN(theta)*SIN(phi)
vis(imeshpt,4) = b_xc(imeshpt,2)
DO ipot = 1,4
vis(imeshpt,ipot) = vis(imeshpt,ipot) * stars%ufft(imeshpt-1)
ENDDO
DO b_ind = 1,3
b_xc(imeshpt,b_ind) = b_xc(imeshpt,b_ind) * stars%ufft(imeshpt-1)
ENDDO
ENDDO
!---> Fouriertransform the matrix potential back to reciprocal space
......@@ -104,14 +120,21 @@ CONTAINS
fftwork=0.0
CALL fft3d(vis(:,ipot),fftwork, vTot%pw_w(1,ipot), stars,-1)
ENDDO
CALL fft3d(vis(:,3),vis(:,4), vTot%pw_w(1,3), stars,-1)
DO b_ind=1,3
fftwork=0.0
CALL fft3d(b_xc(:,b_ind),fftwork, xcB%pw_w(1,b_ind), stars,-1)
ENDDO
IF (.NOT. input%film) RETURN
!Now the vacuum part starts
ALLOCATE(vvacxy(ifft2,vacuum%nmzxyd,2,4))
ALLOCATE(b_xc_vacxy(ifft2,vacuum%nmzxyd,2,3))
!---> fouriertransform the spin up and down potential
......@@ -148,10 +171,13 @@ CONTAINS
phi = den%phi_vacxy(imeshpt,imz,ivac)
veff = (vup + vdown)/2.0
beff = (vup - vdown)/2.0
vvacxy(imeshpt,imz,ivac,1) = veff + beff*COS(theta)
vvacxy(imeshpt,imz,ivac,2) = veff - beff*COS(theta)
vvacxy(imeshpt,imz,ivac,3) = beff*SIN(theta)*COS(phi)
vvacxy(imeshpt,imz,ivac,4) = beff*SIN(theta)*SIN(phi)
b_xc_vacxy(imeshpt,imz,ivac,1) = beff*SIN(theta)*COS(phi)
b_xc_vacxy(imeshpt,imz,ivac,2) = beff*SIN(theta)*SIN(phi)
b_xc_vacxy(imeshpt,imz,ivac,3) = beff*COS(theta)
vvacxy(imeshpt,imz,ivac,1) = veff + b_xc_vacxy(imeshpt,imz,ivac,3)
vvacxy(imeshpt,imz,ivac,2) = veff - b_xc_vacxy(imeshpt,imz,ivac,3)
vvacxy(imeshpt,imz,ivac,3) = b_xc_vacxy(imeshpt,imz,ivac,1)
vvacxy(imeshpt,imz,ivac,4) = b_xc_vacxy(imeshpt,imz,ivac,2)
ENDDO
ENDDO
DO imz = vacuum%nmzxyd+1,vacuum%nmzd
......@@ -161,10 +187,13 @@ CONTAINS
phi = den%phi_vacz(imz,ivac)
veff = (vup + vdown)/2.0
beff = (vup - vdown)/2.0
vTot%vacz(imz,ivac,1) = veff + beff*COS(theta)
vTot%vacz(imz,ivac,2) = veff - beff*COS(theta)
vTot%vacz(imz,ivac,3) = beff*SIN(theta)*COS(phi)
vTot%vacz(imz,ivac,4) = beff*SIN(theta)*SIN(phi)
xcB%vacz(imz,ivac,1) = beff*SIN(theta)*COS(phi)
xcB%vacz(imz,ivac,2) = beff*SIN(theta)*SIN(phi)
xcB%vacz(imz,ivac,3) = beff*COS(theta)
vTot%vacz(imz,ivac,1) = veff + xcB%vacz(imz,ivac,3)
vTot%vacz(imz,ivac,2) = veff - xcB%vacz(imz,ivac,3)
vTot%vacz(imz,ivac,3) = xcB%vacz(imz,ivac,1)
vTot%vacz(imz,ivac,4) = xcB%vacz(imz,ivac,2)
ENDDO
ENDDO
......@@ -190,6 +219,16 @@ CONTAINS
ENDDO
ENDDO
DO b_ind = 1,3
DO ivac = 1,vacuum%nvac
DO imz = 1,vacuum%nmzxyd
fftwork=0.0
CALL fft2d(stars, b_xc_vacxy(:,imz,ivac,b_ind),fftwork,&
xcB%vacz(imz,ivac,b_ind),vziw,xcB%vacxy(imz,1,ivac,b_ind), vacuum%nmzxyd,-1)
ENDDO
ENDDO
ENDDO
DO ivac = 1,vacuum%nvac
DO imz = 1,vacuum%nmzxyd
fftwork=0.0
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment