stdmix.f90 1.66 KB
Newer Older
1 2 3 4 5 6
!--------------------------------------------------------------------------------
! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
! This file is part of FLEUR and available as free software under the conditions
! of the MIT license as expressed in the LICENSE file in more detail.
!--------------------------------------------------------------------------------

7 8 9 10 11 12 13 14 15 16 17
MODULE m_stmix
  !
  !      straight mixing,     r.pentcheva, iff, 1996
  !
  !     sm   : input charge density of iteration m
  !     sm1  : input charge density of iteration m+1
  !     fsm  : output minus input charge densityof iteration m
  !
CONTAINS
  SUBROUTINE stmix(&
       &                 atoms,input,noco,&
Daniel Wortmann's avatar
Daniel Wortmann committed
18 19
       &                 fsm,fsm_mag,sm)
    USE m_types_mixvector
20 21
    USE m_types
    IMPLICIT NONE
Daniel Wortmann's avatar
Daniel Wortmann committed
22 23 24 25 26
    TYPE(t_input),INTENT(IN)        :: input
    TYPE(t_noco),INTENT(IN)         :: noco
    TYPE(t_atoms),INTENT(IN)        :: atoms
    TYPE(t_mixvector),INTENT(IN)    :: fsm,fsm_mag
    TYPE(t_mixvector),INTENT(INOUT) :: sm
27 28 29 30 31 32
    !     ..
    !     .. Local Scalars ..
    INTEGER imap
    REAL,PARAMETER:: tol_6=1.0e-6
    !     ..
    !
Daniel Wortmann's avatar
Daniel Wortmann committed
33
    sm = sm + input%alpha*fsm
34

35
    IF ( ABS(input%spinf-1.0e0).LE.tol_6 .OR. input%jspins.EQ.1 .or.input%imix.ne.0) THEN
Daniel Wortmann's avatar
Daniel Wortmann committed
36 37
       !  Done with     sm1 = sm + alpha * F(sm)
       !No spin
38 39
       RETURN
    ELSE
Daniel Wortmann's avatar
Daniel Wortmann committed
40
       sm = sm + input%alpha/2.0*(input%spinf-1.0)*fsm_mag
41 42 43 44 45 46 47 48 49
       !     -->perform simple mixing with the mixing parameters
       !        for charge and spin
       !
       !       sm1+/_ = (sm+/_) + alpha* F(sm)
       !                +/-0.5alpha(spinf-1)( F(sm+) + F(sm-) )
    END IF

  END SUBROUTINE stmix
END MODULE m_stmix