types_forcetheo.F90 3.2 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 26 27 28 29 30 31 32 33 34 35 36 37 38 39
!--------------------------------------------------------------------------------
! 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
   CONTAINS
     PROCEDURE :: start   =>forcetheo_start
     PROCEDURE :: next_job=>forcetheo_next_job 
     PROCEDURE :: eval    =>forcetheo_eval
     PROCEDURE :: postprocess => forcetheo_postprocess
  END TYPE t_forcetheo

CONTAINS
  SUBROUTINE forcetheo_start(this)
    IMPLICIT NONE
    CLASS(t_forcetheo),INTENT(INOUT):: this
    this%firstloop=.TRUE.
  END SUBROUTINE forcetheo_start

40 41
  LOGICAL FUNCTION forcetheo_next_job(this,lastiter,noco)
    USE m_types_setup
42 43
    IMPLICIT NONE
    CLASS(t_forcetheo),INTENT(INOUT):: this
44 45 46
     LOGICAL,INTENT(IN)                  :: lastiter
    !Stuff that might be modified...
    TYPE(t_noco),INTENT(INOUT) :: noco
47 48 49 50
    forcetheo_next_job=this%firstloop
    this%firstloop=.FALSE.
  END FUNCTION forcetheo_next_job

51 52 53 54 55
  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
56
    USE m_types_misc
57 58 59
    USE m_types_kpts
    USE m_types_enpara
    
60
    IMPLICIT NONE
61 62 63
    CLASS(t_forcetheo),INTENT(INOUT):: this
    LOGICAL :: skip
    !Stuff that might be used...
64 65 66 67 68 69 70 71 72 73 74 75 76
    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
77
    skip=.FALSE.
78 79 80 81
  END FUNCTION forcetheo_eval

  SUBROUTINE forcetheo_postprocess(this)
    IMPLICIT NONE
82
    CLASS(t_forcetheo),INTENT(INOUT):: this
83 84 85 86 87
  END SUBROUTINE forcetheo_postprocess

  
END MODULE m_types_forcetheo