Line data Source code
1 : !--------------------------------------------------------------------------------
2 : ! Copyright (c) 2016 Peter Grünberg Institut, Forschungszentrum Jülich, Germany
3 : ! This file is part of FLEUR and available as free software under the conditions
4 : ! of the MIT license as expressed in the LICENSE file in more detail.
5 : !--------------------------------------------------------------------------------
6 :
7 :
8 : !>This module defines the basic type for calculations of force-theorem type
9 : !! Here only a dummy is defined that should be extended by a custom made data-type
10 : !! The functionality is encoded into four functions/subroutines:
11 : !! start: This routine is called in each SC-loop before the force theorem-loop
12 : !! next_job: This function returns .true. if another job should be done, it also modifies its
13 : !! arguments appropriately to perform the calculation
14 : !! eval: Here the calculation is done in this function, the results might be stored in
15 : !! MODULE variables, IF a .TRUE. is returned, the rest of the loop (charge generation)
16 : !! is skipped
17 : !! postprocess: After the calculation here some IO etc. can be done
18 : !!
19 : !!
20 : !! An example for a non-trivial force-theorem type extending this datatype can be found in
21 : !! forcetheorem/mae.F90
22 :
23 : MODULE m_types_forcetheo
24 : USE m_juDFT
25 : IMPLICIT NONE
26 : PRIVATE
27 : PUBLIC:: t_forcetheo
28 : TYPE :: t_forcetheo
29 : LOGICAL,PRIVATE :: firstloop=.false.
30 : LOGICAL :: l_IO=.true.
31 : LOGICAL :: l_needs_vectors=.true.
32 : logical :: l_in_forcetheo_loop=.false.
33 : CONTAINS
34 : PROCEDURE :: start =>forcetheo_start
35 : PROCEDURE :: next_job=>forcetheo_next_job
36 : PROCEDURE :: eval =>forcetheo_eval
37 : PROCEDURE :: postprocess => forcetheo_postprocess
38 : END TYPE t_forcetheo
39 :
40 : CONTAINS
41 686 : SUBROUTINE forcetheo_start(this,potden,l_io)
42 : USE m_types_potden
43 : IMPLICIT NONE
44 : CLASS(t_forcetheo),INTENT(INOUT):: this
45 : TYPE(t_potden) ,INTENT(INOUT) :: potden
46 : LOGICAL,INTENT(IN) :: l_io
47 686 : this%firstloop=.TRUE.
48 686 : this%l_io=l_io
49 686 : END SUBROUTINE forcetheo_start
50 :
51 1350 : LOGICAL FUNCTION forcetheo_next_job(this,fmpi,lastiter,atoms,noco,nococonv)
52 : USE m_types_atoms
53 : USE m_types_noco
54 : USE m_types_nococonv
55 : USE m_types_mpi
56 : IMPLICIT NONE
57 : CLASS(t_forcetheo),INTENT(INOUT) :: this
58 : TYPE(t_mpi), INTENT(IN) :: fmpi
59 : LOGICAL,INTENT(IN) :: lastiter
60 : TYPE(t_atoms),INTENT(IN) :: atoms
61 : TYPE(t_noco),INTENT(IN) :: noco
62 : !Stuff that might be modified...
63 : TYPE(t_nococonv),INTENT(INOUT) :: nococonv
64 1350 : forcetheo_next_job=this%firstloop
65 1350 : this%firstloop=.FALSE.
66 1350 : END FUNCTION forcetheo_next_job
67 :
68 686 : FUNCTION forcetheo_eval(this,eig_id,atoms,kpts,sym,&
69 : cell,noco,nococonv, input,fmpi, enpara,v,results)RESULT(skip)
70 : USE m_types_atoms
71 :
72 : USE m_types_input
73 : USE m_types_noco
74 : USE m_types_sym
75 : USE m_types_cell
76 : USE m_types_mpi
77 : USE m_types_potden
78 : USE m_types_misc
79 : USE m_types_kpts
80 : USE m_types_enpara
81 : USE m_types_nococonv
82 :
83 : IMPLICIT NONE
84 : CLASS(t_forcetheo),INTENT(INOUT):: this
85 : LOGICAL :: skip
86 : !Stuff that might be used...
87 : TYPE(t_mpi),INTENT(IN) :: fmpi
88 :
89 :
90 : TYPE(t_input),INTENT(IN) :: input
91 : TYPE(t_noco),INTENT(IN) :: noco
92 : TYPE(t_nococonv),INTENT(IN) :: nococonv
93 : TYPE(t_sym),INTENT(IN) :: sym
94 : TYPE(t_cell),INTENT(IN) :: cell
95 : TYPE(t_kpts),INTENT(IN) :: kpts
96 : TYPE(t_atoms),INTENT(IN) :: atoms
97 : TYPE(t_enpara),INTENT(IN) :: enpara
98 : TYPE(t_potden),INTENT(IN) :: v
99 : TYPE(t_results),INTENT(IN) :: results
100 : INTEGER,INTENT(IN) :: eig_id
101 686 : skip=.FALSE.
102 686 : END FUNCTION forcetheo_eval
103 :
104 664 : SUBROUTINE forcetheo_postprocess(this)
105 : IMPLICIT NONE
106 : CLASS(t_forcetheo),INTENT(INOUT):: this
107 664 : END SUBROUTINE forcetheo_postprocess
108 :
109 :
110 320 : END MODULE m_types_forcetheo
|