Commit 73bbf6db authored by Alexander Neukirchen's avatar Alexander Neukirchen

the early bird catches the worm

parent 21ff95f6
......@@ -37,6 +37,7 @@ MODULE m_constants
INTEGER, PARAMETER :: PLOT_POT_EXT=8
INTEGER, PARAMETER :: PLOT_POT_COU=9
INTEGER, PARAMETER :: PLOT_POT_VXC=10
INTEGER, PARAMETER :: PLOT_SPECIAL=14
......
......@@ -64,6 +64,7 @@ CONTAINS
USE m_dwigner
USE m_ylm
USE m_metagga
USE m_divergence
USE m_plot
#ifdef CPP_MPI
USE m_mpi_bc_potden
......@@ -98,14 +99,14 @@ CONTAINS
TYPE(t_coreSpecInput) :: coreSpecInput
TYPE(t_wann) :: wann
TYPE(t_potden) :: vTot, vx, vCoul, vTemp, vxcForPlotting
TYPE(t_potden) :: inDen, outDen, EnergyDen
TYPE(t_potden) :: inDen, outDen, EnergyDen, divB
TYPE(t_potden), dimension(3):: xcB
CLASS(t_xcpot), ALLOCATABLE :: xcpot
CLASS(t_forcetheo), ALLOCATABLE :: forcetheo
! local scalars
INTEGER :: eig_id,archiveType, num_threads
INTEGER :: iter,iterHF,i
INTEGER :: iter,iterHF,i,n
LOGICAL :: l_opti,l_cont,l_qfix,l_real
REAL :: fix
#ifdef CPP_MPI
......@@ -495,7 +496,17 @@ CONTAINS
END DO scfloop ! DO WHILE (l_cont)
! DIVERGENCE
CALL divB%init(stars,atoms,sphhar,vacuum,noco,input%jspins,POTDEN_TYPE_DEN)
DO n=1,atoms%ntype
CALL divergence(input%jspins,n,stars%kxc1_fft*stars%kxc2_fft*stars%kxc3_fft,atoms,sphhar,sym,stars,cell,vacuum,noco,xcB,divB)
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)
END IF
CALL add_usage_data("Iterations",iter)
IF (mpi%irank.EQ.0) CALL closeXMLElement('scfLoop')
......
......@@ -878,6 +878,18 @@ CONTAINS
END IF
END IF
!Plotting the divergence of B_xc_vec. identifier: 14
!No core subtraction done!
! --> Additive term for iplot: 16384
IF (plot_const.EQ.14) THEN
denName = 'diverg'
score = .FALSE.
potnorm = .FALSE.
CALL savxsf(potnorm,oneD,stars,vacuum,sphhar,atoms,input,sym,cell,sliceplot,noco,score,denName,denmat)
END IF
END SUBROUTINE procplot
......
......@@ -6,7 +6,7 @@
MODULE m_divergence
USE m_types
PRIVATE
PUBLIC :: mt_div, pw_div, divergence
PUBLIC :: mt_div, pw_div, divergence!, divpotgrad
CONTAINS
SUBROUTINE mt_div(jspins,n,atoms,sphhar,sym,xcB,div)
......@@ -28,7 +28,7 @@ CONTAINS
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_sphhar), INTENT(IN) :: sphhar
TYPE(t_sym), INTENT(IN) :: sym
TYPE(t_potden), dimension(3), INTENT(INOUT) :: xcB
TYPE(t_potden), dimension(3), INTENT(IN) :: xcB
TYPE(t_potden), INTENT(INOUT) :: div
TYPE(t_gradients) :: gradx, grady, gradz
......@@ -71,12 +71,11 @@ CONTAINS
SUBROUTINE pw_div(ifftxc3,jspins,stars,cell,noco,sym,xcB,div)
!-----------------------------------------------------------------------------!
!By use of the cartesian components of a field, its radial/angular derivati- !
!ves in the muffin tin at each spherical grid point and the corresponding an- !
!gles: !
!By use of the cartesian components of a field and its carthesian derivatives !
!in the interstitial/vacuum region at each grid point: !
! !
!Make the divergence of said field in real space and store it as a source !
!density, again represented by mt-coefficients in a potden. !
!density, again represented by pw-coefficients in a potden. !
! !
!Code by A. Neukirchen, September 2019 !
!-----------------------------------------------------------------------------!
......@@ -89,7 +88,7 @@ CONTAINS
TYPE(t_noco), INTENT(IN) :: noco
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_cell),INTENT(IN) :: cell
TYPE(t_potden), dimension(3), INTENT(INOUT) :: xcB
TYPE(t_potden), dimension(3), INTENT(IN) :: xcB
TYPE(t_potden), INTENT(INOUT) :: div
TYPE(t_gradients) :: gradx, grady, gradz
......@@ -119,9 +118,14 @@ CONTAINS
END SUBROUTINE pw_div
SUBROUTINE divergence(jspins,n,ifftxc3,atoms,sphhar,sym,stars,cell,vacuum,noco,xcB,div)
USE m_types
USE m_constants
IMPLICIT NONE
!-----------------------------------------------------------------------------!
!Use the two divergence subroutines above to now put the complete divergence !
!of a field into a t_potden variable. !
!-----------------------------------------------------------------------------!
INTEGER, INTENT(IN) :: jspins, n, ifftxc3
TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_sphhar), INTENT(IN) :: sphhar
......@@ -130,14 +134,18 @@ CONTAINS
TYPE(t_stars),INTENT(IN) :: stars
TYPE(t_cell),INTENT(IN) :: cell
TYPE(t_vacuum),INTENT(IN) :: vacuum
TYPE(t_potden), dimension(3), INTENT(INOUT) :: xcB
TYPE(t_potden), dimension(3), INTENT(OUT) :: xcB
TYPE(t_potden), INTENT(OUT) :: div
CALL div%init(stars,atoms,sphhar,vacuum,noco,jspins,1001)
CALL div%init(stars,atoms,sphhar,vacuum,noco,jspins,POTDEN_TYPE_DEN)
CALL mt_div(jspins,n,atoms,sphhar,sym,xcB,div)
CALL pw_div(ifftxc3,jspins,stars,cell,noco,sym,xcB,div)
END SUBROUTINE divergence
! SUBROUTINE divpotgrad(jspins,n,ifftxc3,atoms,sphhar,sym,stars,cell,vacuum,noco,xcB,div)
!
! END SUBROUTINE divpotgrad
END MODULE m_divergence
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