(git:374b731)
Loading...
Searching...
No Matches
fist_nonbond_env_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!> none
11!> \author HAF
12! **************************************************************************************************
15 USE cell_types, ONLY: cell_release,&
21 USE kinds, ONLY: default_string_length,&
22 dp
24 gal_type,&
32#include "./base/base_uses.f90"
33
34 IMPLICIT NONE
35 PRIVATE
36
37 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'fist_nonbond_env_types'
42
43! **************************************************************************************************
45 REAL(kind=dp) :: r(3) = 0.0_dp
46 END TYPE
47
49 REAL(kind=dp) :: f_embed = 0.0_dp
50 REAL(kind=dp) :: rho = 0.0_dp
51 END TYPE
52
54 INTEGER, POINTER :: use_indices(:) => null()
55 REAL(kind=dp), POINTER :: force(:, :) => null()
56 REAL(kind=dp) :: virial(3, 3) = 0.0_dp
57 END TYPE
58
60 INTEGER, POINTER :: use_indices(:) => null()
61 REAL(kind=dp), POINTER :: force(:, :) => null()
62 REAL(kind=dp) :: virial(3, 3) = 0.0_dp
63 TYPE(torch_model_type) :: model
64 END TYPE
65
67 INTEGER, POINTER :: use_indices(:) => null()
68 REAL(kind=dp), POINTER :: force(:, :) => null()
69 REAL(kind=dp) :: virial(3, 3) = 0.0_dp
70 TYPE(torch_model_type) :: model
71 END TYPE
72
74 INTEGER, POINTER :: use_indices(:) => null()
75 REAL(kind=dp), POINTER :: force(:, :) => null()
76 REAL(kind=dp) :: virial(3, 3) = 0.0_dp
77 TYPE(deepmd_model_type) :: model
78 END TYPE
79
80! **************************************************************************************************
82 INTEGER :: natom_types = -1
83 INTEGER :: counter = -1
84 INTEGER :: last_update = -1
85 INTEGER :: num_update = -1
86 LOGICAL :: do_nonbonded = .false.
87 LOGICAL :: do_electrostatics = .false.
88 LOGICAL :: shift_cutoff = .false.
89 CHARACTER(len=default_string_length) :: unit_type = ""
90 REAL(kind=dp) :: lup = 0.0_dp
91 REAL(kind=dp) :: aup = 0.0_dp
92 REAL(kind=dp) :: ei_scale14 = 0.0_dp
93 REAL(kind=dp) :: vdw_scale14 = 0.0_dp
94 REAL(kind=dp) :: long_range_correction = 0.0_dp
95 REAL(kind=dp), DIMENSION(:, :), POINTER :: rlist_cut => null()
96 REAL(kind=dp), DIMENSION(:, :), POINTER :: rlist_lowsq => null()
97 REAL(kind=dp), DIMENSION(:, :), POINTER :: ij_kind_full_fac => null()
98 REAL(kind=dp), DIMENSION(:), POINTER :: charges => null()
99 TYPE(fist_neighbor_type), POINTER :: nonbonded => null()
100 TYPE(pair_potential_pp_type), POINTER :: potparm14 => null()
101 TYPE(pair_potential_pp_type), POINTER :: potparm => null()
102 TYPE(cell_type), POINTER :: cell_last_update => null()
103 TYPE(pos_type), DIMENSION(:), POINTER :: r_last_update => null()
104 TYPE(pos_type), DIMENSION(:), POINTER :: r_last_update_pbc => null()
105 TYPE(pos_type), DIMENSION(:), POINTER :: rshell_last_update_pbc => null()
106 TYPE(pos_type), DIMENSION(:), POINTER :: rcore_last_update_pbc => null()
107 TYPE(eam_type), DIMENSION(:), POINTER :: eam_data => null()
108 TYPE(quip_data_type), POINTER :: quip_data => null()
109 TYPE(deepmd_data_type), POINTER :: deepmd_data => null()
110 TYPE(nequip_data_type), POINTER :: nequip_data => null()
111 TYPE(allegro_data_type), POINTER :: allegro_data => null()
112 END TYPE fist_nonbond_env_type
113
114CONTAINS
115
116! **************************************************************************************************
117!> \brief sets a fist_nonbond_env
118!> \param fist_nonbond_env the object to create
119!> \param potparm14 ...
120!> \param potparm ...
121!> \param nonbonded ...
122!> \param rlist_cut ...
123!> \param rlist_lowsq ...
124!> \param aup ...
125!> \param lup ...
126!> \param ei_scale14 ...
127!> \param vdw_scale14 ...
128!> \param shift_cutoff ...
129!> \param do_electrostatics ...
130!> \param r_last_update ...
131!> \param r_last_update_pbc ...
132!> \param rshell_last_update_pbc ...
133!> \param rcore_last_update_pbc ...
134!> \param cell_last_update ...
135!> \param num_update ...
136!> \param last_update ...
137!> \param counter ...
138!> \param natom_types ...
139!> \param long_range_correction ...
140!> \param ij_kind_full_fac ...
141!> \param eam_data ...
142!> \param quip_data ...
143!> \param nequip_data ...
144!> \param allegro_data ...
145!> \param deepmd_data ...
146!> \param charges ...
147!> \par History
148!> 12.2002 created [fawzi]
149!> \author Fawzi Mohamed
150! **************************************************************************************************
151 SUBROUTINE fist_nonbond_env_get(fist_nonbond_env, potparm14, potparm, &
152 nonbonded, rlist_cut, rlist_lowsq, aup, lup, ei_scale14, vdw_scale14, &
153 shift_cutoff, do_electrostatics, r_last_update, r_last_update_pbc, rshell_last_update_pbc, &
154 rcore_last_update_pbc, cell_last_update, num_update, last_update, &
155 counter, natom_types, long_range_correction, ij_kind_full_fac, eam_data, &
156 quip_data, nequip_data, allegro_data, deepmd_data, charges)
157
158 TYPE(fist_nonbond_env_type), INTENT(IN) :: fist_nonbond_env
159 TYPE(pair_potential_pp_type), OPTIONAL, POINTER :: potparm14, potparm
160 TYPE(fist_neighbor_type), OPTIONAL, POINTER :: nonbonded
161 REAL(kind=dp), DIMENSION(:, :), OPTIONAL, POINTER :: rlist_cut, rlist_lowsq
162 REAL(kind=dp), OPTIONAL :: aup, lup, ei_scale14, vdw_scale14
163 LOGICAL, INTENT(OUT), OPTIONAL :: shift_cutoff, do_electrostatics
164 TYPE(pos_type), DIMENSION(:), OPTIONAL, POINTER :: r_last_update, r_last_update_pbc, &
165 rshell_last_update_pbc, &
166 rcore_last_update_pbc
167 TYPE(cell_type), OPTIONAL, POINTER :: cell_last_update
168 INTEGER, OPTIONAL :: num_update, last_update, counter, &
169 natom_types
170 REAL(kind=dp), OPTIONAL :: long_range_correction
171 REAL(kind=dp), DIMENSION(:, :), OPTIONAL, POINTER :: ij_kind_full_fac
172 TYPE(eam_type), DIMENSION(:), OPTIONAL, POINTER :: eam_data
173 TYPE(quip_data_type), OPTIONAL, POINTER :: quip_data
174 TYPE(nequip_data_type), OPTIONAL, POINTER :: nequip_data
175 TYPE(allegro_data_type), OPTIONAL, POINTER :: allegro_data
176 TYPE(deepmd_data_type), OPTIONAL, POINTER :: deepmd_data
177 REAL(kind=dp), DIMENSION(:), OPTIONAL, POINTER :: charges
178
179 IF (PRESENT(charges)) charges => fist_nonbond_env%charges
180 IF (PRESENT(potparm14)) potparm14 => fist_nonbond_env%potparm14
181 IF (PRESENT(eam_data)) eam_data => fist_nonbond_env%eam_data
182 IF (PRESENT(quip_data)) quip_data => fist_nonbond_env%quip_data
183 IF (PRESENT(nequip_data)) nequip_data => fist_nonbond_env%nequip_data
184 IF (PRESENT(allegro_data)) allegro_data => fist_nonbond_env%allegro_data
185 IF (PRESENT(deepmd_data)) deepmd_data => fist_nonbond_env%deepmd_data
186 IF (PRESENT(potparm)) potparm => fist_nonbond_env%potparm
187 IF (PRESENT(rlist_cut)) rlist_cut => fist_nonbond_env%rlist_cut
188 IF (PRESENT(rlist_lowsq)) rlist_lowsq => fist_nonbond_env%rlist_lowsq
189 IF (PRESENT(ij_kind_full_fac)) ij_kind_full_fac => fist_nonbond_env%ij_kind_full_fac
190 IF (PRESENT(nonbonded)) nonbonded => fist_nonbond_env%nonbonded
191 IF (PRESENT(r_last_update)) &
192 r_last_update => fist_nonbond_env%r_last_update
193 IF (PRESENT(r_last_update_pbc)) &
194 r_last_update_pbc => fist_nonbond_env%r_last_update_pbc
195 IF (PRESENT(rshell_last_update_pbc)) &
196 rshell_last_update_pbc => fist_nonbond_env%rshell_last_update_pbc
197 IF (PRESENT(rcore_last_update_pbc)) &
198 rcore_last_update_pbc => fist_nonbond_env%rcore_last_update_pbc
199 IF (PRESENT(cell_last_update)) &
200 cell_last_update => fist_nonbond_env%cell_last_update
201 IF (PRESENT(lup)) lup = fist_nonbond_env%lup
202 IF (PRESENT(aup)) aup = fist_nonbond_env%aup
203 IF (PRESENT(ei_scale14)) ei_scale14 = fist_nonbond_env%ei_scale14
204 IF (PRESENT(vdw_scale14)) vdw_scale14 = fist_nonbond_env%vdw_scale14
205 IF (PRESENT(shift_cutoff)) &
206 shift_cutoff = fist_nonbond_env%shift_cutoff
207 IF (PRESENT(do_electrostatics)) do_electrostatics = fist_nonbond_env%do_electrostatics
208 IF (PRESENT(natom_types)) natom_types = fist_nonbond_env%natom_types
209 IF (PRESENT(counter)) counter = fist_nonbond_env%counter
210 IF (PRESENT(last_update)) last_update = fist_nonbond_env%last_update
211 IF (PRESENT(num_update)) num_update = fist_nonbond_env%num_update
212 IF (PRESENT(long_range_correction)) &
213 long_range_correction = fist_nonbond_env%long_range_correction
214 END SUBROUTINE fist_nonbond_env_get
215
216! **************************************************************************************************
217!> \brief sets a fist_nonbond_env
218!> \param fist_nonbond_env the object to create
219!> \param potparm14 ...
220!> \param potparm ...
221!> \param rlist_cut ...
222!> \param rlist_lowsq ...
223!> \param nonbonded ...
224!> \param aup ...
225!> \param lup ...
226!> \param ei_scale14 ...
227!> \param vdw_scale14 ...
228!> \param shift_cutoff ...
229!> \param do_electrostatics ...
230!> \param r_last_update ...
231!> \param r_last_update_pbc ...
232!> \param rshell_last_update_pbc ...
233!> \param rcore_last_update_pbc ...
234!> \param cell_last_update ...
235!> \param num_update ...
236!> \param last_update ...
237!> \param counter ...
238!> \param natom_types ...
239!> \param long_range_correction ...
240!> \param eam_data ...
241!> \param quip_data ...
242!> \param nequip_data ...
243!> \param allegro_data ...
244!> \param deepmd_data ...
245!> \param charges ...
246!> \par History
247!> 12.2002 created [fawzi]
248!> \author Fawzi Mohamed
249! **************************************************************************************************
250 SUBROUTINE fist_nonbond_env_set(fist_nonbond_env, potparm14, potparm, &
251 rlist_cut, rlist_lowsq, nonbonded, aup, lup, ei_scale14, vdw_scale14, &
252 shift_cutoff, do_electrostatics, r_last_update, r_last_update_pbc, rshell_last_update_pbc, &
253 rcore_last_update_pbc, cell_last_update, num_update, last_update, &
254 counter, natom_types, long_range_correction, eam_data, quip_data, &
255 nequip_data, allegro_data, deepmd_data, charges)
256
257 TYPE(fist_nonbond_env_type), INTENT(INOUT) :: fist_nonbond_env
258 TYPE(pair_potential_pp_type), OPTIONAL, POINTER :: potparm14, potparm
259 REAL(kind=dp), DIMENSION(:, :), OPTIONAL, POINTER :: rlist_cut, rlist_lowsq
260 TYPE(fist_neighbor_type), OPTIONAL, POINTER :: nonbonded
261 REAL(kind=dp), OPTIONAL :: aup, lup, ei_scale14, vdw_scale14
262 LOGICAL, INTENT(IN), OPTIONAL :: shift_cutoff, do_electrostatics
263 TYPE(pos_type), DIMENSION(:), OPTIONAL, POINTER :: r_last_update, r_last_update_pbc, &
264 rshell_last_update_pbc, &
265 rcore_last_update_pbc
266 TYPE(cell_type), OPTIONAL, POINTER :: cell_last_update
267 INTEGER, OPTIONAL :: num_update, last_update, counter, &
268 natom_types
269 REAL(kind=dp), OPTIONAL :: long_range_correction
270 TYPE(eam_type), DIMENSION(:), OPTIONAL, POINTER :: eam_data
271 TYPE(quip_data_type), OPTIONAL, POINTER :: quip_data
272 TYPE(nequip_data_type), OPTIONAL, POINTER :: nequip_data
273 TYPE(allegro_data_type), OPTIONAL, POINTER :: allegro_data
274 TYPE(deepmd_data_type), OPTIONAL, POINTER :: deepmd_data
275 REAL(kind=dp), DIMENSION(:), OPTIONAL, POINTER :: charges
276
277 IF (PRESENT(potparm14)) fist_nonbond_env%potparm14 => potparm14
278 IF (PRESENT(eam_data)) fist_nonbond_env%eam_data => eam_data
279 IF (PRESENT(quip_data)) fist_nonbond_env%quip_data => quip_data
280 IF (PRESENT(nequip_data)) fist_nonbond_env%nequip_data => nequip_data
281 IF (PRESENT(allegro_data)) fist_nonbond_env%allegro_data => allegro_data
282 IF (PRESENT(deepmd_data)) fist_nonbond_env%deepmd_data => deepmd_data
283 IF (PRESENT(potparm)) fist_nonbond_env%potparm => potparm
284 IF (PRESENT(rlist_cut)) fist_nonbond_env%rlist_cut => rlist_cut
285 IF (PRESENT(charges)) fist_nonbond_env%charges => charges
286 IF (PRESENT(rlist_lowsq)) fist_nonbond_env%rlist_lowsq => rlist_lowsq
287 IF (PRESENT(nonbonded)) fist_nonbond_env%nonbonded => nonbonded
288 IF (PRESENT(r_last_update)) &
289 fist_nonbond_env%r_last_update => r_last_update
290 IF (PRESENT(r_last_update_pbc)) &
291 fist_nonbond_env%r_last_update_pbc => r_last_update_pbc
292 IF (PRESENT(rshell_last_update_pbc)) &
293 fist_nonbond_env%rshell_last_update_pbc => rshell_last_update_pbc
294 IF (PRESENT(rcore_last_update_pbc)) &
295 fist_nonbond_env%rcore_last_update_pbc => rcore_last_update_pbc
296 IF (PRESENT(cell_last_update)) &
297 fist_nonbond_env%cell_last_update => cell_last_update
298 IF (PRESENT(lup)) fist_nonbond_env%lup = lup
299 IF (PRESENT(aup)) fist_nonbond_env%aup = aup
300 IF (PRESENT(ei_scale14)) fist_nonbond_env%ei_scale14 = ei_scale14
301 IF (PRESENT(vdw_scale14)) fist_nonbond_env%vdw_scale14 = vdw_scale14
302 IF (PRESENT(shift_cutoff)) &
303 fist_nonbond_env%shift_cutoff = shift_cutoff
304 IF (PRESENT(do_electrostatics)) fist_nonbond_env%do_electrostatics = do_electrostatics
305 IF (PRESENT(natom_types)) fist_nonbond_env%natom_types = natom_types
306 IF (PRESENT(counter)) fist_nonbond_env%counter = counter
307 IF (PRESENT(last_update)) fist_nonbond_env%last_update = last_update
308 IF (PRESENT(num_update)) fist_nonbond_env%num_update = num_update
309 IF (PRESENT(long_range_correction)) &
310 fist_nonbond_env%long_range_correction = long_range_correction
311 END SUBROUTINE fist_nonbond_env_set
312
313! **************************************************************************************************
314!> \brief allocates and intitializes a fist_nonbond_env
315!> \param fist_nonbond_env the object to create
316!> \param atomic_kind_set ...
317!> \param potparm14 ...
318!> \param potparm ...
319!> \param do_nonbonded ...
320!> \param do_electrostatics ...
321!> \param verlet_skin ...
322!> \param ewald_rcut ...
323!> \param ei_scale14 ...
324!> \param vdw_scale14 ...
325!> \param shift_cutoff ...
326!> \par History
327!> 12.2002 created [fawzi]
328!> \author Fawzi Mohamed
329! **************************************************************************************************
330 SUBROUTINE fist_nonbond_env_create(fist_nonbond_env, atomic_kind_set, &
331 potparm14, potparm, do_nonbonded, do_electrostatics, verlet_skin, ewald_rcut, &
332 ei_scale14, vdw_scale14, shift_cutoff)
333 TYPE(fist_nonbond_env_type), INTENT(OUT) :: fist_nonbond_env
334 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
335 TYPE(pair_potential_pp_type), OPTIONAL, POINTER :: potparm14, potparm
336 LOGICAL, INTENT(IN) :: do_nonbonded, do_electrostatics
337 REAL(kind=dp), INTENT(IN) :: verlet_skin, ewald_rcut, ei_scale14, &
338 vdw_scale14
339 LOGICAL, INTENT(IN) :: shift_cutoff
340
341 NULLIFY (fist_nonbond_env%potparm14)
342 NULLIFY (fist_nonbond_env%potparm)
343 NULLIFY (fist_nonbond_env%rlist_cut)
344 NULLIFY (fist_nonbond_env%rlist_lowsq)
345 NULLIFY (fist_nonbond_env%ij_kind_full_fac)
346 NULLIFY (fist_nonbond_env%nonbonded)
347 NULLIFY (fist_nonbond_env%cell_last_update)
348 NULLIFY (fist_nonbond_env%r_last_update)
349 NULLIFY (fist_nonbond_env%r_last_update_pbc)
350 NULLIFY (fist_nonbond_env%rshell_last_update_pbc)
351 NULLIFY (fist_nonbond_env%rcore_last_update_pbc)
352 NULLIFY (fist_nonbond_env%eam_data)
353 NULLIFY (fist_nonbond_env%quip_data)
354 NULLIFY (fist_nonbond_env%nequip_data)
355 NULLIFY (fist_nonbond_env%allegro_data)
356 NULLIFY (fist_nonbond_env%deepmd_data)
357 NULLIFY (fist_nonbond_env%charges)
358 CALL init_fist_nonbond_env(fist_nonbond_env, atomic_kind_set, potparm14, &
359 potparm, do_nonbonded, do_electrostatics, verlet_skin, ewald_rcut, ei_scale14, &
360 vdw_scale14, shift_cutoff)
361 END SUBROUTINE fist_nonbond_env_create
362
363! **************************************************************************************************
364!> \brief Purpose: Initialise the FIST nonbond environment.
365!> \param fist_nonbond_env the object to create
366!> \param atomic_kind_set ...
367!> \param potparm14 ...
368!> \param potparm ...
369!> \param do_nonbonded ...
370!> \param do_electrostatics ...
371!> \param verlet_skin ...
372!> \param ewald_rcut ...
373!> \param ei_scale14 ...
374!> \param vdw_scale14 ...
375!> \param shift_cutoff ...
376! **************************************************************************************************
377 SUBROUTINE init_fist_nonbond_env(fist_nonbond_env, atomic_kind_set, &
378 potparm14, potparm, do_nonbonded, do_electrostatics, verlet_skin, ewald_rcut, ei_scale14, &
379 vdw_scale14, shift_cutoff)
380
381 TYPE(fist_nonbond_env_type), INTENT(INOUT) :: fist_nonbond_env
382 TYPE(atomic_kind_type), DIMENSION(:), POINTER :: atomic_kind_set
383 TYPE(pair_potential_pp_type), OPTIONAL, POINTER :: potparm14, potparm
384 LOGICAL, INTENT(IN) :: do_nonbonded, do_electrostatics
385 REAL(kind=dp), INTENT(IN) :: verlet_skin, ewald_rcut, ei_scale14, &
386 vdw_scale14
387 LOGICAL, INTENT(IN) :: shift_cutoff
388
389 INTEGER :: idim, jdim, natom_types
390 LOGICAL :: check, use_potparm, use_potparm14
391 REAL(kind=dp) :: fac, rcut, rlow
392
393 use_potparm14 = PRESENT(potparm14)
394 IF (use_potparm14) use_potparm14 = use_potparm14 .OR. ASSOCIATED(potparm14)
395 use_potparm = PRESENT(potparm)
396 IF (use_potparm) use_potparm = use_potparm .OR. ASSOCIATED(potparm)
397 NULLIFY (fist_nonbond_env%nonbonded)
398 NULLIFY (fist_nonbond_env%r_last_update)
399 NULLIFY (fist_nonbond_env%r_last_update_pbc)
400 NULLIFY (fist_nonbond_env%rshell_last_update_pbc)
401 NULLIFY (fist_nonbond_env%rcore_last_update_pbc)
402 NULLIFY (fist_nonbond_env%cell_last_update)
403 NULLIFY (fist_nonbond_env%rlist_cut)
404 NULLIFY (fist_nonbond_env%rlist_lowsq)
405 NULLIFY (fist_nonbond_env%ij_kind_full_fac)
406 fist_nonbond_env%unit_type = "ANGSTROM"
407 fist_nonbond_env%do_nonbonded = do_nonbonded
408 fist_nonbond_env%do_electrostatics = do_electrostatics
409 fist_nonbond_env%lup = 0
410 fist_nonbond_env%aup = 0
411 fist_nonbond_env%ei_scale14 = ei_scale14
412 fist_nonbond_env%vdw_scale14 = vdw_scale14
413 fist_nonbond_env%shift_cutoff = shift_cutoff
414 fist_nonbond_env%counter = 0
415 fist_nonbond_env%last_update = 0
416 fist_nonbond_env%num_update = 0
417 fist_nonbond_env%long_range_correction = 0
418 IF (do_nonbonded) THEN
419 natom_types = 1
420 ! Determine size of kind arrays
421 natom_types = SIZE(atomic_kind_set)
422 IF (use_potparm14) THEN
423 check = (SIZE(potparm14%pot, 1) == natom_types)
424 cpassert(check)
425 END IF
426 IF (use_potparm) THEN
427 check = (SIZE(potparm%pot, 1) == natom_types)
428 cpassert(check)
429 END IF
430 ALLOCATE (fist_nonbond_env%rlist_cut(natom_types, natom_types))
431 ALLOCATE (fist_nonbond_env%rlist_lowsq(natom_types, natom_types))
432 ALLOCATE (fist_nonbond_env%ij_kind_full_fac(natom_types, natom_types))
433 fist_nonbond_env%ij_kind_full_fac = 1.0_dp
434 DO idim = 1, natom_types
435 DO jdim = idim, natom_types
436 IF ((use_potparm) .OR. (use_potparm14)) THEN
437 IF (use_potparm) THEN
438 rcut = sqrt(potparm%pot(idim, jdim)%pot%rcutsq)
439 fac = potparm%pot(idim, jdim)%pot%spl_f%rscale(1)
440 rlow = fac/(potparm%pot(idim, jdim)%pot%pair_spline_data(1)%spline_data%xn)
441 ELSE
442 rcut = sqrt(potparm14%pot(idim, jdim)%pot%rcutsq)
443 fac = potparm14%pot(idim, jdim)%pot%spl_f%rscale(1)
444 rlow = fac/(potparm14%pot(idim, jdim)%pot%pair_spline_data(1)%spline_data%xn)
445 END IF
446 ! Warning: rlist_rcut should only be used by the neighbor list
447 ! algorithm. It is not the cutoff for the evaluation of the
448 ! interactions because rlist_rcut includes the Verlet skin.
449 rcut = max(rcut, ewald_rcut) + verlet_skin
450 fist_nonbond_env%rlist_cut(idim, jdim) = rcut
451 fist_nonbond_env%rlist_cut(jdim, idim) = rcut
452 rlow = rlow*(1.06_dp)**2 ! 1.06_dp in order to have 1/2 Emax_spline
453 fist_nonbond_env%rlist_lowsq(idim, jdim) = rlow
454 fist_nonbond_env%rlist_lowsq(jdim, idim) = rlow
455 ! In case of manybody potential the neighbor list will be full.
456 ! This means that for each atom pair (a,b) of the current types,
457 ! atom a is in the neighbor list of b and b is in the neighbor
458 ! list of a. ij_kind_full_fac is used to correct for the double
459 ! counting in the conventional pair potentials cause by this
460 ! situation.
461 IF (any(potparm%pot(idim, jdim)%pot%type == tersoff_type)) THEN
462 ! TODO: what if 14 is not of tersoff type while the normal
463 ! nonbond is? (or the reverse). We'd better impose
464 ! consistency.
465 fist_nonbond_env%ij_kind_full_fac(idim, jdim) = 0.5_dp
466 fist_nonbond_env%ij_kind_full_fac(idim, jdim) = 0.5_dp
467 END IF
468 IF (any(potparm%pot(idim, jdim)%pot%type == siepmann_type)) THEN
469 ! TODO:see tersoff_type
470 fist_nonbond_env%ij_kind_full_fac(idim, jdim) = 0.5_dp
471 fist_nonbond_env%ij_kind_full_fac(idim, jdim) = 0.5_dp
472 END IF
473 IF (any(potparm%pot(idim, jdim)%pot%type == gal_type)) THEN
474 fist_nonbond_env%ij_kind_full_fac(idim, jdim) = 0.5_dp
475 fist_nonbond_env%ij_kind_full_fac(idim, jdim) = 0.5_dp
476 END IF
477 IF (any(potparm%pot(idim, jdim)%pot%type == gal21_type)) THEN
478 fist_nonbond_env%ij_kind_full_fac(idim, jdim) = 0.5_dp
479 fist_nonbond_env%ij_kind_full_fac(idim, jdim) = 0.5_dp
480 END IF
481 IF (any(potparm%pot(idim, jdim)%pot%type == nequip_type)) THEN
482 fist_nonbond_env%ij_kind_full_fac(idim, jdim) = 0.5_dp
483 fist_nonbond_env%ij_kind_full_fac(idim, jdim) = 0.5_dp
484 END IF
485 ELSE
486 ! In case we don't use potparm for initialization let's account
487 ! only for the real-space part of the Ewald sum.
488 fist_nonbond_env%rlist_cut(idim, jdim) = ewald_rcut
489 fist_nonbond_env%rlist_cut(jdim, idim) = ewald_rcut
490 fist_nonbond_env%rlist_lowsq(idim, jdim) = 0.0_dp
491 fist_nonbond_env%rlist_lowsq(jdim, idim) = 0.0_dp
492 END IF
493 END DO
494 END DO
495 IF (use_potparm14) fist_nonbond_env%potparm14 => potparm14
496 IF (use_potparm) fist_nonbond_env%potparm => potparm
497 fist_nonbond_env%natom_types = natom_types
498 ELSE
499 NULLIFY (fist_nonbond_env%potparm)
500 NULLIFY (fist_nonbond_env%potparm14)
501 END IF
502 END SUBROUTINE init_fist_nonbond_env
503
504! **************************************************************************************************
505!> \brief releases the given fist_nonbond_env (see doc/ReferenceCounting.html)
506!> \param fist_nonbond_env the object to release
507!> \par History
508!> 12.2002 created [fawzi]
509!> \author Fawzi Mohamed
510! **************************************************************************************************
511 SUBROUTINE fist_nonbond_env_release(fist_nonbond_env)
512 TYPE(fist_nonbond_env_type), INTENT(INOUT) :: fist_nonbond_env
513
514 IF (ASSOCIATED(fist_nonbond_env%nonbonded)) THEN
515 CALL fist_neighbor_deallocate(fist_nonbond_env%nonbonded)
516 END IF
517 ! Release potparm
518 CALL pair_potential_pp_release(fist_nonbond_env%potparm)
519 ! Release potparm14
520 CALL pair_potential_pp_release(fist_nonbond_env%potparm14)
521 IF (ASSOCIATED(fist_nonbond_env%r_last_update)) THEN
522 DEALLOCATE (fist_nonbond_env%r_last_update)
523 END IF
524 IF (ASSOCIATED(fist_nonbond_env%r_last_update_pbc)) THEN
525 DEALLOCATE (fist_nonbond_env%r_last_update_pbc)
526 END IF
527 IF (ASSOCIATED(fist_nonbond_env%charges)) THEN
528 DEALLOCATE (fist_nonbond_env%charges)
529 END IF
530 IF (ASSOCIATED(fist_nonbond_env%eam_data)) THEN
531 DEALLOCATE (fist_nonbond_env%eam_data)
532 END IF
533 IF (ASSOCIATED(fist_nonbond_env%quip_data)) THEN
534 IF (ASSOCIATED(fist_nonbond_env%quip_data%force)) THEN
535 DEALLOCATE (fist_nonbond_env%quip_data%force)
536 END IF
537 IF (ASSOCIATED(fist_nonbond_env%quip_data%use_indices)) THEN
538 DEALLOCATE (fist_nonbond_env%quip_data%use_indices)
539 END IF
540 DEALLOCATE (fist_nonbond_env%quip_data)
541 END IF
542 IF (ASSOCIATED(fist_nonbond_env%nequip_data)) THEN
543 IF (ASSOCIATED(fist_nonbond_env%nequip_data%force)) THEN
544 DEALLOCATE (fist_nonbond_env%nequip_data%force)
545 END IF
546 IF (ASSOCIATED(fist_nonbond_env%nequip_data%use_indices)) THEN
547 DEALLOCATE (fist_nonbond_env%nequip_data%use_indices)
548 END IF
549 CALL torch_model_release(fist_nonbond_env%nequip_data%model)
550 DEALLOCATE (fist_nonbond_env%nequip_data)
551 END IF
552 IF (ASSOCIATED(fist_nonbond_env%allegro_data)) THEN
553 IF (ASSOCIATED(fist_nonbond_env%allegro_data%force)) THEN
554 DEALLOCATE (fist_nonbond_env%allegro_data%force)
555 END IF
556 IF (ASSOCIATED(fist_nonbond_env%allegro_data%use_indices)) THEN
557 DEALLOCATE (fist_nonbond_env%allegro_data%use_indices)
558 END IF
559 CALL torch_model_release(fist_nonbond_env%allegro_data%model)
560 DEALLOCATE (fist_nonbond_env%allegro_data)
561 END IF
562 IF (ASSOCIATED(fist_nonbond_env%deepmd_data)) THEN
563 IF (ASSOCIATED(fist_nonbond_env%deepmd_data%force)) THEN
564 DEALLOCATE (fist_nonbond_env%deepmd_data%force)
565 END IF
566 IF (ASSOCIATED(fist_nonbond_env%deepmd_data%use_indices)) THEN
567 DEALLOCATE (fist_nonbond_env%deepmd_data%use_indices)
568 END IF
569 CALL deepmd_model_release(fist_nonbond_env%deepmd_data%model)
570 DEALLOCATE (fist_nonbond_env%deepmd_data)
571 END IF
572 IF (ASSOCIATED(fist_nonbond_env%rshell_last_update_pbc)) THEN
573 DEALLOCATE (fist_nonbond_env%rshell_last_update_pbc)
574 END IF
575 IF (ASSOCIATED(fist_nonbond_env%rcore_last_update_pbc)) THEN
576 DEALLOCATE (fist_nonbond_env%rcore_last_update_pbc)
577 END IF
578 IF (ASSOCIATED(fist_nonbond_env%cell_last_update)) THEN
579 CALL cell_release(fist_nonbond_env%cell_last_update)
580 END IF
581 IF (ASSOCIATED(fist_nonbond_env%ij_kind_full_fac)) THEN
582 DEALLOCATE (fist_nonbond_env%ij_kind_full_fac)
583 END IF
584 IF (ASSOCIATED(fist_nonbond_env%rlist_cut)) THEN
585 DEALLOCATE (fist_nonbond_env%rlist_cut)
586 END IF
587 IF (ASSOCIATED(fist_nonbond_env%rlist_lowsq)) THEN
588 DEALLOCATE (fist_nonbond_env%rlist_lowsq)
589 END IF
590 END SUBROUTINE fist_nonbond_env_release
591
592END MODULE fist_nonbond_env_types
static GRID_HOST_DEVICE double fac(const int i)
Factorial function, e.g. fac(5) = 5! = 120.
Definition grid_common.h:48
Define the atomic kind types and their sub types.
Handles all functions related to the CELL.
Definition cell_types.F:15
subroutine, public cell_release(cell)
releases the given cell (see doc/ReferenceCounting.html)
Definition cell_types.F:559
Interface to the DeePMD-kit or a c++ wrapper.
subroutine, public deepmd_model_release(model)
Releases a deepmd model and all its ressources.
Define the neighbor list data types and the corresponding functionality.
subroutine, public fist_neighbor_deallocate(fist_neighbor)
...
subroutine, public fist_nonbond_env_create(fist_nonbond_env, atomic_kind_set, potparm14, potparm, do_nonbonded, do_electrostatics, verlet_skin, ewald_rcut, ei_scale14, vdw_scale14, shift_cutoff)
allocates and intitializes a fist_nonbond_env
subroutine, public fist_nonbond_env_get(fist_nonbond_env, potparm14, potparm, nonbonded, rlist_cut, rlist_lowsq, aup, lup, ei_scale14, vdw_scale14, shift_cutoff, do_electrostatics, r_last_update, r_last_update_pbc, rshell_last_update_pbc, rcore_last_update_pbc, cell_last_update, num_update, last_update, counter, natom_types, long_range_correction, ij_kind_full_fac, eam_data, quip_data, nequip_data, allegro_data, deepmd_data, charges)
sets a fist_nonbond_env
subroutine, public fist_nonbond_env_set(fist_nonbond_env, potparm14, potparm, rlist_cut, rlist_lowsq, nonbonded, aup, lup, ei_scale14, vdw_scale14, shift_cutoff, do_electrostatics, r_last_update, r_last_update_pbc, rshell_last_update_pbc, rcore_last_update_pbc, cell_last_update, num_update, last_update, counter, natom_types, long_range_correction, eam_data, quip_data, nequip_data, allegro_data, deepmd_data, charges)
sets a fist_nonbond_env
subroutine, public fist_nonbond_env_release(fist_nonbond_env)
releases the given fist_nonbond_env (see doc/ReferenceCounting.html)
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
integer, parameter, public default_string_length
Definition kinds.F:57
integer, parameter, public gal_type
subroutine, public pair_potential_pp_release(potparm)
Release Data-structure that constains potential parameters.
integer, parameter, public nequip_type
integer, parameter, public siepmann_type
integer, parameter, public gal21_type
integer, parameter, public tersoff_type
subroutine, public torch_model_release(model)
Releases a Torch model and all its ressources.
Definition torch_api.F:1004
Provides all information about an atomic kind.
Type defining parameters related to the simulation cell.
Definition cell_types.F:55