1 /*----------------------------------------------------------------------
2   demo.c
3 
4   Sample program of LIBERI
5 
6   Coded by TOYODA MAsayuki, June 2009.
7 ----------------------------------------------------------------------*/
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <math.h>
11 #include "eri.h"
12 
13 #define NMESH 8192
14 
15 
main(void)16 int main(void)
17 {
18   int i;
19   double r, I4[2];
20   const double rmax = 300.0;
21 
22   ERI_t *eri;
23   ERI_Orbital_t p[4];
24 
25   double xr[NMESH], gto_s[NMESH];
26 
27   /* radial mesh and GTO */
28   for (i=0; i<NMESH; i++) {
29     r = rmax*(double)i/(double)NMESH;
30     xr[i] = r;
31     gto_s[i] = exp(-r*r);
32   }
33 
34   /*  prepare orbital informations */
35   p[0].fr = gto_s; p[0].xr = xr; p[0].ngrid = NMESH; p[0].l = 0; p[0].m = 0;
36   p[1].fr = gto_s; p[1].xr = xr; p[1].ngrid = NMESH; p[1].l = 0; p[1].m = 0;
37   p[2].fr = gto_s; p[2].xr = xr; p[2].ngrid = NMESH; p[2].l = 0; p[2].m = 0;
38   p[3].fr = gto_s; p[3].xr = xr; p[3].ngrid = NMESH; p[3].l = 0; p[3].m = 0;
39 
40   /* positions */
41   p[0].c[0] =  0.5; p[0].c[1] =  0.5; p[0].c[2] = 0.0;
42   p[1].c[0] =  0.5; p[1].c[1] = -0.5; p[1].c[2] = 0.0;
43   p[2].c[0] = -0.5; p[2].c[1] =  0.5; p[2].c[2] = 0.0;
44   p[3].c[0] = -0.5; p[3].c[1] = -0.5; p[3].c[2] = 0.0;
45 
46   /* initialize LIBERI */
47   eri = ERI_Init(15, 8, 1024, 100, ERI_SH_COMPLEX, NULL);
48   if (NULL == eri) {
49     fprintf(stderr, "*** Failed to initialize LIBERI.\n");
50     return -1;
51   }
52 
53   /* calculate ERI */
54   ERI_Integral(eri, I4, NULL, &p[0], &p[1], &p[2], &p[3], ERI_NOSCREEN);
55   printf("  %10.6f  %10.6f\n", I4[0], I4[1]);
56 
57   /* release LIBERI */
58   ERI_Free(eri);
59 
60   return 0;
61 }
62 
63 
64 /* EOF */
65