(git:374b731)
Loading...
Searching...
No Matches
hartree_local_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! **************************************************************************************************
9
10 USE kinds, ONLY: dp
12#include "./base/base_uses.f90"
13
14 IMPLICIT NONE
15
16 PRIVATE
17
18! *** Global parameters (only in this module)
19
20 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'hartree_local_types'
21
22! *** Define the ecoul_1center_type ***
23
24! **************************************************************************************************
26 TYPE(rho_atom_coeff), POINTER :: vh1_h, vh1_s
27 REAL(dp) :: ecoul_1_h = 0.0_dp, &
28 ecoul_1_s = 0.0_dp, &
29 ecoul_1_z = 0.0_dp, &
30 ecoul_1_0 = 0.0_dp
31 END TYPE ecoul_1center_type
32
33! **************************************************************************************************
36 DIMENSION(:), POINTER :: ecoul_1c
37 END TYPE hartree_local_type
38
39! *** Public subroutines ***
40
41 PUBLIC :: allocate_ecoul_1center, &
45
46! *** Public data types ***
47
49
50CONTAINS
51
52! **************************************************************************************************
53!> \brief ...
54!> \param ecoul_1c ...
55!> \param natom ...
56! **************************************************************************************************
57 SUBROUTINE allocate_ecoul_1center(ecoul_1c, natom)
58
59 TYPE(ecoul_1center_type), DIMENSION(:), POINTER :: ecoul_1c
60 INTEGER, INTENT(IN) :: natom
61
62 INTEGER :: iat
63
64 IF (ASSOCIATED(ecoul_1c)) THEN
65 CALL deallocate_ecoul_1center(ecoul_1c)
66 END IF
67
68 ALLOCATE (ecoul_1c(natom))
69
70 DO iat = 1, natom
71 ALLOCATE (ecoul_1c(iat)%Vh1_h)
72 NULLIFY (ecoul_1c(iat)%Vh1_h%r_coef)
73 ALLOCATE (ecoul_1c(iat)%Vh1_s)
74 NULLIFY (ecoul_1c(iat)%Vh1_s%r_coef)
75 END DO
76
77 END SUBROUTINE allocate_ecoul_1center
78
79! **************************************************************************************************
80!> \brief ...
81!> \param ecoul_1c ...
82! **************************************************************************************************
83 SUBROUTINE deallocate_ecoul_1center(ecoul_1c)
84
85 TYPE(ecoul_1center_type), DIMENSION(:), POINTER :: ecoul_1c
86
87 INTEGER :: iat, natom
88
89 natom = SIZE(ecoul_1c, 1)
90
91 DO iat = 1, natom
92 IF (ASSOCIATED(ecoul_1c(iat)%Vh1_h%r_coef)) THEN
93 DEALLOCATE (ecoul_1c(iat)%Vh1_h%r_coef)
94 END IF
95 DEALLOCATE (ecoul_1c(iat)%Vh1_h)
96
97 IF (ASSOCIATED(ecoul_1c(iat)%Vh1_s%r_coef)) THEN
98 DEALLOCATE (ecoul_1c(iat)%Vh1_s%r_coef)
99 END IF
100 DEALLOCATE (ecoul_1c(iat)%Vh1_s)
101
102 END DO
103
104 DEALLOCATE (ecoul_1c)
105
106 END SUBROUTINE deallocate_ecoul_1center
107
108! **************************************************************************************************
109!> \brief ...
110!> \param hartree_local ...
111!> \param ecoul_1c ...
112! **************************************************************************************************
113 SUBROUTINE get_hartree_local(hartree_local, ecoul_1c)
114
115 TYPE(hartree_local_type), POINTER :: hartree_local
116 TYPE(ecoul_1center_type), DIMENSION(:), OPTIONAL, &
117 POINTER :: ecoul_1c
118
119 IF (PRESENT(ecoul_1c)) ecoul_1c => hartree_local%ecoul_1c
120
121 END SUBROUTINE get_hartree_local
122
123! **************************************************************************************************
124!> \brief ...
125!> \param hartree_local ...
126! **************************************************************************************************
127 SUBROUTINE hartree_local_create(hartree_local)
128
129 TYPE(hartree_local_type), POINTER :: hartree_local
130
131 ALLOCATE (hartree_local)
132
133 NULLIFY (hartree_local%ecoul_1c)
134
135 END SUBROUTINE hartree_local_create
136
137! **************************************************************************************************
138!> \brief ...
139!> \param hartree_local ...
140! **************************************************************************************************
141 SUBROUTINE hartree_local_release(hartree_local)
142
143 TYPE(hartree_local_type), POINTER :: hartree_local
144
145 IF (ASSOCIATED(hartree_local)) THEN
146 IF (ASSOCIATED(hartree_local%ecoul_1c)) THEN
147 CALL deallocate_ecoul_1center(hartree_local%ecoul_1c)
148 END IF
149
150 DEALLOCATE (hartree_local)
151 END IF
152
153 END SUBROUTINE hartree_local_release
154
155! **************************************************************************************************
156!> \brief ...
157!> \param ecoul_1c ...
158!> \param iatom ...
159!> \param ecoul_1_h ...
160!> \param ecoul_1_s ...
161!> \param ecoul_1_z ...
162!> \param ecoul_1_0 ...
163! **************************************************************************************************
164 SUBROUTINE set_ecoul_1c(ecoul_1c, iatom, ecoul_1_h, ecoul_1_s, ecoul_1_z, ecoul_1_0)
165
166 TYPE(ecoul_1center_type), DIMENSION(:), POINTER :: ecoul_1c
167 INTEGER, INTENT(IN), OPTIONAL :: iatom
168 REAL(dp), INTENT(IN), OPTIONAL :: ecoul_1_h, ecoul_1_s, ecoul_1_z, &
169 ecoul_1_0
170
171 IF (PRESENT(iatom)) THEN
172 IF (PRESENT(ecoul_1_h)) ecoul_1c(iatom)%ecoul_1_h = ecoul_1_h
173 IF (PRESENT(ecoul_1_s)) ecoul_1c(iatom)%ecoul_1_s = ecoul_1_s
174 IF (PRESENT(ecoul_1_0)) ecoul_1c(iatom)%ecoul_1_0 = ecoul_1_0
175 IF (PRESENT(ecoul_1_z)) ecoul_1c(iatom)%ecoul_1_z = ecoul_1_z
176 END IF
177
178 END SUBROUTINE set_ecoul_1c
179
180! **************************************************************************************************
181!> \brief ...
182!> \param hartree_local ...
183!> \param ecoul_1c ...
184! **************************************************************************************************
185 SUBROUTINE set_hartree_local(hartree_local, ecoul_1c)
186
187 TYPE(hartree_local_type), POINTER :: hartree_local
188 TYPE(ecoul_1center_type), DIMENSION(:), OPTIONAL, &
189 POINTER :: ecoul_1c
190
191 IF (PRESENT(ecoul_1c)) hartree_local%ecoul_1c => ecoul_1c
192
193 END SUBROUTINE set_hartree_local
194
195END MODULE hartree_local_types
196
subroutine, public get_hartree_local(hartree_local, ecoul_1c)
...
subroutine, public set_hartree_local(hartree_local, ecoul_1c)
...
subroutine, public allocate_ecoul_1center(ecoul_1c, natom)
...
subroutine, public hartree_local_release(hartree_local)
...
subroutine, public set_ecoul_1c(ecoul_1c, iatom, ecoul_1_h, ecoul_1_s, ecoul_1_z, ecoul_1_0)
...
subroutine, public hartree_local_create(hartree_local)
...
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34