15 USE ieee_arithmetic,
ONLY: ieee_is_finite
28 LOGICAL :: source_root_argument
30 INTEGER,
PARAMETER :: la = 4, lb = 3, nder = 2, na = 5, nb = 5
31 REAL(kind=
dp),
PARAMETER :: alpha(na) = [0.04_dp, 0.3_dp, 1.2_dp, 5.0_dp, 24.0_dp]
32 REAL(kind=
dp),
PARAMETER :: eta(nb) = [0.3_dp, 0.7_dp, 1.1_dp, 2.2_dp, 0.4_dp]
33 CHARACTER(LEN=default_path_length) :: filename
34 INTEGER :: grid, nr, i, j, p, m, l, geometry, id, ld, ldai, first, shell, q, io_unit
35 REAL(kind=
dp) :: dx, rac(3), origin(3), error, scale, expected_d
36 REAL(kind=
dp),
ALLOCATABLE :: sab(:, :), work(:, :, :), moments(:, :, :), integrals(:, :, :), reference(:, :, :)
37 TYPE(atom_upfpot_type) :: pot
42 pot%number_of_proj = nb
43 ALLOCATE (pot%lbeta(nb))
44 pot%lbeta(:) = [0, 1, 2, 3, 1]
45 ALLOCATE (pot%dion(nb, nb))
48 pot%dion(i, i) = 0.3_dp*i - 0.8_dp
50 pot%dion(2, 5) = 0.17_dp
51 pot%dion(5, 2) = 0.17_dp
55 IF (grid == 2) nr = 2500
56 ALLOCATE (pot%r(nr), pot%rab(nr), pot%beta(nr, nb))
59 dx = log(1.0_dp + 12.5_dp/0.001_dp)/(nr - 1)
60 pot%r(i) = 0.001_dp*(exp((i - 1)*dx) - 1.0_dp)
61 pot%rab(i) = dx*(pot%r(i) + 0.001_dp)
63 pot%r(i) = (i - 1)*0.005_dp
68 pot%beta(:, i) = pot%r**pot%lbeta(i)*exp(-eta(i)*pot%r**2)
74 DO m = -pot%lbeta(i), pot%lbeta(i)
78 DO l = -pot%lbeta(j), pot%lbeta(j)
81 IF (pot%lbeta(i) == pot%lbeta(j) .AND. m == l) expected_d = pot%dion(i, j)
82 IF (abs(projectors%d(p, q) - expected_d) > 1.e-15_dp) error stop
"UPF D expansion failed"
89 ALLOCATE (sab(ld, ld*
ncoset(nder)), work(ldai, ldai,
ncoset(nder)), &
91 integrals(na*
ncoset(la), projectors%nproj,
ncoset(nder)), &
92 reference(na*
ncoset(la), projectors%nproj,
ncoset(nder)))
94 SELECT CASE (geometry)
98 rac = [0.2_dp, -0.5_dp, 0.7_dp]
100 rac = [3.0_dp, 2.0_dp, -1.0_dp]
102 rac = [-7.0_dp, 1.0_dp, 2.0_dp]
105 CALL overlap(la, 0, na, spread(100.0_dp, 1, na), alpha, &
106 lb, 0, nb, spread(100.0_dp, 1, nb), eta, rac, norm2(rac), &
107 sab, nder, .true., work, ldai)
112 first = (id - 1)*ld + (i - 1)*
ncoset(lb) +
ncoset(l - 1) + 1
113 reference(:, p + 1:p + 2*l + 1, id) = &
120 scale = max(1.0_dp, maxval(abs(reference(:, :, id))))
121 error = maxval(abs(integrals(:, :, id) - reference(:, :, id)))/scale
122 IF (io_unit > 0)
WRITE (io_unit,
'(A,3I4,ES16.7)') &
123 "UPF radial Gaussian overlap/derivative:", grid, geometry, id, error
124 IF (error > 1.e-10_dp) error stop
"Numerical UPF overlaps disagree with analytic Gaussian integrals"
127 origin = [0.4_dp, 0.6_dp, -0.3_dp]
128 CALL moment(la, na, alpha, spread(100.0_dp, 1, na), 0, &
129 lb, nb, eta, spread(100.0_dp, 1, nb), nder, origin, origin + rac, moments)
135 reference(:, p + 1:p + 2*l + 1, id) = &
136 matmul(moments(:, shell:shell +
nco(l) - 1, id - 1), transpose(
orbtramat(l)%slm))
141 scale = max(1.0_dp, maxval(abs(reference)))
142 error = maxval(abs(integrals - reference))/scale
143 IF (io_unit > 0)
WRITE (io_unit,
'(A,2I4,ES16.7)')
"UPF radial Gaussian moments:", grid, geometry, error
144 IF (error > 1.e-10_dp) error stop
"Numerical UPF moments disagree with analytic Gaussian integrals"
146 DEALLOCATE (pot%r, pot%rab, pot%beta, sab, work, moments, integrals, reference)
151 DO i = 1, command_argument_count()
152 CALL get_command_argument(i, filename)
155 INQUIRE (file=trim(filename)//
"/tests/UNIT_TESTS", exist=source_root_argument)
156 IF (source_root_argument) cycle
159 IF (pot%number_of_proj > 0)
THEN
161 IF (.NOT. all(ieee_is_finite(projectors%d))) error stop
"Non-finite original UPF D matrix"
162 ALLOCATE (integrals(na*
ncoset(la), projectors%nproj,
ncoset(nder)))
165 IF (geometry == 2) rac = [0.3_dp, -0.5_dp, 1.0_dp]
167 IF (.NOT. all(ieee_is_finite(integrals))) error stop
"Non-finite native UPF projector integrals"
169 IF (io_unit > 0)
WRITE (io_unit,
'(A,1X,A,1X,I6,1X,ES16.7)')
"UPF native integrals:", trim(filename), &
170 projectors%nproj, maxval(abs(integrals))
171 DEALLOCATE (integrals)
Calculation of the moment integrals over Cartesian Gaussian-type functions.
subroutine, public moment(la_max, npgfa, zeta, rpgfa, la_min, lb_max, npgfb, zetb, rpgfb, lc_max, rac, rbc, mab)
...
Calculation of the overlap integrals over Cartesian Gaussian-type functions.
subroutine, public overlap(la_max_set, la_min_set, npgfa, rpgfa, zeta, lb_max_set, lb_min_set, npgfb, rpgfb, zetb, rab, dab, sab, da_max_set, return_derivatives, s, lds)
Purpose: Calculation of the two-center overlap integrals [a|b] over Cartesian Gaussian-type functions...
Routines that process Quantum Espresso UPF files.
pure subroutine, public atom_release_upf(upfpot)
...
subroutine, public atom_read_upf(pot, upf_filename, read_header, read_augmentation)
...
various routines to log and control the output. The idea is that decisions about where to log should ...
integer function, public cp_logger_get_default_io_unit(logger)
returns the unit nr for the ionode (-1 on all other processors) skips as well checks if the procs cal...
Defines the basic variable types.
integer, parameter, public dp
integer, parameter, public default_path_length
subroutine, public cp2k_finalize()
...
subroutine, public cp2k_init()
...
Provides Cartesian and spherical orbital pointers and indices.
integer, dimension(:), allocatable, public nco
integer, dimension(:), allocatable, public ncoset
Half-numerical overlaps with the original scalar UPF radial projectors. Cartesian polynomials and ang...
subroutine, public upf_projector_init(pot, degree, projectors)
Prepare immutable radial and angular data outside parallel regions.
subroutine, public upf_projector_overlap(projectors, la, zeta, rac, nder, integrals, moment_origin)
Evaluate <Cartesian Gaussian|beta_i Y_lm> and AO-center derivatives.
program upf_projector_integrals_unittest