(git:374b731)
Loading...
Searching...
No Matches
qmmm_types_low.F
Go to the documentation of this file.
1!--------------------------------------------------------------------------------------------------!
2! CP2K: A general program to perform molecular dynamics simulations !
3! Copyright 2000-2024 CP2K developers group <https://cp2k.org> !
4! !
5! SPDX-License-Identifier: GPL-2.0-or-later !
6!--------------------------------------------------------------------------------------------------!
7
8! **************************************************************************************************
9!> \par History
10!> 05.2004 created [fawzi]
11!> \author Fawzi Mohamed
12! **************************************************************************************************
23 USE input_constants, ONLY: do_eri_mme,&
25 USE kinds, ONLY: dp
30 USE pw_grids, ONLY: pw_grid_release
31 USE pw_pool_types, ONLY: pw_pool_p_type,&
35 USE pw_types, ONLY: pw_r3d_rs_type
37#include "./base/base_uses.f90"
38
39 IMPLICIT NONE
40 PRIVATE
41
42 LOGICAL, PRIVATE, PARAMETER :: debug_this_module = .true.
43 CHARACTER(len=*), PARAMETER, PRIVATE :: moduleN = 'qmmm_types_low'
44 INTEGER, PARAMETER, PUBLIC :: force_mixing_label_none = -1, &
52
60
61! **************************************************************************************************
62!> \brief variables needed for QM/MM calculation in QM section
63!> \par History
64!> 05.2004 created [fawzi]
65!> \author Fawzi Mohamed
66!> Teodoro Laino
67! **************************************************************************************************
68 TYPE gridlevel_info_type
69 INTEGER :: auxbas_grid
70 INTEGER :: coarser_grid
71 END TYPE gridlevel_info_type
72
73! **************************************************************************************************
74!> \brief Real Space Potential
75! **************************************************************************************************
77 REAL(kind=dp), DIMENSION(:, :), POINTER :: pot0_2
78 REAL(kind=dp) :: rmax, rmin, dx, rc
79 INTEGER :: npts
80 INTEGER, DIMENSION(:), POINTER :: mm_atom_index
81 END TYPE qmmm_pot_type
82
84 TYPE(qmmm_pot_type), POINTER :: pot
85 END TYPE qmmm_pot_p_type
86
87! **************************************************************************************************
88!> \brief Periodic Potential
89! **************************************************************************************************
91 REAL(kind=dp), DIMENSION(:), POINTER :: lg, gx, gy, gz
92 REAL(kind=dp) :: gmax, fac(3)
93 INTEGER :: kmax(3), n_rep_real(3)
94 INTEGER, DIMENSION(:), POINTER :: mm_atom_index
95 TYPE(pw_pool_type), POINTER :: pw_pool
96 TYPE(pw_grid_type), POINTER :: pw_grid
97 TYPE(pw_r3d_rs_type), POINTER :: tablr
98 END TYPE qmmm_per_pot_type
99
101 TYPE(qmmm_per_pot_type), POINTER :: pot
102 END TYPE qmmm_per_pot_p_type
103
104! **************************************************************************************************
105!> \brief LINKs IMOMM
106! **************************************************************************************************
108 INTEGER :: qm_index, mm_index
109 REAL(kind=dp) :: alpha
110 END TYPE qmmm_imomm_link_type
111
112 TYPE qmmm_imomm_link_p_type
113 TYPE(qmmm_imomm_link_type), POINTER :: link
114 END TYPE qmmm_imomm_link_p_type
115
116! **************************************************************************************************
117!> \brief LINKs PSEUDO
118! **************************************************************************************************
119 TYPE qmmm_pseudo_link_type
120 INTEGER :: qm_index, mm_index
121 END TYPE qmmm_pseudo_link_type
122
123 TYPE qmmm_pseudo_link_p_type
124 TYPE(qmmm_pseudo_link_type), POINTER :: link
125 END TYPE qmmm_pseudo_link_p_type
126
127! **************************************************************************************************
128!> \brief LINKs summary
129! **************************************************************************************************
131 TYPE(qmmm_imomm_link_p_type), DIMENSION(:), POINTER :: imomm
132 TYPE(qmmm_pseudo_link_p_type), DIMENSION(:), POINTER :: pseudo
133 END TYPE qmmm_links_type
134
135! **************************************************************************************************
136!> \brief ...
137! **************************************************************************************************
138 TYPE add_env_type
139 INTEGER :: index1, index2
140 REAL(kind=dp) :: alpha
141 END TYPE add_env_type
142
143! **************************************************************************************************
144!> \brief ...
145! **************************************************************************************************
147 INTEGER :: num_mm_atoms
148 TYPE(add_env_type), DIMENSION(:), POINTER :: add_env
149 TYPE(particle_type), DIMENSION(:), POINTER :: added_particles
150 INTEGER, DIMENSION(:), POINTER :: mm_atom_index
151 REAL(kind=dp), DIMENSION(:), POINTER :: mm_atom_chrg
152 REAL(kind=dp), DIMENSION(:), POINTER :: mm_el_pot_radius
153 REAL(kind=dp), DIMENSION(:), POINTER :: mm_el_pot_radius_corr
154 TYPE(qmmm_pot_p_type), DIMENSION(:), POINTER :: potentials
155 TYPE(qmmm_per_pot_p_type), DIMENSION(:), POINTER :: per_potentials
156 TYPE(qmmm_gaussian_p_type), DIMENSION(:), POINTER :: pgfs
157 END TYPE add_set_type
158
159! **************************************************************************************************
160!> \brief parameters for core-shell model potentials
161! **************************************************************************************************
163 INTEGER :: num_mm_atoms
164 TYPE(particle_type), DIMENSION(:), POINTER :: added_particles
165 TYPE(particle_type), DIMENSION(:), POINTER :: added_cores
166 INTEGER, DIMENSION(:), POINTER :: mm_core_index
167 REAL(kind=dp), DIMENSION(:), POINTER :: mm_core_chrg
168 REAL(kind=dp), DIMENSION(:), POINTER :: mm_el_pot_radius
169 REAL(kind=dp), DIMENSION(:), POINTER :: mm_el_pot_radius_corr
170 TYPE(qmmm_pot_p_type), DIMENSION(:), POINTER :: potentials
171 TYPE(qmmm_per_pot_p_type), DIMENSION(:), POINTER :: per_potentials
172 TYPE(qmmm_gaussian_p_type), DIMENSION(:), POINTER :: pgfs
173 END TYPE add_shell_type
174
175! **************************************************************************************************
176!> \brief ...
177! **************************************************************************************************
178 TYPE image_charge_type
179 LOGICAL :: all_mm
180 LOGICAL :: coeff_iterative
181 LOGICAL :: image_restart
182 INTEGER :: state_image_matrix
183 INTEGER, DIMENSION(:), POINTER :: image_mm_list
184 TYPE(particle_type), DIMENSION(:), POINTER :: particles_all
185 REAL(kind=dp), DIMENSION(:, :), POINTER :: image_forcesmm
186 REAL(kind=dp) :: v0
187 REAL(kind=dp) :: eta
188 INTEGER :: image_matrix_method
189 TYPE(cp_eri_mme_param) :: eri_mme_param
190 END TYPE image_charge_type
191
192! **************************************************************************************************
193!> \brief ...
194! **************************************************************************************************
196 LOGICAL :: center_qm_subsys
197 LOGICAL :: center_qm_subsys0, do_translate
198 LOGICAL :: center_qm_subsys_pbc_aware
199 LOGICAL :: do_force_mixing
200 LOGICAL :: compatibility
201 LOGICAL :: qmmm_link
202 LOGICAL :: move_mm_charges
203 LOGICAL :: add_mm_charges
204 LOGICAL :: periodic
205 LOGICAL :: multipole
206 LOGICAL :: image_charge
207 INTEGER :: par_scheme
208 INTEGER :: qmmm_coupl_type
209 INTEGER :: num_qm_atoms
210 INTEGER :: num_mm_atoms
211 INTEGER :: num_image_mm_atoms
212 REAL(kind=dp) :: eps_mm_rspace
213 REAL(kind=dp), DIMENSION(3) :: dommoqm, utrasl, transl_v
214 REAL(kind=dp), DIMENSION(2) :: spherical_cutoff
215 REAL(kind=dp), DIMENSION(:), POINTER :: maxradius
216 INTEGER, DIMENSION(:), POINTER :: qm_atom_index
217 INTEGER, DIMENSION(:), POINTER :: mm_atom_index
218 INTEGER, DIMENSION(:), POINTER :: mm_link_atoms
219 REAL(kind=dp), DIMENSION(:), POINTER :: mm_atom_chrg
220 REAL(kind=dp), DIMENSION(:), POINTER :: mm_el_pot_radius
221 REAL(kind=dp), DIMENSION(:), POINTER :: mm_el_pot_radius_corr
222 TYPE(qmmm_pot_p_type), DIMENSION(:), POINTER :: potentials
223 TYPE(qmmm_per_pot_p_type), DIMENSION(:), POINTER :: per_potentials
224 TYPE(gridlevel_info_type) :: gridlevel_info
225 TYPE(qmmm_gaussian_p_type), DIMENSION(:), POINTER :: pgfs
226 TYPE(pw_pool_p_type), DIMENSION(:), POINTER :: aug_pools
227 TYPE(qmmm_links_type), POINTER :: qmmm_links
228 TYPE(add_set_type), POINTER :: added_charges
229 TYPE(add_shell_type), POINTER :: added_shells
230 TYPE(image_charge_type), POINTER :: image_charge_pot
231 TYPE(ewald_environment_type), POINTER :: ewald_env
232 TYPE(ewald_pw_type), POINTER :: ewald_pw
233 END TYPE qmmm_env_qm_type
234
235! **************************************************************************************************
236!> \brief ...
237! **************************************************************************************************
239 LOGICAL :: qmmm_link
240 LOGICAL :: use_qmmm_ff
241 LOGICAL :: multiple_potential
242 INTEGER :: qmmm_coupl_type
243 INTEGER, DIMENSION(:), POINTER :: qm_atom_index
244 INTEGER, DIMENSION(:), POINTER :: mm_link_atoms
245 REAL(kind=dp), DIMENSION(:), POINTER :: mm_link_scale_factor
246 REAL(kind=dp), DIMENSION(:), POINTER :: fist_scale_charge_link
247 INTEGER, DIMENSION(:), POINTER :: qm_molecule_index
248 TYPE(input_info_type), POINTER :: inp_info
249 END TYPE qmmm_env_mm_type
250
251CONTAINS
252
253! **************************************************************************************************
254!> \brief ...
255!> \param qmmm_env ...
256!> \author Teodoro Laino
257! **************************************************************************************************
258 SUBROUTINE qmmm_env_mm_create(qmmm_env)
259 TYPE(qmmm_env_mm_type), INTENT(OUT) :: qmmm_env
260
261 NULLIFY (qmmm_env%qm_atom_index, &
262 qmmm_env%qm_molecule_index, &
263 qmmm_env%mm_link_atoms, &
264 qmmm_env%mm_link_scale_factor, &
265 qmmm_env%fist_scale_charge_link, &
266 qmmm_env%inp_info)
267 qmmm_env%qmmm_coupl_type = do_qmmm_none
268 qmmm_env%qmmm_link = .false.
269 qmmm_env%use_qmmm_ff = .false.
270 ALLOCATE (qmmm_env%inp_info)
271 CALL init_inp_info(qmmm_env%inp_info)
272 END SUBROUTINE qmmm_env_mm_create
273
274! **************************************************************************************************
275!> \brief releases the given qmmm_env (see doc/ReferenceCounting.html)
276!> \param qmmm_env the object to release
277!> \author Fawzi Mohamed
278!> Teodoro Laino
279! **************************************************************************************************
280 SUBROUTINE qmmm_env_mm_release(qmmm_env)
281 TYPE(qmmm_env_mm_type), INTENT(INOUT) :: qmmm_env
282
283 IF (ASSOCIATED(qmmm_env%qm_atom_index)) THEN
284 DEALLOCATE (qmmm_env%qm_atom_index)
285 END IF
286 IF (ASSOCIATED(qmmm_env%qm_molecule_index)) THEN
287 DEALLOCATE (qmmm_env%qm_molecule_index)
288 END IF
289 IF (ASSOCIATED(qmmm_env%mm_link_atoms)) THEN
290 DEALLOCATE (qmmm_env%mm_link_atoms)
291 END IF
292 IF (ASSOCIATED(qmmm_env%mm_link_scale_factor)) THEN
293 DEALLOCATE (qmmm_env%mm_link_scale_factor)
294 END IF
295 IF (ASSOCIATED(qmmm_env%fist_scale_charge_link)) THEN
296 DEALLOCATE (qmmm_env%fist_scale_charge_link)
297 END IF
298 IF (ASSOCIATED(qmmm_env%inp_info)) THEN
299 CALL deallocate_inp_info(qmmm_env%inp_info)
300 DEALLOCATE (qmmm_env%inp_info)
301 END IF
302
303 END SUBROUTINE qmmm_env_mm_release
304
305! **************************************************************************************************
306!> \brief ...
307!> \param qmmm_env ...
308!> \author Fawzi Mohamed
309! **************************************************************************************************
310 SUBROUTINE qmmm_env_qm_create(qmmm_env)
311 TYPE(qmmm_env_qm_type), INTENT(OUT) :: qmmm_env
312
313 NULLIFY (qmmm_env%qm_atom_index, qmmm_env%mm_link_atoms, &
314 qmmm_env%mm_atom_index, qmmm_env%mm_atom_chrg, &
315 qmmm_env%pgfs, qmmm_env%maxradius, &
316 qmmm_env%aug_pools, qmmm_env%potentials, &
317 qmmm_env%qmmm_links, qmmm_env%added_charges, &
318 qmmm_env%per_potentials, qmmm_env%image_charge_pot, &
319 qmmm_env%added_shells)
320 NULLIFY (qmmm_env%ewald_env, qmmm_env%ewald_pw)
321 qmmm_env%do_translate = .true.
322 qmmm_env%center_qm_subsys = .true.
323 qmmm_env%center_qm_subsys0 = .true.
324 qmmm_env%center_qm_subsys_pbc_aware = .false.
325 qmmm_env%do_force_mixing = .false.
326 qmmm_env%compatibility = .true.
327 qmmm_env%qmmm_link = .false.
328 qmmm_env%add_mm_charges = .false.
329 qmmm_env%move_mm_charges = .false.
330 qmmm_env%periodic = .false.
331 qmmm_env%multipole = .false.
332 qmmm_env%image_charge = .false.
333 qmmm_env%qmmm_coupl_type = do_qmmm_none
334 qmmm_env%num_qm_atoms = 0
335 qmmm_env%num_mm_atoms = 0
336 qmmm_env%num_image_mm_atoms = 0
337 qmmm_env%gridlevel_info%auxbas_grid = 0
338 qmmm_env%gridlevel_info%coarser_grid = 0
339 CALL create_add_set_type(qmmm_env%added_charges, ndim=0)
340 !CALL create_add_shell_type(qmmm_env%added_shells, ndim=0)
341 CALL create_image_charge_type(qmmm_env%image_charge_pot)
342 END SUBROUTINE qmmm_env_qm_create
343
344! **************************************************************************************************
345!> \brief releases the given qmmm_env (see doc/ReferenceCounting.html)
346!> \param qmmm_env the object to release
347!> \author Fawzi Mohamed
348!> Teodoro Laino
349! **************************************************************************************************
350 SUBROUTINE qmmm_env_qm_release(qmmm_env)
351 TYPE(qmmm_env_qm_type), POINTER :: qmmm_env
352
353 IF (ASSOCIATED(qmmm_env%qm_atom_index)) THEN
354 DEALLOCATE (qmmm_env%qm_atom_index)
355 END IF
356 IF (ASSOCIATED(qmmm_env%maxradius)) THEN
357 DEALLOCATE (qmmm_env%maxradius)
358 END IF
359 IF (ASSOCIATED(qmmm_env%mm_atom_index)) THEN
360 DEALLOCATE (qmmm_env%mm_atom_index)
361 END IF
362 IF (ASSOCIATED(qmmm_env%mm_link_atoms)) THEN
363 DEALLOCATE (qmmm_env%mm_link_atoms)
364 END IF
365 IF (ASSOCIATED(qmmm_env%mm_atom_chrg)) THEN
366 DEALLOCATE (qmmm_env%mm_atom_chrg)
367 END IF
368 IF (ASSOCIATED(qmmm_env%mm_el_pot_radius)) THEN
369 DEALLOCATE (qmmm_env%mm_el_pot_radius)
370 END IF
371 IF (ASSOCIATED(qmmm_env%mm_el_pot_radius_corr)) THEN
372 DEALLOCATE (qmmm_env%mm_el_pot_radius_corr)
373 END IF
374 IF (ASSOCIATED(qmmm_env%pgfs)) THEN
375 CALL pgfs_release(qmmm_env%pgfs)
376 DEALLOCATE (qmmm_env%pgfs)
377 END IF
378 IF (ASSOCIATED(qmmm_env%Potentials)) THEN
379 CALL qmmm_pot_type_dealloc(qmmm_env%Potentials)
380 DEALLOCATE (qmmm_env%Potentials)
381 END IF
382 IF (ASSOCIATED(qmmm_env%Per_Potentials)) THEN
383 CALL qmmm_per_pot_type_dealloc(qmmm_env%Per_Potentials)
384 DEALLOCATE (qmmm_env%Per_Potentials)
385 END IF
386 IF (ASSOCIATED(qmmm_env%aug_pools)) THEN
387 CALL pw_pools_dealloc(qmmm_env%aug_pools)
388 END IF
389 IF (ASSOCIATED(qmmm_env%qmmm_links)) THEN
390 CALL qmmm_links_dealloc(qmmm_env%qmmm_links)
391 END IF
392 IF (ASSOCIATED(qmmm_env%added_charges)) THEN
393 CALL add_set_release(qmmm_env%added_charges)
394 END IF
395 IF (ASSOCIATED(qmmm_env%added_shells)) THEN
396 CALL add_shell_release(qmmm_env%added_shells)
397 END IF
398 IF (ASSOCIATED(qmmm_env%image_charge_pot)) THEN
399 IF (qmmm_env%image_charge) THEN
400 IF (qmmm_env%image_charge_pot%image_matrix_method .EQ. do_eri_mme) THEN
401 CALL cp_eri_mme_finalize(qmmm_env%image_charge_pot%eri_mme_param)
402 END IF
403 END IF
404 CALL qmmm_image_charge_dealloc(qmmm_env%image_charge_pot)
405 END IF
406 IF (ASSOCIATED(qmmm_env%ewald_env)) THEN
407 CALL ewald_env_release(qmmm_env%ewald_env)
408 DEALLOCATE (qmmm_env%ewald_env)
409 END IF
410 IF (ASSOCIATED(qmmm_env%ewald_pw)) THEN
411 CALL ewald_pw_release(qmmm_env%ewald_pw)
412 DEALLOCATE (qmmm_env%ewald_pw)
413 END IF
414
415 END SUBROUTINE qmmm_env_qm_release
416
417! **************************************************************************************************
418!> \brief deallocates the pgfs type
419!> \param pgfs ...
420!> \author Teodoro Laino
421! **************************************************************************************************
422 SUBROUTINE pgfs_release(pgfs)
423 TYPE(qmmm_gaussian_p_type), DIMENSION(:), POINTER :: pgfs
424
425 INTEGER :: i
426
427 DO i = 1, SIZE(pgfs)
428 IF (ASSOCIATED(pgfs(i)%pgf)) THEN
429 IF (ASSOCIATED(pgfs(i)%pgf%Ak)) THEN
430 DEALLOCATE (pgfs(i)%pgf%Ak)
431 END IF
432 IF (ASSOCIATED(pgfs(i)%pgf%Gk)) THEN
433 DEALLOCATE (pgfs(i)%pgf%Gk)
434 END IF
435 IF (ASSOCIATED(pgfs(i)%pgf%grid_level)) THEN
436 DEALLOCATE (pgfs(i)%pgf%grid_level)
437 END IF
438 DEALLOCATE (pgfs(i)%pgf)
439 END IF
440 END DO
441 END SUBROUTINE pgfs_release
442
443! **************************************************************************************************
444!> \brief deallocates the qmmm_links structure
445!> \param qmmm_links ...
446!> \author Teodoro Laino
447! **************************************************************************************************
448 SUBROUTINE qmmm_links_dealloc(qmmm_links)
449 TYPE(qmmm_links_type), POINTER :: qmmm_links
450
451 INTEGER :: i
452
453 IF (ASSOCIATED(qmmm_links%imomm)) THEN
454 DO i = 1, SIZE(qmmm_links%imomm)
455 IF (ASSOCIATED(qmmm_links%imomm(i)%link)) DEALLOCATE (qmmm_links%imomm(i)%link)
456 END DO
457 DEALLOCATE (qmmm_links%imomm)
458 END IF
459 IF (ASSOCIATED(qmmm_links%pseudo)) THEN
460 DO i = 1, SIZE(qmmm_links%pseudo)
461 IF (ASSOCIATED(qmmm_links%pseudo(i)%link)) DEALLOCATE (qmmm_links%pseudo(i)%link)
462 END DO
463 DEALLOCATE (qmmm_links%pseudo)
464 END IF
465 DEALLOCATE (qmmm_links)
466 END SUBROUTINE qmmm_links_dealloc
467
468! ****************************************************************************
469!> \brief deallocates the image_charge_pot structure
470!> \param image_charge_pot ...
471!> \author Dorothea Golze
472! **************************************************************************************************
473 SUBROUTINE qmmm_image_charge_dealloc(image_charge_pot)
474 TYPE(image_charge_type), POINTER :: image_charge_pot
475
476 IF (ASSOCIATED(image_charge_pot)) THEN
477 IF (ASSOCIATED(image_charge_pot%image_mm_list)) THEN
478 IF (.NOT. image_charge_pot%all_mm) THEN
479 DEALLOCATE (image_charge_pot%image_mm_list)
480 END IF
481 END IF
482 IF (ASSOCIATED(image_charge_pot%image_forcesMM)) THEN
483 DEALLOCATE (image_charge_pot%image_forcesMM)
484 END IF
485 DEALLOCATE (image_charge_pot)
486 END IF
487 END SUBROUTINE qmmm_image_charge_dealloc
488
489! **************************************************************************************************
490!> \brief deallocates the qmmm_pot_type structure
491!> \param Potentials ...
492!> \author Teodoro Laino
493! **************************************************************************************************
494 SUBROUTINE qmmm_pot_type_dealloc(Potentials)
495 TYPE(qmmm_pot_p_type), DIMENSION(:), POINTER :: potentials
496
497 INTEGER :: i
498
499 DO i = 1, SIZE(potentials)
500 IF (ASSOCIATED(potentials(i)%Pot)) THEN
501 IF (ASSOCIATED(potentials(i)%Pot%pot0_2)) THEN
502 DEALLOCATE (potentials(i)%Pot%pot0_2)
503 END IF
504 IF (ASSOCIATED(potentials(i)%Pot%mm_atom_index)) THEN
505 DEALLOCATE (potentials(i)%Pot%mm_atom_index)
506 END IF
507 DEALLOCATE (potentials(i)%Pot)
508 END IF
509 END DO
510
511 END SUBROUTINE qmmm_pot_type_dealloc
512
513! **************************************************************************************************
514!> \brief deallocates the qmmm_per_pot_type structure
515!> for QM/MM periodic boundary conditions
516!> \param Per_Potentials ...
517!> \author Teodoro Laino
518! **************************************************************************************************
519 SUBROUTINE qmmm_per_pot_type_dealloc(Per_Potentials)
520 TYPE(qmmm_per_pot_p_type), DIMENSION(:), POINTER :: per_potentials
521
522 INTEGER :: i
523
524 DO i = 1, SIZE(per_potentials)
525 IF (ASSOCIATED(per_potentials(i)%Pot)) THEN
526 IF (ASSOCIATED(per_potentials(i)%Pot%LG)) THEN
527 DEALLOCATE (per_potentials(i)%Pot%LG)
528 END IF
529 IF (ASSOCIATED(per_potentials(i)%Pot%gx)) THEN
530 DEALLOCATE (per_potentials(i)%Pot%gx)
531 END IF
532 IF (ASSOCIATED(per_potentials(i)%Pot%gy)) THEN
533 DEALLOCATE (per_potentials(i)%Pot%gy)
534 END IF
535 IF (ASSOCIATED(per_potentials(i)%Pot%gz)) THEN
536 DEALLOCATE (per_potentials(i)%Pot%gz)
537 END IF
538 IF (ASSOCIATED(per_potentials(i)%Pot%mm_atom_index)) THEN
539 DEALLOCATE (per_potentials(i)%Pot%mm_atom_index)
540 END IF
541 IF (ASSOCIATED(per_potentials(i)%Pot%TabLR)) THEN
542 CALL per_potentials(i)%Pot%pw_pool%give_back_pw(per_potentials(i)%Pot%TabLR)
543 DEALLOCATE (per_potentials(i)%Pot%TabLR)
544 END IF
545 IF (ASSOCIATED(per_potentials(i)%Pot%pw_pool)) THEN
546 CALL pw_pool_release(per_potentials(i)%Pot%pw_pool)
547 cpassert(.NOT. ASSOCIATED(per_potentials(i)%Pot%pw_pool))
548 END IF
549 IF (ASSOCIATED(per_potentials(i)%Pot%pw_grid)) THEN
550 CALL pw_grid_release(per_potentials(i)%Pot%pw_grid)
551 cpassert(.NOT. ASSOCIATED(per_potentials(i)%Pot%pw_grid))
552 END IF
553 DEALLOCATE (per_potentials(i)%Pot)
554 END IF
555 END DO
556
557 END SUBROUTINE qmmm_per_pot_type_dealloc
558
559! **************************************************************************************************
560!> \brief deallocates the add_set_release
561!> \param added_charges ...
562!> \author Teodoro Laino
563! **************************************************************************************************
564 SUBROUTINE add_set_release(added_charges)
565 TYPE(add_set_type), POINTER :: added_charges
566
567 IF (ASSOCIATED(added_charges)) THEN
568 IF (ASSOCIATED(added_charges%add_env)) THEN
569 DEALLOCATE (added_charges%add_env)
570 END IF
571 IF (ASSOCIATED(added_charges%added_particles)) THEN
572 CALL deallocate_particle_set(added_charges%added_particles)
573 END IF
574 IF (ASSOCIATED(added_charges%mm_atom_index)) THEN
575 DEALLOCATE (added_charges%mm_atom_index)
576 END IF
577 IF (ASSOCIATED(added_charges%mm_atom_chrg)) THEN
578 DEALLOCATE (added_charges%mm_atom_chrg)
579 END IF
580 IF (ASSOCIATED(added_charges%mm_el_pot_radius)) THEN
581 DEALLOCATE (added_charges%mm_el_pot_radius)
582 END IF
583 IF (ASSOCIATED(added_charges%mm_el_pot_radius_corr)) THEN
584 DEALLOCATE (added_charges%mm_el_pot_radius_corr)
585 END IF
586 IF (ASSOCIATED(added_charges%Potentials)) THEN
587 CALL qmmm_pot_type_dealloc(added_charges%Potentials)
588 DEALLOCATE (added_charges%Potentials)
589 END IF
590 IF (ASSOCIATED(added_charges%Per_Potentials)) THEN
591 CALL qmmm_per_pot_type_dealloc(added_charges%Per_Potentials)
592 DEALLOCATE (added_charges%Per_Potentials)
593 END IF
594 IF (ASSOCIATED(added_charges%pgfs)) THEN
595 CALL pgfs_release(added_charges%pgfs)
596 DEALLOCATE (added_charges%pgfs)
597 END IF
598 DEALLOCATE (added_charges)
599 END IF
600 END SUBROUTINE add_set_release
601
602! **************************************************************************************************
603!> \brief deallocates the add_shell_release
604!> \param added_shells ...
605!> \author MattW
606! **************************************************************************************************
607 SUBROUTINE add_shell_release(added_shells)
608
609 TYPE(add_shell_type), POINTER :: added_shells
610
611 IF (ASSOCIATED(added_shells)) THEN
612 IF (ASSOCIATED(added_shells%added_particles)) THEN
613 !XXXFIST should clean up shell particles
614 NULLIFY (added_shells%added_particles)
615 NULLIFY (added_shells%added_cores)
616 !CALL deallocate_particle_set(added_shells%added_particles)
617 END IF
618 IF (ASSOCIATED(added_shells%mm_core_index)) THEN
619 DEALLOCATE (added_shells%mm_core_index)
620 END IF
621 IF (ASSOCIATED(added_shells%mm_core_chrg)) THEN
622 DEALLOCATE (added_shells%mm_core_chrg)
623 END IF
624 IF (ASSOCIATED(added_shells%mm_el_pot_radius)) THEN
625 DEALLOCATE (added_shells%mm_el_pot_radius)
626 END IF
627 IF (ASSOCIATED(added_shells%mm_el_pot_radius_corr)) THEN
628 DEALLOCATE (added_shells%mm_el_pot_radius_corr)
629 END IF
630 IF (ASSOCIATED(added_shells%Potentials)) THEN
631 CALL qmmm_pot_type_dealloc(added_shells%Potentials)
632 DEALLOCATE (added_shells%Potentials)
633 END IF
634 IF (ASSOCIATED(added_shells%Per_Potentials)) THEN
635 CALL qmmm_per_pot_type_dealloc(added_shells%Per_Potentials)
636 DEALLOCATE (added_shells%Per_Potentials)
637 END IF
638 IF (ASSOCIATED(added_shells%pgfs)) THEN
639 CALL pgfs_release(added_shells%pgfs)
640 DEALLOCATE (added_shells%pgfs)
641 END IF
642 DEALLOCATE (added_shells)
643 END IF
644
645 END SUBROUTINE add_shell_release
646
647! **************************************************************************************************
648!> \brief creates the add_set_type structure
649!> \param added_charges ...
650!> \param ndim ...
651!> \author Teodoro Laino
652! **************************************************************************************************
653 SUBROUTINE create_add_set_type(added_charges, ndim)
654 TYPE(add_set_type), POINTER :: added_charges
655 INTEGER, INTENT(IN) :: ndim
656
657 IF (ASSOCIATED(added_charges)) CALL add_set_release(added_charges)
658 ALLOCATE (added_charges)
659
660 NULLIFY (added_charges%add_env, &
661 added_charges%mm_atom_index, &
662 added_charges%added_particles, &
663 added_charges%mm_atom_chrg, &
664 added_charges%mm_el_pot_radius, &
665 added_charges%mm_el_pot_radius_corr, &
666 added_charges%potentials, &
667 added_charges%per_potentials, &
668 added_charges%pgfs)
669
670 added_charges%num_mm_atoms = ndim
671 IF (ndim == 0) RETURN
672 !
673 ! Allocate leave out just potential and pgfs...
674 !
675 ALLOCATE (added_charges%add_env(ndim))
676 CALL allocate_particle_set(added_charges%added_particles, ndim)
677 ALLOCATE (added_charges%mm_atom_index(ndim))
678 ALLOCATE (added_charges%mm_atom_chrg(ndim))
679 ALLOCATE (added_charges%mm_el_pot_radius(ndim))
680 ALLOCATE (added_charges%mm_el_pot_radius_corr(ndim))
681 END SUBROUTINE create_add_set_type
682
683! **************************************************************************************************
684!> \brief creates the add_shell_type structure
685!> \param added_shells ...
686!> \param ndim ...
687!> \author Teodoro Laino
688! **************************************************************************************************
689
690 SUBROUTINE create_add_shell_type(added_shells, ndim)
691 TYPE(add_shell_type), POINTER :: added_shells
692 INTEGER, INTENT(IN) :: ndim
693
694 IF (ASSOCIATED(added_shells)) CALL add_shell_release(added_shells)
695 ALLOCATE (added_shells)
696
697 NULLIFY (added_shells%mm_core_index, &
698 added_shells%added_particles, &
699 added_shells%added_cores, &
700 added_shells%mm_core_chrg, &
701 added_shells%mm_el_pot_radius, &
702 added_shells%mm_el_pot_radius_corr, &
703 added_shells%potentials, &
704 added_shells%per_potentials, &
705 added_shells%pgfs)
706
707 added_shells%num_mm_atoms = ndim
708 IF (ndim == 0) RETURN
709 !
710 ! Allocate leave out just potential and pgfs...
711 !
712 ALLOCATE (added_shells%mm_core_index(ndim))
713 ALLOCATE (added_shells%mm_core_chrg(ndim))
714 ALLOCATE (added_shells%mm_el_pot_radius(ndim))
715 ALLOCATE (added_shells%mm_el_pot_radius_corr(ndim))
716
717 END SUBROUTINE create_add_shell_type
718
719! **************************************************************************************************
720!> \brief creates the image_charge_type structure
721!> \param image_charge_pot ...
722!> \author Dorothea Golze
723! **************************************************************************************************
724 SUBROUTINE create_image_charge_type(image_charge_pot)
725 TYPE(image_charge_type), POINTER :: image_charge_pot
726
727 IF (ASSOCIATED(image_charge_pot)) CALL qmmm_image_charge_dealloc(image_charge_pot)
728 ALLOCATE (image_charge_pot)
729
730 NULLIFY (image_charge_pot%image_mm_list, &
731 image_charge_pot%particles_all, &
732 image_charge_pot%image_forcesMM)
733
734 image_charge_pot%all_mm = .true.
735 image_charge_pot%coeff_iterative = .false.
736 image_charge_pot%image_restart = .false.
737
738 END SUBROUTINE create_image_charge_type
739
740END MODULE qmmm_types_low
static GRID_HOST_DEVICE double fac(const int i)
Factorial function, e.g. fac(5) = 5! = 120.
Definition grid_common.h:48
Interface to Minimax-Ewald method for periodic ERI's to be used in CP2K.
subroutine, public cp_eri_mme_finalize(param)
Release eri mme data. Prints some statistics on summation methods chosen.
subroutine, public ewald_env_release(ewald_env)
releases the given ewald_env (see doc/ReferenceCounting.html)
subroutine, public ewald_pw_release(ewald_pw)
releases the memory used by the ewald_pw
Define all structures types related to force_fields.
subroutine, public deallocate_inp_info(inp_info)
Specific function to deallocate the inp_info.
subroutine, public init_inp_info(inp_info)
Specific function to initialize the inp_info.
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_qmmm_none
integer, parameter, public do_eri_mme
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Define the data structure for the particle information.
subroutine, public deallocate_particle_set(particle_set)
Deallocate a particle set.
subroutine, public allocate_particle_set(particle_set, nparticle)
Allocate a particle set.
This module defines the grid data type and some basic operations on it.
Definition pw_grids.F:36
subroutine, public pw_grid_release(pw_grid)
releases the given pw grid
Definition pw_grids.F:2133
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
subroutine, public pw_pools_dealloc(pools)
deallocates the given pools (releasing each of the underlying pools)
subroutine, public pw_pool_release(pool)
releases the given pool (see cp2k/doc/ReferenceCounting.html)
Sets the typo for the gaussian treatment of the qm/mm interaction.
integer, parameter, public force_mixing_label_qm_core
integer, parameter, public force_mixing_label_buffer
subroutine, public qmmm_env_mm_create(qmmm_env)
...
subroutine, public create_add_shell_type(added_shells, ndim)
creates the add_shell_type structure
integer, parameter, public force_mixing_label_none
integer, parameter, public force_mixing_label_qm_core_list
integer, parameter, public force_mixing_label_qm_dynamics_list
integer, parameter, public force_mixing_label_termination
subroutine, public qmmm_env_qm_create(qmmm_env)
...
subroutine, public qmmm_env_qm_release(qmmm_env)
releases the given qmmm_env (see doc/ReferenceCounting.html)
integer, parameter, public force_mixing_label_buffer_list
integer, parameter, public force_mixing_label_qm_dynamics
subroutine, public qmmm_env_mm_release(qmmm_env)
releases the given qmmm_env (see doc/ReferenceCounting.html)
subroutine, public create_add_set_type(added_charges, ndim)
creates the add_set_type structure
subroutine, public add_set_release(added_charges)
deallocates the add_set_release
to create arrays of pools
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
represent a pointer to a qmmm_gaussian_type, to be able to create arrays of pointers
parameters for core-shell model potentials
Real Space Potential.