(git:d1312bc)
Loading...
Searching...
No Matches
pair_potential_types.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2026 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \par History
10!> Teodoro Laino [Teo] 11.2005 : Reorganizing the structures to optimize
11!> memory management
12!> \author CJM
13! **************************************************************************************************
15
17 USE kinds, ONLY: default_path_length,&
19 dp
27#include "./base/base_uses.f90"
28
29 IMPLICIT NONE
30
31 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'pair_potential_types'
32
33 PRIVATE
34 ! when adding a new nonbonded potential please update also the list_pot
35 ! used for the linear scaling screening of potential calculation
36 INTEGER, PUBLIC, PARAMETER :: multi_type = -1, &
37 nn_type = 0, &
38 lj_type = 1, &
39 lj_charmm_type = 2, &
40 ft_type = 3, &
41 wl_type = 4, &
42 gw_type = 5, &
43 ip_type = 6, &
44 ea_type = 7, &
45 b4_type = 8, &
46 bm_type = 9, &
47 gp_type = 10, &
48 tersoff_type = 11, &
49 ftd_type = 12, &
50 siepmann_type = 13, &
51 gal_type = 14, &
52 nequip_type = 16, &
53 allegro_type = 17, &
54 gal21_type = 18, &
55 tab_type = 19, &
56 deepmd_type = 20, &
57 ace_type = 21, &
58 mace_type = 22
59
60 INTEGER, PUBLIC, PARAMETER, DIMENSION(22) :: list_pot = [nn_type, &
61 lj_type, &
63 ft_type, &
64 wl_type, &
65 gw_type, &
66 ip_type, &
67 ea_type, &
68 b4_type, &
69 bm_type, &
70 gp_type, &
72 ftd_type, &
74 gal_type, &
77 gal21_type, &
78 tab_type, &
80 ace_type, &
82
83 ! Shell model
84 INTEGER, PUBLIC, PARAMETER :: nosh_nosh = 0, &
85 nosh_sh = 1, &
86 sh_sh = 2
87
88 INTEGER, PUBLIC, PARAMETER, DIMENSION(3) :: list_sh_type = [nosh_nosh, nosh_sh, sh_sh]
89
90 ! Single Spline generation info
91 REAL(kind=dp), PARAMETER, PUBLIC :: not_initialized = -huge(0.0_dp)
92 INTEGER, PARAMETER, DIMENSION(2), PUBLIC :: do_potential_single_allocation = [lj_type, lj_charmm_type]
93 INTEGER, PARAMETER, DIMENSION(2), PUBLIC :: no_potential_single_allocation = [-huge(0), -huge(0)]
94 INTEGER, DIMENSION(2), PUBLIC :: potential_single_allocation
95
97
102
103 PUBLIC :: pair_potential_pp_create, &
106
107 PUBLIC :: pair_potential_p_type, &
109
110 PUBLIC :: ft_pot_type, &
112 eam_pot_type, &
115 ace_pot_type, &
118 gal_pot_type, &
121
123 PUBLIC :: compare_pot
124
125! **************************************************************************************************
127 REAL(kind=dp), DIMENSION(2:15) :: a = 0.0_dp
128 REAL(kind=dp) :: rcore = 0.0_dp
129 REAL(kind=dp) :: m = 0.0_dp
130 REAL(kind=dp) :: b = 0.0_dp
131 END TYPE ipbv_pot_type
132
133! **************************************************************************************************
134 TYPE lj_pot_type
135 REAL(kind=dp) :: epsilon = 0.0_dp
136 REAL(kind=dp) :: sigma6 = 0.0_dp
137 REAL(kind=dp) :: sigma12 = 0.0_dp
138 END TYPE lj_pot_type
139
140! **************************************************************************************************
142 REAL(kind=dp) :: a = 0.0_dp
143 REAL(kind=dp) :: b = 0.0_dp
144 REAL(kind=dp) :: c = 0.0_dp
145 REAL(kind=dp) :: d = 0.0_dp
146 END TYPE ft_pot_type
147
148! **************************************************************************************************
149 TYPE ftd_pot_type
150 REAL(kind=dp) :: a = 0.0_dp
151 REAL(kind=dp) :: b = 0.0_dp
152 REAL(kind=dp) :: c = 0.0_dp
153 REAL(kind=dp) :: d = 0.0_dp
154 REAL(kind=dp), DIMENSION(2) :: bd = 0.0_dp
155 END TYPE ftd_pot_type
156
157! **************************************************************************************************
158 TYPE williams_pot_type
159 REAL(kind=dp) :: a = 0.0_dp
160 REAL(kind=dp) :: b = 0.0_dp
161 REAL(kind=dp) :: c = 0.0_dp
162 END TYPE williams_pot_type
163
164! **************************************************************************************************
165 TYPE goodwin_pot_type
166 REAL(kind=dp) :: vr0 = 0.0_dp
167 REAL(kind=dp) :: m = 0.0_dp, mc = 0.0_dp
168 REAL(kind=dp) :: d = 0.0_dp, dc = 0.0_dp
169 END TYPE goodwin_pot_type
170
171! **************************************************************************************************
173 CHARACTER(LEN=default_path_length) :: eam_file_name = ""
174 INTEGER :: npoints = 0
175 REAL(kind=dp) :: drar = 0.0_dp, drhoar = 0.0_dp, acutal = 0.0_dp
176 REAL(kind=dp), POINTER, DIMENSION(:) :: rho => null(), phi => null(), frho => null(), rhoval => null(), rval => null()
177 REAL(kind=dp), POINTER, DIMENSION(:) :: rhop => null(), phip => null(), frhop => null()
178 END TYPE eam_pot_type
179
180! **************************************************************************************************
182 CHARACTER(LEN=default_path_length) :: ace_file_name = 'NULL'
183 INTEGER :: atom_ace_type = 0
185 END TYPE ace_pot_type
186
187! **************************************************************************************************
189 CHARACTER(LEN=default_path_length) :: deepmd_file_name = 'NULL'
190 INTEGER :: atom_deepmd_type = 0
191 END TYPE deepmd_pot_type
192
193! **************************************************************************************************
195 CHARACTER(LEN=default_path_length) :: pot_file_name = 'NULL', &
196 unit_length = 'NULL', unit_forces = 'NULL', &
197 unit_energy = 'NULL'
198 CHARACTER(LEN=100), DIMENSION(:), ALLOCATABLE :: type_names_torch
199 REAL(kind=dp), DIMENSION(:, :), ALLOCATABLE :: cutoff_matrix
200 INTEGER :: num_types = 0
201 REAL(kind=dp) :: rcutsq = 0.0_dp, unit_length_val = 1.0_dp, &
202 unit_forces_val = 1.0_dp, unit_energy_val = 1.0_dp
203 LOGICAL :: mixed_precision = .false.
204 END TYPE nequip_pot_type
205
206! **************************************************************************************************
207 TYPE buck4ran_pot_type
208 REAL(kind=dp) :: a = 0.0_dp
209 REAL(kind=dp) :: b = 0.0_dp
210 REAL(kind=dp) :: c = 0.0_dp
211 REAL(kind=dp) :: r1 = 0.0_dp
212 REAL(kind=dp) :: r2 = 0.0_dp
213 REAL(kind=dp) :: r3 = 0.0_dp
214 INTEGER :: npoly1 = 0, npoly2 = 0
215 REAL(kind=dp), DIMENSION(0:10) :: poly1 = 0.0_dp
216 REAL(kind=dp), DIMENSION(0:10) :: poly2 = 0.0_dp
217 END TYPE buck4ran_pot_type
218
219! **************************************************************************************************
220 TYPE buckmorse_pot_type
221 REAL(kind=dp) :: f0 = 0.0_dp
222 REAL(kind=dp) :: a1 = 0.0_dp
223 REAL(kind=dp) :: a2 = 0.0_dp
224 REAL(kind=dp) :: b1 = 0.0_dp
225 REAL(kind=dp) :: b2 = 0.0_dp
226 REAL(kind=dp) :: c = 0.0_dp
227 REAL(kind=dp) :: d = 0.0_dp
228 REAL(kind=dp) :: r0 = 0.0_dp
229 REAL(kind=dp) :: beta = 0.0_dp
230 END TYPE buckmorse_pot_type
231
232! **************************************************************************************************
233 TYPE gp_pot_type
234 INTEGER :: myid = 0
235 CHARACTER(LEN=default_path_length) :: potential = ""
236 CHARACTER(LEN=default_string_length), &
237 POINTER, DIMENSION(:) :: parameters => null(), units => null()
238 CHARACTER(LEN=default_string_length) :: variables = ""
239 REAL(kind=dp), DIMENSION(:), POINTER :: values => null()
240 END TYPE gp_pot_type
241
242! **************************************************************************************************
244 ! Get this stuff from the PRB V38, N14 9902 (1988) by Tersoff
245 REAL(kind=dp) :: a = 0.0_dp
246 REAL(kind=dp) :: b = 0.0_dp
247 REAL(kind=dp) :: lambda1 = 0.0_dp
248 REAL(kind=dp) :: lambda2 = 0.0_dp
249 REAL(kind=dp) :: alpha = 0.0_dp
250 REAL(kind=dp) :: beta = 0.0_dp
251 REAL(kind=dp) :: n = 0.0_dp
252 REAL(kind=dp) :: c = 0.0_dp
253 REAL(kind=dp) :: d = 0.0_dp
254 REAL(kind=dp) :: h = 0.0_dp
255 REAL(kind=dp) :: lambda3 = 0.0_dp
256 REAL(kind=dp) :: bigr = 0.0_dp ! Used to be R = Rij + D
257 REAL(kind=dp) :: bigd = 0.0_dp ! Used to be D = Rij - D
258 REAL(kind=dp) :: rcutsq = 0.0_dp ! Always set to (bigR+bigD)^2
259 END TYPE tersoff_pot_type
260
261! **************************************************************************************************
263 REAL(kind=dp) :: b = 0.0_dp
264 REAL(kind=dp) :: d = 0.0_dp
265 REAL(kind=dp) :: e = 0.0_dp
266 REAL(kind=dp) :: f = 0.0_dp
267 REAL(kind=dp) :: beta = 0.0_dp
268 REAL(kind=dp) :: rcutsq = 0.0_dp
269 LOGICAL :: allow_oh_formation = .false.
270 LOGICAL :: allow_h3o_formation = .false.
271 LOGICAL :: allow_o_formation = .false.
272 END TYPE siepmann_pot_type
273
274! **************************************************************************************************
276 CHARACTER(LEN=2) :: met1 = ""
277 CHARACTER(LEN=2) :: met2 = ""
278 REAL(kind=dp) :: epsilon = 0.0_dp
279 REAL(kind=dp) :: bxy = 0.0_dp
280 REAL(kind=dp) :: bz = 0.0_dp
281 REAL(kind=dp) :: r1 = 0.0_dp
282 REAL(kind=dp) :: r2 = 0.0_dp
283 REAL(kind=dp) :: a1 = 0.0_dp
284 REAL(kind=dp) :: a2 = 0.0_dp
285 REAL(kind=dp) :: a3 = 0.0_dp
286 REAL(kind=dp) :: a4 = 0.0_dp
287 REAL(kind=dp) :: a = 0.0_dp
288 REAL(kind=dp) :: b = 0.0_dp
289 REAL(kind=dp) :: c = 0.0_dp
290 REAL(kind=dp), POINTER, DIMENSION(:) :: gcn => null()
291 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: n_vectors
292 REAL(kind=dp) :: rcutsq = 0.0_dp
293 LOGICAL :: express = .false.
294 END TYPE gal_pot_type
295
296! **************************************************************************************************
297
299 CHARACTER(LEN=2) :: met1 = ""
300 CHARACTER(LEN=2) :: met2 = ""
301 REAL(kind=dp) :: epsilon1 = 0.0_dp
302 REAL(kind=dp) :: epsilon2 = 0.0_dp
303 REAL(kind=dp) :: epsilon3 = 0.0_dp
304 REAL(kind=dp) :: bxy1 = 0.0_dp
305 REAL(kind=dp) :: bxy2 = 0.0_dp
306 REAL(kind=dp) :: bz1 = 0.0_dp
307 REAL(kind=dp) :: bz2 = 0.0_dp
308 REAL(kind=dp) :: r1 = 0.0_dp
309 REAL(kind=dp) :: r2 = 0.0_dp
310 REAL(kind=dp) :: a11 = 0.0_dp
311 REAL(kind=dp) :: a12 = 0.0_dp
312 REAL(kind=dp) :: a13 = 0.0_dp
313 REAL(kind=dp) :: a21 = 0.0_dp
314 REAL(kind=dp) :: a22 = 0.0_dp
315 REAL(kind=dp) :: a23 = 0.0_dp
316 REAL(kind=dp) :: a31 = 0.0_dp
317 REAL(kind=dp) :: a32 = 0.0_dp
318 REAL(kind=dp) :: a33 = 0.0_dp
319 REAL(kind=dp) :: a41 = 0.0_dp
320 REAL(kind=dp) :: a42 = 0.0_dp
321 REAL(kind=dp) :: a43 = 0.0_dp
322 REAL(kind=dp) :: ao1 = 0.0_dp
323 REAL(kind=dp) :: ao2 = 0.0_dp
324 REAL(kind=dp) :: bo1 = 0.0_dp
325 REAL(kind=dp) :: bo2 = 0.0_dp
326 REAL(kind=dp) :: c = 0.0_dp
327 REAL(kind=dp) :: ah1 = 0.0_dp
328 REAL(kind=dp) :: ah2 = 0.0_dp
329 REAL(kind=dp) :: bh1 = 0.0_dp
330 REAL(kind=dp) :: bh2 = 0.0_dp
331 REAL(kind=dp), POINTER, DIMENSION(:) :: gcn => null()
332 REAL(kind=dp), ALLOCATABLE, DIMENSION(:, :) :: n_vectors
333 REAL(kind=dp) :: rcutsq = 0.0_dp
334 LOGICAL :: express = .false.
335 END TYPE gal21_pot_type
336
337! **************************************************************************************************
338
340 CHARACTER(LEN=default_path_length) :: tabpot_file_name = ""
341 INTEGER :: npoints = 0, index = 0
342 REAL(kind=dp) :: dr = 0.0_dp, rcut = 0.0_dp
343 REAL(kind=dp), POINTER, DIMENSION(:) :: r => null(), e => null(), f => null()
344 END TYPE tab_pot_type
345
346! **************************************************************************************************
347
348 TYPE pot_set_type
349 REAL(kind=dp) :: rmin = 0.0_dp, rmax = 0.0_dp
350 TYPE(ipbv_pot_type), POINTER :: ipbv => null()
351 TYPE(gp_pot_type), POINTER :: gp => null()
352 TYPE(lj_pot_type), POINTER :: lj => null()
353 TYPE(ft_pot_type), POINTER :: ft => null()
354 TYPE(williams_pot_type), POINTER :: willis => null()
355 TYPE(goodwin_pot_type), POINTER :: goodwin => null()
356 TYPE(eam_pot_type), POINTER :: eam => null()
357 TYPE(nequip_pot_type), POINTER :: nequip => null()
358 TYPE(ace_pot_type), POINTER :: ace => null()
359 TYPE(deepmd_pot_type), POINTER :: deepmd => null()
360 TYPE(buck4ran_pot_type), POINTER :: buck4r => null()
361 TYPE(buckmorse_pot_type), POINTER :: buckmo => null()
362 TYPE(tersoff_pot_type), POINTER :: tersoff => null()
363 TYPE(siepmann_pot_type), POINTER :: siepmann => null()
364 TYPE(gal_pot_type), POINTER :: gal => null()
365 TYPE(gal21_pot_type), POINTER :: gal21 => null()
366 TYPE(ftd_pot_type), POINTER :: ftd => null()
367 TYPE(tab_pot_type), POINTER :: tab => null()
368 END TYPE pot_set_type
369
370! **************************************************************************************************
372 REAL(kind=dp) :: rcutsq = 0.0_dp
373 REAL(kind=dp) :: e_fac = 0.0_dp
374 REAL(kind=dp) :: e_fcc = 0.0_dp
375 REAL(kind=dp) :: e_fcs = 0.0_dp
376 REAL(kind=dp) :: e_fsc = 0.0_dp
377 REAL(kind=dp) :: z1 = 0.0_dp
378 REAL(kind=dp) :: z2 = 0.0_dp
379 REAL(kind=dp), DIMENSION(0:5) :: zbl_poly = 0.0_dp
380 REAL(kind=dp), DIMENSION(2) :: zbl_rcut = 0.0_dp
381 LOGICAL :: undef = .false., & ! non-bonding interaction not defined
382 no_mb = .false., & ! no many-body potential
383 no_pp = .false. ! no pair (=two-body) potential
384 INTEGER :: shell_type = 0
385 CHARACTER(LEN=default_string_length) :: at1 = ""
386 CHARACTER(LEN=default_string_length) :: at2 = ""
387 INTEGER, POINTER, DIMENSION(:) :: TYPE => null()
388 TYPE(pot_set_type), POINTER, DIMENSION(:) :: set => null()
389 TYPE(spline_data_p_type), POINTER, DIMENSION(:) :: pair_spline_data => null()
390 TYPE(spline_factor_type), POINTER :: spl_f => null()
392
393! **************************************************************************************************
394 TYPE pair_potential_type
395 TYPE(pair_potential_single_type), POINTER :: pot => null()
396 END TYPE pair_potential_type
397
398! **************************************************************************************************
400 TYPE(pair_potential_type), DIMENSION(:), POINTER :: pot => null()
401 END TYPE pair_potential_p_type
402
403! **************************************************************************************************
405 TYPE(pair_potential_type), DIMENSION(:, :), POINTER :: pot => null()
407
408CONTAINS
409
410! **************************************************************************************************
411!> \brief compare two different potentials
412!> \param pot1 ...
413!> \param pot2 ...
414!> \param compare ...
415!> \author Teodoro Laino [teo] 05.2006
416! **************************************************************************************************
417 SUBROUTINE compare_pot(pot1, pot2, compare)
418 TYPE(pair_potential_single_type), POINTER :: pot1, pot2
419 LOGICAL, INTENT(OUT) :: compare
420
421 INTEGER :: i
422 LOGICAL :: mycompare
423
424 compare = .false.
425 ! Preliminary checks
426
427 cpassert(ASSOCIATED(pot1%type))
428 cpassert(ASSOCIATED(pot2%type))
429 IF (SIZE(pot1%type) /= SIZE(pot2%type)) RETURN
430 IF (any(pot1%type /= pot2%type)) RETURN
431
432 ! Checking the real values of parameters
433 cpassert(ASSOCIATED(pot1%set))
434 cpassert(ASSOCIATED(pot2%set))
435 DO i = 1, SIZE(pot1%type)
436 mycompare = .false.
437 SELECT CASE (pot1%type(i))
438 CASE (lj_type, lj_charmm_type)
439 IF ((pot1%set(i)%lj%epsilon == pot2%set(i)%lj%epsilon) .AND. &
440 (pot1%set(i)%lj%sigma6 == pot2%set(i)%lj%sigma6) .AND. &
441 (pot1%set(i)%lj%sigma12 == pot2%set(i)%lj%sigma12)) mycompare = .true.
442 CASE (wl_type)
443 IF ((pot1%set(i)%willis%a == pot2%set(i)%willis%a) .AND. &
444 (pot1%set(i)%willis%b == pot2%set(i)%willis%b) .AND. &
445 (pot1%set(i)%willis%c == pot2%set(i)%willis%c)) mycompare = .true.
446 CASE (gw_type)
447 IF ((pot1%set(i)%goodwin%vr0 == pot2%set(i)%goodwin%vr0) .AND. &
448 (pot1%set(i)%goodwin%m == pot2%set(i)%goodwin%m) .AND. &
449 (pot1%set(i)%goodwin%mc == pot2%set(i)%goodwin%mc) .AND. &
450 (pot1%set(i)%goodwin%d == pot2%set(i)%goodwin%d) .AND. &
451 (pot1%set(i)%goodwin%dc == pot2%set(i)%goodwin%dc)) mycompare = .true.
452 CASE (ea_type)
453 ! Compare only if EAM have the same number of points
454 IF (pot1%set(i)%eam%npoints == pot2%set(i)%eam%npoints) THEN
455 IF ((pot1%set(i)%eam%drar == pot2%set(i)%eam%drar) .AND. &
456 (pot1%set(i)%eam%drhoar == pot2%set(i)%eam%drhoar) .AND. &
457 (pot1%set(i)%eam%acutal == pot2%set(i)%eam%acutal) .AND. &
458 (sum(abs(pot1%set(i)%eam%rho - pot2%set(i)%eam%rho)) == 0.0_dp) .AND. &
459 (sum(abs(pot1%set(i)%eam%phi - pot2%set(i)%eam%phi)) == 0.0_dp) .AND. &
460 (sum(abs(pot1%set(i)%eam%frho - pot2%set(i)%eam%frho)) == 0.0_dp) .AND. &
461 (sum(abs(pot1%set(i)%eam%rhoval - pot2%set(i)%eam%rhoval)) == 0.0_dp) .AND. &
462 (sum(abs(pot1%set(i)%eam%rval - pot2%set(i)%eam%rval)) == 0.0_dp) .AND. &
463 (sum(abs(pot1%set(i)%eam%rhop - pot2%set(i)%eam%rhop)) == 0.0_dp) .AND. &
464 (sum(abs(pot1%set(i)%eam%phip - pot2%set(i)%eam%phip)) == 0.0_dp) .AND. &
465 (sum(abs(pot1%set(i)%eam%frhop - pot2%set(i)%eam%frhop)) == 0.0_dp)) mycompare = .true.
466 END IF
467 CASE (ace_type)
468 IF ((pot1%set(i)%ace%ace_file_name == pot2%set(i)%ace%ace_file_name) .AND. &
469 (pot1%set(i)%ace%atom_ace_type == pot2%set(i)%ace%atom_ace_type)) mycompare = .true.
470 CASE (deepmd_type)
471 IF ((pot1%set(i)%deepmd%deepmd_file_name == pot2%set(i)%deepmd%deepmd_file_name) .AND. &
472 (pot1%set(i)%deepmd%atom_deepmd_type == pot2%set(i)%deepmd%atom_deepmd_type)) mycompare = .true.
474 IF ((pot1%set(i)%nequip%pot_file_name == pot2%set(i)%nequip%pot_file_name) .AND. &
475 (pot1%set(i)%nequip%unit_length == pot2%set(i)%nequip%unit_length) .AND. &
476 (pot1%set(i)%nequip%unit_forces == pot2%set(i)%nequip%unit_forces) .AND. &
477 (pot1%set(i)%nequip%unit_energy == pot2%set(i)%nequip%unit_energy)) mycompare = .true.
478 CASE (ft_type)
479 IF ((pot1%set(i)%ft%A == pot2%set(i)%ft%A) .AND. &
480 (pot1%set(i)%ft%B == pot2%set(i)%ft%B) .AND. &
481 (pot1%set(i)%ft%C == pot2%set(i)%ft%C) .AND. &
482 (pot1%set(i)%ft%D == pot2%set(i)%ft%D)) mycompare = .true.
483 CASE (ftd_type)
484 IF ((pot1%set(i)%ftd%A == pot2%set(i)%ftd%A) .AND. &
485 (pot1%set(i)%ftd%B == pot2%set(i)%ftd%B) .AND. &
486 (pot1%set(i)%ftd%C == pot2%set(i)%ftd%C) .AND. &
487 (pot1%set(i)%ftd%D == pot2%set(i)%ftd%D) .AND. &
488 (all(pot1%set(i)%ftd%BD(:) == pot2%set(i)%ftd%BD(:)))) mycompare = .true.
489 CASE (ip_type)
490 IF ((sum(abs(pot1%set(i)%ipbv%a - pot2%set(i)%ipbv%a)) == 0.0_dp) .AND. &
491 (pot1%set(i)%ipbv%rcore == pot2%set(i)%ipbv%rcore) .AND. &
492 (pot1%set(i)%ipbv%m == pot2%set(i)%ipbv%m) .AND. &
493 (pot1%set(i)%ipbv%b == pot2%set(i)%ipbv%b)) mycompare = .true.
494 CASE (tersoff_type)
495 IF ((pot1%set(i)%tersoff%A == pot2%set(i)%tersoff%A) .AND. &
496 (pot1%set(i)%tersoff%B == pot2%set(i)%tersoff%B) .AND. &
497 (pot1%set(i)%tersoff%lambda1 == pot2%set(i)%tersoff%lambda1) .AND. &
498 (pot1%set(i)%tersoff%lambda2 == pot2%set(i)%tersoff%lambda2) .AND. &
499 (pot1%set(i)%tersoff%alpha == pot2%set(i)%tersoff%alpha) .AND. &
500 (pot1%set(i)%tersoff%beta == pot2%set(i)%tersoff%beta) .AND. &
501 (pot1%set(i)%tersoff%n == pot2%set(i)%tersoff%n) .AND. &
502 (pot1%set(i)%tersoff%c == pot2%set(i)%tersoff%c) .AND. &
503 (pot1%set(i)%tersoff%d == pot2%set(i)%tersoff%d) .AND. &
504 (pot1%set(i)%tersoff%h == pot2%set(i)%tersoff%h) .AND. &
505 (pot1%set(i)%tersoff%lambda3 == pot2%set(i)%tersoff%lambda3) .AND. &
506 (pot1%set(i)%tersoff%rcutsq == pot2%set(i)%tersoff%rcutsq) .AND. &
507 (pot1%set(i)%tersoff%bigR == pot2%set(i)%tersoff%bigR) .AND. &
508 (pot1%set(i)%tersoff%bigD == pot2%set(i)%tersoff%bigD)) mycompare = .true.
509 CASE (siepmann_type)
510 IF ((pot1%set(i)%siepmann%B == pot2%set(i)%siepmann%B) .AND. &
511 (pot1%set(i)%siepmann%D == pot2%set(i)%siepmann%D) .AND. &
512 (pot1%set(i)%siepmann%E == pot2%set(i)%siepmann%E) .AND. &
513 (pot1%set(i)%siepmann%F == pot2%set(i)%siepmann%F) .AND. &
514 (pot1%set(i)%siepmann%beta == pot2%set(i)%siepmann%beta) .AND. &
515 (pot1%set(i)%siepmann%rcutsq == pot2%set(i)%siepmann%rcutsq) .AND. &
516 (pot1%set(i)%siepmann%allow_oh_formation .EQV. &
517 pot2%set(i)%siepmann%allow_oh_formation) .AND. &
518 (pot1%set(i)%siepmann%allow_o_formation .EQV. &
519 pot2%set(i)%siepmann%allow_o_formation) .AND. &
520 (pot1%set(i)%siepmann%allow_h3o_formation .EQV. &
521 pot2%set(i)%siepmann%allow_h3o_formation)) mycompare = .true.
522 CASE (gal_type)
523 IF ((pot1%set(i)%gal%epsilon == pot2%set(i)%gal%epsilon) .AND. &
524 (pot1%set(i)%gal%bxy == pot2%set(i)%gal%bxy) .AND. &
525 (pot1%set(i)%gal%bz == pot2%set(i)%gal%bz) .AND. &
526 (pot1%set(i)%gal%r1 == pot2%set(i)%gal%r1) .AND. &
527 (pot1%set(i)%gal%r2 == pot2%set(i)%gal%r2) .AND. &
528 (pot1%set(i)%gal%a1 == pot2%set(i)%gal%a1) .AND. &
529 (pot1%set(i)%gal%a2 == pot2%set(i)%gal%a2) .AND. &
530 (pot1%set(i)%gal%a3 == pot2%set(i)%gal%a3) .AND. &
531 (pot1%set(i)%gal%a4 == pot2%set(i)%gal%a4) .AND. &
532 (pot1%set(i)%gal%a == pot2%set(i)%gal%a) .AND. &
533 (pot1%set(i)%gal%b == pot2%set(i)%gal%b) .AND. &
534 (pot1%set(i)%gal%c == pot2%set(i)%gal%c) .AND. &
535 (pot1%set(i)%gal%express .EQV. &
536 pot2%set(i)%gal%express) .AND. &
537 (pot1%set(i)%gal%rcutsq == pot2%set(i)%gal%rcutsq)) mycompare = .true.
538 CASE (gal21_type)
539 IF ((pot1%set(i)%gal21%epsilon1 == pot2%set(i)%gal21%epsilon1) .AND. &
540 (pot1%set(i)%gal21%epsilon2 == pot2%set(i)%gal21%epsilon2) .AND. &
541 (pot1%set(i)%gal21%epsilon3 == pot2%set(i)%gal21%epsilon3) .AND. &
542 (pot1%set(i)%gal21%bxy1 == pot2%set(i)%gal21%bxy1) .AND. &
543 (pot1%set(i)%gal21%bxy2 == pot2%set(i)%gal21%bxy1) .AND. &
544 (pot1%set(i)%gal21%bz1 == pot2%set(i)%gal21%bz1) .AND. &
545 (pot1%set(i)%gal21%bz2 == pot2%set(i)%gal21%bz2) .AND. &
546 (pot1%set(i)%gal21%r1 == pot2%set(i)%gal21%r1) .AND. &
547 (pot1%set(i)%gal21%r2 == pot2%set(i)%gal21%r2) .AND. &
548 (pot1%set(i)%gal21%a11 == pot2%set(i)%gal21%a11) .AND. &
549 (pot1%set(i)%gal21%a12 == pot2%set(i)%gal21%a12) .AND. &
550 (pot1%set(i)%gal21%a13 == pot2%set(i)%gal21%a13) .AND. &
551 (pot1%set(i)%gal21%a21 == pot2%set(i)%gal21%a21) .AND. &
552 (pot1%set(i)%gal21%a22 == pot2%set(i)%gal21%a22) .AND. &
553 (pot1%set(i)%gal21%a23 == pot2%set(i)%gal21%a23) .AND. &
554 (pot1%set(i)%gal21%a31 == pot2%set(i)%gal21%a31) .AND. &
555 (pot1%set(i)%gal21%a32 == pot2%set(i)%gal21%a32) .AND. &
556 (pot1%set(i)%gal21%a33 == pot2%set(i)%gal21%a33) .AND. &
557 (pot1%set(i)%gal21%a41 == pot2%set(i)%gal21%a41) .AND. &
558 (pot1%set(i)%gal21%a42 == pot2%set(i)%gal21%a42) .AND. &
559 (pot1%set(i)%gal21%a43 == pot2%set(i)%gal21%a43) .AND. &
560 (pot1%set(i)%gal21%AO1 == pot2%set(i)%gal21%AO1) .AND. &
561 (pot1%set(i)%gal21%AO2 == pot2%set(i)%gal21%AO2) .AND. &
562 (pot1%set(i)%gal21%BO1 == pot2%set(i)%gal21%BO1) .AND. &
563 (pot1%set(i)%gal21%BO2 == pot2%set(i)%gal21%BO2) .AND. &
564 (pot1%set(i)%gal21%c == pot2%set(i)%gal21%c) .AND. &
565 (pot1%set(i)%gal21%AH1 == pot2%set(i)%gal21%AH1) .AND. &
566 (pot1%set(i)%gal21%AH2 == pot2%set(i)%gal21%AH2) .AND. &
567 (pot1%set(i)%gal21%BH1 == pot2%set(i)%gal21%BH1) .AND. &
568 (pot1%set(i)%gal21%BH2 == pot2%set(i)%gal21%BH2) .AND. &
569 (pot1%set(i)%gal21%express .EQV. &
570 pot2%set(i)%gal21%express) .AND. &
571 (pot1%set(i)%gal21%rcutsq == pot2%set(i)%gal21%rcutsq)) mycompare = .true.
572
573 END SELECT
574 mycompare = mycompare .AND. &
575 (pot1%set(i)%rmin == pot2%set(i)%rmin) .AND. (pot1%set(i)%rmax == pot2%set(i)%rmax)
576 IF ((mycompare) .AND. (i == 1)) compare = .true.
577 compare = compare .AND. mycompare
578 END DO
579
580 END SUBROUTINE compare_pot
581
582! **************************************************************************************************
583!> \brief Creates the potential parameter type
584!> \param potparm ...
585!> \param nset ...
586!> \author Teodoro Laino [teo] 11.2005
587! **************************************************************************************************
588 SUBROUTINE pair_potential_single_create(potparm, nset)
589 TYPE(pair_potential_single_type), POINTER :: potparm
590 INTEGER, INTENT(IN), OPTIONAL :: nset
591
592 INTEGER :: i, lnset
593
594 cpassert(.NOT. ASSOCIATED(potparm))
595 ALLOCATE (potparm)
596 lnset = 1
597 IF (PRESENT(nset)) lnset = nset
598 ! Standard allocation to size 1
599 ALLOCATE (potparm%type(lnset))
600 ALLOCATE (potparm%set(lnset))
601 NULLIFY (potparm%spl_f, &
602 potparm%pair_spline_data)
603 DO i = 1, lnset
604 potparm%set(i)%rmin = not_initialized
605 potparm%set(i)%rmax = not_initialized
606 NULLIFY (potparm%set(i)%ipbv, &
607 potparm%set(i)%lj, &
608 potparm%set(i)%gp, &
609 potparm%set(i)%ft, &
610 potparm%set(i)%willis, &
611 potparm%set(i)%goodwin, &
612 potparm%set(i)%eam, &
613 potparm%set(i)%nequip, &
614 potparm%set(i)%ace, &
615 potparm%set(i)%deepmd, &
616 potparm%set(i)%buck4r, &
617 potparm%set(i)%buckmo, &
618 potparm%set(i)%tersoff, &
619 potparm%set(i)%siepmann, &
620 potparm%set(i)%gal, &
621 potparm%set(i)%gal21, &
622 potparm%set(i)%ftd, &
623 potparm%set(i)%tab)
624 END DO
625 CALL pair_potential_single_clean(potparm)
626 END SUBROUTINE pair_potential_single_create
627
628! **************************************************************************************************
629!> \brief Cleans the potential parameter type
630!> \param potparm ...
631!> \author unknown
632! **************************************************************************************************
633 SUBROUTINE pair_potential_single_clean(potparm)
634 TYPE(pair_potential_single_type), POINTER :: potparm
635
636 INTEGER :: i
637
638 potparm%type = nn_type
639 potparm%shell_type = nosh_nosh
640 potparm%undef = .true.
641 potparm%no_pp = .false.
642 potparm%no_mb = .false.
643 potparm%at1 = 'NULL'
644 potparm%at2 = 'NULL'
645 potparm%rcutsq = 0.0_dp
646 IF (ASSOCIATED(potparm%pair_spline_data)) THEN
647 CALL spline_data_p_release(potparm%pair_spline_data)
648 END IF
649 IF (ASSOCIATED(potparm%spl_f)) THEN
650 CALL spline_factor_release(potparm%spl_f)
651 END IF
652
653 DO i = 1, SIZE(potparm%type)
654 potparm%set(i)%rmin = not_initialized
655 potparm%set(i)%rmax = not_initialized
656 CALL pair_potential_lj_clean(potparm%set(i)%lj)
657 CALL pair_potential_williams_clean(potparm%set(i)%willis)
658 CALL pair_potential_goodwin_clean(potparm%set(i)%goodwin)
659 CALL pair_potential_eam_clean(potparm%set(i)%eam)
660 CALL pair_potential_nequip_clean(potparm%set(i)%nequip)
661 CALL pair_potential_ace_clean(potparm%set(i)%ace)
662 CALL pair_potential_deepmd_clean(potparm%set(i)%deepmd)
663 CALL pair_potential_buck4r_clean(potparm%set(i)%buck4r)
664 CALL pair_potential_buckmo_clean(potparm%set(i)%buckmo)
665 CALL pair_potential_bmhft_clean(potparm%set(i)%ft)
666 CALL pair_potential_bmhftd_clean(potparm%set(i)%ftd)
667 CALL pair_potential_ipbv_clean(potparm%set(i)%ipbv)
668 CALL pair_potential_gp_clean(potparm%set(i)%gp)
669 CALL pair_potential_tersoff_clean(potparm%set(i)%tersoff)
670 CALL pair_potential_siepmann_clean(potparm%set(i)%siepmann)
671 CALL pair_potential_gal_clean(potparm%set(i)%gal)
672 CALL pair_potential_gal21_clean(potparm%set(i)%gal21)
673 CALL pair_potential_tab_clean(potparm%set(i)%tab)
674 END DO
675 END SUBROUTINE pair_potential_single_clean
676
677! **************************************************************************************************
678!> \brief Copy two potential parameter type
679!> \param potparm_source ...
680!> \param potparm_dest ...
681!> \author Teodoro Laino [teo] 11.2005
682! **************************************************************************************************
683 SUBROUTINE pair_potential_single_copy(potparm_source, potparm_dest)
684 TYPE(pair_potential_single_type), POINTER :: potparm_source, potparm_dest
685
686 INTEGER :: i
687
688 cpassert(ASSOCIATED(potparm_source))
689 IF (.NOT. ASSOCIATED(potparm_dest)) THEN
690 CALL pair_potential_single_create(potparm_dest, SIZE(potparm_source%type))
691 ELSE
692 CALL pair_potential_single_clean(potparm_dest)
693 END IF
694 potparm_dest%type = potparm_source%type
695 potparm_dest%shell_type = potparm_source%shell_type
696 potparm_dest%undef = potparm_source%undef
697 potparm_dest%no_mb = potparm_source%no_mb
698 potparm_dest%no_pp = potparm_source%no_pp
699 potparm_dest%at1 = potparm_source%at1
700 potparm_dest%at2 = potparm_source%at2
701 potparm_dest%rcutsq = potparm_source%rcutsq
702 IF (ASSOCIATED(potparm_source%pair_spline_data)) THEN
703 CALL spline_data_p_copy(potparm_source%pair_spline_data, potparm_dest%pair_spline_data)
704 END IF
705
706 IF (ASSOCIATED(potparm_source%spl_f)) THEN
707 CALL spline_factor_copy(potparm_source%spl_f, potparm_dest%spl_f)
708 END IF
709
710 DO i = 1, SIZE(potparm_source%type)
711 potparm_dest%set(i)%rmin = potparm_source%set(i)%rmin
712 potparm_dest%set(i)%rmax = potparm_source%set(i)%rmax
713 CALL pair_potential_lj_copy(potparm_source%set(i)%lj, potparm_dest%set(i)%lj)
714 CALL pair_potential_williams_copy(potparm_source%set(i)%willis, potparm_dest%set(i)%willis)
715 CALL pair_potential_goodwin_copy(potparm_source%set(i)%goodwin, potparm_dest%set(i)%goodwin)
716 CALL pair_potential_eam_copy(potparm_source%set(i)%eam, potparm_dest%set(i)%eam)
717 CALL pair_potential_nequip_copy(potparm_source%set(i)%nequip, potparm_dest%set(i)%nequip)
718 CALL pair_potential_ace_copy(potparm_source%set(i)%ace, potparm_dest%set(i)%ace)
719 CALL pair_potential_deepmd_copy(potparm_source%set(i)%deepmd, potparm_dest%set(i)%deepmd)
720 CALL pair_potential_bmhft_copy(potparm_source%set(i)%ft, potparm_dest%set(i)%ft)
721 CALL pair_potential_bmhftd_copy(potparm_source%set(i)%ftd, potparm_dest%set(i)%ftd)
722 CALL pair_potential_ipbv_copy(potparm_source%set(i)%ipbv, potparm_dest%set(i)%ipbv)
723 CALL pair_potential_buck4r_copy(potparm_source%set(i)%buck4r, potparm_dest%set(i)%buck4r)
724 CALL pair_potential_buckmo_copy(potparm_source%set(i)%buckmo, potparm_dest%set(i)%buckmo)
725 CALL pair_potential_gp_copy(potparm_source%set(i)%gp, potparm_dest%set(i)%gp)
726 CALL pair_potential_tersoff_copy(potparm_source%set(i)%tersoff, potparm_dest%set(i)%tersoff)
727 CALL pair_potential_siepmann_copy(potparm_source%set(i)%siepmann, potparm_dest%set(i)%siepmann)
728 CALL pair_potential_gal_copy(potparm_source%set(i)%gal, potparm_dest%set(i)%gal)
729 CALL pair_potential_gal21_copy(potparm_source%set(i)%gal21, potparm_dest%set(i)%gal21)
730 CALL pair_potential_tab_copy(potparm_source%set(i)%tab, potparm_dest%set(i)%tab)
731 END DO
732 END SUBROUTINE pair_potential_single_copy
733
734! **************************************************************************************************
735!> \brief Add potential parameter type to an existing potential parameter type
736!> Used in case of multiple_potential definition
737!> \param potparm_source ...
738!> \param potparm_dest ...
739!> \author Teodoro Laino [teo] 11.2005
740! **************************************************************************************************
741 SUBROUTINE pair_potential_single_add(potparm_source, potparm_dest)
742 TYPE(pair_potential_single_type), POINTER :: potparm_source, potparm_dest
743
744 INTEGER :: i, j, size_dest, size_source
745 LOGICAL :: allocate_new, check
746 TYPE(pair_potential_single_type), POINTER :: potparm_tmp
747
748 cpassert(ASSOCIATED(potparm_source))
749 ! At this level we expect all splines types
750 ! be not allocated.. No sense add splines at this level.. in case fail!
751 check = (.NOT. ASSOCIATED(potparm_source%pair_spline_data)) .AND. &
752 (.NOT. ASSOCIATED(potparm_source%spl_f))
753 cpassert(check)
754 check = (.NOT. ASSOCIATED(potparm_dest%pair_spline_data)) .AND. &
755 (.NOT. ASSOCIATED(potparm_dest%spl_f))
756 cpassert(check)
757 ! Increase the size of the destination potparm (in case) and copy the new data
758 size_source = SIZE(potparm_source%type)
759 allocate_new = .NOT. ASSOCIATED(potparm_dest)
760 IF (.NOT. allocate_new) THEN
761 size_dest = SIZE(potparm_dest%type)
762 IF (size_dest == 1) THEN
763 check = (ASSOCIATED(potparm_dest%set(1)%lj)) .OR. &
764 (ASSOCIATED(potparm_dest%set(1)%willis)) .OR. &
765 (ASSOCIATED(potparm_dest%set(1)%goodwin)) .OR. &
766 (ASSOCIATED(potparm_dest%set(1)%eam)) .OR. &
767 (ASSOCIATED(potparm_dest%set(1)%nequip)) .OR. &
768 (ASSOCIATED(potparm_dest%set(1)%ace)) .OR. &
769 (ASSOCIATED(potparm_dest%set(1)%deepmd)) .OR. &
770 (ASSOCIATED(potparm_dest%set(1)%ft)) .OR. &
771 (ASSOCIATED(potparm_dest%set(1)%ftd)) .OR. &
772 (ASSOCIATED(potparm_dest%set(1)%ipbv)) .OR. &
773 (ASSOCIATED(potparm_dest%set(1)%buck4r)) .OR. &
774 (ASSOCIATED(potparm_dest%set(1)%buckmo)) .OR. &
775 (ASSOCIATED(potparm_dest%set(1)%gp)) .OR. &
776 (ASSOCIATED(potparm_dest%set(1)%tersoff)) .OR. &
777 (ASSOCIATED(potparm_dest%set(1)%siepmann)) .OR. &
778 (ASSOCIATED(potparm_dest%set(1)%gal)) .OR. &
779 (ASSOCIATED(potparm_dest%set(1)%gal)) .OR. &
780 (ASSOCIATED(potparm_dest%set(1)%tab))
781 IF (.NOT. check) THEN
782 allocate_new = .true.
783 CALL pair_potential_single_release(potparm_dest)
784 END IF
785 END IF
786 END IF
787 IF (allocate_new) THEN
788 size_dest = 0
789 CALL pair_potential_single_create(potparm_dest, size_source)
790 potparm_dest%shell_type = potparm_source%shell_type
791 potparm_dest%undef = potparm_source%undef
792 potparm_dest%no_mb = potparm_source%no_mb
793 potparm_dest%no_pp = potparm_source%no_pp
794 potparm_dest%at1 = potparm_source%at1
795 potparm_dest%at2 = potparm_source%at2
796 potparm_dest%rcutsq = potparm_source%rcutsq
797 ELSE
798 size_dest = SIZE(potparm_dest%type)
799 NULLIFY (potparm_tmp)
800 CALL pair_potential_single_copy(potparm_dest, potparm_tmp)
801 CALL pair_potential_single_release(potparm_dest)
802 CALL pair_potential_single_create(potparm_dest, size_dest + size_source)
803 ! Copy back original informations..
804 potparm_dest%shell_type = potparm_tmp%shell_type
805 potparm_dest%undef = potparm_tmp%undef
806 potparm_dest%no_mb = potparm_tmp%no_mb
807 potparm_dest%no_pp = potparm_tmp%no_pp
808 potparm_dest%at1 = potparm_tmp%at1
809 potparm_dest%at2 = potparm_tmp%at2
810 potparm_dest%rcutsq = potparm_tmp%rcutsq
811 DO i = 1, size_dest
812 potparm_dest%type(i) = potparm_tmp%type(i)
813 potparm_dest%set(i)%rmin = potparm_tmp%set(i)%rmin
814 potparm_dest%set(i)%rmax = potparm_tmp%set(i)%rmax
815 CALL pair_potential_lj_copy(potparm_tmp%set(i)%lj, potparm_dest%set(i)%lj)
816 CALL pair_potential_williams_copy(potparm_tmp%set(i)%willis, potparm_dest%set(i)%willis)
817 CALL pair_potential_goodwin_copy(potparm_tmp%set(i)%goodwin, potparm_dest%set(i)%goodwin)
818 CALL pair_potential_eam_copy(potparm_tmp%set(i)%eam, potparm_dest%set(i)%eam)
819 CALL pair_potential_nequip_copy(potparm_tmp%set(i)%nequip, potparm_dest%set(i)%nequip)
820 CALL pair_potential_ace_copy(potparm_tmp%set(i)%ace, potparm_dest%set(i)%ace)
821 CALL pair_potential_deepmd_copy(potparm_tmp%set(i)%deepmd, potparm_dest%set(i)%deepmd)
822 CALL pair_potential_bmhft_copy(potparm_tmp%set(i)%ft, potparm_dest%set(i)%ft)
823 CALL pair_potential_bmhftd_copy(potparm_tmp%set(i)%ftd, potparm_dest%set(i)%ftd)
824 CALL pair_potential_ipbv_copy(potparm_tmp%set(i)%ipbv, potparm_dest%set(i)%ipbv)
825 CALL pair_potential_buck4r_copy(potparm_tmp%set(i)%buck4r, potparm_dest%set(i)%buck4r)
826 CALL pair_potential_buckmo_copy(potparm_tmp%set(i)%buckmo, potparm_dest%set(i)%buckmo)
827 CALL pair_potential_gp_copy(potparm_tmp%set(i)%gp, potparm_dest%set(i)%gp)
828 CALL pair_potential_tersoff_copy(potparm_tmp%set(i)%tersoff, potparm_dest%set(i)%tersoff)
829 CALL pair_potential_siepmann_copy(potparm_tmp%set(i)%siepmann, potparm_dest%set(i)%siepmann)
830 CALL pair_potential_gal_copy(potparm_tmp%set(i)%gal, potparm_dest%set(i)%gal)
831 CALL pair_potential_gal21_copy(potparm_tmp%set(i)%gal21, potparm_dest%set(i)%gal21)
832 CALL pair_potential_tab_copy(potparm_tmp%set(i)%tab, potparm_dest%set(i)%tab)
833 END DO
834 CALL pair_potential_single_release(potparm_tmp)
835 END IF
836 ! Further check with main option with source and dest (already filled with few informations)
837 check = (potparm_dest%shell_type == potparm_source%shell_type) .AND. &
838 (potparm_dest%undef .EQV. potparm_source%undef) .AND. &
839 (potparm_dest%no_mb .EQV. potparm_source%no_mb) .AND. &
840 (potparm_dest%no_pp .EQV. potparm_source%no_pp) .AND. &
841 (potparm_dest%at1 == potparm_source%at1) .AND. &
842 (potparm_dest%at2 == potparm_source%at2) .AND. &
843 (potparm_dest%rcutsq == potparm_source%rcutsq)
844 cpassert(check)
845 ! Now copy the new pair_potential type
846 DO i = size_dest + 1, size_dest + size_source
847 j = i - size_dest
848 potparm_dest%type(i) = potparm_source%type(j)
849 potparm_dest%set(i)%rmin = potparm_source%set(j)%rmin
850 potparm_dest%set(i)%rmax = potparm_source%set(j)%rmax
851 CALL pair_potential_lj_copy(potparm_source%set(j)%lj, potparm_dest%set(i)%lj)
852 CALL pair_potential_williams_copy(potparm_source%set(j)%willis, potparm_dest%set(i)%willis)
853 CALL pair_potential_goodwin_copy(potparm_source%set(j)%goodwin, potparm_dest%set(i)%goodwin)
854 CALL pair_potential_eam_copy(potparm_source%set(j)%eam, potparm_dest%set(i)%eam)
855 CALL pair_potential_nequip_copy(potparm_source%set(j)%nequip, potparm_dest%set(i)%nequip)
856 CALL pair_potential_ace_copy(potparm_source%set(j)%ace, potparm_dest%set(i)%ace)
857 CALL pair_potential_deepmd_copy(potparm_source%set(j)%deepmd, potparm_dest%set(i)%deepmd)
858 CALL pair_potential_bmhft_copy(potparm_source%set(j)%ft, potparm_dest%set(i)%ft)
859 CALL pair_potential_bmhftd_copy(potparm_source%set(j)%ftd, potparm_dest%set(i)%ftd)
860 CALL pair_potential_ipbv_copy(potparm_source%set(j)%ipbv, potparm_dest%set(i)%ipbv)
861 CALL pair_potential_buck4r_copy(potparm_source%set(j)%buck4r, potparm_dest%set(i)%buck4r)
862 CALL pair_potential_buckmo_copy(potparm_source%set(j)%buckmo, potparm_dest%set(i)%buckmo)
863 CALL pair_potential_gp_copy(potparm_source%set(j)%gp, potparm_dest%set(i)%gp)
864 CALL pair_potential_tersoff_copy(potparm_source%set(j)%tersoff, potparm_dest%set(i)%tersoff)
865 CALL pair_potential_siepmann_copy(potparm_source%set(j)%siepmann, potparm_dest%set(i)%siepmann)
866 CALL pair_potential_gal_copy(potparm_source%set(j)%gal, potparm_dest%set(i)%gal)
867 CALL pair_potential_gal21_copy(potparm_source%set(j)%gal21, potparm_dest%set(i)%gal21)
868 CALL pair_potential_tab_copy(potparm_source%set(j)%tab, potparm_dest%set(i)%tab)
869 END DO
870 END SUBROUTINE pair_potential_single_add
871
872! **************************************************************************************************
873!> \brief Release Data-structure that constains potential parameters of a single pair
874!> \param potparm ...
875!> \author Teodoro Laino [Teo] 11.2005
876! **************************************************************************************************
877 SUBROUTINE pair_potential_single_release(potparm)
878 TYPE(pair_potential_single_type), POINTER :: potparm
879
880 INTEGER :: i
881
882 cpassert(ASSOCIATED(potparm))
883 CALL spline_data_p_release(potparm%pair_spline_data)
884 CALL spline_factor_release(potparm%spl_f)
885 DO i = 1, SIZE(potparm%type)
886 CALL pair_potential_ipbv_release(potparm%set(i)%ipbv)
887 CALL pair_potential_lj_release(potparm%set(i)%lj)
888 CALL pair_potential_bmhft_release(potparm%set(i)%ft)
889 CALL pair_potential_bmhftd_release(potparm%set(i)%ftd)
890 CALL pair_potential_williams_release(potparm%set(i)%willis)
891 CALL pair_potential_goodwin_release(potparm%set(i)%goodwin)
892 CALL pair_potential_eam_release(potparm%set(i)%eam)
893 CALL pair_potential_nequip_release(potparm%set(i)%nequip)
894 CALL pair_potential_ace_release(potparm%set(i)%ace)
895 CALL pair_potential_deepmd_release(potparm%set(i)%deepmd)
896 CALL pair_potential_buck4r_release(potparm%set(i)%buck4r)
897 CALL pair_potential_buckmo_release(potparm%set(i)%buckmo)
898 CALL pair_potential_gp_release(potparm%set(i)%gp)
899 CALL pair_potential_tersoff_release(potparm%set(i)%tersoff)
900 CALL pair_potential_siepmann_release(potparm%set(i)%siepmann)
901 CALL pair_potential_gal_release(potparm%set(i)%gal)
902 CALL pair_potential_gal21_release(potparm%set(i)%gal21)
903 CALL pair_potential_tab_release(potparm%set(i)%tab)
904 END DO
905 DEALLOCATE (potparm%type)
906 DEALLOCATE (potparm%set)
907 DEALLOCATE (potparm)
908 END SUBROUTINE pair_potential_single_release
909
910! **************************************************************************************************
911!> \brief Data-structure that constains potential parameters
912!> \param potparm ...
913!> \param nkinds ...
914!> \author unknown
915! **************************************************************************************************
916 SUBROUTINE pair_potential_pp_create(potparm, nkinds)
917 TYPE(pair_potential_pp_type), POINTER :: potparm
918 INTEGER, INTENT(IN) :: nkinds
919
920 INTEGER :: i, j
921
922 cpassert(.NOT. ASSOCIATED(potparm))
923 ALLOCATE (potparm)
924 ALLOCATE (potparm%pot(nkinds, nkinds))
925 DO i = 1, nkinds
926 DO j = 1, nkinds
927 NULLIFY (potparm%pot(i, j)%pot)
928 END DO
929 END DO
930 ! Use no-redundancy in the potential definition
931 DO i = 1, nkinds
932 DO j = i, nkinds
933 CALL pair_potential_single_create(potparm%pot(i, j)%pot)
934 potparm%pot(j, i)%pot => potparm%pot(i, j)%pot
935 END DO
936 END DO
937 END SUBROUTINE pair_potential_pp_create
938
939! **************************************************************************************************
940!> \brief Release Data-structure that constains potential parameters
941!> \param potparm ...
942!> \par History
943!> Teodoro Laino [Teo] 11.2005 : Reorganizing the structures to optimize
944!> memory management
945!> \author unknown
946! **************************************************************************************************
947 SUBROUTINE pair_potential_pp_release(potparm)
948 TYPE(pair_potential_pp_type), POINTER :: potparm
949
950 INTEGER :: i, j
951
952 IF (ASSOCIATED(potparm)) THEN
953 IF (ASSOCIATED(potparm%pot)) THEN
954 DO i = 1, SIZE(potparm%pot, 1)
955 DO j = i, SIZE(potparm%pot, 2)
956 CALL pair_potential_single_release(potparm%pot(i, j)%pot)
957 NULLIFY (potparm%pot(j, i)%pot)
958 END DO
959 END DO
960 DEALLOCATE (potparm%pot)
961 END IF
962 DEALLOCATE (potparm)
963 END IF
964 NULLIFY (potparm)
965 END SUBROUTINE pair_potential_pp_release
966
967! **************************************************************************************************
968!> \brief Data-structure that constains potential parameters
969!> \param potparm ...
970!> \param ndim ...
971!> \param ub ...
972!> \param lb ...
973!> \author unknown
974! **************************************************************************************************
975 SUBROUTINE pair_potential_p_create(potparm, ndim, ub, lb)
976 TYPE(pair_potential_p_type), POINTER :: potparm
977 INTEGER, INTENT(IN), OPTIONAL :: ndim, ub, lb
978
979 INTEGER :: i, loc_lb, loc_ub
980
981 cpassert(.NOT. ASSOCIATED(potparm))
982 ALLOCATE (potparm)
983
984 IF (PRESENT(ndim) .AND. (PRESENT(ub) .OR. PRESENT(lb))) THEN
985 CALL cp_abort(__location__, &
986 "pair_potential_p_create expects either 1 input parameter <ndim> "// &
987 "or 2 input parameters <ub> and <lb> at each call; found <ndim> "// &
988 "together with <ub> or <lb>")
989 END IF
990
991 IF (PRESENT(ndim)) THEN
992 loc_lb = 1
993 loc_ub = ndim
994 ALLOCATE (potparm%pot(loc_lb:loc_ub))
995 ELSE IF (PRESENT(lb) .AND. PRESENT(ub)) THEN
996 loc_lb = lb
997 loc_ub = ub
998 ALLOCATE (potparm%pot(loc_lb:loc_ub))
999 ELSE
1000 CALL cp_abort(__location__, &
1001 "pair_potential_p_create expects either 1 input parameter <ndim> "// &
1002 "or 2 input parameters <ub> and <lb> at each call; found none")
1003 END IF
1004 DO i = loc_lb, loc_ub
1005 NULLIFY (potparm%pot(i)%pot)
1006 CALL pair_potential_single_create(potparm%pot(i)%pot)
1007 END DO
1008 END SUBROUTINE pair_potential_p_create
1009
1010! **************************************************************************************************
1011!> \brief Release Data-structure that constains potential parameters
1012!> \param potparm ...
1013!> \par History
1014!> Teodoro Laino [Teo] 11.2005 : Reorganizing the structures to optimize
1015!> memory management
1016!> \author unknown
1017! **************************************************************************************************
1018 SUBROUTINE pair_potential_p_release(potparm)
1019 TYPE(pair_potential_p_type), POINTER :: potparm
1020
1021 INTEGER :: i
1022
1023 IF (ASSOCIATED(potparm)) THEN
1024 IF (ASSOCIATED(potparm%pot)) THEN
1025 DO i = 1, SIZE(potparm%pot)
1026 CALL pair_potential_single_release(potparm%pot(i)%pot)
1027 END DO
1028 DEALLOCATE (potparm%pot)
1029 END IF
1030 DEALLOCATE (potparm)
1031 END IF
1032 NULLIFY (potparm)
1033 END SUBROUTINE pair_potential_p_release
1034
1035! **************************************************************************************************
1036!> \brief Copy structures between two pair_potential_p_type
1037!> \param source ...
1038!> \param dest ...
1039!> \param istart ...
1040!> \param iend ...
1041!> \author Teodoro Laino [Teo] 11.2005
1042! **************************************************************************************************
1043 SUBROUTINE pair_potential_p_copy(source, dest, istart, iend)
1044 TYPE(pair_potential_p_type), POINTER :: source, dest
1045 INTEGER, INTENT(IN), OPTIONAL :: istart, iend
1046
1047 INTEGER :: i, l_end, l_start
1048
1049 cpassert(ASSOCIATED(source))
1050 cpassert(ASSOCIATED(dest))
1051 l_start = lbound(source%pot, 1)
1052 l_end = ubound(source%pot, 1)
1053 IF (PRESENT(istart)) l_start = istart
1054 IF (PRESENT(iend)) l_end = iend
1055 DO i = l_start, l_end
1056 IF (.NOT. ASSOCIATED(source%pot(i)%pot)) THEN
1057 CALL pair_potential_single_create(source%pot(i)%pot)
1058 END IF
1059 CALL pair_potential_single_copy(source%pot(i)%pot, dest%pot(i)%pot)
1060 END DO
1061 END SUBROUTINE pair_potential_p_copy
1062
1063! **************************************************************************************************
1064!> \brief Cleans the potential parameter type
1065!> \param p ...
1066!> \param lb1_new ...
1067!> \param ub1_new ...
1068!> \param lj ...
1069!> \param lj_charmm ...
1070!> \param williams ...
1071!> \param goodwin ...
1072!> \param eam ...
1073!> \param nequip ...
1074!> \param bmhft ...
1075!> \param bmhftd ...
1076!> \param ipbv ...
1077!> \param buck4r ...
1078!> \param buckmo ...
1079!> \param gp ...
1080!> \param tersoff ...
1081!> \param siepmann ...
1082!> \param gal ...
1083!> \param gal21 ...
1084!> \param tab ...
1085!> \param deepmd ...
1086!> \param ace ...
1087!> \author Teodoro Laino [Teo] 11.2005
1088! **************************************************************************************************
1089 SUBROUTINE pair_potential_reallocate(p, lb1_new, ub1_new, lj, lj_charmm, williams, goodwin, eam, &
1090 nequip, bmhft, bmhftd, ipbv, buck4r, buckmo, &
1091 gp, tersoff, siepmann, gal, gal21, tab, deepmd, ace)
1092 TYPE(pair_potential_p_type), POINTER :: p
1093 INTEGER, INTENT(IN) :: lb1_new, ub1_new
1094 LOGICAL, INTENT(IN), OPTIONAL :: lj, lj_charmm, williams, goodwin, eam, nequip, bmhft, &
1095 bmhftd, ipbv, buck4r, buckmo, gp, tersoff, siepmann, gal, gal21, tab, deepmd, ace
1096
1097 INTEGER :: i, ipot, lb1_old, std_dim, ub1_old
1098 LOGICAL :: check, lace, lbmhft, lbmhftd, lbuck4r, lbuckmo, ldeepmd, leam, lgal, lgal21, &
1099 lgoodwin, lgp, lipbv, llj, llj_charmm, lnequip, lsiepmann, ltab, ltersoff, lwilliams
1100 TYPE(pair_potential_p_type), POINTER :: work
1101
1102 NULLIFY (work)
1103 ipot = 0
1104 llj = .false.; IF (PRESENT(lj)) llj = lj
1105 llj_charmm = .false.; IF (PRESENT(lj_charmm)) llj_charmm = lj_charmm
1106 lwilliams = .false.; IF (PRESENT(williams)) lwilliams = williams
1107 lgoodwin = .false.; IF (PRESENT(goodwin)) lgoodwin = goodwin
1108 leam = .false.; IF (PRESENT(eam)) leam = eam
1109 lnequip = .false.; IF (PRESENT(nequip)) lnequip = nequip
1110 lace = .false.; IF (PRESENT(ace)) lace = ace
1111 ldeepmd = .false.; IF (PRESENT(deepmd)) ldeepmd = deepmd
1112 lbmhft = .false.; IF (PRESENT(bmhft)) lbmhft = bmhft
1113 lbmhftd = .false.; IF (PRESENT(bmhftd)) lbmhftd = bmhftd
1114 lipbv = .false.; IF (PRESENT(ipbv)) lipbv = ipbv
1115 lbuck4r = .false.; IF (PRESENT(buck4r)) lbuck4r = buck4r
1116 lbuckmo = .false.; IF (PRESENT(buckmo)) lbuckmo = buckmo
1117 lgp = .false.; IF (PRESENT(gp)) lgp = gp
1118 ltersoff = .false.; IF (PRESENT(tersoff)) ltersoff = tersoff
1119 lsiepmann = .false.; IF (PRESENT(siepmann)) lsiepmann = siepmann
1120 lgal = .false.; IF (PRESENT(gal)) lgal = gal
1121 lgal21 = .false.; IF (PRESENT(gal21)) lgal21 = gal21
1122 ltab = .false.; IF (PRESENT(tab)) ltab = tab
1123
1124 IF (llj) THEN
1125 ipot = lj_type
1126 check = .NOT. (llj_charmm .OR. lwilliams .OR. lgoodwin .OR. leam .OR. lnequip &
1127 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lbuckmo .OR. lgp .OR. ltersoff &
1128 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1129 cpassert(check)
1130 END IF
1131 IF (llj_charmm) THEN
1132 ipot = lj_charmm_type
1133 check = .NOT. (llj .OR. lwilliams .OR. lgoodwin .OR. leam .OR. lnequip &
1134 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lbuckmo .OR. lgp .OR. ltersoff &
1135 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1136 cpassert(check)
1137 END IF
1138 IF (lwilliams) THEN
1139 ipot = wl_type
1140 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. leam .OR. lnequip &
1141 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lbuckmo .OR. lgp .OR. ltersoff &
1142 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1143 cpassert(check)
1144 END IF
1145 IF (lgoodwin) THEN
1146 ipot = gw_type
1147 check = .NOT. (llj .OR. llj_charmm .OR. lwilliams .OR. leam .OR. lnequip &
1148 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lbuckmo .OR. lgp .OR. ltersoff &
1149 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1150 cpassert(check)
1151 END IF
1152 IF (leam) THEN
1153 ipot = ea_type
1154 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. lnequip &
1155 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lbuckmo .OR. lgp .OR. ltersoff &
1156 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1157 cpassert(check)
1158 END IF
1159 IF (lnequip) THEN
1160 ipot = nequip_type
1161 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam &
1162 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lbuckmo .OR. lgp .OR. ltersoff &
1163 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1164 cpassert(check)
1165 END IF
1166 IF (lace) THEN
1167 ipot = ace_type
1168 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1169 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lbuckmo .OR. lgp &
1170 .OR. ltersoff .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd)
1171 cpassert(check)
1172 END IF
1173 IF (ldeepmd) THEN
1174 ipot = deepmd_type
1175 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1176 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lbuckmo .OR. lgp &
1177 .OR. ltersoff .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. lace)
1178 cpassert(check)
1179 END IF
1180 IF (lbmhft) THEN
1181 ipot = ft_type
1182 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1183 .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lbuckmo .OR. lgp .OR. ltersoff &
1184 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1185 cpassert(check)
1186 END IF
1187 IF (lbmhftd) THEN
1188 ipot = ftd_type
1189 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1190 .OR. lbmhft .OR. lipbv .OR. lbuck4r .OR. lbuckmo .OR. lgp .OR. ltersoff &
1191 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1192 cpassert(check)
1193 END IF
1194 IF (lipbv) THEN
1195 ipot = ip_type
1196 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1197 .OR. lbmhft .OR. lbmhftd .OR. lbuck4r .OR. lbuckmo .OR. lgp .OR. ltersoff &
1198 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1199 cpassert(check)
1200 END IF
1201 IF (lbuck4r) THEN
1202 ipot = b4_type
1203 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1204 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuckmo .OR. lgp .OR. ltersoff &
1205 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1206 cpassert(check)
1207 END IF
1208 IF (lbuckmo) THEN
1209 ipot = bm_type
1210 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1211 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lgp .OR. ltersoff &
1212 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1213 cpassert(check)
1214 END IF
1215 IF (ltersoff) THEN
1216 ipot = tersoff_type
1217 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1218 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lgp .OR. lbuckmo &
1219 .OR. lsiepmann .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1220 cpassert(check)
1221 END IF
1222 IF (lsiepmann) THEN
1223 ipot = siepmann_type
1224 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1225 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lgp .OR. lbuckmo &
1226 .OR. ltersoff .OR. lgal .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1227 cpassert(check)
1228 END IF
1229 IF (lgal) THEN
1230 ipot = gal_type
1231 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1232 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lgp .OR. lbuckmo &
1233 .OR. ltersoff .OR. lsiepmann .OR. lgal21 .OR. ltab .OR. ldeepmd .OR. lace)
1234 cpassert(check)
1235 END IF
1236 IF (lgal21) THEN
1237 ipot = gal21_type
1238 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1239 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lgp .OR. lbuckmo &
1240 .OR. ltersoff .OR. lsiepmann .OR. lgal .OR. ltab .OR. ldeepmd .OR. lace)
1241 cpassert(check)
1242 END IF
1243 IF (lgp) THEN
1244 ipot = gp_type
1245 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1246 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lgal21 .OR. lbuckmo &
1247 .OR. ltersoff .OR. lsiepmann .OR. lgal .OR. ltab .OR. ldeepmd .OR. lace)
1248 cpassert(check)
1249 END IF
1250 IF (ltab) THEN
1251 ipot = tab_type
1252 check = .NOT. (llj .OR. llj_charmm .OR. lgoodwin .OR. lwilliams .OR. leam .OR. lnequip &
1253 .OR. lbmhft .OR. lbmhftd .OR. lipbv .OR. lbuck4r .OR. lgp .OR. lgal21 &
1254 .OR. lbuckmo .OR. ltersoff .OR. lsiepmann .OR. lgal .OR. lace)
1255 cpassert(check)
1256 END IF
1257
1258 lb1_old = 0
1259 ub1_old = 0
1260 IF (ASSOCIATED(p)) THEN
1261 lb1_old = lbound(p%pot, 1)
1262 ub1_old = ubound(p%pot, 1)
1263 CALL pair_potential_p_create(work, lb=lb1_old, ub=ub1_old)
1264 CALL pair_potential_p_copy(p, work)
1266 END IF
1267
1268 CALL pair_potential_p_create(p, lb=lb1_new, ub=ub1_new)
1269 IF (ASSOCIATED(work)) THEN
1270 CALL pair_potential_p_copy(work, p, istart=lb1_old, iend=ub1_old)
1271 END IF
1272 std_dim = 1
1273 DO i = ub1_old + 1, ub1_new
1274 check = (SIZE(p%pot(i)%pot%type) == std_dim) .AND. (SIZE(p%pot(i)%pot%type) == std_dim)
1275 cpassert(check)
1276 p%pot(i)%pot%type = nn_type
1277 p%pot(i)%pot%shell_type = nosh_nosh
1278 p%pot(i)%pot%undef = .true.
1279 p%pot(i)%pot%no_mb = .false.
1280 p%pot(i)%pot%no_pp = .false.
1281 p%pot(i)%pot%at1 = 'NULL'
1282 p%pot(i)%pot%at2 = 'NULL'
1283 p%pot(i)%pot%set(std_dim)%rmin = not_initialized
1284 p%pot(i)%pot%set(std_dim)%rmax = not_initialized
1285 SELECT CASE (ipot)
1286 CASE (lj_type, lj_charmm_type)
1287 CALL pair_potential_lj_create(p%pot(i)%pot%set(std_dim)%lj)
1288 CASE (wl_type)
1289 CALL pair_potential_williams_create(p%pot(i)%pot%set(std_dim)%willis)
1290 CASE (gw_type)
1291 CALL pair_potential_goodwin_create(p%pot(i)%pot%set(std_dim)%goodwin)
1292 CASE (ea_type)
1293 CALL pair_potential_eam_create(p%pot(i)%pot%set(std_dim)%eam)
1295 CALL pair_potential_nequip_create(p%pot(i)%pot%set(std_dim)%nequip)
1296 CASE (ace_type)
1297 CALL pair_potential_ace_create(p%pot(i)%pot%set(std_dim)%ace)
1298 CASE (deepmd_type)
1299 CALL pair_potential_deepmd_create(p%pot(i)%pot%set(std_dim)%deepmd)
1300 CASE (ft_type)
1301 CALL pair_potential_bmhft_create(p%pot(i)%pot%set(std_dim)%ft)
1302 CASE (ftd_type)
1303 CALL pair_potential_bmhftd_create(p%pot(i)%pot%set(std_dim)%ftd)
1304 CASE (ip_type)
1305 CALL pair_potential_ipbv_create(p%pot(i)%pot%set(std_dim)%ipbv)
1306 CASE (b4_type)
1307 CALL pair_potential_buck4r_create(p%pot(i)%pot%set(std_dim)%buck4r)
1308 CASE (bm_type)
1309 CALL pair_potential_buckmo_create(p%pot(i)%pot%set(std_dim)%buckmo)
1310 CASE (gp_type)
1311 CALL pair_potential_gp_create(p%pot(i)%pot%set(std_dim)%gp)
1312 CASE (tersoff_type)
1313 CALL pair_potential_tersoff_create(p%pot(i)%pot%set(std_dim)%tersoff)
1314 CASE (siepmann_type)
1315 CALL pair_potential_siepmann_create(p%pot(i)%pot%set(std_dim)%siepmann)
1316 CASE (gal_type)
1317 CALL pair_potential_gal_create(p%pot(i)%pot%set(std_dim)%gal)
1318 CASE (gal21_type)
1319 CALL pair_potential_gal21_create(p%pot(i)%pot%set(std_dim)%gal21)
1320 CASE (tab_type)
1321 CALL pair_potential_tab_create(p%pot(i)%pot%set(std_dim)%tab)
1322 END SELECT
1323 NULLIFY (p%pot(i)%pot%spl_f)
1324 NULLIFY (p%pot(i)%pot%pair_spline_data)
1325 END DO
1326
1327 IF (ASSOCIATED(work)) CALL pair_potential_p_release(work)
1328 END SUBROUTINE pair_potential_reallocate
1329
1330! **************************************************************************************************
1331!> \brief Creates the generic potential type
1332!> \param gp ...
1333!> \author Teodoro Laino [teo] 11.2005
1334! **************************************************************************************************
1335 SUBROUTINE pair_potential_gp_create(gp)
1336 TYPE(gp_pot_type), POINTER :: gp
1337
1338 cpassert(.NOT. ASSOCIATED(gp))
1339 ALLOCATE (gp)
1340 NULLIFY (gp%parameters)
1341 NULLIFY (gp%values)
1342 CALL pair_potential_gp_clean(gp)
1343 END SUBROUTINE pair_potential_gp_create
1344
1345! **************************************************************************************************
1346!> \brief Copy two generic potential type
1347!> \param gp_source ...
1348!> \param gp_dest ...
1349!> \author Teodoro Laino [teo] 11.2005
1350! **************************************************************************************************
1351 SUBROUTINE pair_potential_gp_copy(gp_source, gp_dest)
1352 TYPE(gp_pot_type), POINTER :: gp_source, gp_dest
1353
1354 INTEGER :: idim
1355
1356 IF (.NOT. ASSOCIATED(gp_source)) RETURN
1357 IF (ASSOCIATED(gp_dest)) CALL pair_potential_gp_release(gp_dest)
1358 CALL pair_potential_gp_create(gp_dest)
1359 gp_dest%myid = gp_source%myid
1360 gp_dest%potential = gp_source%potential
1361 gp_dest%variables = gp_source%variables
1362 IF (ASSOCIATED(gp_source%parameters)) THEN
1363 idim = SIZE(gp_source%parameters)
1364 ALLOCATE (gp_dest%parameters(idim))
1365 gp_dest%parameters = gp_source%parameters
1366 END IF
1367 IF (ASSOCIATED(gp_source%values)) THEN
1368 idim = SIZE(gp_source%values)
1369 ALLOCATE (gp_dest%values(idim))
1370 gp_dest%values = gp_source%values
1371 END IF
1372 END SUBROUTINE pair_potential_gp_copy
1373
1374! **************************************************************************************************
1375!> \brief Cleans the generic potential type
1376!> \param gp ...
1377!> \author Teodoro Laino [teo] 11.2005
1378! **************************************************************************************************
1379 SUBROUTINE pair_potential_gp_clean(gp)
1380 TYPE(gp_pot_type), POINTER :: gp
1381
1382 IF (.NOT. ASSOCIATED(gp)) RETURN
1383 gp%myid = 0
1384 gp%potential = ""
1385 gp%variables = ""
1386 IF (ASSOCIATED(gp%values)) THEN
1387 DEALLOCATE (gp%values)
1388 END IF
1389 IF (ASSOCIATED(gp%parameters)) THEN
1390 DEALLOCATE (gp%parameters)
1391 END IF
1392 END SUBROUTINE pair_potential_gp_clean
1393
1394! **************************************************************************************************
1395!> \brief Destroys the generic potential type
1396!> \param gp ...
1397!> \author Teodoro Laino [teo] 11.2005
1398! **************************************************************************************************
1399 SUBROUTINE pair_potential_gp_release(gp)
1400 TYPE(gp_pot_type), POINTER :: gp
1401
1402 IF (ASSOCIATED(gp)) THEN
1403 IF (ASSOCIATED(gp%parameters)) THEN
1404 DEALLOCATE (gp%parameters)
1405 END IF
1406 IF (ASSOCIATED(gp%values)) THEN
1407 DEALLOCATE (gp%values)
1408 END IF
1409 DEALLOCATE (gp)
1410 END IF
1411 NULLIFY (gp)
1412 END SUBROUTINE pair_potential_gp_release
1413
1414! **************************************************************************************************
1415!> \brief Cleans the LJ potential type
1416!> \param lj ...
1417!> \author Teodoro Laino [teo] 11.2005
1418! **************************************************************************************************
1420 TYPE(lj_pot_type), POINTER :: lj
1421
1422 cpassert(.NOT. ASSOCIATED(lj))
1423 ALLOCATE (lj)
1424 CALL pair_potential_lj_clean(lj)
1425 END SUBROUTINE pair_potential_lj_create
1426
1427! **************************************************************************************************
1428!> \brief Copy two LJ potential type
1429!> \param lj_source ...
1430!> \param lj_dest ...
1431!> \author Teodoro Laino [teo] 11.2005
1432! **************************************************************************************************
1433 SUBROUTINE pair_potential_lj_copy(lj_source, lj_dest)
1434 TYPE(lj_pot_type), POINTER :: lj_source, lj_dest
1435
1436 IF (.NOT. ASSOCIATED(lj_source)) RETURN
1437 IF (ASSOCIATED(lj_dest)) CALL pair_potential_lj_release(lj_dest)
1438 CALL pair_potential_lj_create(lj_dest)
1439 lj_dest%epsilon = lj_source%epsilon
1440 lj_dest%sigma6 = lj_source%sigma6
1441 lj_dest%sigma12 = lj_source%sigma12
1442 END SUBROUTINE pair_potential_lj_copy
1443
1444! **************************************************************************************************
1445!> \brief Creates the LJ potential type
1446!> \param lj ...
1447!> \author Teodoro Laino [teo] 11.2005
1448! **************************************************************************************************
1449 SUBROUTINE pair_potential_lj_clean(lj)
1450 TYPE(lj_pot_type), POINTER :: lj
1451
1452 IF (.NOT. ASSOCIATED(lj)) RETURN
1453 lj%epsilon = 0.0_dp
1454 lj%sigma6 = 0.0_dp
1455 lj%sigma12 = 0.0_dp
1456 END SUBROUTINE pair_potential_lj_clean
1457
1458! **************************************************************************************************
1459!> \brief Destroys the LJ potential type
1460!> \param lj ...
1461!> \author Teodoro Laino [teo] 11.2005
1462! **************************************************************************************************
1463 SUBROUTINE pair_potential_lj_release(lj)
1464 TYPE(lj_pot_type), POINTER :: lj
1465
1466 IF (ASSOCIATED(lj)) THEN
1467 DEALLOCATE (lj)
1468 END IF
1469 NULLIFY (lj)
1470 END SUBROUTINE pair_potential_lj_release
1471
1472! **************************************************************************************************
1473!> \brief Creates the WILLIAMS potential type
1474!> \param willis ...
1475!> \author Teodoro Laino [teo] 11.2005
1476! **************************************************************************************************
1477 SUBROUTINE pair_potential_williams_create(willis)
1478 TYPE(williams_pot_type), POINTER :: willis
1479
1480 cpassert(.NOT. ASSOCIATED(willis))
1481 ALLOCATE (willis)
1482 CALL pair_potential_williams_clean(willis)
1483 END SUBROUTINE pair_potential_williams_create
1484
1485! **************************************************************************************************
1486!> \brief Copy two WILLIAMS potential type
1487!> \param willis_source ...
1488!> \param willis_dest ...
1489!> \author Teodoro Laino [teo] 11.2005
1490! **************************************************************************************************
1491 SUBROUTINE pair_potential_williams_copy(willis_source, willis_dest)
1492 TYPE(williams_pot_type), POINTER :: willis_source, willis_dest
1493
1494 IF (.NOT. ASSOCIATED(willis_source)) RETURN
1495 IF (ASSOCIATED(willis_dest)) CALL pair_potential_williams_release(willis_dest)
1496 CALL pair_potential_williams_create(willis_dest)
1497 willis_dest%a = willis_source%a
1498 willis_dest%b = willis_source%b
1499 willis_dest%c = willis_source%c
1500 END SUBROUTINE pair_potential_williams_copy
1501
1502! **************************************************************************************************
1503!> \brief Creates the WILLIAMS potential type
1504!> \param willis ...
1505!> \author Teodoro Laino [teo] 11.2005
1506! **************************************************************************************************
1507 SUBROUTINE pair_potential_williams_clean(willis)
1508 TYPE(williams_pot_type), POINTER :: willis
1509
1510 IF (.NOT. ASSOCIATED(willis)) RETURN
1511 willis%a = 0.0_dp
1512 willis%b = 0.0_dp
1513 willis%c = 0.0_dp
1514 END SUBROUTINE pair_potential_williams_clean
1515
1516! **************************************************************************************************
1517!> \brief Destroys the WILLIAMS potential type
1518!> \param willis ...
1519!> \author Teodoro Laino [teo] 11.2005
1520! **************************************************************************************************
1521 SUBROUTINE pair_potential_williams_release(willis)
1522 TYPE(williams_pot_type), POINTER :: willis
1523
1524 IF (ASSOCIATED(willis)) THEN
1525 DEALLOCATE (willis)
1526 END IF
1527 NULLIFY (willis)
1528 END SUBROUTINE pair_potential_williams_release
1529
1530! **************************************************************************************************
1531!> \brief Creates the GOODWIN potential type
1532!> \param goodwin ...
1533!> \author Teodoro Laino [teo] 11.2005
1534! **************************************************************************************************
1535 SUBROUTINE pair_potential_goodwin_create(goodwin)
1536 TYPE(goodwin_pot_type), POINTER :: goodwin
1537
1538 cpassert(.NOT. ASSOCIATED(goodwin))
1539 ALLOCATE (goodwin)
1540 CALL pair_potential_goodwin_clean(goodwin)
1541 END SUBROUTINE pair_potential_goodwin_create
1542
1543! **************************************************************************************************
1544!> \brief Copy two GOODWIN potential type
1545!> \param goodwin_source ...
1546!> \param goodwin_dest ...
1547!> \author Teodoro Laino [teo] 11.2005
1548! **************************************************************************************************
1549 SUBROUTINE pair_potential_goodwin_copy(goodwin_source, goodwin_dest)
1550 TYPE(goodwin_pot_type), POINTER :: goodwin_source, goodwin_dest
1551
1552 IF (.NOT. ASSOCIATED(goodwin_source)) RETURN
1553 IF (ASSOCIATED(goodwin_dest)) CALL pair_potential_goodwin_release(goodwin_dest)
1554 CALL pair_potential_goodwin_create(goodwin_dest)
1555 goodwin_dest%vr0 = goodwin_source%vr0
1556 goodwin_dest%d = goodwin_source%d
1557 goodwin_dest%dc = goodwin_source%dc
1558 goodwin_dest%m = goodwin_source%m
1559 goodwin_dest%mc = goodwin_source%mc
1560 END SUBROUTINE pair_potential_goodwin_copy
1561
1562! **************************************************************************************************
1563!> \brief Creates the GOODWIN potential type
1564!> \param goodwin ...
1565!> \author Teodoro Laino [teo] 11.2005
1566! **************************************************************************************************
1567 SUBROUTINE pair_potential_goodwin_clean(goodwin)
1568 TYPE(goodwin_pot_type), POINTER :: goodwin
1569
1570 IF (.NOT. ASSOCIATED(goodwin)) RETURN
1571 goodwin%vr0 = 0.0_dp
1572 goodwin%d = 0.0_dp
1573 goodwin%dc = 0.0_dp
1574 goodwin%m = 0.0_dp
1575 goodwin%mc = 0.0_dp
1576 END SUBROUTINE pair_potential_goodwin_clean
1577
1578! **************************************************************************************************
1579!> \brief Destroys the GOODWIN potential type
1580!> \param goodwin ...
1581!> \author Teodoro Laino [teo] 11.2005
1582! **************************************************************************************************
1583 SUBROUTINE pair_potential_goodwin_release(goodwin)
1584 TYPE(goodwin_pot_type), POINTER :: goodwin
1585
1586 IF (ASSOCIATED(goodwin)) THEN
1587 DEALLOCATE (goodwin)
1588 END IF
1589 NULLIFY (goodwin)
1590 END SUBROUTINE pair_potential_goodwin_release
1591
1592! **************************************************************************************************
1593!> \brief Creates the EAM potential type
1594!> \param eam ...
1595!> \author Teodoro Laino [teo] 11.2005
1596! **************************************************************************************************
1597 SUBROUTINE pair_potential_eam_create(eam)
1598 TYPE(eam_pot_type), POINTER :: eam
1599
1600 cpassert(.NOT. ASSOCIATED(eam))
1601 ALLOCATE (eam)
1602 NULLIFY (eam%rho, eam%phi, eam%frho, eam%rhoval, eam%rval, &
1603 eam%rhop, eam%phip, eam%frhop)
1604 CALL pair_potential_eam_clean(eam)
1605 END SUBROUTINE pair_potential_eam_create
1606
1607! **************************************************************************************************
1608!> \brief Copy two EAM potential type
1609!> \param eam_source ...
1610!> \param eam_dest ...
1611!> \author Teodoro Laino [teo] 11.2005
1612! **************************************************************************************************
1613 SUBROUTINE pair_potential_eam_copy(eam_source, eam_dest)
1614 TYPE(eam_pot_type), POINTER :: eam_source, eam_dest
1615
1616 IF (.NOT. ASSOCIATED(eam_source)) RETURN
1617 IF (ASSOCIATED(eam_dest)) CALL pair_potential_eam_release(eam_dest)
1618 CALL pair_potential_eam_create(eam_dest)
1619 eam_dest%eam_file_name = eam_source%eam_file_name
1620 eam_dest%drar = eam_source%drar
1621 eam_dest%drhoar = eam_source%drhoar
1622 eam_dest%acutal = eam_source%acutal
1623 eam_dest%npoints = eam_source%npoints
1624 ! Allocate arrays with the proper size
1625 CALL reallocate(eam_dest%rho, 1, eam_dest%npoints)
1626 CALL reallocate(eam_dest%rhop, 1, eam_dest%npoints)
1627 CALL reallocate(eam_dest%phi, 1, eam_dest%npoints)
1628 CALL reallocate(eam_dest%phip, 1, eam_dest%npoints)
1629 CALL reallocate(eam_dest%frho, 1, eam_dest%npoints)
1630 CALL reallocate(eam_dest%frhop, 1, eam_dest%npoints)
1631 CALL reallocate(eam_dest%rval, 1, eam_dest%npoints)
1632 CALL reallocate(eam_dest%rhoval, 1, eam_dest%npoints)
1633 eam_dest%rho = eam_source%rho
1634 eam_dest%phi = eam_source%phi
1635 eam_dest%frho = eam_source%frho
1636 eam_dest%rhoval = eam_source%rhoval
1637 eam_dest%rval = eam_source%rval
1638 eam_dest%rhop = eam_source%rhop
1639 eam_dest%phip = eam_source%phip
1640 eam_dest%frhop = eam_source%frhop
1641 END SUBROUTINE pair_potential_eam_copy
1642
1643! **************************************************************************************************
1644!> \brief Creates the EAM potential type
1645!> \param eam ...
1646!> \author Teodoro Laino [teo] 11.2005
1647! **************************************************************************************************
1648 SUBROUTINE pair_potential_eam_clean(eam)
1649 TYPE(eam_pot_type), POINTER :: eam
1650
1651 IF (.NOT. ASSOCIATED(eam)) RETURN
1652 eam%eam_file_name = 'NULL'
1653 eam%drar = 0.0_dp
1654 eam%drhoar = 0.0_dp
1655 eam%acutal = 0.0_dp
1656 eam%npoints = 0
1657 CALL reallocate(eam%rho, 1, eam%npoints)
1658 CALL reallocate(eam%rhop, 1, eam%npoints)
1659 CALL reallocate(eam%phi, 1, eam%npoints)
1660 CALL reallocate(eam%phip, 1, eam%npoints)
1661 CALL reallocate(eam%frho, 1, eam%npoints)
1662 CALL reallocate(eam%frhop, 1, eam%npoints)
1663 CALL reallocate(eam%rval, 1, eam%npoints)
1664 CALL reallocate(eam%rhoval, 1, eam%npoints)
1665 END SUBROUTINE pair_potential_eam_clean
1666
1667! **************************************************************************************************
1668!> \brief Destroys the EAM potential type
1669!> \param eam ...
1670!> \author Teodoro Laino [teo] 11.2005
1671! **************************************************************************************************
1672 SUBROUTINE pair_potential_eam_release(eam)
1673 TYPE(eam_pot_type), POINTER :: eam
1674
1675 IF (ASSOCIATED(eam)) THEN
1676 IF (ASSOCIATED(eam%rho)) THEN
1677 DEALLOCATE (eam%rho)
1678 END IF
1679 IF (ASSOCIATED(eam%rhop)) THEN
1680 DEALLOCATE (eam%rhop)
1681 END IF
1682 IF (ASSOCIATED(eam%phi)) THEN
1683 DEALLOCATE (eam%phi)
1684 END IF
1685 IF (ASSOCIATED(eam%phip)) THEN
1686 DEALLOCATE (eam%phip)
1687 END IF
1688 IF (ASSOCIATED(eam%frho)) THEN
1689 DEALLOCATE (eam%frho)
1690 END IF
1691 IF (ASSOCIATED(eam%frhop)) THEN
1692 DEALLOCATE (eam%frhop)
1693 END IF
1694 IF (ASSOCIATED(eam%rval)) THEN
1695 DEALLOCATE (eam%rval)
1696 END IF
1697 IF (ASSOCIATED(eam%rhoval)) THEN
1698 DEALLOCATE (eam%rhoval)
1699 END IF
1700 DEALLOCATE (eam)
1701 END IF
1702 END SUBROUTINE pair_potential_eam_release
1703
1704! **************************************************************************************************
1705!> \brief Creates the ACE potential type
1706!> \param ace ...
1707!> \author
1708! **************************************************************************************************
1709 SUBROUTINE pair_potential_ace_create(ace)
1710 TYPE(ace_pot_type), POINTER :: ace
1711
1712 cpassert(.NOT. ASSOCIATED(ace))
1713 ALLOCATE (ace)
1714 END SUBROUTINE pair_potential_ace_create
1715
1716! **************************************************************************************************
1717!> \brief Copy two ACE potential type
1718!> \param ace_source ...
1719!> \param ace_dest ...
1720!> \author
1721! **************************************************************************************************
1722 SUBROUTINE pair_potential_ace_copy(ace_source, ace_dest)
1723 TYPE(ace_pot_type), POINTER :: ace_source, ace_dest
1724
1725 IF (.NOT. ASSOCIATED(ace_source)) RETURN
1726 NULLIFY (ace_dest)
1727 IF (ASSOCIATED(ace_dest)) CALL pair_potential_ace_release(ace_dest)
1728 CALL pair_potential_ace_create(ace_dest)
1729 ace_dest = ace_source
1730 END SUBROUTINE pair_potential_ace_copy
1731
1732! **************************************************************************************************
1733!> \brief CLEAN the ACE potential type
1734!> \param ace ...
1735!> \author
1736! **************************************************************************************************
1737 SUBROUTINE pair_potential_ace_clean(ace)
1738 TYPE(ace_pot_type), POINTER :: ace
1739
1740 IF (.NOT. ASSOCIATED(ace)) RETURN
1741 ace = ace_pot_type()
1742 END SUBROUTINE pair_potential_ace_clean
1743
1744! **************************************************************************************************
1745!> \brief Destroys the ACE potential type
1746!> \param ace ...
1747!> \author
1748! **************************************************************************************************
1749 SUBROUTINE pair_potential_ace_release(ace)
1750 TYPE(ace_pot_type), POINTER :: ace
1751
1752 IF (ASSOCIATED(ace)) THEN
1753 DEALLOCATE (ace)
1754 END IF
1755 END SUBROUTINE pair_potential_ace_release
1756
1757! **************************************************************************************************
1758!> \brief Creates the DEEPMD potential type
1759!> \param deepmd ...
1760!> \author Yongbin Zhuang 07.2019
1761! **************************************************************************************************
1762 SUBROUTINE pair_potential_deepmd_create(deepmd)
1763 TYPE(deepmd_pot_type), POINTER :: deepmd
1764
1765 cpassert(.NOT. ASSOCIATED(deepmd))
1766 ALLOCATE (deepmd)
1767 END SUBROUTINE pair_potential_deepmd_create
1768
1769! **************************************************************************************************
1770!> \brief Copy two DEEPMD potential type
1771!> \param deepmd_source ...
1772!> \param deepmd_dest ...
1773!> \author Yongbin Zhuang 07.2019
1774! **************************************************************************************************
1775 SUBROUTINE pair_potential_deepmd_copy(deepmd_source, deepmd_dest)
1776 TYPE(deepmd_pot_type), POINTER :: deepmd_source, deepmd_dest
1777
1778 IF (.NOT. ASSOCIATED(deepmd_source)) RETURN
1779 NULLIFY (deepmd_dest)
1780 IF (ASSOCIATED(deepmd_dest)) CALL pair_potential_deepmd_release(deepmd_dest)
1781 CALL pair_potential_deepmd_create(deepmd_dest)
1782 deepmd_dest = deepmd_source
1783 END SUBROUTINE pair_potential_deepmd_copy
1784
1785! **************************************************************************************************
1786!> \brief CLEAN the DEEPMD potential type
1787!> \param deepmd ...
1788!> \author Yongbin Zhuang 07.2019
1789! **************************************************************************************************
1790 SUBROUTINE pair_potential_deepmd_clean(deepmd)
1791 TYPE(deepmd_pot_type), POINTER :: deepmd
1792
1793 IF (.NOT. ASSOCIATED(deepmd)) RETURN
1794 deepmd = deepmd_pot_type()
1795 END SUBROUTINE pair_potential_deepmd_clean
1796
1797! **************************************************************************************************
1798!> \brief Destroys the DEEPMD potential type
1799!> \param deepmd ...
1800!> \author Yongbin Zhuang 07.2019
1801! **************************************************************************************************
1802 SUBROUTINE pair_potential_deepmd_release(deepmd)
1803 TYPE(deepmd_pot_type), POINTER :: deepmd
1804
1805 IF (ASSOCIATED(deepmd)) THEN
1806 DEALLOCATE (deepmd)
1807 END IF
1808 END SUBROUTINE pair_potential_deepmd_release
1809
1810! **************************************************************************************************
1811!> \brief Creates the NEQUIP potential type
1812!> \param nequip ...
1813!> \author Gabriele Tocci 2023
1814! **************************************************************************************************
1815 SUBROUTINE pair_potential_nequip_create(nequip)
1816 TYPE(nequip_pot_type), POINTER :: nequip
1817
1818 cpassert(.NOT. ASSOCIATED(nequip))
1819 ALLOCATE (nequip)
1820 END SUBROUTINE pair_potential_nequip_create
1821
1822! **************************************************************************************************
1823!> \brief Copy two NEQUIP potential type
1824!> \param nequip_source ...
1825!> \param nequip_dest ...
1826!> \author Gabriele Tocci 2023
1827! **************************************************************************************************
1828 SUBROUTINE pair_potential_nequip_copy(nequip_source, nequip_dest)
1829 TYPE(nequip_pot_type), POINTER :: nequip_source, nequip_dest
1830
1831 IF (.NOT. ASSOCIATED(nequip_source)) RETURN
1832 IF (ASSOCIATED(nequip_dest)) CALL pair_potential_nequip_release(nequip_dest)
1833 CALL pair_potential_nequip_create(nequip_dest)
1834 nequip_dest = nequip_source
1835
1836 END SUBROUTINE pair_potential_nequip_copy
1837
1838! **************************************************************************************************
1839!> \brief Creates the NEQUIP potential type
1840!> \param nequip ...
1841!> \author Gabriele Tocci 2023
1842! **************************************************************************************************
1843 SUBROUTINE pair_potential_nequip_clean(nequip)
1844 TYPE(nequip_pot_type), POINTER :: nequip
1845
1846 IF (.NOT. ASSOCIATED(nequip)) RETURN
1847 nequip = nequip_pot_type()
1848
1849 END SUBROUTINE pair_potential_nequip_clean
1850
1851! **************************************************************************************************
1852!> \brief Destroys the NEQUIP potential type
1853!> \param nequip ...
1854!> \author Gabriele Tocci 2023
1855! **************************************************************************************************
1856 SUBROUTINE pair_potential_nequip_release(nequip)
1857 TYPE(nequip_pot_type), POINTER :: nequip
1858
1859 IF (ASSOCIATED(nequip)) THEN
1860 DEALLOCATE (nequip)
1861 END IF
1862 END SUBROUTINE pair_potential_nequip_release
1863
1864! **************************************************************************************************
1865!> \brief Creates the BMHFT (TOSI-FUMI) potential type
1866!> \param ft ...
1867!> \author Teodoro Laino [teo] 11.2005
1868! **************************************************************************************************
1869 SUBROUTINE pair_potential_bmhft_create(ft)
1870 TYPE(ft_pot_type), POINTER :: ft
1871
1872 cpassert(.NOT. ASSOCIATED(ft))
1873 ALLOCATE (ft)
1874 CALL pair_potential_bmhft_clean(ft)
1875 END SUBROUTINE pair_potential_bmhft_create
1876
1877! **************************************************************************************************
1878!> \brief Copy two BMHFT (TOSI-FUMI) potential type
1879!> \param ft_source ...
1880!> \param ft_dest ...
1881!> \author Teodoro Laino [teo] 11.2005
1882! **************************************************************************************************
1883 SUBROUTINE pair_potential_bmhft_copy(ft_source, ft_dest)
1884 TYPE(ft_pot_type), POINTER :: ft_source, ft_dest
1885
1886 IF (.NOT. ASSOCIATED(ft_source)) RETURN
1887 IF (ASSOCIATED(ft_dest)) CALL pair_potential_bmhft_release(ft_dest)
1888 CALL pair_potential_bmhft_create(ft_dest)
1889 ft_dest%A = ft_source%A
1890 ft_dest%B = ft_source%B
1891 ft_dest%C = ft_source%C
1892 ft_dest%D = ft_source%D
1893 END SUBROUTINE pair_potential_bmhft_copy
1894
1895! **************************************************************************************************
1896!> \brief Creates the BMHFT (TOSI-FUMI) potential type
1897!> \param ft ...
1898!> \author Teodoro Laino [teo] 11.2005
1899! **************************************************************************************************
1900 SUBROUTINE pair_potential_bmhft_clean(ft)
1901 TYPE(ft_pot_type), POINTER :: ft
1902
1903 IF (.NOT. ASSOCIATED(ft)) RETURN
1904 ft%A = 0.0_dp
1905 ft%B = 0.0_dp
1906 ft%C = 0.0_dp
1907 ft%D = 0.0_dp
1908 END SUBROUTINE pair_potential_bmhft_clean
1909
1910! **************************************************************************************************
1911!> \brief Destroys the BMHFT potential type
1912!> \param ft ...
1913!> \author Teodoro Laino [teo] 11.2005
1914! **************************************************************************************************
1915 SUBROUTINE pair_potential_bmhft_release(ft)
1916 TYPE(ft_pot_type), POINTER :: ft
1917
1918 IF (ASSOCIATED(ft)) THEN
1919 DEALLOCATE (ft)
1920 END IF
1921 NULLIFY (ft)
1922 END SUBROUTINE pair_potential_bmhft_release
1923
1924! **************************************************************************************************
1925!> \brief Creates the BMHFTD (damped TOSI-FUMI) potential type
1926!> \param ftd ...
1927!> \author Mathieu Salanne 05.2010
1928! **************************************************************************************************
1929 SUBROUTINE pair_potential_bmhftd_create(ftd)
1930 TYPE(ftd_pot_type), POINTER :: ftd
1931
1932 cpassert(.NOT. ASSOCIATED(ftd))
1933 ALLOCATE (ftd)
1934 CALL pair_potential_bmhftd_clean(ftd)
1935 END SUBROUTINE pair_potential_bmhftd_create
1936
1937! **************************************************************************************************
1938!> \brief Copy two BMHFTD (Damped TOSI-FUMI) potential type
1939!> \param ftd_source ...
1940!> \param ftd_dest ...
1941!> \author Mathieu Salanne 05.2010
1942! **************************************************************************************************
1943 SUBROUTINE pair_potential_bmhftd_copy(ftd_source, ftd_dest)
1944 TYPE(ftd_pot_type), POINTER :: ftd_source, ftd_dest
1945
1946 IF (.NOT. ASSOCIATED(ftd_source)) RETURN
1947 IF (ASSOCIATED(ftd_dest)) CALL pair_potential_bmhftd_release(ftd_dest)
1948 CALL pair_potential_bmhftd_create(ftd_dest)
1949 ftd_dest%A = ftd_source%A
1950 ftd_dest%B = ftd_source%B
1951 ftd_dest%C = ftd_source%C
1952 ftd_dest%D = ftd_source%D
1953 ftd_dest%BD = ftd_source%BD
1954 END SUBROUTINE pair_potential_bmhftd_copy
1955
1956! **************************************************************************************************
1957!> \brief Cleans the BMHFTD (damped TOSI-FUMI) potential type
1958!> \param ftd ...
1959!> \author Mathieu Salanne
1960! **************************************************************************************************
1961 SUBROUTINE pair_potential_bmhftd_clean(ftd)
1962 TYPE(ftd_pot_type), POINTER :: ftd
1963
1964 IF (.NOT. ASSOCIATED(ftd)) RETURN
1965 ftd%A = 0.0_dp
1966 ftd%B = 0.0_dp
1967 ftd%C = 0.0_dp
1968 ftd%D = 0.0_dp
1969 ftd%BD = 0.0_dp
1970 END SUBROUTINE pair_potential_bmhftd_clean
1971
1972! **************************************************************************************************
1973!> \brief Destroys the BMHFTD potential type
1974!> \param ftd ...
1975!> \author Mathieu Salanne 05.2010
1976! **************************************************************************************************
1977 SUBROUTINE pair_potential_bmhftd_release(ftd)
1978 TYPE(ftd_pot_type), POINTER :: ftd
1979
1980 IF (ASSOCIATED(ftd)) THEN
1981 DEALLOCATE (ftd)
1982 END IF
1983 NULLIFY (ftd)
1984 END SUBROUTINE pair_potential_bmhftd_release
1985
1986! **************************************************************************************************
1987!> \brief Creates the IPBV potential type
1988!> \param ipbv ...
1989!> \author Teodoro Laino [teo] 11.2005
1990! **************************************************************************************************
1991 SUBROUTINE pair_potential_ipbv_create(ipbv)
1992 TYPE(ipbv_pot_type), POINTER :: ipbv
1993
1994 cpassert(.NOT. ASSOCIATED(ipbv))
1995 ALLOCATE (ipbv)
1996 CALL pair_potential_ipbv_clean(ipbv)
1997 END SUBROUTINE pair_potential_ipbv_create
1998
1999! **************************************************************************************************
2000!> \brief Copy two IPBV potential type
2001!> \param ipbv_source ...
2002!> \param ipbv_dest ...
2003!> \author Teodoro Laino [teo] 11.2005
2004! **************************************************************************************************
2005 SUBROUTINE pair_potential_ipbv_copy(ipbv_source, ipbv_dest)
2006 TYPE(ipbv_pot_type), POINTER :: ipbv_source, ipbv_dest
2007
2008 IF (.NOT. ASSOCIATED(ipbv_source)) RETURN
2009 IF (ASSOCIATED(ipbv_dest)) CALL pair_potential_ipbv_release(ipbv_dest)
2010 CALL pair_potential_ipbv_create(ipbv_dest)
2011 ipbv_dest%a = ipbv_source%a
2012 ipbv_dest%rcore = ipbv_source%rcore
2013 ipbv_dest%b = ipbv_source%b
2014 ipbv_dest%m = ipbv_source%m
2015 END SUBROUTINE pair_potential_ipbv_copy
2016
2017! **************************************************************************************************
2018!> \brief Creates the IPBV potential type
2019!> \param ipbv ...
2020!> \author Teodoro Laino [teo] 11.2005
2021! **************************************************************************************************
2022 SUBROUTINE pair_potential_ipbv_clean(ipbv)
2023 TYPE(ipbv_pot_type), POINTER :: ipbv
2024
2025 IF (.NOT. ASSOCIATED(ipbv)) RETURN
2026 ipbv%a = 0.0_dp
2027 ipbv%rcore = 0.0_dp
2028 ipbv%b = 0.0_dp
2029 ipbv%m = 0.0_dp
2030 END SUBROUTINE pair_potential_ipbv_clean
2031
2032! **************************************************************************************************
2033!> \brief Destroys the IPBV potential type
2034!> \param ipbv ...
2035!> \author Teodoro Laino [teo] 11.2005
2036! **************************************************************************************************
2037 SUBROUTINE pair_potential_ipbv_release(ipbv)
2038 TYPE(ipbv_pot_type), POINTER :: ipbv
2039
2040 IF (ASSOCIATED(ipbv)) THEN
2041 DEALLOCATE (ipbv)
2042 END IF
2043 NULLIFY (ipbv)
2044 END SUBROUTINE pair_potential_ipbv_release
2045
2046! **************************************************************************************************
2047!> \brief Creates the Buckingham 4 ranges potential type
2048!> \param buck4r ...
2049!> \author MI 10.2006
2050! **************************************************************************************************
2051 SUBROUTINE pair_potential_buck4r_create(buck4r)
2052 TYPE(buck4ran_pot_type), POINTER :: buck4r
2053
2054 cpassert(.NOT. ASSOCIATED(buck4r))
2055 ALLOCATE (buck4r)
2056 CALL pair_potential_buck4r_clean(buck4r)
2057 END SUBROUTINE pair_potential_buck4r_create
2058
2059! **************************************************************************************************
2060!> \brief Copy two Buckingham 4 ranges potential type
2061!> \param buck4r_source ...
2062!> \param buck4r_dest ...
2063!> \author MI 10.2006
2064! **************************************************************************************************
2065 SUBROUTINE pair_potential_buck4r_copy(buck4r_source, buck4r_dest)
2066 TYPE(buck4ran_pot_type), POINTER :: buck4r_source, buck4r_dest
2067
2068 IF (.NOT. ASSOCIATED(buck4r_source)) RETURN
2069 IF (ASSOCIATED(buck4r_dest)) CALL pair_potential_buck4r_release(buck4r_dest)
2070 CALL pair_potential_buck4r_create(buck4r_dest)
2071 buck4r_dest%a = buck4r_source%a
2072 buck4r_dest%b = buck4r_source%b
2073 buck4r_dest%c = buck4r_source%c
2074 buck4r_dest%r1 = buck4r_source%r1
2075 buck4r_dest%r2 = buck4r_source%r2
2076 buck4r_dest%r3 = buck4r_source%r3
2077 buck4r_dest%poly1 = buck4r_source%poly1
2078 buck4r_dest%poly2 = buck4r_source%poly2
2079 buck4r_dest%npoly1 = buck4r_source%npoly1
2080 buck4r_dest%npoly2 = buck4r_source%npoly2
2081 END SUBROUTINE pair_potential_buck4r_copy
2082
2083! **************************************************************************************************
2084!> \brief Creates the Buckingham 4 ranges potential type
2085!> \param buck4r ...
2086!> \author MI 10.2006
2087! **************************************************************************************************
2088 SUBROUTINE pair_potential_buck4r_clean(buck4r)
2089 TYPE(buck4ran_pot_type), POINTER :: buck4r
2090
2091 IF (.NOT. ASSOCIATED(buck4r)) RETURN
2092 buck4r%a = 0.0_dp
2093 buck4r%b = 0.0_dp
2094 buck4r%c = 0.0_dp
2095 buck4r%r1 = 0.0_dp
2096 buck4r%r2 = 0.0_dp
2097 buck4r%r3 = 0.0_dp
2098 buck4r%poly1 = 0.0_dp
2099 buck4r%npoly1 = 0
2100 buck4r%poly2 = 0.0_dp
2101 buck4r%npoly2 = 0
2102 END SUBROUTINE pair_potential_buck4r_clean
2103
2104! **************************************************************************************************
2105!> \brief Destroys the Buckingham 4 ranges potential type
2106!> \param buck4r ...
2107!> \author MI 10.2006
2108! **************************************************************************************************
2109 SUBROUTINE pair_potential_buck4r_release(buck4r)
2110 TYPE(buck4ran_pot_type), POINTER :: buck4r
2111
2112 IF (ASSOCIATED(buck4r)) THEN
2113 DEALLOCATE (buck4r)
2114 END IF
2115 NULLIFY (buck4r)
2116 END SUBROUTINE pair_potential_buck4r_release
2117
2118! **************************************************************************************************
2119!> \brief Creates the Buckingham plus Morse potential type
2120!> \param buckmo ...
2121!> \author MI 10.2006
2122! **************************************************************************************************
2123 SUBROUTINE pair_potential_buckmo_create(buckmo)
2124 TYPE(buckmorse_pot_type), POINTER :: buckmo
2125
2126 cpassert(.NOT. ASSOCIATED(buckmo))
2127 ALLOCATE (buckmo)
2128 CALL pair_potential_buckmo_clean(buckmo)
2129 END SUBROUTINE pair_potential_buckmo_create
2130
2131! **************************************************************************************************
2132!> \brief Copy two Buckingham plus Morse potential type
2133!> \param buckmo_source ...
2134!> \param buckmo_dest ...
2135!> \author MI 10.2006
2136! **************************************************************************************************
2137 SUBROUTINE pair_potential_buckmo_copy(buckmo_source, buckmo_dest)
2138 TYPE(buckmorse_pot_type), POINTER :: buckmo_source, buckmo_dest
2139
2140 IF (.NOT. ASSOCIATED(buckmo_source)) RETURN
2141 IF (ASSOCIATED(buckmo_dest)) CALL pair_potential_buckmo_release(buckmo_dest)
2142 CALL pair_potential_buckmo_create(buckmo_dest)
2143 buckmo_dest%f0 = buckmo_source%f0
2144 buckmo_dest%a1 = buckmo_source%a1
2145 buckmo_dest%a2 = buckmo_source%a2
2146 buckmo_dest%b1 = buckmo_source%b1
2147 buckmo_dest%b2 = buckmo_source%b2
2148 buckmo_dest%c = buckmo_source%c
2149 buckmo_dest%d = buckmo_source%d
2150 buckmo_dest%r0 = buckmo_source%r0
2151 buckmo_dest%beta = buckmo_source%beta
2152 END SUBROUTINE pair_potential_buckmo_copy
2153
2154! **************************************************************************************************
2155!> \brief Creates the Buckingham plus Morse potential type
2156!> \param buckmo ...
2157!> \author MI 10.2006
2158! **************************************************************************************************
2159 SUBROUTINE pair_potential_buckmo_clean(buckmo)
2160 TYPE(buckmorse_pot_type), POINTER :: buckmo
2161
2162 IF (.NOT. ASSOCIATED(buckmo)) RETURN
2163 buckmo%f0 = 0.0_dp
2164 buckmo%a1 = 0.0_dp
2165 buckmo%a2 = 0.0_dp
2166 buckmo%b1 = 0.0_dp
2167 buckmo%b2 = 0.0_dp
2168 buckmo%c = 0.0_dp
2169 buckmo%d = 0.0_dp
2170 buckmo%r0 = 0.0_dp
2171 buckmo%beta = 0.0_dp
2172 END SUBROUTINE pair_potential_buckmo_clean
2173
2174! **************************************************************************************************
2175!> \brief Destroys the Buckingham plus Morse potential type
2176!> \param buckmo ...
2177!> \author MI 10.2006
2178! **************************************************************************************************
2179 SUBROUTINE pair_potential_buckmo_release(buckmo)
2180 TYPE(buckmorse_pot_type), POINTER :: buckmo
2181
2182 IF (ASSOCIATED(buckmo)) THEN
2183 DEALLOCATE (buckmo)
2184 END IF
2185 NULLIFY (buckmo)
2186 END SUBROUTINE pair_potential_buckmo_release
2187
2188! **************************************************************************************************
2189!> \brief Creates the Tersoff potential type
2190!> (Tersoff, J. PRB 39(8), 5566, 1989)
2191!> \param tersoff ...
2192! **************************************************************************************************
2193 SUBROUTINE pair_potential_tersoff_create(tersoff)
2194 TYPE(tersoff_pot_type), POINTER :: tersoff
2195
2196 cpassert(.NOT. ASSOCIATED(tersoff))
2197 ALLOCATE (tersoff)
2198 CALL pair_potential_tersoff_clean(tersoff)
2199 END SUBROUTINE pair_potential_tersoff_create
2200
2201! **************************************************************************************************
2202!> \brief Copy two Tersoff potential type
2203!> (Tersoff, J. PRB 39(8), 5566, 1989)
2204!> \param tersoff_source ...
2205!> \param tersoff_dest ...
2206! **************************************************************************************************
2207 SUBROUTINE pair_potential_tersoff_copy(tersoff_source, tersoff_dest)
2208 TYPE(tersoff_pot_type), POINTER :: tersoff_source, tersoff_dest
2209
2210 IF (.NOT. ASSOCIATED(tersoff_source)) RETURN
2211 IF (ASSOCIATED(tersoff_dest)) CALL pair_potential_tersoff_release(tersoff_dest)
2212 CALL pair_potential_tersoff_create(tersoff_dest)
2213 tersoff_dest%A = tersoff_source%A
2214 tersoff_dest%B = tersoff_source%B
2215 tersoff_dest%lambda1 = tersoff_source%lambda1
2216 tersoff_dest%lambda2 = tersoff_source%lambda2
2217 tersoff_dest%alpha = tersoff_source%alpha
2218 tersoff_dest%beta = tersoff_source%beta
2219 tersoff_dest%n = tersoff_source%n
2220 tersoff_dest%c = tersoff_source%c
2221 tersoff_dest%d = tersoff_source%d
2222 tersoff_dest%h = tersoff_source%h
2223 tersoff_dest%lambda3 = tersoff_source%lambda3
2224 tersoff_dest%bigR = tersoff_source%bigR
2225 tersoff_dest%bigD = tersoff_source%bigD
2226 tersoff_dest%rcutsq = tersoff_source%rcutsq
2227 END SUBROUTINE pair_potential_tersoff_copy
2228
2229! **************************************************************************************************
2230!> \brief Creates the Tersoff potential type
2231!> (Tersoff, J. PRB 39(8), 5566, 1989)
2232!> \param tersoff ...
2233! **************************************************************************************************
2234 SUBROUTINE pair_potential_tersoff_clean(tersoff)
2235 TYPE(tersoff_pot_type), POINTER :: tersoff
2236
2237 IF (.NOT. ASSOCIATED(tersoff)) RETURN
2238 tersoff%A = 0.0_dp
2239 tersoff%B = 0.0_dp
2240 tersoff%lambda1 = 0.0_dp
2241 tersoff%lambda2 = 0.0_dp
2242 tersoff%alpha = 0.0_dp
2243 tersoff%beta = 0.0_dp
2244 tersoff%n = 0.0_dp
2245 tersoff%c = 0.0_dp
2246 tersoff%d = 0.0_dp
2247 tersoff%h = 0.0_dp
2248 tersoff%lambda3 = 0.0_dp
2249 tersoff%bigR = 0.0_dp
2250 tersoff%bigD = 0.0_dp
2251 tersoff%rcutsq = 0.0_dp
2252 END SUBROUTINE pair_potential_tersoff_clean
2253
2254! **************************************************************************************************
2255!> \brief Destroys the Tersoff
2256!> (Tersoff, J. PRB 39(8), 5566, 1989)
2257!> \param tersoff ...
2258! **************************************************************************************************
2259 SUBROUTINE pair_potential_tersoff_release(tersoff)
2260 TYPE(tersoff_pot_type), POINTER :: tersoff
2261
2262 IF (ASSOCIATED(tersoff)) THEN
2263 DEALLOCATE (tersoff)
2264 END IF
2265 NULLIFY (tersoff)
2266 END SUBROUTINE pair_potential_tersoff_release
2267
2268! **************************************************************************************************
2269!> \brief Creates the Siepmann-Sprik potential type
2270!> (Siepmann and Sprik, J. Chem. Phys. 102(1) 511, 1995)
2271!> \param siepmann ...
2272! **************************************************************************************************
2273 SUBROUTINE pair_potential_siepmann_create(siepmann)
2274 TYPE(siepmann_pot_type), POINTER :: siepmann
2275
2276 cpassert(.NOT. ASSOCIATED(siepmann))
2277 ALLOCATE (siepmann)
2278 CALL pair_potential_siepmann_clean(siepmann)
2279 END SUBROUTINE pair_potential_siepmann_create
2280! **************************************************************************************************
2281!> \brief Copy two Siepmann potential type
2282!> (Siepmann and Sprik, J. Chem. Phys. 102(1) 511, 1995)
2283!> \param siepmann_source ...
2284!> \param siepmann_dest ...
2285! **************************************************************************************************
2286 SUBROUTINE pair_potential_siepmann_copy(siepmann_source, siepmann_dest)
2287 TYPE(siepmann_pot_type), POINTER :: siepmann_source, siepmann_dest
2288
2289 IF (.NOT. ASSOCIATED(siepmann_source)) RETURN
2290 IF (ASSOCIATED(siepmann_dest)) CALL pair_potential_siepmann_release(siepmann_dest)
2291 CALL pair_potential_siepmann_create(siepmann_dest)
2292 siepmann_dest%B = siepmann_source%B
2293 siepmann_dest%D = siepmann_source%D
2294 siepmann_dest%E = siepmann_source%E
2295 siepmann_dest%F = siepmann_source%F
2296 siepmann_dest%beta = siepmann_source%beta
2297 siepmann_dest%rcutsq = siepmann_source%rcutsq
2298 siepmann_dest%allow_oh_formation = siepmann_source%allow_oh_formation
2299 siepmann_dest%allow_h3o_formation = siepmann_source%allow_h3o_formation
2300 siepmann_dest%allow_o_formation = siepmann_source%allow_o_formation
2301
2302 END SUBROUTINE pair_potential_siepmann_copy
2303
2304! **************************************************************************************************
2305!> \brief Creates the Siepmann-Sprik potential type
2306!> (Siepmann and Sprik, J. Chem. Phys. 102(1) 511, 1995)
2307!> \param siepmann ...
2308! **************************************************************************************************
2309 SUBROUTINE pair_potential_siepmann_clean(siepmann)
2310 TYPE(siepmann_pot_type), POINTER :: siepmann
2311
2312 IF (.NOT. ASSOCIATED(siepmann)) RETURN
2313 siepmann%B = 0.0_dp
2314 siepmann%D = 0.0_dp
2315 siepmann%E = 0.0_dp
2316 siepmann%F = 0.0_dp
2317 siepmann%beta = 0.0_dp
2318 siepmann%rcutsq = 0.0_dp
2319 siepmann%allow_oh_formation = .false.
2320 siepmann%allow_h3o_formation = .false.
2321 siepmann%allow_o_formation = .false.
2322
2323 END SUBROUTINE pair_potential_siepmann_clean
2324
2325! **************************************************************************************************
2326!> \brief Destroys the Siepmann-Sprik potential
2327!> (Siepmann and Sprik, J. Chem. Phys. 102(1) 511, 1995)
2328!> \param siepmann ...
2329! **************************************************************************************************
2330 SUBROUTINE pair_potential_siepmann_release(siepmann)
2331 TYPE(siepmann_pot_type), POINTER :: siepmann
2332
2333 IF (ASSOCIATED(siepmann)) THEN
2334 DEALLOCATE (siepmann)
2335 END IF
2336 NULLIFY (siepmann)
2337 END SUBROUTINE pair_potential_siepmann_release
2338
2339! **************************************************************************************************
2340!> \brief Creates the GAL19 potential type
2341!> (??)
2342!> \param gal ...
2343! **************************************************************************************************
2344 SUBROUTINE pair_potential_gal_create(gal)
2345 TYPE(gal_pot_type), POINTER :: gal
2346
2347 cpassert(.NOT. ASSOCIATED(gal))
2348 ALLOCATE (gal)
2349 CALL pair_potential_gal_clean(gal)
2350 END SUBROUTINE pair_potential_gal_create
2351
2352! **************************************************************************************************
2353!> \brief Copy two GAL potential type
2354!> (??)
2355!> \param gal_source ...
2356!> \param gal_dest ...
2357! **************************************************************************************************
2358 SUBROUTINE pair_potential_gal_copy(gal_source, gal_dest)
2359 TYPE(gal_pot_type), POINTER :: gal_source, gal_dest
2360
2361 IF (.NOT. ASSOCIATED(gal_source)) RETURN
2362 IF (ASSOCIATED(gal_dest)) CALL pair_potential_gal_release(gal_dest)
2363 CALL pair_potential_gal_create(gal_dest)
2364 gal_dest%met1 = gal_source%met1
2365 gal_dest%met2 = gal_source%met2
2366 gal_dest%epsilon = gal_source%epsilon
2367 gal_dest%bxy = gal_source%bxy
2368 gal_dest%bz = gal_source%bz
2369 gal_dest%r1 = gal_source%r1
2370 gal_dest%r2 = gal_source%r2
2371 gal_dest%a1 = gal_source%a1
2372 gal_dest%a2 = gal_source%a2
2373 gal_dest%a3 = gal_source%a3
2374 gal_dest%a4 = gal_source%a4
2375 gal_dest%a = gal_source%a
2376 gal_dest%b = gal_source%b
2377 gal_dest%c = gal_source%c
2378 ALLOCATE (gal_dest%gcn(SIZE(gal_source%gcn)))
2379 gal_dest%gcn = gal_source%gcn
2380 gal_dest%express = gal_source%express
2381 gal_dest%rcutsq = gal_source%rcutsq
2382
2383 END SUBROUTINE pair_potential_gal_copy
2384
2385! **************************************************************************************************
2386!> \brief Creates the GAL19 potential type
2387!> (??)
2388!> \param gal ...
2389! **************************************************************************************************
2390 SUBROUTINE pair_potential_gal_clean(gal)
2391 TYPE(gal_pot_type), POINTER :: gal
2392
2393 IF (.NOT. ASSOCIATED(gal)) RETURN
2394 gal%epsilon = 0.0_dp
2395 gal%bxy = 0.0_dp
2396 gal%bz = 0.0_dp
2397 gal%r1 = 0.0_dp
2398 gal%r2 = 0.0_dp
2399 gal%a1 = 0.0_dp
2400 gal%a2 = 0.0_dp
2401 gal%a3 = 0.0_dp
2402 gal%a4 = 0.0_dp
2403 gal%a = 0.0_dp
2404 gal%b = 0.0_dp
2405 gal%c = 0.0_dp
2406 gal%rcutsq = 0.0_dp
2407 gal%express = .false.
2408
2409 END SUBROUTINE pair_potential_gal_clean
2410
2411! **************************************************************************************************
2412!> \brief Destroys the GAL19 potential
2413!> (??)
2414!> \param gal ...
2415! **************************************************************************************************
2416 SUBROUTINE pair_potential_gal_release(gal)
2417 TYPE(gal_pot_type), POINTER :: gal
2418
2419 IF (ASSOCIATED(gal)) THEN
2420 DEALLOCATE (gal%gcn)
2421 DEALLOCATE (gal)
2422 END IF
2423 NULLIFY (gal)
2424 END SUBROUTINE pair_potential_gal_release
2425
2426! **************************************************************************************************
2427!> \brief Creates the GAL21 potential type
2428!> (??)
2429!> \param gal21 ...
2430! **************************************************************************************************
2431 SUBROUTINE pair_potential_gal21_create(gal21)
2432 TYPE(gal21_pot_type), POINTER :: gal21
2433
2434 cpassert(.NOT. ASSOCIATED(gal21))
2435 ALLOCATE (gal21)
2436 CALL pair_potential_gal21_clean(gal21)
2437 END SUBROUTINE pair_potential_gal21_create
2438
2439! **************************************************************************************************
2440!> \brief Copy two GAL21 potential type
2441!> (??)
2442!> \param gal21_source ...
2443!> \param gal21_dest ...
2444! **************************************************************************************************
2445 SUBROUTINE pair_potential_gal21_copy(gal21_source, gal21_dest)
2446 TYPE(gal21_pot_type), POINTER :: gal21_source, gal21_dest
2447
2448 IF (.NOT. ASSOCIATED(gal21_source)) RETURN
2449 IF (ASSOCIATED(gal21_dest)) CALL pair_potential_gal21_release(gal21_dest)
2450 CALL pair_potential_gal21_create(gal21_dest)
2451 gal21_dest%met1 = gal21_source%met1
2452 gal21_dest%met2 = gal21_source%met2
2453 gal21_dest%epsilon1 = gal21_source%epsilon1
2454 gal21_dest%epsilon2 = gal21_source%epsilon2
2455 gal21_dest%epsilon3 = gal21_source%epsilon3
2456 gal21_dest%bxy1 = gal21_source%bxy1
2457 gal21_dest%bxy2 = gal21_source%bxy2
2458 gal21_dest%bz1 = gal21_source%bz1
2459 gal21_dest%bz2 = gal21_source%bz2
2460 gal21_dest%r1 = gal21_source%r1
2461 gal21_dest%r2 = gal21_source%r2
2462 gal21_dest%a11 = gal21_source%a11
2463 gal21_dest%a12 = gal21_source%a12
2464 gal21_dest%a13 = gal21_source%a13
2465 gal21_dest%a21 = gal21_source%a21
2466 gal21_dest%a22 = gal21_source%a22
2467 gal21_dest%a23 = gal21_source%a23
2468 gal21_dest%a31 = gal21_source%a31
2469 gal21_dest%a32 = gal21_source%a32
2470 gal21_dest%a33 = gal21_source%a33
2471 gal21_dest%a41 = gal21_source%a41
2472 gal21_dest%a42 = gal21_source%a42
2473 gal21_dest%a43 = gal21_source%a43
2474 gal21_dest%AO1 = gal21_source%AO1
2475 gal21_dest%AO2 = gal21_source%AO2
2476 gal21_dest%BO1 = gal21_source%BO1
2477 gal21_dest%BO2 = gal21_source%BO2
2478 gal21_dest%c = gal21_source%c
2479 gal21_dest%AH1 = gal21_source%AH1
2480 gal21_dest%AH2 = gal21_source%AH2
2481 gal21_dest%BH1 = gal21_source%BH1
2482 gal21_dest%BH2 = gal21_source%BH2
2483 ALLOCATE (gal21_dest%gcn(SIZE(gal21_source%gcn)))
2484 gal21_dest%gcn = gal21_source%gcn
2485 gal21_dest%express = gal21_source%express
2486 gal21_dest%rcutsq = gal21_source%rcutsq
2487
2488 END SUBROUTINE pair_potential_gal21_copy
2489
2490! **************************************************************************************************
2491!> \brief Creates the GAL21 potential type
2492!> (??)
2493!> \param gal21 ...
2494! **************************************************************************************************
2495 SUBROUTINE pair_potential_gal21_clean(gal21)
2496 TYPE(gal21_pot_type), POINTER :: gal21
2497
2498 IF (.NOT. ASSOCIATED(gal21)) RETURN
2499 gal21%epsilon1 = 0.0_dp
2500 gal21%epsilon2 = 0.0_dp
2501 gal21%epsilon3 = 0.0_dp
2502 gal21%bxy1 = 0.0_dp
2503 gal21%bxy2 = 0.0_dp
2504 gal21%bz1 = 0.0_dp
2505 gal21%bz2 = 0.0_dp
2506 gal21%r1 = 0.0_dp
2507 gal21%r2 = 0.0_dp
2508 gal21%a11 = 0.0_dp
2509 gal21%a12 = 0.0_dp
2510 gal21%a13 = 0.0_dp
2511 gal21%a21 = 0.0_dp
2512 gal21%a22 = 0.0_dp
2513 gal21%a23 = 0.0_dp
2514 gal21%a31 = 0.0_dp
2515 gal21%a32 = 0.0_dp
2516 gal21%a33 = 0.0_dp
2517 gal21%a41 = 0.0_dp
2518 gal21%a42 = 0.0_dp
2519 gal21%a43 = 0.0_dp
2520 gal21%AO1 = 0.0_dp
2521 gal21%AO2 = 0.0_dp
2522 gal21%BO1 = 0.0_dp
2523 gal21%BO2 = 0.0_dp
2524 gal21%c = 0.0_dp
2525 gal21%AH1 = 0.0_dp
2526 gal21%AH2 = 0.0_dp
2527 gal21%BH1 = 0.0_dp
2528 gal21%BH2 = 0.0_dp
2529 gal21%rcutsq = 0.0_dp
2530 gal21%express = .false.
2531
2532 END SUBROUTINE pair_potential_gal21_clean
2533
2534! **************************************************************************************************
2535!> \brief Destroys the GAL21 potential
2536!> (??)
2537!> \param gal21 ...
2538! **************************************************************************************************
2539 SUBROUTINE pair_potential_gal21_release(gal21)
2540 TYPE(gal21_pot_type), POINTER :: gal21
2541
2542 IF (ASSOCIATED(gal21)) THEN
2543 DEALLOCATE (gal21%gcn)
2544 DEALLOCATE (gal21)
2545 END IF
2546 NULLIFY (gal21)
2547 END SUBROUTINE pair_potential_gal21_release
2548
2549! **************************************************************************************************
2550!> \brief Creates the TABPOT potential type
2551!> \param tab ...
2552!> \author Alex Mironenko, Da Teng 2019-2022
2553! **************************************************************************************************
2554 SUBROUTINE pair_potential_tab_create(tab)
2555 TYPE(tab_pot_type), POINTER :: tab
2556
2557 cpassert(.NOT. ASSOCIATED(tab))
2558 ALLOCATE (tab)
2559 NULLIFY (tab%r, tab%e, tab%f)
2560 CALL pair_potential_tab_clean(tab)
2561 END SUBROUTINE pair_potential_tab_create
2562
2563! **************************************************************************************************
2564!> \brief Copy two TABPOT potential type
2565!> \param tab_source ...
2566!> \param tab_dest ...
2567! **************************************************************************************************
2568 SUBROUTINE pair_potential_tab_copy(tab_source, tab_dest)
2569 TYPE(tab_pot_type), POINTER :: tab_source, tab_dest
2570
2571 IF (.NOT. ASSOCIATED(tab_source)) RETURN
2572 IF (ASSOCIATED(tab_dest)) CALL pair_potential_tab_release(tab_dest)
2573 CALL pair_potential_tab_create(tab_dest)
2574 tab_dest%tabpot_file_name = tab_source%tabpot_file_name
2575 tab_dest%dr = tab_source%dr
2576 tab_dest%rcut = tab_source%rcut
2577 tab_dest%npoints = tab_source%npoints
2578 tab_dest%index = tab_source%index
2579 ! Allocate arrays with the proper size
2580 CALL reallocate(tab_dest%r, 1, tab_dest%npoints)
2581 CALL reallocate(tab_dest%e, 1, tab_dest%npoints)
2582 CALL reallocate(tab_dest%f, 1, tab_dest%npoints)
2583 tab_dest%r = tab_source%r
2584 tab_dest%e = tab_source%e
2585 tab_dest%f = tab_source%f
2586 END SUBROUTINE pair_potential_tab_copy
2587
2588! **************************************************************************************************
2589!> \brief Creates the TABPOT potential type
2590!> \param tab ...
2591! **************************************************************************************************
2592 SUBROUTINE pair_potential_tab_clean(tab)
2593 TYPE(tab_pot_type), POINTER :: tab
2594
2595 IF (.NOT. ASSOCIATED(tab)) RETURN
2596 tab%tabpot_file_name = 'NULL'
2597 tab%dr = 0.0_dp
2598 tab%rcut = 0.0_dp
2599 tab%npoints = 0
2600 tab%index = 0
2601 CALL reallocate(tab%r, 1, tab%npoints)
2602 CALL reallocate(tab%e, 1, tab%npoints)
2603 CALL reallocate(tab%f, 1, tab%npoints)
2604
2605 END SUBROUTINE pair_potential_tab_clean
2606
2607! **************************************************************************************************
2608!> \brief Destroys the TABPOT potential type
2609!> \param tab ...
2610! **************************************************************************************************
2611 SUBROUTINE pair_potential_tab_release(tab)
2612 TYPE(tab_pot_type), POINTER :: tab
2613
2614 IF (ASSOCIATED(tab)) THEN
2615 IF (ASSOCIATED(tab%r)) THEN
2616 DEALLOCATE (tab%r)
2617 END IF
2618 IF (ASSOCIATED(tab%e)) THEN
2619 DEALLOCATE (tab%e)
2620 END IF
2621 IF (ASSOCIATED(tab%f)) THEN
2622 DEALLOCATE (tab%f)
2623 END IF
2624 DEALLOCATE (tab)
2625 END IF
2626 END SUBROUTINE pair_potential_tab_release
2627
2628END MODULE pair_potential_types
2629
Interface to ACE C wrapper.
Definition ace_wrapper.F:12
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 default_path_length
Definition kinds.F:58
Utility routines for the memory handling.
integer, parameter, public sh_sh
integer, parameter, public nosh_nosh
subroutine, public pair_potential_reallocate(p, lb1_new, ub1_new, lj, lj_charmm, williams, goodwin, eam, nequip, bmhft, bmhftd, ipbv, buck4r, buckmo, gp, tersoff, siepmann, gal, gal21, tab, deepmd, ace)
Cleans the potential parameter type.
integer, parameter, public lj_charmm_type
integer, parameter, public allegro_type
integer, parameter, public bm_type
integer, dimension(22), parameter, public list_pot
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 wl_type
integer, parameter, public ft_type
integer, parameter, public tab_type
integer, parameter, public ftd_type
integer, parameter, public ip_type
subroutine, public pair_potential_p_release(potparm)
Release Data-structure that constains potential parameters.
integer, parameter, public lj_type
integer, parameter, public deepmd_type
subroutine, public pair_potential_single_copy(potparm_source, potparm_dest)
Copy two potential parameter type.
integer, parameter, public nn_type
integer, parameter, public multi_type
integer, parameter, public gp_type
subroutine, public pair_potential_single_add(potparm_source, potparm_dest)
Add potential parameter type to an existing potential parameter type Used in case of multiple_potenti...
integer, parameter, public siepmann_type
integer, parameter, public nosh_sh
subroutine, public pair_potential_single_clean(potparm)
Cleans the potential parameter type.
subroutine, public pair_potential_lj_create(lj)
Cleans the LJ potential type.
integer, parameter, public ace_type
integer, dimension(2), parameter, public do_potential_single_allocation
subroutine, public compare_pot(pot1, pot2, compare)
compare two different potentials
integer, parameter, public gw_type
real(kind=dp), parameter, public not_initialized
subroutine, public pair_potential_pp_create(potparm, nkinds)
Data-structure that constains potential parameters.
integer, dimension(3), parameter, public list_sh_type
integer, dimension(2), parameter, public no_potential_single_allocation
integer, parameter, public mace_type
integer, parameter, public b4_type
integer, parameter, public gal21_type
integer, dimension(2), public potential_single_allocation
integer, parameter, public ea_type
integer, parameter, public tersoff_type
routines for handling splines_types
subroutine, public spline_data_p_copy(spl_p_source, spl_p_dest)
Copy Data-structure of spline_data_p_type.
subroutine, public spline_factor_release(spline_factor)
releases spline_factor
subroutine, public spline_data_p_release(spl_p)
releases spline_data_p
subroutine, public spline_factor_copy(spline_factor_source, spline_factor_dest)
releases spline_factor