28 #ifndef _chemistry_qc_intv3_int2e_h
29 #define _chemistry_qc_intv3_int2e_h
33 #include <util/ref/ref.h>
34 #include <chemistry/qc/basis/basis.h>
35 #include <chemistry/qc/oint3/build.h>
36 #include <chemistry/qc/basis/fjt.h>
37 #include <chemistry/qc/intv3/types.h>
38 #include <chemistry/qc/intv3/storage.h>
39 #include <chemistry/qc/intv3/array.h>
40 #include <chemistry/qc/intv3/macros.h>
46 #define CHECK_INTEGRAL_ALGORITHM 0
71 int bs1_shell_offset_;
72 int bs2_shell_offset_;
73 int bs3_shell_offset_;
74 int bs4_shell_offset_;
86 enum { STORAGE_CHUNK = 4096 };
89 void* data[STORAGE_CHUNK];
96 intfunc build_routine[4][4][4][4][2];
98 int osh1, osh2, osh3, osh4;
100 int opr1, opr2, opr3, opr4;
102 int saved_am12,saved_am34,saved_ncon;
125 int *int_shell_to_prim;
133 double *int_derint_buffer;
162 int int_integral_storage;
165 int int_derivative_bounds;
169 void add_store(
void *p);
172 void build_not_using_gcs(
int nc1,
int nc2,
int nc3,
int nc4,
173 int minam1,
int minam3,
int maxam12,
int maxam34,
174 int dam1,
int dam2,
int dam3,
int dam4,
int eAB);
175 void build_using_gcs(
int nc1,
int nc2,
int nc3,
int nc4,
176 int minam1,
int minam3,
int maxam12,
int maxam34,
177 int dam1,
int dam2,
int dam3,
int dam4,
int eAB);
178 void gen_prim_intermediates(
int pr1,
int pr2,
int pr3,
int pr4,
int am);
179 void gen_prim_intermediates_with_norm(
int pr1,
int pr2,
int pr3,
int pr4,
180 int am,
double norm);
181 void gen_shell_intermediates(
int sh1,
int sh2,
int sh3,
int sh4);
182 void blockbuildprim(
int minam1,
int maxam12,
int minam3,
int maxam34);
183 void blockbuildprim_1(
int am12min,
int am12max,
int am34,
int m);
184 void blockbuildprim_3(
int am34min,
int am34max,
int m);
188 void int_init_buildgc(
int order,
189 int am1,
int am2,
int am3,
int am4,
190 int nc1,
int nc2,
int nc3,
int nc4);
191 void int_done_buildgc();
192 void int_buildgcam(
int minam1,
int minam2,
int minam3,
int minam4,
193 int maxam1,
int maxam2,
int maxam3,
int maxam4,
194 int dam1,
int dam2,
int dam3,
int dam4,
195 int sh1,
int sh2,
int sh3,
int sh4,
200 void int_offset_print(std::ostream &,
206 void int_offset_print_n(std::ostream &,
double *buffer,
207 int n1,
int n2,
int n3,
int n4,
208 int o1,
int o2,
int o3,
int o4,
209 int e12,
int e13e24,
int e34);
210 void int_print(std::ostream &,
double *buffer,
215 void int_print_n(std::ostream &,
double *buffer,
216 int n1,
int n2,
int n3,
int n4,
217 int e12,
int e13e24,
int e34);
218 void int_print_intermediates(std::ostream &);
222 void shiftam_12(
double *I0100,
double *I1000,
double *I0000,
223 int am1,
int am2,
int am3,
int am4);
224 void shiftam_12eAB(
double *I0100,
double *I1000,
double *I0000,
225 int am1,
int am2,
int am3,
int am4);
226 void shiftam_34(
double *I0001,
double *I0010,
double *I0000,
227 int am1,
int am2,
int am3,
int am4);
231 void int_init_shiftgc(
int order,
int am1,
int am2,
int am3,
int am4);
232 void int_done_shiftgc();
233 double *int_shiftgcam(
int gc1,
int gc2,
int gc3,
int gc4,
234 int tam1,
int tam2,
int tam3,
int tam4,
int peAB);
238 void alloc_inter(
int nprim,
int nshell);
246 double *int_initialize_erep(
size_t storage,
int order,
251 void int_done_erep();
260 void transform_init();
261 void transform_done();
262 void source_space(
int nsource);
263 void copy_to_source(
double *integrals,
int nsource);
264 void do_gencon_sparse_transform_2e(
Integral*integ,
265 double *integrals,
double *target,
272 double *integrals,
double *target,
276 double *integrals,
double *target,
282 void compute_erep(
int flags,
int *psh1,
int *psh2,
int *psh3,
int *psh4,
283 int dam1,
int dam2,
int dam3,
int dam4);
284 void compute_erep_1der(
int flags,
double *buffer,
285 int *psh1,
int *psh2,
int *psh3,
int *psh4,
287 void nonredundant_erep(
double *buffer,
int e12,
int e34,
int e13e24,
288 int n1,
int n2,
int n3,
int n4,
289 int *red_off,
int *nonred_off);
290 void compute_erep_bound1der(
int flags,
double *buffer,
291 int *psh1,
int *psh2,
int *psh3,
int *psh4);
295 void int_erep_bound1der(
int flags,
int bsh1,
int bsh2,
int *size);
300 typedef signed char int_bound_t;
301 enum { int_bound_min = SCHAR_MIN, int_bound_max = SCHAR_MAX };
304 int_bound_t *int_Qvec;
305 int_bound_t *int_Rvec;
309 void int_init_bounds_nocomp();
310 void int_init_bounds_1der_nocomp();
311 void int_bounds_comp(
int s1,
int s2);
312 void int_bounds_1der_comp(
int s1,
int s2);
313 int int_erep_2bound(
int s1,
int s2);
314 int int_erep_0bound_1der();
315 int int_erep_2bound_1der(
int s1,
int s2);
319 void compute_bounds(int_bound_t *overall, int_bound_t *vec,
int flag);
320 void compute_bounds_shell(int_bound_t *overall, int_bound_t *vec,
321 int flag,
int sh1,
int sh2);
325 int int_have_stored_integral(
int sh1,
int sh2,
int sh3,
int sh4,
326 int p12,
int p34,
int p13p24);
327 void int_store_integral(
int sh1,
int sh2,
int sh3,
int sh4,
328 int p12,
int p34,
int p13p24,
333 void int_initialize_offsets2();
334 void int_done_offsets2();
338 void make_int_unit_shell();
339 void delete_int_unit_shell();
344 int used_storage_build_;
345 int used_storage_shift_;
356 int order,
size_t storage);
360 void init_storage(
int size);
364 int storage_used() {
return used_storage_; }
368 void init_bounds_1der();
370 void done_bounds_1der();
376 static double logbound_to_bound(
int);
377 static int bound_to_logbound(
double value);
382 int redundant() {
return redundant_; }
383 void set_redundant(
int i) { redundant_ = i; }
387 int permute() {
return permute_; }
388 void set_permute(
int i) { permute_ = i; }
390 int used_storage()
const {
return used_storage_; }
393 void erep(
int &psh1,
int &psh2,
int &psh3,
int &psh4);
394 void erep(
int *shells,
int *sizes);
395 void erep_all1der(
int &psh1,
int &psh2,
int &psh3,
int &psh4,
396 der_centersv3_t *der_centers);
397 void erep_all1der(
int *shells,
int *sizes,
398 der_centersv3_t *dercenters);
401 void erep_2center(
int &psh1,
int &psh2);
402 void erep_2center(
int *shells,
int *sizes);
403 void erep_3center(
int &psh1,
int &psh2,
int &psh3);
404 void erep_3center(
int *shells,
int *sizes);
407 int erep_4bound(
int s1,
int s2,
int s3,
int s4);
408 int erep_4bound_1der(
int s1,
int s2,
int s3,
int s4);
410 double *buffer() {
return int_buffer; }
412 Ref<GaussianBasisSet> basis()
414 if (bs1_==bs2_ && bs1_ == bs3_ && bs1_ == bs4_)
return bs1_;
417 Ref<GaussianBasisSet> basis1() {
return bs1_; }
418 Ref<GaussianBasisSet> basis2() {
return bs2_; }
419 Ref<GaussianBasisSet> basis3() {
return bs3_; }
420 Ref<GaussianBasisSet> basis4() {
return bs4_; }
422 Ref<GaussianBasisSet> cs1()
const {
return int_cs1; }
423 Ref<GaussianBasisSet> cs2()
const {
return int_cs2; }
424 Ref<GaussianBasisSet> cs3()
const {
return int_cs3; }
425 Ref<GaussianBasisSet> cs4()
const {
return int_cs4; }
427 GaussianBasisSet * pcs1()
const {
return int_cs1.
pointer(); }
428 GaussianBasisSet * pcs2()
const {
return int_cs2.
pointer(); }
429 GaussianBasisSet * pcs3()
const {
return int_cs3.
pointer(); }
430 GaussianBasisSet * pcs4()
const {
return int_cs4.
pointer(); }