MolSSI Integral Reference Project
integral4_wrappers.h
Go to the documentation of this file.
1 /*! \file
2  *
3  * \brief Some useful wrapping of functionality
4  */
5 
6 #pragma once
7 
8 #include "mirp/typedefs.h"
9 
10 #ifdef __cplusplus
11 extern "C" {
12 #endif
13 
14 
15 /*! \brief Compute a single 4-center integral using interval arithmetic (string input)
16  *
17  * This function converts string inputs into arblib types and runs the callback \c cb
18  *
19  * \param [out] integral
20  * Output for the computed integral
21  * \param [in] lmn1,lmn2,lmn3,lmn4
22  * Exponents of x, y, and z that signify angular momentum. Required
23  * to be 3 elements.
24  * \param [in] A,B,C,D
25  * XYZ coordinates of the four centers (each of length 3)
26  * \param [in] alpha1,alpha2,alpha3,alpha4
27  * Exponents of the gaussian on the four centers
28  * \param [in] working_prec
29  * Internal working precision
30  * \param [in] cb
31  * Function that computes a single cartesian four-center integral
32  * with interval arithmetic
33  * \param [in] working_prec
34  * The working precision (binary digits/bits) to use
35  * in the calculation
36  */
37 void mirp_integral4_single_str(arb_t integral,
38  const int * lmn1, const char ** A, const char * alpha1,
39  const int * lmn2, const char ** B, const char * alpha2,
40  const int * lmn3, const char ** C, const char * alpha3,
41  const int * lmn4, const char ** D, const char * alpha4,
42  slong working_prec, cb_integral4_single cb);
43 
44 
45 /*! \brief Computes a single integral to exact double precision using interval
46  * arithmetic (four-center)
47  *
48  * This function takes double precision as input and returns double precision
49  * as output. Internally, it uses interval arithmetic to ensure that no
50  * precision is lost
51  *
52  * \param [out] integral
53  * Output for the computed integral
54  * \param [in] lmn1,lmn2,lmn3,lmn4
55  * Exponents of x, y, and z that signify angular momentum. Required
56  * to be 3 elements.
57  * \param [in] A,B,C,D
58  * XYZ coordinates of the four centers (each of length 3)
59  * \param [in] alpha1,alpha2,alpha3,alpha4
60  * Exponents of the gaussian on the four centers
61  * \param [in] cb
62  * Function that computes a single cartesian four-center integral
63  * with interval arithmetic
64  */
65 void mirp_integral4_single_exact(double * integral,
66  const int * lmn1, const double * A, double alpha1,
67  const int * lmn2, const double * B, double alpha2,
68  const int * lmn3, const double * C, double alpha3,
69  const int * lmn4, const double * D, double alpha4,
71 
72 
73 /*! \brief Compute all cartesian integrals of a contracted shell quartet
74  * for an integral (four-center, interval arithmetic)
75  *
76  * This function takes in a pointer to a function that computes single,
77  * primitive cartesian integrals, and uses it to compute all the cartesian
78  * components for an contracted shell quartet.
79  *
80  * \param [out] integrals
81  * Output for the computed integral
82  * \param [in] am1,am2,am3,am4
83  * Angular momentum for the four centers
84  * \param [in] A,B,C,D
85  * XYZ coordinates of the four centers (each of length 3)
86  * \param [in] nprim1,nprim2,nprim3,nprim4
87  * Number of primitive gaussians for each shell
88  * \param [in] ngen1,ngen2,ngen3,ngen4
89  * Number of general contractions for each shell
90  * \param [in] alpha1,alpha2,alpha3,alpha4
91  * Exponents of the primitive gaussians on the four centers
92  * (of lengths \p nprim1, \p nprim2, \p nprim3, \p nprim4 respectively)
93  * \param [in] coeff1,coeff2,coeff3,coeff4
94  * Coefficients for all primitives and for all general contractions
95  * for each shell (of lengths \p nprim1 * \p ngen1, \p nprim2 * \p ngen2,
96  * \p nprim3 * \p ngen3, \p nprim4 * \p ngen4 respectively)
97  * \param [in] cb
98  * Function that computes a single cartesian four-center integral
99  * with interval arithmetic
100  * \param [in] working_prec
101  * The working precision (binary digits/bits) to use
102  * in the calculation
103  */
104 void mirp_integral4(arb_ptr integrals,
105  int am1, arb_srcptr A, int nprim1, int ngen1, arb_srcptr alpha1, arb_srcptr coeff1,
106  int am2, arb_srcptr B, int nprim2, int ngen2, arb_srcptr alpha2, arb_srcptr coeff2,
107  int am3, arb_srcptr C, int nprim3, int ngen3, arb_srcptr alpha3, arb_srcptr coeff3,
108  int am4, arb_srcptr D, int nprim4, int ngen4, arb_srcptr alpha4, arb_srcptr coeff4,
109  slong working_prec, cb_integral4_single cb);
110 
111 
112 /*! \brief Compute a single 4-center integral to a target precision (string input)
113  *
114  * This function converts string inputs into arblib types and runs the callback \c cb
115  *
116  * \param [out] integrals
117  * Output for the computed integral
118  * \param [in] am1,am2,am3,am4
119  * Angular momentum for the four centers
120  * \param [in] A,B,C,D
121  * XYZ coordinates of the four centers (each of length 3)
122  * \param [in] nprim1,nprim2,nprim3,nprim4
123  * Number of primitive gaussians for each shell
124  * \param [in] ngen1,ngen2,ngen3,ngen4
125  * Number of general contractions for each shell
126  * \param [in] alpha1,alpha2,alpha3,alpha4
127  * Exponents of the primitive gaussians on the four centers
128  * (of lengths \p nprim1, \p nprim2, \p nprim3, \p nprim4 respectively)
129  * \param [in] coeff1,coeff2,coeff3,coeff4
130  * Coefficients for all primitives and for all general contractions
131  * for each shell (of lengths \p nprim1 * \p ngen1, \p nprim2 * \p ngen2,
132  * \p nprim3 * \p ngen3, \p nprim4 * \p ngen4 respectively)
133  * \param [in] working_prec
134  * The working precision (binary digits/bits) to use
135  * in the calculation
136  * \param [in] cb
137  * Function that computes a single cartesian four-center integral
138  * with interval arithmetic
139  */
140 void mirp_integral4_str(arb_ptr integrals,
141  int am1, const char ** A, int nprim1, int ngen1, const char ** alpha1, const char ** coeff1,
142  int am2, const char ** B, int nprim2, int ngen2, const char ** alpha2, const char ** coeff2,
143  int am3, const char ** C, int nprim3, int ngen3, const char ** alpha3, const char ** coeff3,
144  int am4, const char ** D, int nprim4, int ngen4, const char ** alpha4, const char ** coeff4,
145  slong working_prec, cb_integral4 cb);
146 
147 
148 /*! \brief Compute all cartesian integrals of a contracted shell quartet
149  * for an integral to exact double precision (four-center)
150  *
151  * This function takes double precision as input and returns double precision
152  * as output. Internally, it uses interval arithmetic to ensure that no
153  * precision is lost
154  *
155  * \param [out] integrals
156  * Output for the computed integrals
157  * \param [in] am1,am2,am3,am4
158  * Angular momentum for the four centers
159  * \param [in] A,B,C,D
160  * XYZ coordinates of the four centers (each of length 3)
161  * \param [in] nprim1,nprim2,nprim3,nprim4
162  * Number of primitive gaussians for each shell
163  * \param [in] ngen1,ngen2,ngen3,ngen4
164  * Number of general contractions for each shell
165  * \param [in] alpha1,alpha2,alpha3,alpha4
166  * Exponents of the primitive gaussians on the four centers
167  * (of lengths \p nprim1, \p nprim2, \p nprim3, \p nprim4 respectively)
168  * \param [in] coeff1,coeff2,coeff3,coeff4
169  * Coefficients for all primitives and for all general contractions
170  * for each shell (of lengths \p nprim1 * \p ngen1, \p nprim2 * \p ngen2,
171  * \p nprim3 * \p ngen3, \p nprim4 * \p ngen4 respectively)
172  * \param [in] cb
173  * Function that computes a single cartesian four-center integral
174  * with interval arithmetic
175  */
176 void mirp_integral4_exact(double * integrals,
177  int am1, const double * A, int nprim1, int ngen1, const double * alpha1, const double * coeff1,
178  int am2, const double * B, int nprim2, int ngen2, const double * alpha2, const double * coeff2,
179  int am3, const double * C, int nprim3, int ngen3, const double * alpha3, const double * coeff3,
180  int am4, const double * D, int nprim4, int ngen4, const double * alpha4, const double * coeff4,
181  cb_integral4 cb);
182 
183 
184 /*! \brief Create a function that computes single cartesian integrals
185  * from string arguments (four-center)
186  *
187  * A function computing single cartesian integrals in interval arithmetic
188  * is expected to exist and be named `mirp_{name}_single`
189  *
190  * The created function is named `mirp_{name}_single_str`.
191  *
192  * \sa mirp_integral4_single_str
193  */
194 #define MIRP_WRAP_SINGLE4_STR(name) \
195  static inline \
196  void mirp_##name##_single_str(arb_t integral, \
197  const int * lmn1, const char ** A, const char * alpha1, \
198  const int * lmn2, const char ** B, const char * alpha2, \
199  const int * lmn3, const char ** C, const char * alpha3, \
200  const int * lmn4, const char ** D, const char * alpha4, \
201  slong working_prec) \
202  { \
203  mirp_integral4_single_str(integral, \
204  lmn1, A, alpha1, \
205  lmn2, B, alpha2, \
206  lmn3, C, alpha3, \
207  lmn4, D, alpha4, \
208  working_prec, \
209  mirp_##name##_single); \
210  }
211 
212 
213 /*! \brief Create a function that computes single cartesian integrals
214  * to exact double precision (four-center)
215  *
216  * A function computing single cartesian integrals is
217  * expected to exist and be named `mirp_{name}_single`
218  *
219  * The created function is named `mirp_{name}_single_exact`.
220  *
221  * \sa mirp_integral4_single_exact
222  */
223 #define MIRP_WRAP_SINGLE4_EXACT(name) \
224  static inline \
225  void mirp_##name##_single_exact(double * integral, \
226  const int * lmn1, const double * A, double alpha1, \
227  const int * lmn2, const double * B, double alpha2, \
228  const int * lmn3, const double * C, double alpha3, \
229  const int * lmn4, const double * D, double alpha4) \
230  { \
231  mirp_integral4_single_exact(integral, \
232  lmn1, A, alpha1, \
233  lmn2, B, alpha2, \
234  lmn3, C, alpha3, \
235  lmn4, D, alpha4, \
236  mirp_##name##_single); \
237  }
238 
239 
240 /*! \brief Create a function that computes all cartesian integrals
241  * of a contracted shell quartet (four-center, interval arithmetic)
242  *
243  * A function computing single cartesian integrals is expected to exist and
244  * be named `mirp_{name}_single`
245  *
246  * The created function is named `mirp_{name}`.
247  *
248  * \sa mirp_integral4
249  */
250 #define MIRP_WRAP_SHELL4(name) \
251  static inline \
252  void mirp_##name(arb_t integrals, \
253  int am1, arb_srcptr A, int nprim1, int ngen1, arb_srcptr alpha1, arb_srcptr coeff1, \
254  int am2, arb_srcptr B, int nprim2, int ngen2, arb_srcptr alpha2, arb_srcptr coeff2, \
255  int am3, arb_srcptr C, int nprim3, int ngen3, arb_srcptr alpha3, arb_srcptr coeff3, \
256  int am4, arb_srcptr D, int nprim4, int ngen4, arb_srcptr alpha4, arb_srcptr coeff4, \
257  slong working_prec) \
258  { \
259  mirp_integral4(integrals, \
260  am1, A, nprim1, ngen1, alpha1, coeff1, \
261  am2, B, nprim2, ngen2, alpha2, coeff2, \
262  am3, C, nprim3, ngen3, alpha3, coeff3, \
263  am4, D, nprim4, ngen4, alpha4, coeff4, \
264  working_prec, mirp_##name##_single); \
265  }
266 
267 
268 /*! \brief Create a function that computes all cartesian integrals
269  * of a contracted shell quartet from string arguments
270  * (four-center)
271  *
272  * A function computing all cartesian integrals of a contracted shell quartet
273  * in interval arithmetic is expected to exist and be named `mirp_{name}`
274  *
275  * The created function is named `mirp_{name}_str`.
276  *
277  * \sa mirp_integral4_str
278  */
279 #define MIRP_WRAP_SHELL4_STR(name) \
280  static inline \
281  void mirp_##name##_str(arb_ptr integrals, \
282  int am1, const char ** A, int nprim1, int ngen1, const char ** alpha1, const char ** coeff1, \
283  int am2, const char ** B, int nprim2, int ngen2, const char ** alpha2, const char ** coeff2, \
284  int am3, const char ** C, int nprim3, int ngen3, const char ** alpha3, const char ** coeff3, \
285  int am4, const char ** D, int nprim4, int ngen4, const char ** alpha4, const char ** coeff4, \
286  slong working_prec) \
287  { \
288  mirp_integral4_str(integrals, \
289  am1, A, nprim1, ngen1, alpha1, coeff1, \
290  am2, B, nprim2, ngen2, alpha2, coeff2, \
291  am3, C, nprim3, ngen3, alpha3, coeff3, \
292  am4, D, nprim4, ngen4, alpha4, coeff4, \
293  working_prec, \
294  mirp_##name); \
295  }
296 
297 
298 /*! \brief Create a function that computes all cartesian integrals
299  * of a contracted shell quartet to exact double precision (four-center)
300  *
301  * A function computing all cartesian integrals of a contracted shell quartet
302  * is expected to exist and be named `mirp_{name}`
303  *
304  * The created function is named `mirp_{name}_exact`.
305  *
306  * \sa mirp_integral4_exact
307  */
308 #define MIRP_WRAP_SHELL4_EXACT(name) \
309  static inline \
310  void mirp_##name##_exact(double * integrals, \
311  int am1, const double * A, int nprim1, int ngen1, const double * alpha1, const double * coeff1, \
312  int am2, const double * B, int nprim2, int ngen2, const double * alpha2, const double * coeff2, \
313  int am3, const double * C, int nprim3, int ngen3, const double * alpha3, const double * coeff3, \
314  int am4, const double * D, int nprim4, int ngen4, const double * alpha4, const double * coeff4) \
315  { \
316  mirp_integral4_exact(integrals, \
317  am1, A, nprim1, ngen1, alpha1, coeff1, \
318  am2, B, nprim2, ngen2, alpha2, coeff2, \
319  am3, C, nprim3, ngen3, alpha3, coeff3, \
320  am4, D, nprim4, ngen4, alpha4, coeff4, \
321  mirp_##name); \
322  }
323 
324 
325 #ifdef __cplusplus
326 }
327 #endif
328 
void mirp_integral4_str(arb_ptr integrals, int am1, const char **A, int nprim1, int ngen1, const char **alpha1, const char **coeff1, int am2, const char **B, int nprim2, int ngen2, const char **alpha2, const char **coeff2, int am3, const char **C, int nprim3, int ngen3, const char **alpha3, const char **coeff3, int am4, const char **D, int nprim4, int ngen4, const char **alpha4, const char **coeff4, slong working_prec, cb_integral4 cb)
Compute a single 4-center integral to a target precision (string input)
Definition: integral4_wrappers.c:221
void(* cb_integral4)(arb_ptr, int, arb_srcptr, int, int, arb_srcptr, arb_srcptr, int, arb_srcptr, int, int, arb_srcptr, arb_srcptr, int, arb_srcptr, int, int, arb_srcptr, arb_srcptr, int, arb_srcptr, int, int, arb_srcptr, arb_srcptr, slong)
Pointer to a function that computes all cartesian integrals for a contracted shell quartet (four-cent...
Definition: typedefs.h:50
void mirp_integral4_exact(double *integrals, int am1, const double *A, int nprim1, int ngen1, const double *alpha1, const double *coeff1, int am2, const double *B, int nprim2, int ngen2, const double *alpha2, const double *coeff2, int am3, const double *C, int nprim3, int ngen3, const double *alpha3, const double *coeff3, int am4, const double *D, int nprim4, int ngen4, const double *alpha4, const double *coeff4, cb_integral4 cb)
Compute all cartesian integrals of a contracted shell quartet for an integral to exact double precisi...
Definition: integral4_wrappers.c:411
void mirp_integral4_single_exact(double *integral, const int *lmn1, const double *A, double alpha1, const int *lmn2, const double *B, double alpha2, const int *lmn3, const double *C, double alpha3, const int *lmn4, const double *D, double alpha4, cb_integral4_single cb)
Computes a single integral to exact double precision using interval arithmetic (four-center) ...
Definition: integral4_wrappers.c:303
void(* cb_integral4_single)(arb_t, const int *, arb_srcptr, const arb_t, const int *, arb_srcptr, const arb_t, const int *, arb_srcptr, const arb_t, const int *, arb_srcptr, const arb_t, slong)
Pointer to a function that computes a single cartesian integral (four-center, interval arithmetic) ...
Definition: typedefs.h:18
Typedefs of common function pointers.
void mirp_integral4(arb_ptr integrals, int am1, arb_srcptr A, int nprim1, int ngen1, arb_srcptr alpha1, arb_srcptr coeff1, int am2, arb_srcptr B, int nprim2, int ngen2, arb_srcptr alpha2, arb_srcptr coeff2, int am3, arb_srcptr C, int nprim3, int ngen3, arb_srcptr alpha3, arb_srcptr coeff3, int am4, arb_srcptr D, int nprim4, int ngen4, arb_srcptr alpha4, arb_srcptr coeff4, slong working_prec, cb_integral4_single cb)
Compute all cartesian integrals of a contracted shell quartet for an integral (four-center, interval arithmetic)
Definition: integral4_wrappers.c:86
void mirp_integral4_single_str(arb_t integral, const int *lmn1, const char **A, const char *alpha1, const int *lmn2, const char **B, const char *alpha2, const int *lmn3, const char **C, const char *alpha3, const int *lmn4, const char **D, const char *alpha4, slong working_prec, cb_integral4_single cb)
Compute a single 4-center integral using interval arithmetic (string input)
Definition: integral4_wrappers.c:165