(git:e7e05ae)
fist_energy_types.F
Go to the documentation of this file.
1 !--------------------------------------------------------------------------------------------------!
2 ! CP2K: A general program to perform molecular dynamics simulations !
3 ! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4 ! !
5 ! SPDX-License-Identifier: GPL-2.0-or-later !
6 !--------------------------------------------------------------------------------------------------!
7 
8 ! **************************************************************************************************
9 !> \par History
10 !> JGH (11.08.2002) exchange and correlation energy now in exc
11 !> \author MK (13.06.2002)
12 ! **************************************************************************************************
14 
15  USE kinds, ONLY: dp
16 #include "./base/base_uses.f90"
17 
18  IMPLICIT NONE
19  CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'fist_energy_types'
20 
21  PRIVATE
22 
23 ! **************************************************************************************************
24  TYPE fist_energy_type
25  REAL(kind=dp) :: kin, pot, e_gspace, e_self, e_neut, e_bonded, e_induction
26  REAL(kind=dp) :: kin_shell, harm_shell
27  END TYPE fist_energy_type
28 
29 ! *** Public data types ***
30 
31  PUBLIC :: fist_energy_type
32 
33 ! *** Public subroutines ***
34 
35  PUBLIC :: allocate_fist_energy, &
37 
38 CONTAINS
39 
40 ! **************************************************************************************************
41 !> \brief Allocate and/or initialise a Fist energy data structure.
42 !> \param fist_energy ...
43 !> \date 13.06.2002
44 !> \author MK
45 !> \version 1.0
46 ! **************************************************************************************************
47  SUBROUTINE allocate_fist_energy(fist_energy)
48  TYPE(fist_energy_type), POINTER :: fist_energy
49 
50  IF (.NOT. ASSOCIATED(fist_energy)) THEN
51  ALLOCATE (fist_energy)
52  END IF
53 
54  CALL init_fist_energy(fist_energy)
55 
56  END SUBROUTINE allocate_fist_energy
57 
58 ! **************************************************************************************************
59 !> \brief Deallocate a Fist energy data structure.
60 !> \param fist_energy ...
61 !> \date 13.06.2002
62 !> \author MK
63 !> \version 1.0
64 ! **************************************************************************************************
65  SUBROUTINE deallocate_fist_energy(fist_energy)
66  TYPE(fist_energy_type), POINTER :: fist_energy
67 
68  IF (ASSOCIATED(fist_energy)) THEN
69  DEALLOCATE (fist_energy)
70  ELSE
71  CALL cp_abort(__location__, &
72  "The fist_energy pointer is not associated "// &
73  "and cannot be deallocated.")
74  END IF
75 
76  END SUBROUTINE deallocate_fist_energy
77 
78 ! **************************************************************************************************
79 !> \brief Initialise a Fist energy data structure.
80 !> \param fist_energy ...
81 !> \date 13.06.2002
82 !> \author MK
83 !> \version 1.0
84 ! **************************************************************************************************
85  SUBROUTINE init_fist_energy(fist_energy)
86  TYPE(fist_energy_type), POINTER :: fist_energy
87 
88  IF (ASSOCIATED(fist_energy)) THEN
89  fist_energy%kin = 0.0_dp
90  fist_energy%pot = 0.0_dp
91  fist_energy%e_gspace = 0.0_dp
92  fist_energy%e_self = 0.0_dp
93  fist_energy%e_neut = 0.0_dp
94  fist_energy%e_bonded = 0.0_dp
95  fist_energy%e_induction = 0.0_dp
96  fist_energy%kin_shell = 0.0_dp
97  fist_energy%harm_shell = 0.0_dp
98  ELSE
99  CALL cp_abort(__location__, &
100  "The fist_energy pointer is not associated "// &
101  "and cannot be initialised.")
102  END IF
103 
104  END SUBROUTINE init_fist_energy
105 
106 END MODULE fist_energy_types
subroutine, public allocate_fist_energy(fist_energy)
Allocate and/or initialise a Fist energy data structure.
subroutine, public deallocate_fist_energy(fist_energy)
Deallocate a Fist energy data structure.
Defines the basic variable types.
Definition: kinds.F:23
integer, parameter, public dp
Definition: kinds.F:34