types_forcetheo.F90 3.41 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
!--------------------------------------------------------------------------------
! 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.
!--------------------------------------------------------------------------------


!>This module defines the basic type for calculations of force-theorem type
!! Here only a dummy is defined that should be extended by a custom made data-type
!! The functionality is encoded into four functions/subroutines:
!! start: This routine is called in each SC-loop before the force theorem-loop
!! next_job: This function returns .true. if another job should be done, it also modifies its
!!           arguments appropriately to perform the calculation
!! eval: Here the calculation is done in this function, the results might be stored in
!!           MODULE variables, IF a .TRUE. is returned, the rest of the loop (charge generation)
!!           is skipped
!! postprocess: After the calculation here some IO etc. can be done
!!
!!
!! An example for a non-trivial force-theorem type extending this datatype can be found in
!! forcetheorem/mae.F90

MODULE m_types_forcetheo
  TYPE :: t_forcetheo
     LOGICAL,PRIVATE :: firstloop
26
     LOGICAL :: l_IO
27 28 29 30 31 32 33 34
   CONTAINS
     PROCEDURE :: start   =>forcetheo_start
     PROCEDURE :: next_job=>forcetheo_next_job 
     PROCEDURE :: eval    =>forcetheo_eval
     PROCEDURE :: postprocess => forcetheo_postprocess
  END TYPE t_forcetheo

CONTAINS
35
  SUBROUTINE forcetheo_start(this,potden,l_io)
36
    USE m_types_potden
37 38
    IMPLICIT NONE
    CLASS(t_forcetheo),INTENT(INOUT):: this
39
    TYPE(t_potden) ,INTENT(INOUT)   :: potden
40
    LOGICAL,INTENT(IN)              :: l_io
41
    this%firstloop=.TRUE.
42
    this%l_io=l_io
43 44
  END SUBROUTINE forcetheo_start

Daniel Wortmann's avatar
Daniel Wortmann committed
45
  LOGICAL FUNCTION forcetheo_next_job(this,lastiter,atoms,noco)
46
    USE m_types_setup
47 48
    IMPLICIT NONE
    CLASS(t_forcetheo),INTENT(INOUT):: this
Daniel Wortmann's avatar
Daniel Wortmann committed
49 50
    LOGICAL,INTENT(IN)                  :: lastiter
    TYPE(t_atoms),INTENT(IN)            :: atoms
51 52
    !Stuff that might be modified...
    TYPE(t_noco),INTENT(INOUT) :: noco
53 54 55 56
    forcetheo_next_job=this%firstloop
    this%firstloop=.FALSE.
  END FUNCTION forcetheo_next_job

57 58 59 60 61
  FUNCTION forcetheo_eval(this,eig_id,DIMENSION,atoms,kpts,sym,&
       cell,noco, input,mpi, oneD,enpara,v,results)RESULT(skip)
    USE m_types_setup
    USE m_types_mpi
    USE m_types_potden
62
    USE m_types_misc
63 64 65
    USE m_types_kpts
    USE m_types_enpara
    
66
    IMPLICIT NONE
67 68 69
    CLASS(t_forcetheo),INTENT(INOUT):: this
    LOGICAL :: skip
    !Stuff that might be used...
70 71 72 73 74 75 76 77 78 79 80 81 82
    TYPE(t_mpi),INTENT(IN)         :: mpi
    TYPE(t_dimension),INTENT(IN)   :: dimension
    TYPE(t_oneD),INTENT(IN)        :: oneD
    TYPE(t_input),INTENT(IN)       :: input
    TYPE(t_noco),INTENT(IN)        :: noco
    TYPE(t_sym),INTENT(IN)         :: sym
    TYPE(t_cell),INTENT(IN)        :: cell
    TYPE(t_kpts),INTENT(IN)        :: kpts
    TYPE(t_atoms),INTENT(IN)       :: atoms
    TYPE(t_enpara),INTENT(IN)      :: enpara
    TYPE(t_potden),INTENT(IN)      :: v
    TYPE(t_results),INTENT(IN)     :: results
    INTEGER,INTENT(IN)             :: eig_id
83
    skip=.FALSE.
84 85 86 87
  END FUNCTION forcetheo_eval

  SUBROUTINE forcetheo_postprocess(this)
    IMPLICIT NONE
88
    CLASS(t_forcetheo),INTENT(INOUT):: this
89 90 91 92 93
  END SUBROUTINE forcetheo_postprocess

  
END MODULE m_types_forcetheo