mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-06-27 15:42:54 +02:00
Added test to set basis set parameters
This commit is contained in:
parent
5c285dcdb6
commit
afd3f6ae7a
|
@ -163,8 +163,7 @@ cppcheck --addon=cert --enable=all *.c &> cppcheck.out
|
|||
and terminated by a ~'\0'~ character (C convention).
|
||||
- Complex numbers can be represented by an array of 2 floats.
|
||||
- Boolean variables are stored as integers, ~1~ for ~true~ and ~0~ for ~false~
|
||||
- Floating point variables should be by default
|
||||
- ~double~ unless explicitly mentioned
|
||||
- Floating point variables should be by default ~double~ unless explicitly mentioned
|
||||
- integers used for counting should always be ~int64_t~
|
||||
|
||||
To facilitate the use in other languages than C, we will provide some
|
||||
|
@ -265,15 +264,3 @@ cppcheck --addon=cert --enable=all *.c &> cppcheck.out
|
|||
QMCkl is a general purpose library, multiple algorithms should be
|
||||
implemented adapted to different problem sizes.
|
||||
|
||||
** Rules for the API
|
||||
|
||||
- =stdint= should be used for integers (=int32_t=, =int64_t=)
|
||||
- integers used for counting should always be =int64_t=
|
||||
- floats should be by default =double=, unless explicitly mentioned
|
||||
- pointers are converted to =int64_t= to increase portability
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
298
src/qmckl_ao.org
298
src/qmckl_ao.org
|
@ -116,7 +116,7 @@ shell_center = [1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2]
|
|||
shell_ang_mom = ['S', 'S', 'S', 'P', 'P', 'D', 'S', 'S', 'S', 'P', 'P', 'D']
|
||||
shell_factor = [ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]
|
||||
shell_prim_num = [5, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1]
|
||||
prim_index = [1, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 20]
|
||||
shell_prim_index = [1, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 20]
|
||||
exponent = [ 33.87, 5.095, 1.159, 0.3258, 0.1027, 0.3258, 0.1027,
|
||||
1.407, 0.388, 1.057, 33.87, 5.095, 1.159, 0.3258, 0.1027,
|
||||
0.3258, 0.1027, 1.407, 0.388, 1.057]
|
||||
|
@ -134,7 +134,7 @@ typedef struct qmckl_ao_basis_struct {
|
|||
int64_t shell_num;
|
||||
int64_t prim_num;
|
||||
int64_t * shell_center;
|
||||
int32_t * shell_ang_mom;
|
||||
char * shell_ang_mom;
|
||||
int64_t * shell_prim_num;
|
||||
int64_t * shell_prim_index;
|
||||
double * shell_factor;
|
||||
|
@ -145,36 +145,41 @@ typedef struct qmckl_ao_basis_struct {
|
|||
#+end_src
|
||||
|
||||
The ~uninitialized~ integer contains one bit set to one for each
|
||||
initialization function which has not bee called. When it is equal
|
||||
to zero, the struct is initialized and ~provided == 1~.
|
||||
initialization function which has not bee called. It becomes equal
|
||||
to zero after all initialization functions have been called. The
|
||||
struct is then initialized and ~provided == 1~.
|
||||
|
||||
** Access functions
|
||||
|
||||
Access to scalars copies the values at the passed address, and
|
||||
for array values a pointer to the array is returned.
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_private_func)
|
||||
char qmckl_get_ao_basis_type (const qmckl_context context);
|
||||
int64_t qmckl_get_ao_basis_shell_num (const qmckl_context context);
|
||||
int64_t qmckl_get_ao_basis_prim_num (const qmckl_context context);
|
||||
int64_t* qmckl_get_ao_basis_shell_center (const qmckl_context context);
|
||||
char* qmckl_get_ao_basis_shell_ang_mom (const qmckl_context context);
|
||||
int64_t* qmckl_get_ao_basis_shell_prim_num (const qmckl_context context);
|
||||
int64_t* qmckl_get_ao_basis_shell_prim_index (const qmckl_context context);
|
||||
double* qmckl_get_ao_basis_shell_factor (const qmckl_context context);
|
||||
double* qmckl_get_ao_basis_exponent (const qmckl_context context);
|
||||
double* qmckl_get_ao_basis_coefficient (const qmckl_context context);
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_func)
|
||||
char qmckl_get_ao_basis_type (qmckl_context context);
|
||||
int64_t qmckl_get_ao_basis_shell_num (qmckl_context context);
|
||||
int64_t qmckl_get_ao_basis_prim_num (qmckl_context context);
|
||||
int64_t* qmckl_get_ao_basis_shell_center (qmckl_context context);
|
||||
int32_t* qmckl_get_ao_basis_shell_ang_mom (qmckl_context context);
|
||||
int64_t* qmckl_get_ao_basis_shell_prim_num (qmckl_context context);
|
||||
double* qmckl_get_ao_basis_shell_factor (qmckl_context context);
|
||||
double* qmckl_get_ao_basis_exponent (qmckl_context context);
|
||||
double* qmckl_get_ao_basis_coefficient (qmckl_context context);
|
||||
int32_t qmckl_ao_basis_provided (const qmckl_context context);
|
||||
#+end_src
|
||||
|
||||
#+NAME:post
|
||||
#+begin_src c
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
||||
#+begin_src c :comments org :tangle (eval c) :noweb yes
|
||||
char qmckl_get_ao_basis_type (qmckl_context context) {
|
||||
char qmckl_get_ao_basis_type (const qmckl_context context) {
|
||||
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return (char) 0;
|
||||
|
@ -185,7 +190,7 @@ char qmckl_get_ao_basis_type (qmckl_context context) {
|
|||
|
||||
int32_t mask = 1;
|
||||
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return (char) 0;
|
||||
}
|
||||
|
||||
|
@ -194,7 +199,7 @@ char qmckl_get_ao_basis_type (qmckl_context context) {
|
|||
}
|
||||
|
||||
|
||||
int64_t qmckl_get_ao_basis_shell_num (qmckl_context context) {
|
||||
int64_t qmckl_get_ao_basis_shell_num (const qmckl_context context) {
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return (int64_t) 0;
|
||||
}
|
||||
|
@ -204,16 +209,16 @@ int64_t qmckl_get_ao_basis_shell_num (qmckl_context context) {
|
|||
|
||||
int32_t mask = 1 << 1;
|
||||
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return (int64_t) 0;
|
||||
}
|
||||
|
||||
assert (ctx->ao_basis.shell_num != (int64_t) 0);
|
||||
assert (ctx->ao_basis.shell_num > (int64_t) 0);
|
||||
return ctx->ao_basis.shell_num;
|
||||
}
|
||||
|
||||
|
||||
int64_t qmckl_get_ao_basis_prim_num (qmckl_context context) {
|
||||
int64_t qmckl_get_ao_basis_prim_num (const qmckl_context context) {
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return (int64_t) 0;
|
||||
}
|
||||
|
@ -223,16 +228,16 @@ int64_t qmckl_get_ao_basis_prim_num (qmckl_context context) {
|
|||
|
||||
int32_t mask = 1 << 2;
|
||||
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return (int64_t) 0;
|
||||
}
|
||||
|
||||
assert (ctx->ao_basis.prim_num != (int64_t) 0);
|
||||
assert (ctx->ao_basis.prim_num > (int64_t) 0);
|
||||
return ctx->ao_basis.prim_num;
|
||||
}
|
||||
|
||||
|
||||
int64_t* qmckl_get_ao_basis_shell_center (qmckl_context context) {
|
||||
int64_t* qmckl_get_ao_basis_shell_center (const qmckl_context context) {
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -242,7 +247,7 @@ int64_t* qmckl_get_ao_basis_shell_center (qmckl_context context) {
|
|||
|
||||
int32_t mask = 1 << 3;
|
||||
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -251,7 +256,7 @@ int64_t* qmckl_get_ao_basis_shell_center (qmckl_context context) {
|
|||
}
|
||||
|
||||
|
||||
int32_t* qmckl_get_ao_basis_shell_ang_mom (qmckl_context context) {
|
||||
char* qmckl_get_ao_basis_shell_ang_mom (const qmckl_context context) {
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -261,7 +266,7 @@ int32_t* qmckl_get_ao_basis_shell_ang_mom (qmckl_context context) {
|
|||
|
||||
int32_t mask = 1 << 4;
|
||||
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -270,7 +275,7 @@ int32_t* qmckl_get_ao_basis_shell_ang_mom (qmckl_context context) {
|
|||
}
|
||||
|
||||
|
||||
int64_t* qmckl_get_ao_basis_shell_prim_num (qmckl_context context) {
|
||||
int64_t* qmckl_get_ao_basis_shell_prim_num (const qmckl_context context) {
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -280,7 +285,7 @@ int64_t* qmckl_get_ao_basis_shell_prim_num (qmckl_context context) {
|
|||
|
||||
int32_t mask = 1 << 5;
|
||||
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -289,7 +294,7 @@ int64_t* qmckl_get_ao_basis_shell_prim_num (qmckl_context context) {
|
|||
}
|
||||
|
||||
|
||||
int64_t* qmckl_get_ao_basis_shell_prim_index (qmckl_context context) {
|
||||
int64_t* qmckl_get_ao_basis_shell_prim_index (const qmckl_context context) {
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -299,7 +304,7 @@ int64_t* qmckl_get_ao_basis_shell_prim_index (qmckl_context context) {
|
|||
|
||||
int32_t mask = 1 << 6;
|
||||
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -308,7 +313,7 @@ int64_t* qmckl_get_ao_basis_shell_prim_index (qmckl_context context) {
|
|||
}
|
||||
|
||||
|
||||
double* qmckl_get_ao_basis_shell_factor (qmckl_context context) {
|
||||
double* qmckl_get_ao_basis_shell_factor (const qmckl_context context) {
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -318,7 +323,7 @@ double* qmckl_get_ao_basis_shell_factor (qmckl_context context) {
|
|||
|
||||
int32_t mask = 1 << 7;
|
||||
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -327,7 +332,7 @@ double* qmckl_get_ao_basis_shell_factor (qmckl_context context) {
|
|||
}
|
||||
|
||||
|
||||
double* qmckl_get_ao_basis_exponent (qmckl_context context) {
|
||||
double* qmckl_get_ao_basis_exponent (const qmckl_context context) {
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -338,7 +343,7 @@ double* qmckl_get_ao_basis_exponent (qmckl_context context) {
|
|||
|
||||
int32_t mask = 1 << 8;
|
||||
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
@ -347,7 +352,7 @@ double* qmckl_get_ao_basis_exponent (qmckl_context context) {
|
|||
}
|
||||
|
||||
|
||||
double* qmckl_get_ao_basis_coefficient (qmckl_context context) {
|
||||
double* qmckl_get_ao_basis_coefficient (const qmckl_context context) {
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return NULL;
|
||||
}
|
||||
|
@ -357,30 +362,44 @@ double* qmckl_get_ao_basis_coefficient (qmckl_context context) {
|
|||
|
||||
int32_t mask = 1 << 9;
|
||||
|
||||
if (ctx->ao_basis.uninitialized &= mask != 0) {
|
||||
if ( (ctx->ao_basis.uninitialized & mask) != 0) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
assert (ctx->ao_basis.coefficient != NULL);
|
||||
return ctx->ao_basis.coefficient;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
||||
int32_t qmckl_ao_basis_provided(const qmckl_context context) {
|
||||
|
||||
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
||||
assert (ctx != NULL);
|
||||
|
||||
return ctx->ao_basis.provided;
|
||||
}
|
||||
#+end_src
|
||||
|
||||
** Initialization functions
|
||||
|
||||
To set the basis set, all the following functions need to be
|
||||
called. When
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_func)
|
||||
qmckl_exit_code qmckl_set_ao_basis_type (qmckl_context context, const char t);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_num (qmckl_context context, const int64_t shell_num);
|
||||
qmckl_exit_code qmckl_set_ao_basis_prim_num (qmckl_context context, const int64_t prim_num);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_center (qmckl_context context, const int64_t * shell_center);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_ang_mom (qmckl_context context, const int32_t * shell_ang_mom);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_center (qmckl_context context, const int64_t * shell_prim_num);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_factor (qmckl_context context, const double * shell_factor);
|
||||
qmckl_exit_code qmckl_set_ao_basis_exponent (qmckl_context context, const double * exponent);
|
||||
qmckl_exit_code qmckl_set_ao_basis_coefficient (qmckl_context context, const double * coefficient);
|
||||
qmckl_exit_code qmckl_set_ao_basis_type (qmckl_context context, const char t);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_num (qmckl_context context, const int64_t shell_num);
|
||||
qmckl_exit_code qmckl_set_ao_basis_prim_num (qmckl_context context, const int64_t prim_num);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_prim_index (qmckl_context context, const int64_t * shell_prim_index);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_center (qmckl_context context, const int64_t * shell_center);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_ang_mom (qmckl_context context, const char * shell_ang_mom);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_prim_num (qmckl_context context, const int64_t * shell_prim_num);
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_factor (qmckl_context context, const double * shell_factor);
|
||||
qmckl_exit_code qmckl_set_ao_basis_exponent (qmckl_context context, const double * exponent);
|
||||
qmckl_exit_code qmckl_set_ao_basis_coefficient (qmckl_context context, const double * coefficient);
|
||||
#+end_src
|
||||
|
||||
#+NAME:pre2
|
||||
|
@ -394,7 +413,7 @@ qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
|
|||
|
||||
#+NAME:post2
|
||||
#+begin_src c
|
||||
ctx->ao_basis.uninitialized &= !(mask);
|
||||
ctx->ao_basis.uninitialized &= ~mask;
|
||||
|
||||
if (ctx->ao_basis.uninitialized == 0) {
|
||||
ctx->ao_basis.provided = 1;
|
||||
|
@ -515,7 +534,7 @@ qmckl_exit_code qmckl_set_ao_basis_shell_center(qmckl_context context, const in
|
|||
}
|
||||
|
||||
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_ang_mom(qmckl_context context, const int32_t* shell_ang_mom) {
|
||||
qmckl_exit_code qmckl_set_ao_basis_shell_ang_mom(qmckl_context context, const char* shell_ang_mom) {
|
||||
<<pre2>>
|
||||
|
||||
int32_t mask = 1 << 4;
|
||||
|
@ -539,8 +558,8 @@ qmckl_exit_code qmckl_set_ao_basis_shell_ang_mom(qmckl_context context, const i
|
|||
|
||||
|
||||
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
|
||||
mem_info.size = shell_num * sizeof(int64_t);
|
||||
int32_t* new_array = (int32_t*) qmckl_malloc(context, mem_info);
|
||||
mem_info.size = shell_num * sizeof(char);
|
||||
char* new_array = (char*) qmckl_malloc(context, mem_info);
|
||||
|
||||
if (new_array == NULL) {
|
||||
return qmckl_failwith( context,
|
||||
|
@ -763,6 +782,101 @@ qmckl_exit_code qmckl_set_ao_basis_coefficient(qmckl_context context, const dou
|
|||
|
||||
#+end_src
|
||||
|
||||
|
||||
** Fortran interfaces
|
||||
#+NAME: qmckl_ao_power_args
|
||||
| qmckl_context | context | in | Global state |
|
||||
| int64_t | n | in | Number of values |
|
||||
| double | X[n] | in | Array containing the input values |
|
||||
| int32_t | LMAX[n] | in | Array containing the maximum power for each value |
|
||||
| double | P[n][ldp] | out | Array containing all the powers of ~X~ |
|
||||
| int64_t | ldp | in | Leading dimension of array ~P~ |
|
||||
|
||||
** Test
|
||||
|
||||
#+begin_src c :tangle (eval c_test)
|
||||
/* Reference input data */
|
||||
|
||||
char typ = 'G';
|
||||
#define shell_num ((int64_t) 12)
|
||||
#define prim_num ((int64_t) 20)
|
||||
|
||||
int64_t shell_center [shell_num] =
|
||||
{ 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2 };
|
||||
|
||||
char shell_ang_mom [shell_num] =
|
||||
{ 'S', 'S', 'S', 'P', 'P', 'D', 'S', 'S', 'S', 'P', 'P', 'D' };
|
||||
|
||||
double shell_factor [shell_num] =
|
||||
{ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1. };
|
||||
|
||||
int64_t shell_prim_num [shell_num] =
|
||||
{5, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1};
|
||||
|
||||
int64_t shell_prim_index [shell_num] =
|
||||
{1, 6, 7, 8, 9, 10, 11, 16, 17, 18, 19, 20};
|
||||
|
||||
double exponent [prim_num] =
|
||||
{ 33.87, 5.095, 1.159, 0.3258, 0.1027, 0.3258, 0.1027,
|
||||
1.407, 0.388, 1.057, 33.87, 5.095, 1.159, 0.3258, 0.1027,
|
||||
0.3258, 0.1027, 1.407, 0.388, 1.057 };
|
||||
|
||||
double coefficient [prim_num] =
|
||||
{ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421,
|
||||
1.0, 1.0, 1.0, 1.0, 1.0, 0.006068, 0.045308, 0.202822,
|
||||
0.503903, 0.383421, 1.0, 1.0, 1.0, 1.0, 1.0 };
|
||||
/* --- */
|
||||
|
||||
qmckl_exit_code rc;
|
||||
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_type (context, typ);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_num (context, shell_num);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_prim_num (context, prim_num);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_center (context, shell_center);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_ang_mom (context, shell_ang_mom);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_factor (context, shell_factor);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_center (context, shell_prim_num);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_prim_num (context, shell_prim_num);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_prim_index (context, shell_prim_index);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_exponent (context, exponent);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0);
|
||||
|
||||
rc = qmckl_set_ao_basis_coefficient (context, coefficient);
|
||||
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
|
||||
munit_assert_int(qmckl_ao_basis_provided(context), ==, 1);
|
||||
|
||||
#+end_src
|
||||
|
||||
* Polynomial part
|
||||
** Powers of $x-X_i$
|
||||
:PROPERTIES:
|
||||
|
@ -924,7 +1038,6 @@ integer(c_int32_t) function test_qmckl_ao_power(context) bind(C)
|
|||
double precision :: epsilon
|
||||
|
||||
epsilon = qmckl_get_numprec_epsilon(context)
|
||||
print *, epsilon
|
||||
|
||||
n = 100;
|
||||
LDP = 10;
|
||||
|
@ -1337,38 +1450,39 @@ int test_qmckl_ao_polynomial_vgl(qmckl_context context);
|
|||
munit_assert_int(0, ==, test_qmckl_ao_polynomial_vgl(context));
|
||||
#+end_src
|
||||
|
||||
* Gaussian basis functions
|
||||
* Radial part
|
||||
** Gaussian basis functions
|
||||
|
||||
~qmckl_ao_gaussian_vgl~ computes the values, gradients and
|
||||
Laplacians at a given point of ~n~ Gaussian functions centered at
|
||||
the same point:
|
||||
~qmckl_ao_gaussian_vgl~ computes the values, gradients and
|
||||
Laplacians at a given point of ~n~ Gaussian functions centered at
|
||||
the same point:
|
||||
|
||||
\[ v_i = \exp(-a_i |X-R|^2) \]
|
||||
\[ \nabla_x v_i = -2 a_i (X_x - R_x) v_i \]
|
||||
\[ \nabla_y v_i = -2 a_i (X_y - R_y) v_i \]
|
||||
\[ \nabla_z v_i = -2 a_i (X_z - R_z) v_i \]
|
||||
\[ \Delta v_i = a_i (4 |X-R|^2 a_i - 6) v_i \]
|
||||
\[ v_i = \exp(-a_i |X-R|^2) \]
|
||||
\[ \nabla_x v_i = -2 a_i (X_x - R_x) v_i \]
|
||||
\[ \nabla_y v_i = -2 a_i (X_y - R_y) v_i \]
|
||||
\[ \nabla_z v_i = -2 a_i (X_z - R_z) v_i \]
|
||||
\[ \Delta v_i = a_i (4 |X-R|^2 a_i - 6) v_i \]
|
||||
|
||||
| ~context~ | input | Global state |
|
||||
| ~X(3)~ | input | Array containing the coordinates of the points |
|
||||
| ~R(3)~ | input | Array containing the x,y,z coordinates of the center |
|
||||
| ~n~ | input | Number of computed Gaussians |
|
||||
| ~A(n)~ | input | Exponents of the Gaussians |
|
||||
| ~VGL(ldv,5)~ | output | Value, gradients and Laplacian of the Gaussians |
|
||||
| ~ldv~ | input | Leading dimension of array ~VGL~ |
|
||||
| ~context~ | input | Global state |
|
||||
| ~X(3)~ | input | Array containing the coordinates of the points |
|
||||
| ~R(3)~ | input | Array containing the x,y,z coordinates of the center |
|
||||
| ~n~ | input | Number of computed Gaussians |
|
||||
| ~A(n)~ | input | Exponents of the Gaussians |
|
||||
| ~VGL(ldv,5)~ | output | Value, gradients and Laplacian of the Gaussians |
|
||||
| ~ldv~ | input | Leading dimension of array ~VGL~ |
|
||||
|
||||
Requirements :
|
||||
Requirements :
|
||||
|
||||
- ~context~ is not 0
|
||||
- ~n~ > 0
|
||||
- ~ldv~ >= 5
|
||||
- ~A(i)~ > 0 for all ~i~
|
||||
- ~X~ is allocated with at least $3 \times 8$ bytes
|
||||
- ~R~ is allocated with at least $3 \times 8$ bytes
|
||||
- ~A~ is allocated with at least $n \times 8$ bytes
|
||||
- ~VGL~ is allocated with at least $n \times 5 \times 8$ bytes
|
||||
- ~context~ is not 0
|
||||
- ~n~ > 0
|
||||
- ~ldv~ >= 5
|
||||
- ~A(i)~ > 0 for all ~i~
|
||||
- ~X~ is allocated with at least $3 \times 8$ bytes
|
||||
- ~R~ is allocated with at least $3 \times 8$ bytes
|
||||
- ~A~ is allocated with at least $n \times 8$ bytes
|
||||
- ~VGL~ is allocated with at least $n \times 5 \times 8$ bytes
|
||||
|
||||
#+begin_src c :tangle (eval h_func)
|
||||
#+begin_src c :tangle (eval h_func)
|
||||
qmckl_exit_code
|
||||
qmckl_ao_gaussian_vgl(const qmckl_context context,
|
||||
const double *X,
|
||||
|
@ -1377,9 +1491,9 @@ qmckl_ao_gaussian_vgl(const qmckl_context context,
|
|||
const int64_t *A,
|
||||
const double *VGL,
|
||||
const int64_t ldv);
|
||||
#+end_src
|
||||
#+end_src
|
||||
|
||||
#+begin_src f90 :tangle (eval f)
|
||||
#+begin_src f90 :tangle (eval f)
|
||||
integer function qmckl_ao_gaussian_vgl_f(context, X, R, n, A, VGL, ldv) result(info)
|
||||
use qmckl
|
||||
implicit none
|
||||
|
@ -1440,9 +1554,9 @@ integer function qmckl_ao_gaussian_vgl_f(context, X, R, n, A, VGL, ldv) result(i
|
|||
end do
|
||||
|
||||
end function qmckl_ao_gaussian_vgl_f
|
||||
#+end_src
|
||||
#+end_src
|
||||
|
||||
#+begin_src f90 :tangle (eval f) :exports none
|
||||
#+begin_src f90 :tangle (eval f) :exports none
|
||||
integer(c_int32_t) function qmckl_ao_gaussian_vgl(context, X, R, n, A, VGL, ldv) &
|
||||
bind(C) result(info)
|
||||
use, intrinsic :: iso_c_binding
|
||||
|
@ -1457,9 +1571,9 @@ integer(c_int32_t) function qmckl_ao_gaussian_vgl(context, X, R, n, A, VGL, ldv)
|
|||
integer, external :: qmckl_ao_gaussian_vgl_f
|
||||
info = qmckl_ao_gaussian_vgl_f(context, X, R, n, A, VGL, ldv)
|
||||
end function qmckl_ao_gaussian_vgl
|
||||
#+end_src
|
||||
#+end_src
|
||||
|
||||
#+begin_src f90 :tangle (eval fh_func) :exports none
|
||||
#+begin_src f90 :tangle (eval fh_func) :exports none
|
||||
interface
|
||||
integer(c_int32_t) function qmckl_ao_gaussian_vgl(context, X, R, n, A, VGL, ldv) &
|
||||
bind(C)
|
||||
|
@ -1471,10 +1585,10 @@ end function qmckl_ao_gaussian_vgl
|
|||
real (c_double) , intent(out) :: VGL(ldv,5)
|
||||
end function qmckl_ao_gaussian_vgl
|
||||
end interface
|
||||
#+end_src
|
||||
#+end_src
|
||||
|
||||
# Test
|
||||
#+begin_src f90 :tangle (eval f_test)
|
||||
# Test
|
||||
#+begin_src f90 :tangle (eval f_test)
|
||||
integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
||||
use qmckl
|
||||
implicit none
|
||||
|
@ -1539,15 +1653,17 @@ integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
|
|||
|
||||
deallocate(VGL)
|
||||
end function test_qmckl_ao_gaussian_vgl
|
||||
#+end_src
|
||||
#+end_src
|
||||
|
||||
#+begin_src c :tangle (eval c_test) :exports none
|
||||
#+begin_src c :tangle (eval c_test) :exports none
|
||||
int test_qmckl_ao_gaussian_vgl(qmckl_context context);
|
||||
munit_assert_int(0, ==, test_qmckl_ao_gaussian_vgl(context));
|
||||
#+end_src
|
||||
#+end_src
|
||||
|
||||
* TODO Slater basis functions
|
||||
** TODO Slater basis functions
|
||||
|
||||
** TODO Radial functions on a grid
|
||||
* Combining radial and polynomial parts
|
||||
* End of files :noexport:
|
||||
|
||||
#+begin_src c :tangle (eval h_private_type)
|
||||
|
|
Loading…
Reference in New Issue
Block a user