53 double *so_x_matrix,
double *so_y_matrix,
54 double *so_z_matrix) {
60 memset(so_x_matrix, 0, size_A * size_B *
sizeof(
double));
61 memset(so_y_matrix, 0, size_A * size_B *
sizeof(
double));
62 memset(so_z_matrix, 0, size_A * size_B *
sizeof(
double));
70 double *A = shell_A->
origin;
71 double *B = shell_B->
origin;
72 double *C = rpp_origin;
74 double CA_x = C[0] - A[0];
75 double CA_y = C[1] - A[1];
76 double CA_z = C[2] - A[2];
77 double CB_x = C[0] - B[0];
78 double CB_y = C[1] - B[1];
79 double CB_z = C[2] - B[2];
80 double CA_2 = CA_x * CA_x + CA_y * CA_y + CA_z * CA_z;
81 double CB_2 = CB_x * CB_x + CB_y * CB_y + CB_z * CB_z;
83 double alpha_A = shell_A->
alpha[0];
84 double alpha_B = shell_B->
alpha[0];
85 double kA_x = -2.0 * (alpha_A * CA_x);
86 double kA_y = -2.0 * (alpha_A * CA_y);
87 double kA_z = -2.0 * (alpha_A * CA_z);
88 double kB_x = -2.0 * (alpha_B * CB_x);
89 double kB_y = -2.0 * (alpha_B * CB_y);
90 double kB_z = -2.0 * (alpha_B * CB_z);
100 int lambda1_max = L + L_A;
101 int lambda2_max = L + L_B;
102 int N_max = L_A + L_B;
107 double *Lx_matrix = calloc((2 * L + 1) * (2 * L + 1),
sizeof(
double));
108 double *Ly_matrix = calloc((2 * L + 1) * (2 * L + 1),
sizeof(
double));
109 double *Lz_matrix = calloc((2 * L + 1) * (2 * L + 1),
sizeof(
double));
116 int lmax =
int_max3(lambda1_max, lambda2_max, L);
122 double rsh_values_kA[
LMAX][2 *
LMAX + 1];
123 double rsh_values_kB[
LMAX][2 *
LMAX + 1];
125 for (
int lambda = 0; lambda <= lmax; lambda++) {
127 rsh_values_kA[lambda]);
129 rsh_values_kB[lambda]);
136 lambda1_max, lambda2_max, N_max, CA_2, CB_2, potential, shell_A, shell_B);
141 for (
int icart = 0; icart < size_A; icart++) {
142 for (
int jcart = 0; jcart < size_B; jcart++) {
148 int n_A = shell_A->
cart_list[3 * icart + 0];
149 int l_A = shell_A->
cart_list[3 * icart + 1];
150 int m_A = shell_A->
cart_list[3 * icart + 2];
151 int n_B = shell_B->
cart_list[3 * jcart + 0];
152 int l_B = shell_B->
cart_list[3 * jcart + 1];
153 int m_B = shell_B->
cart_list[3 * jcart + 2];
155 for (
int a = 0; a <= n_A; a++) {
158 double pow_CA_x = pow(CA_x, n_A - a);
160 for (
int b = 0; b <= l_A; b++) {
163 double pow_CA_y = pow(CA_y, l_A - b);
165 for (
int c = 0; c <= m_A; c++) {
168 double pow_CA_z = pow(CA_z, m_A - c);
170 for (
int d = 0; d <= n_B; d++) {
173 double pow_CB_x = pow(CB_x, n_B - d);
175 for (
int e = 0; e <= l_B; e++) {
178 double pow_CB_y = pow(CB_y, l_B - e);
180 for (
int f = 0; f <= m_B; f++) {
183 double pow_CB_z = pow(CB_z, m_B - f);
185 int N = a + b + c + d + e + f;
186 double factor = C_nA_a * C_lA_b * C_mA_c * C_nB_d * C_lB_e *
187 C_mB_f * pow_CA_x * pow_CA_y * pow_CA_z *
188 pow_CB_x * pow_CB_y * pow_CB_z;
198 double sum_omega_Q_x = 0.0;
199 double sum_omega_Q_y = 0.0;
200 double sum_omega_Q_z = 0.0;
202 int lambda1_lower =
int_max2(L - a - b - c, 0);
203 int lambda2_lower =
int_max2(L - d - e - f, 0);
204 int lambda1_upper = L + a + b + c;
205 int lambda2_upper = L + d + e + f;
207 for (
int lambda_1 = lambda1_lower; lambda_1 <= lambda1_upper;
209 if ((L + a + b + c - lambda_1) % 2 != 0) {
213 for (
int lambda_2 = lambda2_lower;
214 lambda_2 <= lambda2_upper; lambda_2++) {
215 if ((L + d + e + f - lambda_2) % 2 != 0) {
220 radial_table, lambda_1, lambda_2, N);
225 double sum_angular_x, sum_angular_y, sum_angular_z;
227 L, Lx_matrix, Ly_matrix, Lz_matrix, lambda_1, a, b, c,
228 rsh_values_kA[lambda_1], lambda_2, d, e, f,
229 rsh_values_kB[lambda_2], &sum_angular_x,
230 &sum_angular_y, &sum_angular_z);
232 sum_omega_Q_x += QN * sum_angular_x;
233 sum_omega_Q_y += QN * sum_angular_y;
234 sum_omega_Q_z += QN * sum_angular_z;
238 SO_x += factor * sum_omega_Q_x;
239 SO_y += factor * sum_omega_Q_y;
240 SO_z += factor * sum_omega_Q_z;
248 so_x_matrix[icart * size_B + jcart] = SO_x * (16.0 *
M_PI *
M_PI);
249 so_y_matrix[icart * size_B + jcart] = SO_y * (16.0 *
M_PI *
M_PI);
250 so_z_matrix[icart * size_B + jcart] = SO_z * (16.0 *
M_PI *
M_PI);
265 double *Lz_matrix,
int lambda_1,
int a,
int b,
266 int c,
double *rsh_values_kA,
int lambda_2,
int d,
267 int e,
int f,
double *rsh_values_kB,
268 double *sum_angular_x,
double *sum_angular_y,
269 double *sum_angular_z) {
270 *sum_angular_x = 0.0;
271 *sum_angular_y = 0.0;
272 *sum_angular_z = 0.0;
277 for (
int m1 = -L; m1 <= L; m1++) {
278 for (
int m2 = -L; m2 <= L; m2++) {
280 double lx = Lx_matrix[(2 * L + 1) * (m1 + L) + (m2 + L)];
281 double ly = Ly_matrix[(2 * L + 1) * (m1 + L) + (m2 + L)];
282 double lz = Lz_matrix[(2 * L + 1) * (m1 + L) + (m2 + L)];
297 *sum_angular_x += omega_1 * omega_2 * lx;
298 *sum_angular_y += omega_1 * omega_2 * ly;
299 *sum_angular_z += omega_1 * omega_2 * lz;
static void type3_angular_sum(int L, double *Lx_matrix, double *Ly_matrix, double *Lz_matrix, int lambda_1, int a, int b, int c, double *rsh_values_kA, int lambda_2, int d, int e, int f, double *rsh_values_kB, double *sum_angular_x, double *sum_angular_y, double *sum_angular_z)