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