32 #ifndef _chemistry_qc_intv3_int2e_h
33 #define _chemistry_qc_intv3_int2e_h
37 #include <util/ref/ref.h>
38 #include <chemistry/qc/basis/basis.h>
39 #include <chemistry/qc/oint3/build.h>
40 #include <chemistry/qc/intv3/fjt.h>
41 #include <chemistry/qc/intv3/types.h>
42 #include <chemistry/qc/intv3/storage.h>
43 #include <chemistry/qc/intv3/array.h>
44 #include <chemistry/qc/intv3/macros.h>
50 #define CHECK_INTEGRAL_ALGORITHM 0
75 int bs1_shell_offset_;
76 int bs2_shell_offset_;
77 int bs3_shell_offset_;
78 int bs4_shell_offset_;
90 enum { STORAGE_CHUNK = 4096 };
93 void* data[STORAGE_CHUNK];
100 intfunc build_routine[4][4][4][4][2];
102 int osh1, osh2, osh3, osh4;
104 int opr1, opr2, opr3, opr4;
106 int saved_am12,saved_am34,saved_ncon;
129 int *int_shell_to_prim;
137 double *int_derint_buffer;
166 int int_integral_storage;
169 int int_derivative_bounds;
173 void add_store(
void *p);
176 void build_not_using_gcs(
int nc1,
int nc2,
int nc3,
int nc4,
177 int minam1,
int minam3,
int maxam12,
int maxam34,
178 int dam1,
int dam2,
int dam3,
int dam4,
int eAB);
179 void build_using_gcs(
int nc1,
int nc2,
int nc3,
int nc4,
180 int minam1,
int minam3,
int maxam12,
int maxam34,
181 int dam1,
int dam2,
int dam3,
int dam4,
int eAB);
182 void gen_prim_intermediates(
int pr1,
int pr2,
int pr3,
int pr4,
int am);
183 void gen_prim_intermediates_with_norm(
int pr1,
int pr2,
int pr3,
int pr4,
184 int am,
double norm);
185 void gen_shell_intermediates(
int sh1,
int sh2,
int sh3,
int sh4);
186 void blockbuildprim(
int minam1,
int maxam12,
int minam3,
int maxam34);
187 void blockbuildprim_1(
int am12min,
int am12max,
int am34,
int m);
188 void blockbuildprim_3(
int am34min,
int am34max,
int m);
192 void int_init_buildgc(
int order,
193 int am1,
int am2,
int am3,
int am4,
194 int nc1,
int nc2,
int nc3,
int nc4);
195 void int_done_buildgc();
196 void int_buildgcam(
int minam1,
int minam2,
int minam3,
int minam4,
197 int maxam1,
int maxam2,
int maxam3,
int maxam4,
198 int dam1,
int dam2,
int dam3,
int dam4,
199 int sh1,
int sh2,
int sh3,
int sh4,
204 void int_offset_print(std::ostream &,
210 void int_offset_print_n(std::ostream &,
double *buffer,
211 int n1,
int n2,
int n3,
int n4,
212 int o1,
int o2,
int o3,
int o4,
213 int e12,
int e13e24,
int e34);
214 void int_print(std::ostream &,
double *buffer,
219 void int_print_n(std::ostream &,
double *buffer,
220 int n1,
int n2,
int n3,
int n4,
221 int e12,
int e13e24,
int e34);
222 void int_print_intermediates(std::ostream &);
226 void shiftam_12(
double *I0100,
double *I1000,
double *I0000,
227 int am1,
int am2,
int am3,
int am4);
228 void shiftam_12eAB(
double *I0100,
double *I1000,
double *I0000,
229 int am1,
int am2,
int am3,
int am4);
230 void shiftam_34(
double *I0001,
double *I0010,
double *I0000,
231 int am1,
int am2,
int am3,
int am4);
235 void int_init_shiftgc(
int order,
int am1,
int am2,
int am3,
int am4);
236 void int_done_shiftgc();
237 double *int_shiftgcam(
int gc1,
int gc2,
int gc3,
int gc4,
238 int tam1,
int tam2,
int tam3,
int tam4,
int peAB);
242 void alloc_inter(
int nprim,
int nshell);
250 double *int_initialize_erep(
size_t storage,
int order,
255 void int_done_erep();
264 void transform_init();
265 void transform_done();
266 void source_space(
int nsource);
267 void copy_to_source(
double *integrals,
int nsource);
268 void do_gencon_sparse_transform_2e(
Integral*integ,
269 double *integrals,
double *target,
276 double *integrals,
double *target,
280 double *integrals,
double *target,
286 void compute_erep(
int flags,
int *psh1,
int *psh2,
int *psh3,
int *psh4,
287 int dam1,
int dam2,
int dam3,
int dam4);
288 void compute_erep_1der(
int flags,
double *buffer,
289 int *psh1,
int *psh2,
int *psh3,
int *psh4,
291 void nonredundant_erep(
double *buffer,
int e12,
int e34,
int e13e24,
292 int n1,
int n2,
int n3,
int n4,
293 int *red_off,
int *nonred_off);
294 void compute_erep_bound1der(
int flags,
double *buffer,
295 int *psh1,
int *psh2,
int *psh3,
int *psh4);
299 void int_erep_bound1der(
int flags,
int bsh1,
int bsh2,
int *size);
304 typedef signed char int_bound_t;
305 enum { int_bound_min = SCHAR_MIN, int_bound_max = SCHAR_MAX };
308 int_bound_t *int_Qvec;
309 int_bound_t *int_Rvec;
313 void int_init_bounds_nocomp();
314 void int_init_bounds_1der_nocomp();
315 void int_bounds_comp(
int s1,
int s2);
316 void int_bounds_1der_comp(
int s1,
int s2);
317 int int_erep_2bound(
int s1,
int s2);
318 int int_erep_0bound_1der();
319 int int_erep_2bound_1der(
int s1,
int s2);
323 void compute_bounds(int_bound_t *overall, int_bound_t *vec,
int flag);
324 void compute_bounds_shell(int_bound_t *overall, int_bound_t *vec,
325 int flag,
int sh1,
int sh2);
329 int int_have_stored_integral(
int sh1,
int sh2,
int sh3,
int sh4,
330 int p12,
int p34,
int p13p24);
331 void int_store_integral(
int sh1,
int sh2,
int sh3,
int sh4,
332 int p12,
int p34,
int p13p24,
337 void int_initialize_offsets2();
338 void int_done_offsets2();
342 void make_int_unit_shell();
343 void delete_int_unit_shell();
348 int used_storage_build_;
349 int used_storage_shift_;
360 int order,
size_t storage);
364 void init_storage(
int size);
368 int storage_used() {
return used_storage_; }
372 void init_bounds_1der();
374 void done_bounds_1der();
380 static double logbound_to_bound(
int);
381 static int bound_to_logbound(
double value);
386 int redundant() {
return redundant_; }
387 void set_redundant(
int i) { redundant_ = i; }
391 int permute() {
return permute_; }
392 void set_permute(
int i) { permute_ = i; }
394 int used_storage()
const {
return used_storage_; }
397 void erep(
int &psh1,
int &psh2,
int &psh3,
int &psh4);
398 void erep(
int *shells,
int *sizes);
399 void erep_all1der(
int &psh1,
int &psh2,
int &psh3,
int &psh4,
400 der_centersv3_t *der_centers);
401 void erep_all1der(
int *shells,
int *sizes,
402 der_centersv3_t *dercenters);
405 void erep_2center(
int &psh1,
int &psh2);
406 void erep_2center(
int *shells,
int *sizes);
407 void erep_3center(
int &psh1,
int &psh2,
int &psh3);
408 void erep_3center(
int *shells,
int *sizes);
411 int erep_4bound(
int s1,
int s2,
int s3,
int s4);
412 int erep_4bound_1der(
int s1,
int s2,
int s3,
int s4);
414 double *buffer() {
return int_buffer; }
416 Ref<GaussianBasisSet> basis()
418 if (bs1_==bs2_ && bs1_ == bs3_ && bs1_ == bs4_)
return bs1_;
421 Ref<GaussianBasisSet> basis1() {
return bs1_; }
422 Ref<GaussianBasisSet> basis2() {
return bs2_; }
423 Ref<GaussianBasisSet> basis3() {
return bs3_; }
424 Ref<GaussianBasisSet> basis4() {
return bs4_; }
426 Ref<GaussianBasisSet> cs1()
const {
return int_cs1; }
427 Ref<GaussianBasisSet> cs2()
const {
return int_cs2; }
428 Ref<GaussianBasisSet> cs3()
const {
return int_cs3; }
429 Ref<GaussianBasisSet> cs4()
const {
return int_cs4; }
431 GaussianBasisSet * pcs1()
const {
return int_cs1.
pointer(); }
432 GaussianBasisSet * pcs2()
const {
return int_cs2.
pointer(); }
433 GaussianBasisSet * pcs3()
const {
return int_cs3.
pointer(); }
434 GaussianBasisSet * pcs4()
const {
return int_cs4.
pointer(); }