Commit 8c3da07f authored by Alexander Neukirchen's avatar Alexander Neukirchen

trying to figure out stuff

parent dcb9a50e
......@@ -44,6 +44,7 @@ MODULE m_constants
INTEGER, PARAMETER :: PLOT_SPECIAL3x=18
INTEGER, PARAMETER :: PLOT_SPECIAL3y=19
INTEGER, PARAMETER :: PLOT_SPECIAL3z=20
INTEGER, PARAMETER :: PLOT_SPECIAL4=21
......
......@@ -66,6 +66,7 @@ CONTAINS
USE m_ylm
USE m_metagga
USE m_divergence
USE m_rotate_mt_den_tofrom_local
USE m_plot
#ifdef CPP_MPI
USE m_mpi_bc_potden
......@@ -100,7 +101,7 @@ CONTAINS
TYPE(t_coreSpecInput) :: coreSpecInput
TYPE(t_wann) :: wann
TYPE(t_potden) :: vTot, vx, vCoul, vTemp, vxcForPlotting, vDiv
TYPE(t_potden) :: inDen, outDen, EnergyDen, divB
TYPE(t_potden) :: inDen, outDen, EnergyDen, divB, dummyDen
TYPE(t_potden), dimension(3):: xcB, graddiv, corrB
CLASS(t_xcpot), ALLOCATABLE :: xcpot
CLASS(t_forcetheo), ALLOCATABLE :: forcetheo
......@@ -143,9 +144,12 @@ CONTAINS
! Initialize and load inDen density (start)
CALL inDen%init(stars,atoms,sphhar,vacuum,noco,input%jspins,POTDEN_TYPE_DEN)
DO i=1,3
CALL xcB(i)%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_DEN)
! CALL xcB(i)%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_DEN)
CALL xcB(i)%init_potden_simple(stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,atoms%n_u,1,.FALSE.,.FALSE.,POTDEN_TYPE_DEN,vacuum%nmzd,vacuum%nmzxyd,stars%ng2)
ALLOCATE(xcB(i)%pw_w,mold=xcB(i)%pw)
! xcB(i)%
ENDDO
archiveType = CDN_ARCHIVE_TYPE_CDN1_const
IF (noco%l_noco) archiveType = CDN_ARCHIVE_TYPE_NOCO_const
IF(mpi%irank.EQ.0) THEN
......@@ -501,44 +505,60 @@ CONTAINS
! DIVERGENCE
CALL divB%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_DEN)
ALLOCATE(divB%pw_w,mold=divB%pw)
DO i=1,atoms%ntype
CALL divergence(input%jspins,i,stars%kxc1_fft*stars%kxc2_fft*stars%kxc3_fft,atoms,sphhar,sym,stars,cell,vacuum,noco,xcB,divB)
END DO
! CALL vDiv%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_POTCOUL)
CALL vDiv%init_potden_simple(stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,atoms%n_u,1,.FALSE.,.FALSE.,POTDEN_TYPE_POTCOUL,vacuum%nmzd,vacuum%nmzxyd,stars%ng2)
ALLOCATE(vDiv%pw_w(SIZE(vDiv%pw,1),size(vDiv%pw,2)))
vDiv%pw_w = CMPLX(0.0,0.0)
! IF ((.TRUE.).AND.(.NOT.noco%l_mtnocoPot)) THEN
! CALL timestart("grab B Kurz noco")
! CALL only_get_B(atoms,sphhar,sym,vtot,xcB,noco)
! CALL timestop("grab B Kurz noco")
! END IF
CALL vgen_coulomb(1,mpi,dimension,oneD,input,field,vacuum,sym,stars,cell,sphhar,atoms,divB,vDiv)
! CALL dummyDen%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_DEN)
! ALLOCATE(dummyDen%pw_w,mold=dummyDen%pw)
DO i=1,3
CALL graddiv(i)%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_DEN)
ALLOCATE(graddiv(i)%pw_w,mold=graddiv(i)%pw)
CALL corrB(i)%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_DEN)
ALLOCATE(corrB(i)%pw_w,mold=corrB(i)%pw)
ENDDO
! DO i=1,3
! CALL matrixsplit(mpi,sym,stars,atoms,sphhar,vacuum,cell,input,noco,oneD,sliceplot,2.0,vtot,dummyDen,xcB(1),xcB(2),xcB(3))
! END DO
DO i=1,atoms%ntype
CALL divpotgrad(input%jspins,i,stars%kxc1_fft*stars%kxc2_fft*stars%kxc3_fft,atoms,sphhar,sym,stars,cell,vacuum,noco,vDiv,graddiv)
END DO
DO i=1,3
CALL corrB(i)%addPotDen(xcB(i), graddiv(i))
END DO
IF ((sliceplot%iplot.NE.0).AND.(mpi%irank==0) ) THEN
CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,divB,PLOT_SPECIAL)
CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,graddiv(1),PLOT_SPECIAL2x)
CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,graddiv(2),PLOT_SPECIAL2y)
CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,graddiv(3),PLOT_SPECIAL2z)
CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,corrB(1),PLOT_SPECIAL3x)
CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,corrB(2),PLOT_SPECIAL3y)
CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,corrB(3),PLOT_SPECIAL3z)
END IF
! CALL divB%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_DEN)
! ALLOCATE(divB%pw_w,mold=divB%pw)
! DO i=1,atoms%ntype
! CALL divergence(input%jspins,i,stars%kxc1_fft*stars%kxc2_fft*stars%kxc3_fft,atoms,sphhar,sym,stars,cell,vacuum,noco,xcB,divB)
! END DO
!! CALL vDiv%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_POTCOUL)
! CALL vDiv%init_potden_simple(stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,atoms%n_u,1,.FALSE.,.FALSE.,POTDEN_TYPE_POTCOUL,vacuum%nmzd,vacuum%nmzxyd,stars%ng2)
! ALLOCATE(vDiv%pw_w(SIZE(vDiv%pw,1),size(vDiv%pw,2)))
! vDiv%pw_w = CMPLX(0.0,0.0)
! CALL vgen_coulomb(1,mpi,dimension,oneD,input,field,vacuum,sym,stars,cell,sphhar,atoms,divB,vDiv)
! DO i=1,3
!! CALL graddiv(i)%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_DEN)
! CALL graddiv(i)%init_potden_simple(stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,atoms%n_u,1,.FALSE.,.FALSE.,POTDEN_TYPE_DEN,vacuum%nmzd,vacuum%nmzxyd,stars%ng2)
! ALLOCATE(graddiv(i)%pw_w,mold=graddiv(i)%pw)
!! CALL corrB(i)%init(stars,atoms,sphhar,vacuum,noco,1,POTDEN_TYPE_DEN)
! CALL corrB(i)%init_potden_simple(stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,atoms%n_u,1,.FALSE.,.FALSE.,POTDEN_TYPE_DEN,vacuum%nmzd,vacuum%nmzxyd,stars%ng2)
! ALLOCATE(corrB(i)%pw_w,mold=corrB(i)%pw)
! ENDDO
! DO i=1,atoms%ntype
! CALL divpotgrad(input%jspins,i,stars%kxc1_fft*stars%kxc2_fft*stars%kxc3_fft,atoms,sphhar,sym,stars,cell,vacuum,noco,vDiv,graddiv)
! END DO
! DO i=1,3
! CALL corrB(i)%addPotDen(xcB(i), graddiv(i))
! END DO
! IF ((sliceplot%iplot.NE.0).AND.(mpi%irank==0) ) THEN
! CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,divB,PLOT_SPECIAL)
! CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,vDiv,PLOT_SPECIAL4)
! CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,graddiv(1),PLOT_SPECIAL2x)
! CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,graddiv(2),PLOT_SPECIAL2y)
! CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,graddiv(3),PLOT_SPECIAL2z)
! CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,xcB(1),PLOT_SPECIAL3x)
! CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,xcB(2),PLOT_SPECIAL3y)
! CALL makeplots(mpi,sym,stars,vacuum,atoms,sphhar,input,cell,oneD,noco,sliceplot,xcB(3),PLOT_SPECIAL3z)
! END IF
CALL add_usage_data("Iterations",iter)
......
......@@ -65,11 +65,6 @@ CONTAINS
CALL vTot%resetPotDen()
CALL vCoul%resetPotDen()
CALL vx%resetPotDen()
! DO i=1,3
! CALL xcB(i)%resetPotden()
! ALLOCATE(xcB(i)%pw_w,mold=den%pw_w)
! xcB(i)%pw_w = CMPLX(0.0,0.0)
! ENDDO
ALLOCATE(vx%pw_w,mold=vTot%pw)
vx%pw_w = 0.0
......
......@@ -123,7 +123,7 @@ CONTAINS
! Local type instances
TYPE(t_input) :: inp
TYPE(t_potden) :: den
TYPE(t_potden) :: den, plotden
! Local scalars
INTEGER iden,ivac,ifft2,ifft3
......@@ -193,7 +193,7 @@ CONTAINS
den%vacz(:,:,4) = AIMAG(cdomvz(:,:))
den%vacxy(:,:,:,3) = cdomvxy
END IF
CALL qfix(mpi,stars,atoms,sym,vacuum,sphhar,input,cell,oneD,den,noco%l_noco,.FALSE.,.true.,fix)
!CALL qfix(mpi,stars,atoms,sym,vacuum,sphhar,input,cell,oneD,den,noco%l_noco,.FALSE.,.true.,fix)
rho(:,0:,1:,:input%jspins) = den%mt(:,0:,1:,:input%jspins)
qpw(1:,:input%jspins) = den%pw(1:,:input%jspins)
rht(1:,1:,:input%jspins) = den%vacz(1:,1:,:input%jspins)
......@@ -341,38 +341,44 @@ CONTAINS
END DO
END DO
END IF
CALL plotden%init_potden_simple(stars%ng3,atoms%jmtd,sphhar%nlhd,atoms%ntype,atoms%n_u,1,.FALSE.,.FALSE.,POTDEN_TYPE_DEN,vacuum%nmzd,vacuum%nmzxyd,stars%ng2)
! den%mt(:,0:,1:,:)=denmat%mt(:,0:,1:,1)
! den%pw(1:,:) = denmat%pw(1:,1)
! den%vacz(1:,1:,:) = denmat%vacz(1:,1:,1)
! den%vacxy(1:,1:,1:,:) = denmat%vacxy(1:,1:,1:,1)
!---> save charge density to cden
den%mt(:,0:,1:,1) = rho(:,0:,1:,1)
den%pw(1:,1) = qpw(1:,1)
den%vacz(1:,1:,1) = rht(1:,1:,1)
den%vacxy(1:,1:,1:,1) = rhtxy(1:,1:,1:,1)
plotden%mt(:,0:,1:,1) = rho(:,0:,1:,1)
plotden%pw(1:,1) = qpw(1:,1)
plotden%vacz(1:,1:,1) = rht(1:,1:,1)
plotden%vacxy(1:,1:,1:,1) = rhtxy(1:,1:,1:,1)
cden=den
cden=plotden
!---> save m_x to mxden
den%mt(:,0:,1:,1) = rho(:,0:,1:,2)
den%pw(1:,1) = qpw(1:,2)
den%vacz(1:,1:,1) = rht(1:,1:,2)
den%vacxy(1:,1:,1:,1) = rhtxy(1:,1:,1:,2)
plotden%mt(:,0:,1:,1) = rho(:,0:,1:,2)
plotden%pw(1:,1) = qpw(1:,2)
plotden%vacz(1:,1:,1) = rht(1:,1:,2)
plotden%vacxy(1:,1:,1:,1) = rhtxy(1:,1:,1:,2)
mxden=den
mxden=plotden
!---> save m_y to myden
den%mt(:,0:,1:,1) = rho(:,0:,1:,3)
den%pw(1:,1) = qpw(1:,3)
den%vacz(1:,1:,1) = rht(1:,1:,3)
den%vacxy(1:,1:,1:,1) = rhtxy(1:,1:,1:,3)
plotden%mt(:,0:,1:,1) = rho(:,0:,1:,3)
plotden%pw(1:,1) = qpw(1:,3)
plotden%vacz(1:,1:,1) = rht(1:,1:,3)
plotden%vacxy(1:,1:,1:,1) = rhtxy(1:,1:,1:,3)
myden=den
myden=plotden
!---> save m_z to mzden
den%mt(:,0:,1:,1) = rho(:,0:,1:,4)
den%pw(1:,1) = qpw(1:,4)
den%vacz(1:,1:,1) = rht(1:,1:,4)
den%vacxy(1:,1:,1:,1) = rhtxy(1:,1:,1:,4)
plotden%mt(:,0:,1:,1) = rho(:,0:,1:,4)
plotden%pw(1:,1) = qpw(1:,4)
plotden%vacz(1:,1:,1) = rht(1:,1:,4)
plotden%vacxy(1:,1:,1:,1) = rhtxy(1:,1:,1:,4)
mzden=den
mzden=plotden
DEALLOCATE (qpw,rhtxy,cdom,cdomvz,cdomvxy,ris,fftwork,rvacxy,rho,rht)
......@@ -943,6 +949,15 @@ CONTAINS
CALL savxsf(potnorm,oneD,stars,vacuum,sphhar,atoms,input,sym,cell,sliceplot,noco,score,denName,denmat)
END IF
IF (plot_const.EQ.21) THEN
denName = 'correctorP'
score = .FALSE.
potnorm = .TRUE.
CALL savxsf(potnorm,oneD,stars,vacuum,sphhar,atoms,input,sym,cell,sliceplot,noco,score,denName,denmat)
END IF
END SUBROUTINE procplot
......
......@@ -36,7 +36,7 @@ CONTAINS
REAL, ALLOCATABLE :: div_temp(:, :)
REAL, ALLOCATABLE :: thet(:), phi(:)
REAL :: r,th,ph
INTEGER :: jr, k, nsp, kt
INTEGER :: jr, k, nsp, kt, i
nsp = atoms%nsp()
......@@ -58,13 +58,18 @@ CONTAINS
ph = phi(k)
div_temp(kt+nsp,1) = (SIN(th)*COS(ph)*gradx%gr(1,kt+nsp,1) + SIN(th)*SIN(ph)*grady%gr(1,kt+nsp,1) + COS(th)*gradz%gr(1,kt+nsp,1))&
+(COS(th)*COS(ph)*gradx%gr(2,kt+nsp,1) + COS(th)*SIN(ph)*grady%gr(2,kt+nsp,1) - SIN(th)*gradz%gr(2,kt+nsp,1))/r&
-(SIN(ph)*gradx%gr(3,kt+nsp,1) + COS(ph)*grady%gr(3,kt+nsp,1))/(r*SIN(th))
-(SIN(ph)*gradx%gr(3,kt+nsp,1) - COS(ph)*grady%gr(3,kt+nsp,1))/(r*SIN(th))
! div_temp(kt+nsp,1) = div_temp(kt+nsp,1)*r*r
ENDDO ! k
kt = kt+nsp
ENDDO ! jr
CALL mt_from_grid(atoms, sphhar, n, 1, div_temp, div%mt(:,0:,n,:))
DO i=1,atoms%jri(n)
div%mt(i,:,n,:)=div%mt(i,:,n,:)*atoms%rmsh(i,n)**2
ENDDO
CALL finish_mt_grid
......@@ -305,8 +310,8 @@ CONTAINS
den%vacz = pot%vacz
den%vacxy = pot%vacxy
CALL mt_grad(n,atoms,sphhar,sym,den,grad)
CALL pw_grad(ifftxc3,jspins,stars,cell,noco,sym,den,grad)
CALL mt_grad(n,atoms,sphhar,sym,pot,grad)
CALL pw_grad(ifftxc3,jspins,stars,cell,noco,sym,pot,grad)
END SUBROUTINE divpotgrad
......
......@@ -108,6 +108,7 @@ CONTAINS
nsp=atoms%nsp()
ALLOCATE(ch(nsp*atoms%jmtd,4))
ALLOCATE(b_xc(nsp*atoms%jmtd,3))
ALLOCATE(livemt(size(xcB(1)%mt,1),size(xcB(1)%mt,2),size(xcB(1)%mt,3),3))
CALL xcpot%init("vwn",.FALSE.,1)
......@@ -144,4 +145,5 @@ CONTAINS
END DO
CALL finish_mt_grid()
END SUBROUTINE rotate_mt_den_from_local
END MODULE m_rotate_mt_den_tofrom_local
......@@ -49,7 +49,9 @@ CONTAINS
END DO
ELSEIF(noco%l_noco) THEN
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)
IF (noco%l_mtnocoPot) THEN
CALL rotate_mt_den_from_local(atoms,sphhar,sym,denRot,vtot,xcB)
END IF
ENDIF
! Rescale vCoul%pw_w with number of stars
......
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