68#include "./base/base_uses.f90"
73 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .false.
74 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'qmmm_gpw_energy'
98 CHARACTER(len=*),
PARAMETER :: routinen =
'qmmm_el_coupling'
100 INTEGER :: handle, iw, iw2
113 CALL timeset(routinen, handle)
115 NULLIFY (ks_qmmm_env_loc, pw_pools, pw_env, input_section, dft_control)
119 input=input_section, &
120 ks_qmmm_env=ks_qmmm_env_loc, &
122 dft_control=dft_control)
125 CALL pw_env_get(pw_env=pw_env, pw_pools=pw_pools)
128 extension=
".qmmmLog")
130 WRITE (iw,
'(T2,"QMMM|",1X,A)')
"Information on the QM/MM Electrostatic Potential:"
134 CALL pw_zero(ks_qmmm_env_loc%v_qmmm_rspace)
135 IF (dft_control%qs_control%semi_empirical)
THEN
137 SELECT CASE (qmmm_env%qmmm_coupl_type)
141 IF (iw > 0)
WRITE (iw,
'(T2,"QMMM|",1X,A)') &
142 "No QM/MM Electrostatic coupling. Just Mechanical Coupling!"
145 cpabort(
"Point charge QM/MM electrostatic coupling not yet implemented for SE.")
147 cpabort(
"GAUSS or SWAVE QM/MM electrostatic coupling not yet implemented for SE.")
149 IF (iw > 0)
WRITE (iw,
'(T2,"QMMM|",1X,A)')
"Unknown Coupling..."
152 ELSEIF (dft_control%qs_control%dftb .OR. dft_control%qs_control%xtb)
THEN
154 SELECT CASE (qmmm_env%qmmm_coupl_type)
156 IF (iw > 0)
WRITE (iw,
'(T2,"QMMM|",1X,A)') &
157 "No QM/MM Electrostatic coupling. Just Mechanical Coupling!"
164 cpabort(
"GAUSS or SWAVE QM/MM electrostatic coupling not implemented for DFTB.")
166 IF (iw > 0)
WRITE (iw,
'(T2,"QMMM|",1X,A)')
"Unknown Coupling..."
171 SELECT CASE (qmmm_env%qmmm_coupl_type)
173 cpabort(
"Coulomb QM/MM electrostatic coupling not implemented for GPW/GAPW.")
175 cpabort(
"Point Charge QM/MM electrostatic coupling not implemented for GPW/GAPW.")
178 WRITE (iw,
'(T2,"QMMM|",1X,A)') &
179 "QM/MM Coupling computed collocating the Gaussian Potential Functions."
183 v_qmmm=ks_qmmm_env_loc%v_qmmm_rspace, &
184 mm_particles=mm_particles, &
185 aug_pools=qmmm_env%aug_pools, &
187 eps_mm_rspace=qmmm_env%eps_mm_rspace, &
188 cube_info=ks_qmmm_env_loc%cube_info, &
190 auxbas_grid=qmmm_env%gridlevel_info%auxbas_grid, &
191 coarser_grid=qmmm_env%gridlevel_info%coarser_grid, &
192 interp_section=interp_section, &
195 IF (iw > 0)
WRITE (iw,
'(T2,"QMMM|",1X,A)') &
196 "No QM/MM Electrostatic coupling. Just Mechanical Coupling!"
198 IF (iw > 0)
WRITE (iw,
'(T2,"QMMM|",1X,A)')
"Unknown Coupling..."
206 extension=
".qmmmLog", mpi_io=mpi_io)
208 particles=particles, &
210 title=
"QM/MM: MM ELECTROSTATIC POTENTIAL ", &
213 "POTENTIAL", mpi_io=mpi_io)
218 CALL timestop(handle)
241 aug_pools, cube_info, para_env, eps_mm_rspace, pw_pools, &
242 auxbas_grid, coarser_grid, interp_section, mm_cell)
249 REAL(kind=
dp),
INTENT(IN) :: eps_mm_rspace
251 INTEGER,
INTENT(IN) :: auxbas_grid, coarser_grid
255 CHARACTER(len=*),
PARAMETER :: routinen =
'qmmm_elec_with_gaussian'
257 INTEGER :: handle, handle2, igrid, ilevel, &
258 kind_interp, lb(3), ngrids, ub(3)
262 cpassert(
ASSOCIATED(mm_particles))
263 cpassert(
ASSOCIATED(qmmm_env%mm_atom_chrg))
264 cpassert(
ASSOCIATED(qmmm_env%mm_atom_index))
265 cpassert(
ASSOCIATED(aug_pools))
266 cpassert(
ASSOCIATED(pw_pools))
268 CALL timeset(routinen, handle)
269 ngrids =
SIZE(pw_pools)
277 CALL qmmm_elec_with_gaussian_low(grids, mm_particles, &
278 qmmm_env%mm_atom_chrg, qmmm_env%mm_atom_index, &
279 cube_info, para_env, eps_mm_rspace, qmmm_env%pgfs, &
280 auxbas_grid, coarser_grid, qmmm_env%potentials, &
281 mm_cell=mm_cell, dommoqm=qmmm_env%dOmmOqm, periodic=qmmm_env%periodic, &
282 per_potentials=qmmm_env%per_potentials, par_scheme=qmmm_env%par_scheme, &
283 qmmm_spherical_cutoff=qmmm_env%spherical_cutoff, shells=shells)
285 IF (qmmm_env%move_mm_charges .OR. qmmm_env%add_mm_charges)
THEN
286 CALL qmmm_elec_with_gaussian_low(grids, qmmm_env%added_charges%added_particles, &
287 qmmm_env%added_charges%mm_atom_chrg, &
288 qmmm_env%added_charges%mm_atom_index, &
289 cube_info, para_env, eps_mm_rspace, qmmm_env%added_charges%pgfs, auxbas_grid, &
290 coarser_grid, qmmm_env%added_charges%potentials, &
291 mm_cell=mm_cell, dommoqm=qmmm_env%dOmmOqm, periodic=qmmm_env%periodic, &
292 per_potentials=qmmm_env%added_charges%per_potentials, par_scheme=qmmm_env%par_scheme, &
293 qmmm_spherical_cutoff=qmmm_env%spherical_cutoff, shells=shells)
295 IF (qmmm_env%added_shells%num_mm_atoms .GT. 0)
THEN
297 CALL qmmm_elec_with_gaussian_low(grids, qmmm_env%added_shells%added_particles, &
298 qmmm_env%added_shells%mm_core_chrg, &
299 qmmm_env%added_shells%mm_core_index, &
300 cube_info, para_env, eps_mm_rspace, qmmm_env%added_shells%pgfs, auxbas_grid, &
301 coarser_grid, qmmm_env%added_shells%potentials, &
302 mm_cell=mm_cell, dommoqm=qmmm_env%dOmmOqm, periodic=qmmm_env%periodic, &
303 per_potentials=qmmm_env%added_shells%per_potentials, &
304 par_scheme=qmmm_env%par_scheme, qmmm_spherical_cutoff=qmmm_env%spherical_cutoff, &
309 DO ilevel = 1,
SIZE(grids)
310 CALL para_env%sum(grids(ilevel)%array)
315 SELECT CASE (kind_interp)
319 CALL timeset(trim(routinen)//
":spline3Int", handle2)
320 DO ilevel = coarser_grid, auxbas_grid + 1, -1
323 aug_pools(ilevel)%pool, &
324 param_section=interp_section)
326 CALL timestop(handle2)
330 lb = v_qmmm%pw_grid%bounds_local(1, :)
331 ub = v_qmmm%pw_grid%bounds_local(2, :)
333 v_qmmm%array = grids(auxbas_grid)%array(lb(1):ub(1), &
339 CALL timestop(handle)
367 SUBROUTINE qmmm_elec_with_gaussian_low(tmp_grid, mm_particles, mm_charges, &
368 mm_atom_index, cube_info, para_env, &
369 eps_mm_rspace, pgfs, auxbas_grid, coarser_grid, &
370 potentials, mm_cell, dOmmOqm, periodic, per_potentials, par_scheme, &
371 qmmm_spherical_cutoff, shells)
374 REAL(kind=
dp),
DIMENSION(:),
POINTER :: mm_charges
375 INTEGER,
DIMENSION(:),
POINTER :: mm_atom_index
378 REAL(kind=
dp),
INTENT(IN) :: eps_mm_rspace
380 INTEGER,
INTENT(IN) :: auxbas_grid, coarser_grid
383 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: dommoqm
384 LOGICAL,
INTENT(IN) :: periodic
386 INTEGER,
INTENT(IN) :: par_scheme
387 REAL(kind=
dp),
INTENT(IN) :: qmmm_spherical_cutoff(2)
388 LOGICAL,
INTENT(IN) :: shells
390 CHARACTER(len=*),
PARAMETER :: routinen =
'qmmm_elec_with_gaussian_low', &
391 routinenb =
'qmmm_elec_gaussian_low'
393 INTEGER :: handle, handle2, igauss, ilevel, imm, &
394 indmm, iradtyp, lindmm, myind, &
396 INTEGER,
DIMENSION(2, 3) :: bo2
397 REAL(kind=
dp) :: alpha, height, sph_chrg_factor, w
398 REAL(kind=
dp),
DIMENSION(3) :: ra
399 REAL(kind=
dp),
DIMENSION(:),
POINTER :: xdat, ydat, zdat
404 NULLIFY (pgf, pot, per_pot, xdat, ydat, zdat)
405 CALL timeset(routinen, handle)
406 CALL timeset(routinenb//
"_G", handle2)
407 bo2 = tmp_grid(auxbas_grid)%pw_grid%bounds
408 ALLOCATE (xdat(bo2(1, 1):bo2(2, 1)))
409 ALLOCATE (ydat(bo2(1, 2):bo2(2, 2)))
410 ALLOCATE (zdat(bo2(1, 3):bo2(2, 3)))
412 radius:
DO iradtyp = 1,
SIZE(pgfs)
413 pgf => pgfs(iradtyp)%pgf
414 pot => potentials(iradtyp)%pot
417 per_pot => per_potentials(iradtyp)%pot
418 n_rep_real = per_pot%n_rep_real
420 gaussian:
DO igauss = 1, pgf%Number_of_Gaussians
421 alpha = 1.0_dp/pgf%Gk(igauss)
423 height = pgf%Ak(igauss)
424 ilevel = pgf%grid_level(igauss)
425 atoms:
DO imm = 1,
SIZE(pot%mm_atom_index)
428 IF (mod(myind, para_env%num_pe) /= para_env%mepos) cycle atoms
430 lindmm = pot%mm_atom_index(imm)
431 indmm = mm_atom_index(lindmm)
433 ra(:) =
pbc(mm_particles(lindmm)%r - dommoqm, mm_cell) + dommoqm
435 ra(:) =
pbc(mm_particles(indmm)%r - dommoqm, mm_cell) + dommoqm
437 w = mm_charges(lindmm)*height
439 IF (qmmm_spherical_cutoff(1) > 0.0_dp)
THEN
441 w = w*sph_chrg_factor
443 IF (abs(w) <= epsilon(0.0_dp)) cycle atoms
448 pwgrid=tmp_grid(ilevel), &
449 cube_info=cube_info(ilevel), &
450 eps_mm_rspace=eps_mm_rspace, &
455 n_rep_real=n_rep_real, &
460 IF (
ASSOCIATED(xdat))
THEN
463 IF (
ASSOCIATED(ydat))
THEN
466 IF (
ASSOCIATED(zdat))
THEN
469 CALL timestop(handle2)
470 CALL timeset(routinenb//
"_R", handle2)
474 cgrid=tmp_grid(coarser_grid), &
475 mm_charges=mm_charges, &
476 mm_atom_index=mm_atom_index, &
477 mm_particles=mm_particles, &
479 per_potentials=per_potentials, &
482 par_scheme=par_scheme, &
483 qmmm_spherical_cutoff=qmmm_spherical_cutoff, &
488 grid=tmp_grid(coarser_grid), &
489 mm_charges=mm_charges, &
490 mm_atom_index=mm_atom_index, &
491 mm_particles=mm_particles, &
493 potentials=potentials, &
496 par_scheme=par_scheme, &
497 qmmm_spherical_cutoff=qmmm_spherical_cutoff, &
500 CALL timestop(handle2)
501 CALL timestop(handle)
503 END SUBROUTINE qmmm_elec_with_gaussian_low
530 mm_particles, para_env, per_potentials, &
531 mm_cell, dOmmOqm, par_scheme, qmmm_spherical_cutoff, shells)
534 REAL(kind=
dp),
DIMENSION(:),
POINTER :: mm_charges
535 INTEGER,
DIMENSION(:),
POINTER :: mm_atom_index
540 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: dommoqm
541 INTEGER,
INTENT(IN) :: par_scheme
542 REAL(kind=
dp),
DIMENSION(2),
INTENT(IN) :: qmmm_spherical_cutoff
545 CHARACTER(len=*),
PARAMETER :: routinen =
'qmmm_elec_with_gaussian_LG'
547 INTEGER :: handle, i, ii1, ii2, ii3, ii4, ij1, ij2, &
548 ij3, ij4, ik1, ik2, ik3, ik4, imm, &
549 indmm, iradtyp, ivec(3), j, k, lindmm, &
550 my_j, my_k, myind, npts(3)
551 INTEGER,
DIMENSION(2, 3) :: bo, gbo
552 REAL(kind=
dp) :: a1, a2, a3, abc_x(4, 4), abc_x_y(4), b1, b2, b3, c1, c2, c3, d1, d2, d3, &
553 dr1, dr1c, dr2, dr2c, dr3, dr3c, e1, e2, e3, f1, f2, f3, g1, g2, g3, h1, h2, h3, p1, p2, &
554 p3, q1, q2, q3, qt, r1, r2, r3, rt1, rt2, rt3, rv1, rv2, rv3, s1, s2, s3, s4, &
555 sph_chrg_factor, t1, t2, t3, t4, u1, u2, u3, v1, v2, v3, v4, val, xd1, xd2, xd3, xs1, &
557 REAL(kind=
dp),
DIMENSION(3) :: ra, vec
558 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: grid, grid2
562 CALL timeset(routinen, handle)
564 dr1c = cgrid%pw_grid%dr(1)
565 dr2c = cgrid%pw_grid%dr(2)
566 dr3c = cgrid%pw_grid%dr(3)
567 gbo = cgrid%pw_grid%bounds
568 bo = cgrid%pw_grid%bounds_local
571 radius:
DO iradtyp = 1,
SIZE(pgfs)
572 per_pot => per_potentials(iradtyp)%pot
574 npts = pw%pw_grid%npts
575 dr1 = pw%pw_grid%dr(1)
576 dr2 = pw%pw_grid%dr(2)
577 dr3 = pw%pw_grid%dr(3)
578 grid => pw%array(:, :, :)
590 atoms:
DO imm = 1,
SIZE(per_pot%mm_atom_index)
592 myind = imm + (iradtyp - 1)*
SIZE(per_pot%mm_atom_index)
593 IF (mod(myind, para_env%num_pe) /= para_env%mepos) cycle
595 lindmm = per_pot%mm_atom_index(imm)
596 indmm = mm_atom_index(lindmm)
597 qt = mm_charges(lindmm)
599 ra(:) =
pbc(mm_particles(lindmm)%r - dommoqm, mm_cell) + dommoqm
601 ra(:) =
pbc(mm_particles(indmm)%r - dommoqm, mm_cell) + dommoqm
604 IF (qmmm_spherical_cutoff(1) > 0.0_dp)
THEN
606 qt = qt*sph_chrg_factor
608 IF (abs(qt) <= epsilon(0.0_dp)) cycle atoms
612 loopongrid:
DO k = bo(1, 3), bo(2, 3)
614 xs3 = real(my_k,
dp)*dr3c
615 my_j = bo(1, 2) - gbo(1, 2)
616 xs2 = real(my_j,
dp)*dr2c
619 ivec(3) = floor(vec(3)/pw%pw_grid%dr(3))
620 xd3 = (vec(3)/dr3) - real(ivec(3), kind=
dp)
621 ik1 =
modulo(ivec(3) - 1, npts(3)) + 1
622 ik2 =
modulo(ivec(3), npts(3)) + 1
623 ik3 =
modulo(ivec(3) + 1, npts(3)) + 1
624 ik4 =
modulo(ivec(3) + 2, npts(3)) + 1
637 v1 = 1.0_dp/6.0_dp*(64.0_dp - 48.0_dp*p1 + 12.0_dp*p2 - p3)
638 v2 = -22.0_dp/3.0_dp + 10.0_dp*q1 - 4.0_dp*q2 + 0.5_dp*q3
639 v3 = 2.0_dp/3.0_dp - 2.0_dp*r1 + 2.0_dp*r2 - 0.5_dp*r3
640 v4 = 1.0_dp/6.0_dp*u3
641 DO j = bo(1, 2), bo(2, 2)
642 xs1 = (bo(1, 1) - gbo(1, 1))*dr1c
645 ivec(2) = floor(vec(2)/pw%pw_grid%dr(2))
646 xd2 = (vec(2)/dr2) - real(ivec(2), kind=
dp)
647 ij1 =
modulo(ivec(2) - 1, npts(2)) + 1
648 ij2 =
modulo(ivec(2), npts(2)) + 1
649 ij3 =
modulo(ivec(2) + 1, npts(2)) + 1
650 ij4 =
modulo(ivec(2) + 2, npts(2)) + 1
663 s1 = 1.0_dp/6.0_dp*(64.0_dp - 48.0_dp*e1 + 12.0_dp*e2 - e3)
664 s2 = -22.0_dp/3.0_dp + 10.0_dp*f1 - 4.0_dp*f2 + 0.5_dp*f3
665 s3 = 2.0_dp/3.0_dp - 2.0_dp*g1 + 2.0_dp*g2 - 0.5_dp*g3
666 s4 = 1.0_dp/6.0_dp*h3
667 DO i = bo(1, 1), bo(2, 1)
670 ivec(1) = floor(vec(1)/pw%pw_grid%dr(1))
671 xd1 = (vec(1)/dr1) - real(ivec(1), kind=
dp)
672 ii1 =
modulo(ivec(1) - 1, npts(1)) + 1
673 ii2 =
modulo(ivec(1), npts(1)) + 1
674 ii3 =
modulo(ivec(1) + 1, npts(1)) + 1
675 ii4 =
modulo(ivec(1) + 2, npts(1)) + 1
692 t1 = 1.0_dp/6.0_dp*(64.0_dp - 48.0_dp*a1 + 12.0_dp*a2 - a3)
693 t2 = -22.0_dp/3.0_dp + 10.0_dp*b1 - 4.0_dp*b2 + 0.5_dp*b3
694 t3 = 2.0_dp/3.0_dp - 2.0_dp*c1 + 2.0_dp*c2 - 0.5_dp*c3
695 t4 = 1.0_dp/6.0_dp*d3
697 abc_x(1, 1) = grid(ii1, ij1, ik1)*v1 + grid(ii1, ij1, ik2)*v2 + grid(ii1, ij1, ik3)*v3 + grid(ii1, ij1, ik4)*v4
698 abc_x(1, 2) = grid(ii1, ij2, ik1)*v1 + grid(ii1, ij2, ik2)*v2 + grid(ii1, ij2, ik3)*v3 + grid(ii1, ij2, ik4)*v4
699 abc_x(1, 3) = grid(ii1, ij3, ik1)*v1 + grid(ii1, ij3, ik2)*v2 + grid(ii1, ij3, ik3)*v3 + grid(ii1, ij3, ik4)*v4
700 abc_x(1, 4) = grid(ii1, ij4, ik1)*v1 + grid(ii1, ij4, ik2)*v2 + grid(ii1, ij4, ik3)*v3 + grid(ii1, ij4, ik4)*v4
701 abc_x(2, 1) = grid(ii2, ij1, ik1)*v1 + grid(ii2, ij1, ik2)*v2 + grid(ii2, ij1, ik3)*v3 + grid(ii2, ij1, ik4)*v4
702 abc_x(2, 2) = grid(ii2, ij2, ik1)*v1 + grid(ii2, ij2, ik2)*v2 + grid(ii2, ij2, ik3)*v3 + grid(ii2, ij2, ik4)*v4
703 abc_x(2, 3) = grid(ii2, ij3, ik1)*v1 + grid(ii2, ij3, ik2)*v2 + grid(ii2, ij3, ik3)*v3 + grid(ii2, ij3, ik4)*v4
704 abc_x(2, 4) = grid(ii2, ij4, ik1)*v1 + grid(ii2, ij4, ik2)*v2 + grid(ii2, ij4, ik3)*v3 + grid(ii2, ij4, ik4)*v4
705 abc_x(3, 1) = grid(ii3, ij1, ik1)*v1 + grid(ii3, ij1, ik2)*v2 + grid(ii3, ij1, ik3)*v3 + grid(ii3, ij1, ik4)*v4
706 abc_x(3, 2) = grid(ii3, ij2, ik1)*v1 + grid(ii3, ij2, ik2)*v2 + grid(ii3, ij2, ik3)*v3 + grid(ii3, ij2, ik4)*v4
707 abc_x(3, 3) = grid(ii3, ij3, ik1)*v1 + grid(ii3, ij3, ik2)*v2 + grid(ii3, ij3, ik3)*v3 + grid(ii3, ij3, ik4)*v4
708 abc_x(3, 4) = grid(ii3, ij4, ik1)*v1 + grid(ii3, ij4, ik2)*v2 + grid(ii3, ij4, ik3)*v3 + grid(ii3, ij4, ik4)*v4
709 abc_x(4, 1) = grid(ii4, ij1, ik1)*v1 + grid(ii4, ij1, ik2)*v2 + grid(ii4, ij1, ik3)*v3 + grid(ii4, ij1, ik4)*v4
710 abc_x(4, 2) = grid(ii4, ij2, ik1)*v1 + grid(ii4, ij2, ik2)*v2 + grid(ii4, ij2, ik3)*v3 + grid(ii4, ij2, ik4)*v4
711 abc_x(4, 3) = grid(ii4, ij3, ik1)*v1 + grid(ii4, ij3, ik2)*v2 + grid(ii4, ij3, ik3)*v3 + grid(ii4, ij3, ik4)*v4
712 abc_x(4, 4) = grid(ii4, ij4, ik1)*v1 + grid(ii4, ij4, ik2)*v2 + grid(ii4, ij4, ik3)*v3 + grid(ii4, ij4, ik4)*v4
714 abc_x_y(1) = abc_x(1, 1)*t1 + abc_x(2, 1)*t2 + abc_x(3, 1)*t3 + abc_x(4, 1)*t4
715 abc_x_y(2) = abc_x(1, 2)*t1 + abc_x(2, 2)*t2 + abc_x(3, 2)*t3 + abc_x(4, 2)*t4
716 abc_x_y(3) = abc_x(1, 3)*t1 + abc_x(2, 3)*t2 + abc_x(3, 3)*t3 + abc_x(4, 3)*t4
717 abc_x_y(4) = abc_x(1, 4)*t1 + abc_x(2, 4)*t2 + abc_x(3, 4)*t3 + abc_x(4, 4)*t4
719 val = abc_x_y(1)*s1 + abc_x_y(2)*s2 + abc_x_y(3)*s3 + abc_x_y(4)*s4
721 grid2(i, j, k) = grid2(i, j, k) - val*qt
731 CALL timestop(handle)
755 mm_particles, para_env, potentials, &
756 mm_cell, dOmmOqm, par_scheme, qmmm_spherical_cutoff, shells)
759 REAL(kind=
dp),
DIMENSION(:),
POINTER :: mm_charges
760 INTEGER,
DIMENSION(:),
POINTER :: mm_atom_index
765 REAL(kind=
dp),
DIMENSION(3),
INTENT(IN) :: dommoqm
766 INTEGER,
INTENT(IN) :: par_scheme
767 REAL(kind=
dp),
DIMENSION(2),
INTENT(IN) :: qmmm_spherical_cutoff
770 CHARACTER(len=*),
PARAMETER :: routinen =
'qmmm_elec_with_gaussian_LR'
772 INTEGER :: handle, i, imm, indmm, iradtyp, ix, j, &
773 k, lindmm, my_j, my_k, myind, n1, n2, &
775 INTEGER,
DIMENSION(2, 3) :: bo, gbo
776 REAL(kind=
dp) :: dr1, dr2, dr3, dx, qt, r, r2, rt1, rt2, &
777 rt3, rv1, rv2, rv3, rx, rx2, rx3, &
778 sph_chrg_factor, term, xs1, xs2, xs3
779 REAL(kind=
dp),
DIMENSION(3) :: ra
780 REAL(kind=
dp),
DIMENSION(:, :),
POINTER :: pot0_2
781 REAL(kind=
dp),
DIMENSION(:, :, :),
POINTER :: grid2
784 CALL timeset(routinen, handle)
785 n1 = grid%pw_grid%npts(1)
786 n2 = grid%pw_grid%npts(2)
787 n3 = grid%pw_grid%npts(3)
788 dr1 = grid%pw_grid%dr(1)
789 dr2 = grid%pw_grid%dr(2)
790 dr3 = grid%pw_grid%dr(3)
791 gbo = grid%pw_grid%bounds
792 bo = grid%pw_grid%bounds_local
795 radius:
DO iradtyp = 1,
SIZE(pgfs)
796 pot => potentials(iradtyp)%pot
804 atoms:
DO imm = 1,
SIZE(pot%mm_atom_index)
806 myind = imm + (iradtyp - 1)*
SIZE(pot%mm_atom_index)
807 IF (mod(myind, para_env%num_pe) /= para_env%mepos) cycle
809 lindmm = pot%mm_atom_index(imm)
810 indmm = mm_atom_index(lindmm)
811 ra(:) =
pbc(mm_particles(indmm)%r - dommoqm, mm_cell) + dommoqm
812 qt = mm_charges(lindmm)
814 ra(:) =
pbc(mm_particles(lindmm)%r - dommoqm, mm_cell) + dommoqm
816 IF (qmmm_spherical_cutoff(1) > 0.0_dp)
THEN
818 qt = qt*sph_chrg_factor
820 IF (abs(qt) <= epsilon(0.0_dp)) cycle atoms
824 loopongrid:
DO k = bo(1, 3), bo(2, 3)
826 xs3 = real(my_k,
dp)*dr3
827 my_j = bo(1, 2) - gbo(1, 2)
828 xs2 = real(my_j,
dp)*dr2
830 DO j = bo(1, 2), bo(2, 2)
831 xs1 = (bo(1, 1) - gbo(1, 1))*dr1
833 DO i = bo(1, 1), bo(2, 1)
835 r2 = rv1*rv1 + rv2*rv2 + rv3*rv3
838 rx = (r - real(ix - 1,
dp)*dx)/dx
841 term = pot0_2(1, ix)*(1.0_dp - 3.0_dp*rx2 + 2.0_dp*rx3) &
842 + pot0_2(2, ix)*(rx - 2.0_dp*rx2 + rx3) &
843 + pot0_2(1, ix + 1)*(3.0_dp*rx2 - 2.0_dp*rx3) &
844 + pot0_2(2, ix + 1)*(-rx2 + rx3)
846 grid2(i, j, k) = grid2(i, j, k) - term*qt
856 CALL timestop(handle)
static GRID_HOST_DEVICE int modulo(int a, int m)
Equivalent of Fortran's MODULO, which always return a positive number. https://gcc....
Handles all functions related to the CELL.
Defines control structures, which contain the parameters and the settings for the DFT-based calculati...
various routines to log and control the output. The idea is that decisions about where to log should ...
type(cp_logger_type) function, pointer, public cp_get_default_logger()
returns the default logger
routines to handle the output, The idea is to remove the decision of wheter to output and what to out...
integer function, public cp_print_key_unit_nr(logger, basis_section, print_key_path, extension, middle_name, local, log_filename, ignore_should_output, file_form, file_position, file_action, file_status, do_backup, on_file, is_new_file, mpi_io, fout)
...
subroutine, public cp_print_key_finished_output(unit_nr, logger, basis_section, print_key_path, local, ignore_should_output, on_file, mpi_io)
should be called after you finish working with a unit obtained with cp_print_key_unit_nr,...
integer, parameter, public cp_p_file
integer function, public cp_print_key_should_output(iteration_info, basis_section, print_key_path, used_print_key, first_time)
returns what should be done with the given property if btest(res,cp_p_store) then the property should...
A wrapper around pw_to_cube() which accepts particle_list_type.
subroutine, public cp_pw_to_cube(pw, unit_nr, title, particles, stride, zero_tails, silent, mpi_io)
...
utils to manipulate splines on the regular grid of a pw
integer, parameter, public spline3_nopbc_interp
subroutine, public pw_prolongate_s3(pw_coarse_in, pw_fine_out, coarse_pool, param_section)
prolongates a function from a coarse grid into a fine one
integer, parameter, public spline3_pbc_interp
for a given dr()/dh(r) this will provide the bounds to be used if one wants to go over a sphere-subre...
Defines the basic variable types.
integer, parameter, public dp
Interface to the message passing library MPI.
Calculate the MM potential by collocating the primitive Gaussian functions (pgf)
subroutine, public collocate_gf_rspace_nopbc(zetp, rp, scale, w, pwgrid, cube_info, eps_mm_rspace, xdat, ydat, zdat, bo2, n_rep_real, mm_cell)
Main driver to collocate gaussian functions on grid without using periodic boundary conditions (NoPBC...
represent a simple array based list of the given type
Define the data structure for the particle information.
container for various plainwaves related things
subroutine, public pw_env_get(pw_env, pw_pools, cube_info, gridlevel_info, auxbas_pw_pool, auxbas_grid, auxbas_rs_desc, auxbas_rs_grid, rs_descs, rs_grids, xc_pw_pool, vdw_pw_pool, poisson_env, interp_section)
returns the various attributes of the pw env
Manages a pool of grids (to be used for example as tmp objects), but can also be used to instantiate ...
Sets the typo for the gaussian treatment of the qm/mm interaction.
A collection of methods to treat the QM/MM electrostatic coupling.
subroutine, public qmmm_elec_with_gaussian(qmmm_env, v_qmmm, mm_particles, aug_pools, cube_info, para_env, eps_mm_rspace, pw_pools, auxbas_grid, coarser_grid, interp_section, mm_cell)
Compute the QM/MM electrostatic Interaction collocating the gaussian Electrostatic Potential.
subroutine, public qmmm_el_coupling(qs_env, qmmm_env, mm_particles, mm_cell)
Main Driver to compute the QM/MM Electrostatic Coupling.
subroutine, public qmmm_elec_with_gaussian_lr(pgfs, grid, mm_charges, mm_atom_index, mm_particles, para_env, potentials, mm_cell, dommoqm, par_scheme, qmmm_spherical_cutoff, shells)
Compute the QM/MM electrostatic Interaction collocating (1/R - Sum_NG Gaussians) on the coarser grid ...
subroutine, public qmmm_elec_with_gaussian_lg(pgfs, cgrid, mm_charges, mm_atom_index, mm_particles, para_env, per_potentials, mm_cell, dommoqm, par_scheme, qmmm_spherical_cutoff, shells)
Compute the QM/MM electrostatic Interaction collocating (1/R - Sum_NG Gaussians) on the coarser grid ...
Calculation of the QMMM Hamiltonian integral matrix <a|\sum_i q_i|b> for semi-empirical methods.
subroutine, public build_se_qmmm_matrix(qs_env, qmmm_env, particles_mm, mm_cell, para_env)
Constructs the 1-el semi-empirical hamiltonian.
TB methods used with QMMM.
subroutine, public build_tb_qmmm_matrix_zero(qs_env, para_env)
Constructs an empty 1-el DFTB hamiltonian.
subroutine, public build_tb_qmmm_matrix_pc(qs_env, qmmm_env, particles_mm, mm_cell, para_env)
Constructs the 1-el DFTB hamiltonian.
subroutine, public build_tb_qmmm_matrix(qs_env, qmmm_env, particles_mm, mm_cell, para_env)
Constructs the 1-el DFTB hamiltonian.
subroutine, public spherical_cutoff_factor(spherical_cutoff, rij, factor)
Computes a spherical cutoff factor for the QMMM interactions.
subroutine, public get_qs_env(qs_env, atomic_kind_set, qs_kind_set, cell, super_cell, cell_ref, use_ref_cell, kpoints, dft_control, mos, sab_orb, sab_all, qmmm, qmmm_periodic, sac_ae, sac_ppl, sac_lri, sap_ppnl, sab_vdw, sab_scp, sap_oce, sab_lrc, sab_se, sab_xtbe, sab_tbe, sab_core, sab_xb, sab_xtb_pp, sab_xtb_nonbond, sab_almo, sab_kp, sab_kp_nosym, particle_set, energy, force, matrix_h, matrix_h_im, matrix_ks, matrix_ks_im, matrix_vxc, run_rtp, rtp, matrix_h_kp, matrix_h_im_kp, matrix_ks_kp, matrix_ks_im_kp, matrix_vxc_kp, kinetic_kp, matrix_s_kp, matrix_w_kp, matrix_s_ri_aux_kp, matrix_s, matrix_s_ri_aux, matrix_w, matrix_p_mp2, matrix_p_mp2_admm, rho, rho_xc, pw_env, ewald_env, ewald_pw, active_space, mpools, input, para_env, blacs_env, scf_control, rel_control, kinetic, qs_charges, vppl, rho_core, rho_nlcc, rho_nlcc_g, ks_env, ks_qmmm_env, wf_history, scf_env, local_particles, local_molecules, distribution_2d, dbcsr_dist, molecule_kind_set, molecule_set, subsys, cp_subsys, oce, local_rho_set, rho_atom_set, task_list, task_list_soft, rho0_atom_set, rho0_mpole, rhoz_set, ecoul_1c, rho0_s_rs, rho0_s_gs, do_kpoints, has_unit_metric, requires_mo_derivs, mo_derivs, mo_loc_history, nkind, natom, nelectron_total, nelectron_spin, efield, neighbor_list_id, linres_control, xas_env, virial, cp_ddapc_env, cp_ddapc_ewald, outer_scf_history, outer_scf_ihistory, x_data, et_coupling, dftb_potential, results, se_taper, se_store_int_env, se_nddo_mpole, se_nonbond_env, admm_env, lri_env, lri_density, exstate_env, ec_env, harris_env, dispersion_env, gcp_env, vee, rho_external, external_vxc, mask, mp2_env, bs_env, kg_env, wanniercentres, atprop, ls_scf_env, do_transport, transport_env, v_hartree_rspace, s_mstruct_changed, rho_changed, potential_changed, forces_up_to_date, mscfg_env, almo_scf_env, gradient_history, variable_history, embed_pot, spin_embed_pot, polar_env, mos_last_converged, eeq, rhs)
Get the QUICKSTEP environment.
types that represent a quickstep subsys
subroutine, public qs_subsys_get(subsys, atomic_kinds, atomic_kind_set, particles, particle_set, local_particles, molecules, molecule_set, molecule_kinds, molecule_kind_set, local_molecules, para_env, colvar_p, shell_particles, core_particles, gci, multipoles, natom, nparticle, ncore, nshell, nkind, atprop, virial, results, cell, cell_ref, use_ref_cell, energy, force, qs_kind_set, cp_subsys, nelectron_total, nelectron_spin)
...
Type defining parameters related to the simulation cell.
type of a logger, at the moment it contains just a print level starting at which level it should be l...
stores all the informations relevant to an mpi environment
represent a list of objects
contained for different pw related things
to create arrays of pools
represent a pointer to a qmmm_gaussian_type, to be able to create arrays of pointers
calculation environment to calculate the ks_qmmm matrix, holds the QM/MM potential and all the needed...