59 memset(matrix, 0, size_A * size_B *
sizeof(
double));
61 if (potential == NULL) {
70 double *buf = calloc(size_A * size_B,
sizeof(
double));
73 double pot_coef = potential->
coeffs[k];
74 double pot_alpha = potential->
alpha[k];
75 int pot_n = potential->
powers[k];
78 shell_A, shell_B, rpp_origin, pot_alpha, pot_n, buf);
139 double *A,
int n_cart_A,
int *cart_list_A,
double alpha_A,
double *B,
140 int n_cart_B,
int *cart_list_B,
double alpha_B,
double *C,
141 double (*potential)(
double r,
void *params),
void *potential_params,
143 assert(n_cart_A > 0);
144 assert(n_cart_B > 0);
146 memset(matrix, 0, n_cart_A * n_cart_B *
sizeof(
double));
148 double CA_x = C[0] - A[0];
149 double CA_y = C[1] - A[1];
150 double CA_z = C[2] - A[2];
151 double CB_x = C[0] - B[0];
152 double CB_y = C[1] - B[1];
153 double CB_z = C[2] - B[2];
154 double CA_2 = CA_x * CA_x + CA_y * CA_y + CA_z * CA_z;
155 double CB_2 = CB_x * CB_x + CB_y * CB_y + CB_z * CB_z;
157 double kx = -2.0 * (alpha_A * CA_x + alpha_B * CB_x);
158 double ky = -2.0 * (alpha_A * CA_y + alpha_B * CB_y);
159 double kz = -2.0 * (alpha_A * CA_z + alpha_B * CB_z);
160 double k = sqrt(kx * kx + ky * ky + kz * kz);
166 int L_A = cart_list_A[0] + cart_list_A[1] + cart_list_A[2];
167 int L_B = cart_list_B[0] + cart_list_B[1] + cart_list_B[2];
171 double D_ABC = 4 *
M_PI * N_A * N_B;
173 int lambda_max = L_A + L_B;
174 int n_max = lambda_max;
181 lambda_max, n_max, CA_2, CB_2, alpha_A, alpha_B, k, D_ABC, potential,
188 for (
int icart = 0; icart < n_cart_A; icart++) {
189 for (
int jcart = 0; jcart < n_cart_B; jcart++) {
193 int n_A = cart_list_A[3 * icart + 0];
194 int l_A = cart_list_A[3 * icart + 1];
195 int m_A = cart_list_A[3 * icart + 2];
196 int n_B = cart_list_B[3 * jcart + 0];
197 int l_B = cart_list_B[3 * jcart + 1];
198 int m_B = cart_list_B[3 * jcart + 2];
200 for (
int a = 0; a <= n_A; a++) {
202 double pow_CA_x = pow(CA_x, n_A - a);
204 for (
int b = 0; b <= l_A; b++) {
206 double pow_CA_y = pow(CA_y, l_A - b);
208 for (
int c = 0; c <= m_A; c++) {
210 double pow_CA_z = pow(CA_z, m_A - c);
212 for (
int d = 0; d <= n_B; d++) {
214 double pow_CB_x = pow(CB_x, n_B - d);
216 for (
int e = 0; e <= l_B; e++) {
218 double pow_CB_y = pow(CB_y, l_B - e);
220 for (
int f = 0; f <= m_B; f++) {
222 double pow_CB_z = pow(CB_z, m_B - f);
224 double factor = C_nA_a * C_lA_b * C_mA_c * C_nB_d * C_lB_e *
225 C_mB_f * pow_CA_x * pow_CA_y * pow_CA_z *
226 pow_CB_x * pow_CB_y * pow_CB_z;
228 if (fabs(factor) < 1e-13) {
232 int N = a + b + c + d + e + f;
233 double sum_omega_Q = 0.0;
234 for (
int lambda = 0; lambda <= lambda_max; lambda++) {
238 if (fabs(Q) < 1e-16) {
243 lambda, a + d, b + e, c + f, kvec);
245 sum_omega_Q += omega * Q;
248 chi_AB += factor * sum_omega_Q;
256 matrix[icart * n_cart_B + jcart] = chi_AB;
radial_type1_table_t * libgrpp_tabulate_radial_type1_integrals(int lambda_max, int n_max, double CA_2, double CB_2, double alpha_A, double alpha_B, double k, double prefactor, double(*potential)(double r, void *params), void *potential_params)
void evaluate_type1_integral_primitive_gaussians(double *A, int n_cart_A, int *cart_list_A, double alpha_A, double *B, int n_cart_B, int *cart_list_B, double alpha_B, double *C, libgrpp_potential_t *potential, double *matrix)
void libgrpp_evaluate_radially_local_potential_integral_primitive_gaussians(double *A, int n_cart_A, int *cart_list_A, double alpha_A, double *B, int n_cart_B, int *cart_list_B, double alpha_B, double *C, double(*potential)(double r, void *params), void *potential_params, double *matrix)