29 #include "../base/base_uses.f90"
35 LOGICAL,
PRIVATE,
PARAMETER :: debug_this_module = .false.
37 CHARACTER(len=*),
PARAMETER,
PRIVATE :: moduleN =
'eri_mme_test'
59 para_env, iw, potential, pot_par, G_count, R_count)
60 TYPE(eri_mme_param),
INTENT(INOUT) :: param
61 INTEGER,
INTENT(IN) :: l_max
62 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
64 REAL(kind=
dp),
DIMENSION(:, :),
INTENT(IN) :: rabc
65 INTEGER,
INTENT(IN) :: nrep
66 LOGICAL,
INTENT(INOUT) :: test_accuracy
67 TYPE(mp_para_env_type),
INTENT(IN) :: para_env
68 INTEGER,
INTENT(IN) :: iw
69 INTEGER,
INTENT(IN),
OPTIONAL :: potential
70 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: pot_par
71 INTEGER,
INTENT(OUT),
OPTIONAL :: g_count, r_count
73 INTEGER :: iab, irep, izet, l, nr, nzet
75 REAL(kind=
dp) :: acc, t0, t1
76 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: time
77 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :, :) :: i_diff, i_ref, i_test
78 REAL(kind=
dp),
DIMENSION(3, 3) :: ht
80 IF (
PRESENT(g_count)) g_count = 0
81 IF (
PRESENT(r_count)) r_count = 0
86 IF (
PRESENT(potential))
THEN
91 IF (test_accuracy)
THEN
92 ht =
twopi*transpose(param%h_inv)
95 i_ref(:, :, :, :) = 0.0_dp
100 i_ref(:, :, iab, izet), 0, 0, &
101 normalize=.true., potential=potential, pot_par=pot_par)
108 ALLOCATE (i_test(
ncoset(l_max),
ncoset(l_max), nr, nzet))
109 ALLOCATE (i_diff(
ncoset(l_max),
ncoset(l_max), nr, nzet))
111 ALLOCATE (time(0:l_max, nzet))
118 i_test(:, :, iab, izet), 0, 0, &
119 g_count=g_count, r_count=r_count, &
124 time(l, izet) = t1 - t0
128 CALL para_env%sum(time)
130 IF (test_accuracy)
THEN
131 i_diff(:, :, :, :) = abs(i_test - i_ref)
135 WRITE (iw,
'(T2, A)')
"ERI_MME| Test results for 2c cpu time"
136 WRITE (iw,
'(T11, A)')
"l, zet, cpu time, accuracy"
140 IF (test_accuracy)
THEN
146 WRITE (iw,
'(T11, I1, 1X, ES9.2, 1X, ES9.2, 1X, ES9.2)') &
147 l, zet(izet), time(l, izet)/nrep, acc
151 IF (test_accuracy)
THEN
152 WRITE (iw,
'(/T2, A, 47X, ES9.2)')
"ERI_MME| Maximum error:", &
155 IF (param%is_ortho)
THEN
156 acc_check = param%err_mm + param%err_c .GE. maxval(i_diff)
161 IF (.NOT. acc_check) &
162 cpabort(
"Actual error greater than upper bound estimate.")
186 para_env, iw, potential, pot_par, GG_count, GR_count, RR_count)
187 TYPE(eri_mme_param),
INTENT(INOUT) :: param
188 INTEGER,
INTENT(IN) :: l_max
189 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:), &
191 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :), &
193 INTEGER,
INTENT(IN) :: nrep
194 INTEGER,
INTENT(IN),
OPTIONAL :: nsample
195 TYPE(mp_para_env_type),
INTENT(IN) :: para_env
196 INTEGER,
INTENT(IN) :: iw
197 INTEGER,
INTENT(IN),
OPTIONAL :: potential
198 REAL(kind=
dp),
INTENT(IN),
OPTIONAL :: pot_par
199 INTEGER,
INTENT(OUT),
OPTIONAL :: gg_count, gr_count, rr_count
201 INTEGER :: ira, irb, irc, irep, ixyz, izeta, izetb, &
202 izetc, la, lb, lc, nintg, nr, ns, nzet
203 REAL(kind=
dp) :: t0, t1, time
204 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: i_test
206 IF (
PRESENT(gg_count)) gg_count = 0
207 IF (
PRESENT(gr_count)) gr_count = 0
208 IF (
PRESENT(rr_count)) rr_count = 0
211 IF (
PRESENT(nsample)) ns = nsample
216 IF (
PRESENT(potential))
THEN
220 IF (param%debug)
THEN
226 CALL overlap_dist_expansion_test(l_max, l_max, zet(izeta), zet(izetb), &
227 rabc(ixyz, ira), rabc(ixyz, irb), 0.0_dp, param%debug_delta)
236 IF (
PRESENT(potential))
THEN
237 SELECT CASE (potential)
238 CASE (eri_mme_coulomb)
239 WRITE (iw,
'(/T2, A)')
"ERI_MME| Potential: Coulomb"
240 CASE (eri_mme_yukawa)
241 WRITE (iw,
'(/T2, A, ES9.2)')
"ERI_MME| Potential: Yukawa with a=", pot_par
242 CASE (eri_mme_longrange)
243 WRITE (iw,
'(/T2, A, ES9.2)')
"ERI_MME| Potential: long-range Coulomb with a=", pot_par
246 WRITE (iw,
'(/T2, A)')
"ERI_MME| Potential: Coulomb"
248 WRITE (iw,
'(T2, A)')
"ERI_MME| Test results for 3c cpu time"
249 WRITE (iw,
'(T11, A)')
"la, lb, lc, zeta, zetb, zetc, cpu time"
262 IF (mod(nintg, ns) .EQ. 0)
THEN
263 i_test(:, :, :) = 0.0_dp
269 CALL eri_mme_3c_integrate(param, 0, la, 0, lb, 0, lc, zet(izeta), zet(izetb), zet(izetc), &
270 rabc(:, ira), rabc(:, irb), rabc(:, irc), i_test, 0, 0, 0, &
271 gg_count, gr_count, rr_count)
278 CALL para_env%sum(time)
280 WRITE (iw,
'(T11, I1, 1X, I1, 1X, I1, 1X, ES9.2, 1X, ES9.2, 1X, ES9.2, 1X, ES9.2)') &
281 la, lb, lc, zet(izeta), zet(izetb), zet(izetc), time/nrep
306 SUBROUTINE overlap_dist_expansion_test(l_max, m_max, zeta, zetb, R1, R2, r, tolerance)
307 INTEGER,
INTENT(IN) :: l_max, m_max
308 REAL(kind=
dp),
INTENT(IN) :: zeta, zetb, r1, r2, r, tolerance
311 REAL(kind=
dp) :: c_prod_err, h_prod_err, rp, zetp
312 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:) :: c1, c2, c_ol, h1, h2, h_ol
313 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :) :: c_prod_ref, c_prod_test, h_prod_ref, &
314 h_prod_test, h_to_c_1, h_to_c_2, &
316 REAL(kind=
dp),
ALLOCATABLE,
DIMENSION(:, :, :) :: e_c, e_h
319 rp = (zeta*r1 + zetb*r2)/zetp
320 ALLOCATE (c1(0:l_max), h1(0:l_max))
321 ALLOCATE (c2(0:m_max), h2(0:m_max))
322 ALLOCATE (c_ol(0:l_max + m_max))
323 ALLOCATE (h_ol(0:l_max + m_max))
324 ALLOCATE (c_prod_ref(0:l_max, 0:m_max))
325 ALLOCATE (c_prod_test(0:l_max, 0:m_max))
326 ALLOCATE (h_prod_ref(0:l_max, 0:m_max))
327 ALLOCATE (h_prod_test(0:l_max, 0:m_max))
329 ALLOCATE (e_c(-1:l_max + m_max + 1, -1:l_max, -1:m_max))
330 ALLOCATE (e_h(-1:l_max + m_max + 1, -1:l_max, -1:m_max))
337 DO t = 0, l_max + m_max
338 c_ol(t) = (r - rp)**t*exp(-zetp*(r - rp)**2)
342 c1(l) = (r - r1)**l*exp(-zeta*(r - r1)**2)
345 c2(m) = (r - r2)**m*exp(-zetb*(r - r2)**2)
348 h1(:) = matmul(transpose(h_to_c_1(0:, 0:)), c1)
349 h2(:) = matmul(transpose(h_to_c_2(0:, 0:)), c2)
350 h_ol(:) = matmul(transpose(h_to_c_ol(0:, 0:)), c_ol)
354 c_prod_ref(l, m) = c1(l)*c2(m)
355 h_prod_ref(l, m) = h1(l)*h2(m)
356 c_prod_test(l, m) = 0.0_dp
357 h_prod_test(l, m) = 0.0_dp
359 c_prod_test(l, m) = c_prod_test(l, m) + e_c(t, l, m)*h_ol(t)
360 h_prod_test(l, m) = h_prod_test(l, m) + e_h(t, l, m)*h_ol(t)
365 c_prod_err = maxval(abs(c_prod_test - c_prod_ref)/(0.5_dp*(abs(c_prod_test) + abs(c_prod_ref)) + 1.0_dp))
366 h_prod_err = maxval(abs(h_prod_test - h_prod_ref)/(0.5_dp*(abs(c_prod_test) + abs(c_prod_ref)) + 1.0_dp))
368 cpassert(c_prod_err .LE. tolerance)
369 cpassert(h_prod_err .LE. tolerance)
372 END SUBROUTINE overlap_dist_expansion_test
Methods related to properties of Hermite and Cartesian Gaussian functions.
pure subroutine, public create_gaussian_overlap_dist_to_hermite(l, m, a, b, R1, R2, H_or_C_product, E)
Expand 1d product of cartesian (or hermite) gaussians into single hermite gaussians: Find E_t^{lm} s....
pure subroutine, public create_hermite_to_cartesian(zet, l_max, h_to_c)
Create matrix to transform between cartesian and hermite gaussian basis functions.
Minimax-Ewald (MME) method for calculating 2-center and 3-center electron repulsion integrals (ERI) o...
subroutine, public eri_mme_2c_integrate(param, la_min, la_max, lb_min, lb_max, zeta, zetb, rab, hab, o1, o2, G_count, R_count, normalize, potential, pot_par)
Low-level integration routine for 2-center ERIs.
subroutine, public eri_mme_3c_integrate(param, la_min, la_max, lb_min, lb_max, lc_min, lc_max, zeta, zetb, zetc, RA, RB, RC, habc, o1, o2, o3, GG_count, GR_count, RR_count)
Low-level integration routine for 3-center ERIs.
Methods for testing / debugging.
subroutine, public eri_mme_3c_perf_acc_test(param, l_max, zet, rabc, nrep, nsample, para_env, iw, potential, pot_par, GG_count, GR_count, RR_count)
...
subroutine, public eri_mme_2c_perf_acc_test(param, l_max, zet, rabc, nrep, test_accuracy, para_env, iw, potential, pot_par, G_count, R_count)
Unit test for performance and accuracy.
Types and initialization / release routines for Minimax-Ewald method for electron repulsion integrals...
subroutine, public eri_mme_set_potential(param, potential, pot_par)
...
Defines the basic variable types.
integer, parameter, public dp
Definition of mathematical constants and functions.
real(kind=dp), parameter, public twopi
Interface to the message passing library MPI.
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public ncoset