Commit 0bf2eadd authored by Miriam Hinzen's avatar Miriam Hinzen

Film-Case Kerker Preconditions in Film Region Only

parent 400cfea6
......@@ -28,7 +28,6 @@ CONTAINS
REAL :: q2(vacuum%nmz), w, rht1(vacuum%nmzd,2,input%jspins)
COMPLEX :: x(stars%ng3)
CALL timestart("cdntot")
qtot = 0.0
qistot = 0.0
DO jsp = 1,input%jspins
......@@ -109,7 +108,10 @@ CONTAINS
REAL qmt(atoms%ntype,input%jspins),qvac(2,input%jspins)
INTEGER, ALLOCATABLE :: lengths(:,:)
CHARACTER(LEN=20) :: attributes(6), names(6)
CALL timestart("cdntot")
call cdntot_integrate(stars,atoms,sym,vacuum,input,cell,oneD, den, &
q, qis, qmt, qvac, qtot, qistot)
......
......@@ -87,9 +87,9 @@ contains
! KERKER PRECONDITIONER
IF( input%preconditioning_param /= 0 ) THEN
CALL timestart("Preconditioner")
CALL kerker(field, DIMENSION, mpi, &
stars, atoms, sphhar, vacuum, input, sym, cell, noco, &
oneD, inDen, outDen, fsm(it) )
CALL kerker( field, DIMENSION, mpi, &
stars, atoms, sphhar, vacuum, input, sym, cell, noco, &
oneD, inDen, outDen, fsm(it) )
!Store modified density in history
CALL mixing_history_store(fsm(it))
CALL timestop("Preconditioner")
......
......@@ -4,12 +4,15 @@
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------
MODULE m_kerker
CONTAINS
SUBROUTINE kerker(field, DIMENSION, mpi, &
SUBROUTINE kerker( field, DIMENSION, mpi, &
stars, atoms, sphhar, vacuum, input, sym, cell, noco, &
oneD, inDen, outDen, precon_v )
!Implementation of the Kerker preconditioner by M.Hinzen
USE m_vgen_coulomb
USE m_VYukawaFilm
USE m_juDFT
......@@ -19,6 +22,7 @@ CONTAINS
USE m_constants
USE m_mpi_bc_potden
IMPLICIT NONE
TYPE(t_oneD), INTENT(in) :: oneD
TYPE(t_input), INTENT(in) :: input
TYPE(t_vacuum), INTENT(in) :: vacuum
......@@ -35,10 +39,9 @@ CONTAINS
TYPE(t_potden), INTENT(in) :: inDen
TYPE(t_mixvector), INTENT(INOUT) :: precon_v
!Locals
type(t_potden) :: resDen, vYukawa
real :: fix
integer :: lh,n
type(t_potden) :: resDen, vYukawa, resDenMod
real :: fix
integer :: lh,n
CALL resDen%init( stars, atoms, sphhar, vacuum, noco, input%jspins, POTDEN_TYPE_DEN )
CALL vYukawa%init( stars, atoms, sphhar, vacuum, noco, input%jspins, 4 )
......@@ -53,8 +56,12 @@ CONTAINS
CALL vgen_coulomb( 1, mpi, DIMENSION, oneD, input, field, vacuum, sym, stars, cell, &
sphhar, atoms, resDen, vYukawa )
ELSE
if( mpi%irank == 0 ) then
call resDenMod%init( stars, atoms, sphhar, vacuum, noco, input%jspins, POTDEN_TYPE_DEN )
call resDenMod%copyPotDen( resDen )
end if
vYukawa%iter = resDen%iter
CALL VYukawaFilm( stars, vacuum, cell, sym, input, mpi, atoms, sphhar, DIMENSION, oneD, resDen, &
CALL VYukawaFilm( stars, vacuum, cell, sym, input, mpi, atoms, sphhar, DIMENSION, oneD, noco, resDenMod, &
vYukawa )
END IF
......@@ -67,8 +74,6 @@ CONTAINS
* vYukawa%mt(1:atoms%jri(n),lh,n,1) * atoms%rmsh(1:atoms%jri(n),n) ** 2
END DO
END DO
resDen%vacz = resDen%vacz - input%preconditioning_param ** 2 / fpi_const * vYukawa%vacz
resDen%vacxy = resDen%vacxy - input%preconditioning_param ** 2 / fpi_const * vYukawa%vacxy
IF( input%jspins == 2 ) CALL resDen%ChargeAndMagnetisationToSpins()
! fix the preconditioned density
CALL outDen%addPotDen( resDen, inDen )
......@@ -76,6 +81,7 @@ CONTAINS
CALL resDen%subPotDen( outDen, inDen )
END IF MPI0_c
CALL precon_v%from_density(resden)
! end of preconditioner
END SUBROUTINE kerker
END SUBROUTINE kerker
END MODULE m_kerker
......@@ -42,6 +42,7 @@ MODULE m_types_potden
procedure :: ChargeAndMagnetisationToSpins
procedure :: addPotDen
procedure :: subPotDen
procedure :: copyPotDen
procedure :: distribute
procedure :: collect
END TYPE t_potden
......@@ -233,6 +234,21 @@ CONTAINS
end subroutine
subroutine copyPotDen( PotDenCopy, PotDen )
implicit none
class(t_potden), intent(in) :: PotDen
class(t_potden), intent(inout) :: PotDenCopy
PotDenCopy%iter = PotDen%iter
PotDenCopy%potdenType = PotDen%potdenType
PotDenCopy%mt = PotDen%mt
PotDenCopy%pw = PotDen%pw
PotDenCopy%vacz = PotDen%vacz
PotDenCopy%vacxy = PotDen%vacxy
end subroutine copyPotDen
SUBROUTINE init_potden_types(pd,stars,atoms,sphhar,vacuum,noco,jspins,potden_type)
USE m_judft
USE m_types_setup
......
This diff is collapsed.
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