(git:6344619)
Loading...
Searching...
No Matches
r12_fundamentals.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!> \brief Radial fundamentals for Gaussian two-electron integrals.
10!> Entry m+1 stores order m. Private kernels provide unnormalized coefficients;
11!> the dispatcher returns their common multiplicative normalization separately.
12!> Gaussian-product attenuation and geometry prefactors belong to the caller.
13! **************************************************************************************************
15 USE gamma, ONLY: fgamma => fgamma_0
16 USE input_constants, ONLY: &
20 USE kinds, ONLY: dp
21 USE mathconstants, ONLY: pi
22 USE t_c_g0, ONLY: t_c_g0_n
24#include "./base/base_uses.f90"
25
26 IMPLICIT NONE
27 PRIVATE
28
30
31CONTAINS
32
33! **************************************************************************************************
34!> \brief Compute the unnormalized Coulomb Boys coefficients.
35!> \param F coefficients of orders zero through m_max
36!> \param m_max maximum order, nonnegative
37!> \param T reduced squared distance between Gaussian product centers
38! **************************************************************************************************
39 SUBROUTINE compute_coulomb_fundamentals(F, m_max, T)
40 INTEGER, INTENT(IN) :: m_max
41 REAL(dp), INTENT(OUT) :: F(m_max + 1)
42 REAL(dp), INTENT(IN) :: T
43
44 CALL fgamma(m_max, t, f)
45 END SUBROUTINE compute_coulomb_fundamentals
46
47! **************************************************************************************************
48!> \brief Compute radial coefficients for erf(omega*r)/r.
49!> \param F coefficients of orders zero through m_max
50!> \param m_max maximum order, nonnegative
51!> \param rho reduced Gaussian exponent, positive
52!> \param T reduced squared distance between Gaussian product centers
53!> \param omega range-separation parameter in inverse length units
54! **************************************************************************************************
55 SUBROUTINE compute_long_range_fundamentals(F, m_max, rho, T, omega)
56 INTEGER, INTENT(IN) :: m_max
57 REAL(dp), INTENT(OUT) :: F(m_max + 1)
58 REAL(dp), INTENT(IN) :: rho, T, omega
59
60 INTEGER :: m
61 REAL(dp) :: omega2, omega_corr2, scaled_T, weight
62
63 omega2 = omega**2
64 omega_corr2 = omega2/(omega2 + rho)
65 scaled_t = t*omega_corr2
66 CALL fgamma(m_max, scaled_t, f)
67 weight = sqrt(omega_corr2)
68 DO m = 1, m_max + 1
69 f(m) = f(m)*weight
70 weight = weight*omega_corr2
71 END DO
72 END SUBROUTINE compute_long_range_fundamentals
73
74! **************************************************************************************************
75!> \brief Compute radial coefficients for erfc(omega*r)/r.
76!> \param F coefficients of orders zero through m_max
77!> \param m_max maximum order, nonnegative
78!> \param rho reduced Gaussian exponent, positive
79!> \param T reduced squared distance between Gaussian product centers
80!> \param omega range-separation parameter in inverse length units
81!> \param work scratch space for the long-range coefficients
82! **************************************************************************************************
83 SUBROUTINE compute_short_range_fundamentals(F, m_max, rho, T, omega, work)
84 INTEGER, INTENT(IN) :: m_max
85 REAL(dp), INTENT(OUT) :: F(m_max + 1)
86 REAL(dp), INTENT(IN) :: rho, T, omega
87 REAL(dp), INTENT(INOUT) :: work(m_max + 1)
88
89 CALL compute_coulomb_fundamentals(f, m_max, t)
90 CALL compute_long_range_fundamentals(work, m_max, rho, t, omega)
91 f = f - work
92 END SUBROUTINE compute_short_range_fundamentals
93
94! **************************************************************************************************
95!> \brief Compute radial coefficients for Coulomb truncated at cutoff_radius.
96!> \param F coefficients of orders zero through m_max
97!> \param m_max maximum order, nonnegative
98!> \param rho reduced Gaussian exponent, positive
99!> \param T reduced squared distance between Gaussian product centers
100!> \param cutoff_radius truncation radius
101!> \note The truncated-Coulomb tables must be initialized before this call.
102! **************************************************************************************************
103 SUBROUTINE compute_truncated_fundamentals(F, m_max, rho, T, cutoff_radius)
104 INTEGER, INTENT(IN) :: m_max
105 REAL(dp), INTENT(OUT) :: F(m_max + 1)
106 REAL(dp), INTENT(IN) :: rho, T, cutoff_radius
107
108 LOGICAL :: use_gamma
109 REAL(dp) :: R
110
111 r = cutoff_radius*sqrt(rho)
112 CALL t_c_g0_n(f, use_gamma, r, t, m_max)
113 IF (use_gamma) CALL compute_coulomb_fundamentals(f, m_max, t)
114 END SUBROUTINE compute_truncated_fundamentals
115
116! **************************************************************************************************
117!> \brief Compute radial coefficients for exp(-alpha*r*r).
118!> \param F coefficients of orders zero through m_max
119!> \param m_max maximum order, nonnegative
120!> \param rho reduced Gaussian exponent, positive
121!> \param T reduced squared distance between Gaussian product centers
122!> \param alpha Gaussian operator exponent in inverse squared length units
123! **************************************************************************************************
124 SUBROUTINE compute_gaussian_fundamentals(F, m_max, rho, T, alpha)
125 INTEGER, INTENT(IN) :: m_max
126 REAL(dp), INTENT(OUT) :: F(m_max + 1)
127 REAL(dp), INTENT(IN) :: rho, T, alpha
128
129 INTEGER :: m
130 REAL(dp) :: scaled_T, weight
131
132 scaled_t = -alpha*t/(rho + alpha)
133 weight = 1.0_dp
134 DO m = 1, m_max + 1
135 f(m) = exp(scaled_t)*weight
136 weight = weight*alpha/(rho + alpha)
137 END DO
138 END SUBROUTINE compute_gaussian_fundamentals
139
140! **************************************************************************************************
141!> \brief Compose radial kernels before applying their common normalization.
142!> \param F coefficients of orders zero through m_max, excluding normalization;
143!> MIX_LG includes its distinct component normalizations in F
144!> \param normalization common multiplicative normalization; one for MIX_LG
145!> \param m_max maximum order, nonnegative
146!> \param potential_type operator selector from input_constants
147!> \param rho reduced Gaussian exponent, positive
148!> \param T reduced squared distance between Gaussian product centers
149!> \param work reusable scratch space for composing radial kernels
150!> \param omega range-separation parameter; Gaussian operators use alpha=omega**2
151!> \param cutoff_radius cutoff parameter for truncated Coulomb and TShPSC
152!> \param scale_coulomb Coulomb coefficient in mixed operators
153!> \param scale_longrange long-range coefficient in mixed operators
154!> \param scale_gaussian Gaussian coefficient in mixed operators
155!> \note Spatial screening and table initialization belong to the caller.
156! **************************************************************************************************
157 SUBROUTINE compute_r12_fundamentals(F, normalization, m_max, potential_type, rho, T, work, &
158 omega, cutoff_radius, scale_coulomb, scale_longrange, scale_gaussian)
159 REAL(dp), INTENT(OUT) :: normalization
160 INTEGER, INTENT(IN) :: m_max
161 REAL(dp), INTENT(OUT) :: f(m_max + 1)
162 INTEGER, INTENT(IN) :: potential_type
163 REAL(dp), INTENT(IN) :: rho, t
164 REAL(dp), INTENT(INOUT) :: work(m_max + 1)
165 REAL(dp), INTENT(IN) :: omega, cutoff_radius, scale_coulomb, &
166 scale_longrange, scale_gaussian
167
168 REAL(dp) :: gaussian_normalization, r
169
170 normalization = 2.0_dp*pi/rho
171 SELECT CASE (potential_type)
173 CALL compute_coulomb_fundamentals(f, m_max, t)
175 CALL compute_truncated_fundamentals(f, m_max, rho, t, cutoff_radius)
177 r = cutoff_radius*sqrt(rho)
178 f = 0.0_dp
179 CALL trunc_cs_poly_n20(f, r, t, m_max)
180 CASE (do_potential_short)
181 CALL compute_short_range_fundamentals(f, m_max, rho, t, omega, work)
182 CASE (do_potential_long)
183 CALL compute_long_range_fundamentals(f, m_max, rho, t, omega)
185 CALL compute_gaussian_fundamentals(f, m_max, rho, t, omega**2)
186 normalization = (pi/(rho + omega**2))**1.5_dp
188 CALL compute_coulomb_fundamentals(f, m_max, t)
189 CALL compute_long_range_fundamentals(work, m_max, rho, t, omega)
190 f = f*scale_coulomb + work*scale_longrange
192 CALL compute_truncated_fundamentals(f, m_max, rho, t, cutoff_radius)
193 CALL compute_coulomb_fundamentals(work, m_max, t)
194 f = f*(scale_coulomb + scale_longrange) - work*scale_longrange
195 CALL compute_long_range_fundamentals(work, m_max, rho, t, omega)
196 f = f + work*scale_longrange
198 CALL compute_long_range_fundamentals(f, m_max, rho, t, omega)
199 CALL compute_gaussian_fundamentals(work, m_max, rho, t, omega**2)
200 gaussian_normalization = (pi/(rho + omega**2))**1.5_dp
201 f = work*gaussian_normalization*scale_gaussian + f*normalization*scale_longrange
202 normalization = 1.0_dp
203 CASE DEFAULT
204 cpabort("Unsupported operator for radial r12 fundamentals")
205 END SELECT
206 END SUBROUTINE compute_r12_fundamentals
207
208END MODULE r12_fundamentals
Calculation of the incomplete Gamma function F_n(t) for multi-center integrals over Cartesian Gaussia...
Definition gamma.F:15
subroutine, public fgamma_0(nmax, t, f)
Calculation of the incomplete Gamma function F(t) for multicenter integrals over Gaussian functions....
Definition gamma.F:154
collects all constants needed in input so that they can be used without circular dependencies
integer, parameter, public do_potential_mix_cl
integer, parameter, public do_potential_gaussian
integer, parameter, public do_potential_truncated
integer, parameter, public do_potential_mix_lg
integer, parameter, public do_potential_coulomb
integer, parameter, public do_potential_short
integer, parameter, public do_potential_mix_cl_trunc
integer, parameter, public do_potential_long
integer, parameter, public do_potential_tshpsc
Defines the basic variable types.
Definition kinds.F:23
integer, parameter, public dp
Definition kinds.F:34
Definition of mathematical constants and functions.
real(kind=dp), parameter, public pi
Radial fundamentals for Gaussian two-electron integrals. Entry m+1 stores order m....
subroutine, public compute_r12_fundamentals(f, normalization, m_max, potential_type, rho, t, work, omega, cutoff_radius, scale_coulomb, scale_longrange, scale_gaussian)
Compose radial kernels before applying their common normalization.
This module computes the basic integrals for the truncated coulomb operator.
Definition t_c_g0.F:58
subroutine, public t_c_g0_n(res, use_gamma, r, t, nderiv)
...
Definition t_c_g0.F:88
subroutine, public trunc_cs_poly_n20(res, r, t, nderiv)
...
Definition t_sh_p_s_c.F:65