Commit 0ec46f54 authored by Daniel Wortmann's avatar Daniel Wortmann

Made field type intent(in)

parent f24cee50
...@@ -16,7 +16,6 @@ MODULE m_types_field ...@@ -16,7 +16,6 @@ MODULE m_types_field
REAL :: zsigma = 10.0 ! Distance to the charged plates REAL :: zsigma = 10.0 ! Distance to the charged plates
REAL :: sigma ! charge at the plates REAL :: sigma ! charge at the plates
REAL :: sig_b(2)= 0.0 ! Extra charge for the top/bottom plate REAL :: sig_b(2)= 0.0 ! Extra charge for the top/bottom plate
COMPLEX :: vslope = 0.0 ! Dirichlet bnd. cond.: Slope
REAL, ALLOCATABLE :: sigEF(:,:,:) ! (nx, ny, nvac) REAL, ALLOCATABLE :: sigEF(:,:,:) ! (nx, ny, nvac)
COMPLEX, ALLOCATABLE :: rhoEF(:,:) ! (g_||, nvac) COMPLEX, ALLOCATABLE :: rhoEF(:,:) ! (g_||, nvac)
COMPLEX, ALLOCATABLE :: C1(:), C2(:) ! Coeff. for Dirichlet bnd.cond. COMPLEX, ALLOCATABLE :: C1(:), C2(:) ! Coeff. for Dirichlet bnd.cond.
...@@ -64,7 +63,6 @@ CONTAINS ...@@ -64,7 +63,6 @@ CONTAINS
CALL mpi_bc(this%efield%sigma ,rank,mpi_comm) CALL mpi_bc(this%efield%sigma ,rank,mpi_comm)
CALL mpi_bc(this%efield%sig_b(1),rank,mpi_comm) CALL mpi_bc(this%efield%sig_b(1),rank,mpi_comm)
CALL mpi_bc(this%efield%sig_b(2),rank,mpi_comm) CALL mpi_bc(this%efield%sig_b(2),rank,mpi_comm)
CALL mpi_bc(this%efield%vslope ,rank,mpi_comm)
CALL mpi_bc(this%efield%sigEF ,rank,mpi_comm) CALL mpi_bc(this%efield%sigEF ,rank,mpi_comm)
CALL mpi_bc(this%efield%rhoEF ,rank,mpi_comm) CALL mpi_bc(this%efield%rhoEF ,rank,mpi_comm)
CALL MPI_BC(THIS%EFIELD%C1,RANK,MPI_COMM) CALL MPI_BC(THIS%EFIELD%C1,RANK,MPI_COMM)
......
...@@ -84,7 +84,7 @@ CONTAINS ...@@ -84,7 +84,7 @@ CONTAINS
TYPE(t_mpi),INTENT(IN) :: mpi TYPE(t_mpi),INTENT(IN) :: mpi
TYPE(t_input),INTENT(IN) :: input TYPE(t_input),INTENT(IN) :: input
TYPE(t_field),INTENT(INOUT) :: field !This should become INTENT(IN)!! TYPE(t_field),INTENT(IN) :: field
TYPE(t_atoms),INTENT(IN) :: atoms TYPE(t_atoms),INTENT(IN) :: atoms
TYPE(t_sphhar),INTENT(IN) :: sphhar TYPE(t_sphhar),INTENT(IN) :: sphhar
TYPE(t_cell),INTENT(IN) :: cell TYPE(t_cell),INTENT(IN) :: cell
......
...@@ -42,7 +42,7 @@ CONTAINS ...@@ -42,7 +42,7 @@ CONTAINS
TYPE(t_oneD), INTENT(IN) :: oneD TYPE(t_oneD), INTENT(IN) :: oneD
TYPE(t_sliceplot), INTENT(IN) :: sliceplot TYPE(t_sliceplot), INTENT(IN) :: sliceplot
TYPE(t_input), INTENT(IN) :: input TYPE(t_input), INTENT(IN) :: input
TYPE(t_field), INTENT(INOUT) :: field !efield can be modified TYPE(t_field), INTENT(IN) :: field
TYPE(t_vacuum), INTENT(IN) :: vacuum TYPE(t_vacuum), INTENT(IN) :: vacuum
TYPE(t_noco), INTENT(IN) :: noco TYPE(t_noco), INTENT(IN) :: noco
TYPE(t_nococonv), INTENT(INOUT) :: nococonv TYPE(t_nococonv), INTENT(INOUT) :: nococonv
......
...@@ -57,7 +57,7 @@ SUBROUTINE rdmft(eig_id,mpi,input,kpts,banddos,sliceplot,cell,atoms,enpara,stars ...@@ -57,7 +57,7 @@ SUBROUTINE rdmft(eig_id,mpi,input,kpts,banddos,sliceplot,cell,atoms,enpara,stars
TYPE(t_vacuum), INTENT(IN) :: vacuum TYPE(t_vacuum), INTENT(IN) :: vacuum
TYPE(t_sphhar), INTENT(IN) :: sphhar TYPE(t_sphhar), INTENT(IN) :: sphhar
TYPE(t_sym), INTENT(IN) :: sym TYPE(t_sym), INTENT(IN) :: sym
TYPE(t_field), INTENT(INOUT) :: field TYPE(t_field), INTENT(IN) :: field
TYPE(t_potden), INTENT(INOUT) :: vTot TYPE(t_potden), INTENT(INOUT) :: vTot
TYPE(t_potden), INTENT(INOUT) :: vCoul TYPE(t_potden), INTENT(INOUT) :: vCoul
TYPE(t_oneD), INTENT(IN) :: oneD TYPE(t_oneD), INTENT(IN) :: oneD
......
...@@ -43,7 +43,7 @@ contains ...@@ -43,7 +43,7 @@ contains
type(t_oneD), intent(in) :: oneD type(t_oneD), intent(in) :: oneD
type(t_input), intent(in) :: input type(t_input), intent(in) :: input
type(t_field), intent(inout) :: field type(t_field), intent(in) :: field
type(t_vacuum), intent(in) :: vacuum type(t_vacuum), intent(in) :: vacuum
type(t_sym), intent(in) :: sym type(t_sym), intent(in) :: sym
type(t_stars), intent(in) :: stars type(t_stars), intent(in) :: stars
...@@ -55,7 +55,7 @@ contains ...@@ -55,7 +55,7 @@ contains
type(t_potden), intent(inout) :: vCoul type(t_potden), intent(inout) :: vCoul
type(t_results), intent(inout), optional :: results type(t_results), intent(inout), optional :: results
complex :: vintcza, xint, rhobar complex :: vintcza, xint, rhobar,vslope
integer :: i, i3, irec2, irec3, ivac, j, js, k, k3 integer :: i, i3, irec2, irec3, ivac, j, js, k, k3
integer :: lh, n, nzst1 integer :: lh, n, nzst1
integer :: imz, imzxy, ichsmrg, ivfft integer :: imz, imzxy, ichsmrg, ivfft
...@@ -100,7 +100,7 @@ contains ...@@ -100,7 +100,7 @@ contains
elseif ( input%film .and. .not. oneD%odi%d1 ) then elseif ( input%film .and. .not. oneD%odi%d1 ) then
! ----> potential in the vacuum region ! ----> potential in the vacuum region
call timestart( "Vacuum" ) call timestart( "Vacuum" )
call vvac( vacuum, stars, cell, sym, input, field, psq, den%vacz(:,:,ispin), vCoul%vacz(:,:,ispin), rhobar, sig1dh, vz1dh ) call vvac( vacuum, stars, cell, sym, input, field, psq, den%vacz(:,:,ispin), vCoul%vacz(:,:,ispin), rhobar, sig1dh, vz1dh,vslope )
call vvacis( stars, vacuum, sym, cell, psq, input, field, vCoul%vacxy(:,:,:,ispin) ) call vvacis( stars, vacuum, sym, cell, psq, input, field, vCoul%vacxy(:,:,:,ispin) )
call vvacxy( stars, vacuum, cell, sym, input, field, den%vacxy(:,:,:,ispin), vCoul%vacxy(:,:,:,ispin), alphm ) call vvacxy( stars, vacuum, cell, sym, input, field, den%vacxy(:,:,:,ispin), vCoul%vacxy(:,:,:,ispin), alphm )
call timestop( "Vacuum" ) call timestop( "Vacuum" )
...@@ -125,7 +125,7 @@ contains ...@@ -125,7 +125,7 @@ contains
if ( z > cell%amat(3,3) / 2. ) z = z - cell%amat(3,3) if ( z > cell%amat(3,3) / 2. ) z = z - cell%amat(3,3)
vintcza = vintcz( stars, vacuum, cell, sym, input, field, z, irec2, psq, & vintcza = vintcz( stars, vacuum, cell, sym, input, field, z, irec2, psq, &
vCoul%vacxy(:,:,:,ispin), vCoul%vacz(:,:,ispin), & vCoul%vacxy(:,:,:,ispin), vCoul%vacz(:,:,ispin), &
rhobar, sig1dh, vz1dh, alphm ) rhobar, sig1dh, vz1dh, alphm,vslope )
af1(i) = real( vintcza ) af1(i) = real( vintcza )
bf1(i) = aimag( vintcza ) bf1(i) = aimag( vintcza )
end do end do
......
...@@ -24,7 +24,7 @@ CONTAINS ...@@ -24,7 +24,7 @@ CONTAINS
IMPLICIT NONE IMPLICIT NONE
TYPE(t_mpi), INTENT(IN) :: mpi TYPE(t_mpi), INTENT(IN) :: mpi
TYPE(t_oneD), INTENT(IN) :: oneD TYPE(t_oneD), INTENT(IN) :: oneD
TYPE(t_field), INTENT(INOUT) :: field TYPE(t_field), INTENT(IN) :: field
TYPE(t_cell), INTENT(IN) :: cell TYPE(t_cell), INTENT(IN) :: cell
TYPE(t_vacuum),INTENT(IN) :: vacuum TYPE(t_vacuum),INTENT(IN) :: vacuum
TYPE(t_noco),INTENT(IN) :: noco TYPE(t_noco),INTENT(IN) :: noco
......
...@@ -8,7 +8,7 @@ MODULE m_vintcz ...@@ -8,7 +8,7 @@ MODULE m_vintcz
CONTAINS CONTAINS
COMPLEX FUNCTION vintcz(& COMPLEX FUNCTION vintcz(&
& stars,vacuum,cell,sym,input,field,& & stars,vacuum,cell,sym,input,field,&
& z,nrec2,psq,vxy,vz,rhobar,sig1dh,vz1dh,alphm) & z,nrec2,psq,vxy,vz,rhobar,sig1dh,vz1dh,alphm,vslope)
USE m_constants USE m_constants
USE m_types USE m_types
...@@ -22,13 +22,13 @@ CONTAINS ...@@ -22,13 +22,13 @@ CONTAINS
TYPE(t_input),INTENT(IN) :: input TYPE(t_input),INTENT(IN) :: input
TYPE(t_field),INTENT(IN) :: field TYPE(t_field),INTENT(IN) :: field
INTEGER, INTENT (IN) :: nrec2 INTEGER, INTENT (IN) :: nrec2
COMPLEX, INTENT (IN) :: rhobar COMPLEX, INTENT (IN) :: rhobar,vslope
REAL, INTENT (IN) :: sig1dh,vz1dh ,z REAL, INTENT (IN) :: sig1dh,vz1dh ,z
! .. ! ..
! .. Array Arguments .. ! .. Array Arguments ..
COMPLEX, INTENT (IN) :: psq(stars%ng3),vxy(:,:,:) !(vacuum%nmzxyd,stars%ng2-1,2) COMPLEX, INTENT (IN) :: psq(stars%ng3),vxy(:,:,:) !(vacuum%nmzxyd,stars%ng2-1,2)
COMPLEX, INTENT (IN) :: alphm(stars%ng2,2) COMPLEX, INTENT (IN) :: alphm(stars%ng2,2)
REAL, INTENT (IN) :: vz(:,:) !(vacuum%nmzd,2,jspins) REAL, INTENT (IN) :: vz(:,:) !(vacuum%nmzd,2,jspins)
COMPLEX argr,sumrr,vcons1,test,c_ph COMPLEX argr,sumrr,vcons1,test,c_ph
REAL bj0,dh,fit,g,g3,q,qdh,signz,vcons2,zf REAL bj0,dh,fit,g,g3,q,qdh,signz,vcons2,zf
...@@ -97,8 +97,8 @@ CONTAINS ...@@ -97,8 +97,8 @@ CONTAINS
! -----> v2(z) ! -----> v2(z)
vintcz = vintcz + vz1dh - fpi_const* (dh-z)*& vintcz = vintcz + vz1dh - fpi_const* (dh-z)*&
& (sig1dh-rhobar/2.* (dh-z)) & (sig1dh-rhobar/2.* (dh-z))
IF (field%efield%dirichlet .AND. field%efield%vslope /= 0.0) THEN IF (field%efield%dirichlet .AND. vslope /= 0.0) THEN
vintcz = vintcz + field%efield%vslope * (dh-z) vintcz = vintcz + vslope * (dh-z)
END IF END IF
! ----> (g.ne.0) coefficients ! ----> (g.ne.0) coefficients
ELSE ELSE
......
...@@ -5,7 +5,7 @@ module m_vvac ...@@ -5,7 +5,7 @@ module m_vvac
! **************************************************************** ! ****************************************************************
contains contains
subroutine vvac( vacuum, stars, cell, sym, input, field, psq, rht, vz, rhobar, sig1dh, vz1dh ) subroutine vvac( vacuum, stars, cell, sym, input, field, psq, rht, vz, rhobar, sig1dh, vz1dh ,vslope)
use m_constants use m_constants
use m_qsf use m_qsf
...@@ -20,9 +20,10 @@ module m_vvac ...@@ -20,9 +20,10 @@ module m_vvac
complex, intent(out) :: rhobar complex, intent(out) :: rhobar
real, intent(out) :: sig1dh, vz1dh real, intent(out) :: sig1dh, vz1dh
type(t_input), intent(in) :: input type(t_input), intent(in) :: input
type(t_field), intent(inout) :: field ! efield is modified here type(t_field), intent(in) :: field
COMPLEX,INTENT(OUT) :: vslope
real, intent(in) :: rht(vacuum%nmzd,2) real, intent(in) :: rht(vacuum%nmzd,2)
complex, intent(in) :: psq(stars%ng3) complex, intent(in) :: psq(stars%ng3)
real, intent(out) :: vz(vacuum%nmzd,2) real, intent(out) :: vz(vacuum%nmzd,2)
...@@ -92,14 +93,14 @@ module m_vvac ...@@ -92,14 +93,14 @@ module m_vvac
end do end do
! force matching on the other side ! force matching on the other side
field%efield%vslope = ( field%efield%sig_b(2) - vz(ncsh,1) ) / ( 2 * vacuum%delz * ( ncsh + 1 ) + vacuum%dvac ) vslope = ( field%efield%sig_b(2) - vz(ncsh,1) ) / ( 2 * vacuum%delz * ( ncsh + 1 ) + vacuum%dvac )
ivac = 1 ivac = 1
do imz = 1, ncsh do imz = 1, ncsh
vz(imz,ivac) = vz(imz,ivac) + field%efield%vslope * vacuum%delz * ( ncsh - imz + 1 ) vz(imz,ivac) = vz(imz,ivac) + vslope * vacuum%delz * ( ncsh - imz + 1 )
end do end do
ivac = 2 ivac = 2
do imz = 1, ncsh do imz = 1, ncsh
vz(imz,ivac) = vz(imz,ivac) + field%efield%vslope * ( vacuum%dvac + vacuum%delz * imz + vacuum%delz * ncsh ) vz(imz,ivac) = vz(imz,ivac) + vslope * ( vacuum%dvac + vacuum%delz * imz + vacuum%delz * ncsh )
end do end do
vz(ncsh+1:vacuum%nmz,ivac) = field%efield%sig_b(2) vz(ncsh+1:vacuum%nmz,ivac) = field%efield%sig_b(2)
...@@ -110,7 +111,7 @@ module m_vvac ...@@ -110,7 +111,7 @@ module m_vvac
sig1dh = sig(vacuum%nmz) - sigmaa(1) ! need to include contribution from electric field sig1dh = sig(vacuum%nmz) - sigmaa(1) ! need to include contribution from electric field
sig(1:vacuum%nmz) = sig(vacuum%nmz) - sig(1:vacuum%nmz) sig(1:vacuum%nmz) = sig(vacuum%nmz) - sig(1:vacuum%nmz)
call qsf( vacuum%delz, sig, vtemp, vacuum%nmz, 1 ) call qsf( vacuum%delz, sig, vtemp, vacuum%nmz, 1 )
! external electric field contribution ! external electric field contribution
do imz = 1, ncsh do imz = 1, ncsh
vz(imz,ivac) = - fpi_const * ( vtemp(vacuum%nmz) - vtemp(imz) ) + vz(imz,ivac) - fpi_const * ( imz - ncsh ) * vacuum%delz * sigmaa(1) vz(imz,ivac) = - fpi_const * ( vtemp(vacuum%nmz) - vtemp(imz) ) + vz(imz,ivac) - fpi_const * ( imz - ncsh ) * vacuum%delz * sigmaa(1)
enddo enddo
......
...@@ -110,7 +110,7 @@ CONTAINS ...@@ -110,7 +110,7 @@ CONTAINS
! A field of the same form will also be calculated. ! A field of the same form will also be calculated.
TYPE(t_mpi), INTENT(IN) :: mpi TYPE(t_mpi), INTENT(IN) :: mpi
TYPE(t_field), INTENT(INOUT) :: field TYPE(t_field), INTENT(IN) :: field
TYPE(t_stars), INTENT(IN) :: stars TYPE(t_stars), INTENT(IN) :: stars
TYPE(t_atoms), INTENT(IN) :: atoms TYPE(t_atoms), INTENT(IN) :: atoms
TYPE(t_sphhar), INTENT(IN) :: sphhar TYPE(t_sphhar), INTENT(IN) :: sphhar
......
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