1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-07-18 00:43:51 +02:00

Merge branch 'master' into jastrow_vj

This commit is contained in:
vijay 2021-07-08 10:10:13 +05:30 committed by GitHub
commit cf9c3c0e3d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 121 additions and 52 deletions

View File

@ -23,6 +23,11 @@ jobs:
make -j 8 make -j 8
make -j check make -j check
make distcheck make distcheck
- name: Archive test log file
uses: actions/upload-artifact@v2
with:
name: test-suite.log
path: test-suite.log
# x86_macos: # x86_macos:
# #

View File

@ -108,13 +108,14 @@ int main() {
Computed data: Computed data:
|----------------------+-------------------------------------+-----------------------------------------------------------------------------------------------| |--------------------------+-------------------------------------+-----------------------------------------------------------------------------------------------|
| ~coefficient_normalized~ | ~[prim_num]~ | Normalized primitive coefficients |
| ~nucleus_prim_index~ | ~[nucl_num]~ | Index of the first primitive for each nucleus | | ~nucleus_prim_index~ | ~[nucl_num]~ | Index of the first primitive for each nucleus |
| ~primitive_vgl~ | ~[prim_num][5][walk_num][elec_num]~ | Value, gradients, Laplacian of the primitives at electron positions | | ~primitive_vgl~ | ~[prim_num][5][walk_num][elec_num]~ | Value, gradients, Laplacian of the primitives at electron positions |
| ~primitive_vgl_date~ | ~uint64_t~ | Late modification date of Value, gradients, Laplacian of the primitives at electron positions | | ~primitive_vgl_date~ | ~uint64_t~ | Late modification date of Value, gradients, Laplacian of the primitives at electron positions |
| ~shell_vgl~ | ~[prim_num][5][walk_num][elec_num]~ | Value, gradients, Laplacian of the primitives at electron positions | | ~shell_vgl~ | ~[prim_num][5][walk_num][elec_num]~ | Value, gradients, Laplacian of the primitives at electron positions |
| ~shell_vgl_date~ | ~uint64_t~ | Late modification date of Value, gradients, Laplacian of the shells at electron positions | | ~shell_vgl_date~ | ~uint64_t~ | Late modification date of Value, gradients, Laplacian of the shells at electron positions |
|----------------------+-------------------------------------+-----------------------------------------------------------------------------------------------| |--------------------------+-------------------------------------+-----------------------------------------------------------------------------------------------|
| ~nucl_shell_index~ | ~[nucl_num]~ | Index of the first shell for each nucleus | | ~nucl_shell_index~ | ~[nucl_num]~ | Index of the first shell for each nucleus |
| ~exponent_sorted~ | ~[prim_num]~ | Array of exponents for sorted primitives | | ~exponent_sorted~ | ~[prim_num]~ | Array of exponents for sorted primitives |
| ~coeff_norm_sorted~ | ~[prim_num]~ | Array of normalized coefficients for sorted primitives | | ~coeff_norm_sorted~ | ~[prim_num]~ | Array of normalized coefficients for sorted primitives |
@ -180,12 +181,14 @@ typedef struct qmckl_ao_basis_struct {
int64_t * nucleus_shell_num; int64_t * nucleus_shell_num;
int32_t * shell_ang_mom; int32_t * shell_ang_mom;
int64_t * shell_prim_num; int64_t * shell_prim_num;
int64_t * nucleus_prim_index;
int64_t * shell_prim_index; int64_t * shell_prim_index;
double * shell_factor; double * shell_factor;
double * exponent ; double * exponent ;
double * coefficient ; double * coefficient ;
double * prim_factor ; double * prim_factor ;
int64_t * nucleus_prim_index;
double * coefficient_normalized ;
double * primitive_vgl; double * primitive_vgl;
int64_t primitive_vgl_date; int64_t primitive_vgl_date;
double * shell_vgl; double * shell_vgl;
@ -1009,6 +1012,7 @@ qmckl_exit_code qmckl_finalize_basis(qmckl_context context) {
if (rc != QMCKL_SUCCESS) return rc; if (rc != QMCKL_SUCCESS) return rc;
/* nucleus_prim_index */ /* nucleus_prim_index */
{
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero; qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
mem_info.size = (ctx->nucleus.num + (int64_t) 1) * sizeof(int64_t); mem_info.size = (ctx->nucleus.num + (int64_t) 1) * sizeof(int64_t);
@ -1017,7 +1021,7 @@ qmckl_exit_code qmckl_finalize_basis(qmckl_context context) {
if (ctx->ao_basis.nucleus_prim_index == NULL) { if (ctx->ao_basis.nucleus_prim_index == NULL) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED, QMCKL_ALLOCATION_FAILED,
"qmckl_nucleus_prim_index", "ao_basis.nucleus_prim_index",
NULL); NULL);
} }
@ -1026,8 +1030,40 @@ qmckl_exit_code qmckl_finalize_basis(qmckl_context context) {
ctx->ao_basis.nucleus_prim_index[i] = ctx->ao_basis.shell_prim_index[shell_idx]; ctx->ao_basis.nucleus_prim_index[i] = ctx->ao_basis.shell_prim_index[shell_idx];
} }
ctx->ao_basis.nucleus_prim_index[nucl_num] = ctx->ao_basis.prim_num; ctx->ao_basis.nucleus_prim_index[nucl_num] = ctx->ao_basis.prim_num;
}
/* Normalize coefficients */
{
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
mem_info.size = ctx->ao_basis.prim_num * sizeof(double);
ctx->ao_basis.coefficient_normalized = (double *) qmckl_malloc(context, mem_info);
if (ctx->ao_basis.coefficient_normalized == NULL) {
return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED,
"ao_basis.coefficient_normalized",
NULL);
}
/*
for (int64_t i=0 ; i < ctx->ao_basis.prim_num ; ++i) {
ctx->ao_basis.coefficient_normalized[i] =
ctx->ao_basis.coefficient[i] * ctx->ao_basis.prim_factor[i];
}
*/
for (int64_t ishell=0 ; ishell < ctx->ao_basis.shell_num ; ++ishell) {
for (int64_t iprim=ctx->ao_basis.shell_prim_index[ishell] ;
iprim < ctx->ao_basis.shell_prim_index[ishell]+ctx->ao_basis.shell_prim_num[ishell] ;
++iprim) {
ctx->ao_basis.coefficient_normalized[iprim] =
ctx->ao_basis.coefficient[iprim] * ctx->ao_basis.prim_factor[iprim] *
ctx->ao_basis.shell_factor[ishell];
}
}
}
/* TODO : sort the basis set here */ /* TODO : sort the basis set here */
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }
@ -1928,7 +1964,7 @@ qmckl_exit_code qmckl_provide_ao_basis_shell_vgl(qmckl_context context)
ctx->electron.coord_new, ctx->electron.coord_new,
ctx->nucleus.coord, ctx->nucleus.coord,
ctx->ao_basis.exponent, ctx->ao_basis.exponent,
ctx->ao_basis.coefficient, ctx->ao_basis.coefficient_normalized,
ctx->ao_basis.shell_vgl); ctx->ao_basis.shell_vgl);
} else { } else {
return qmckl_failwith( context, return qmckl_failwith( context,
@ -1968,14 +2004,14 @@ qmckl_exit_code qmckl_provide_ao_basis_shell_vgl(qmckl_context context)
| ~double~ | ~elec_coord[walk_num][3][elec_num]~ | in | Electron coordinates | | ~double~ | ~elec_coord[walk_num][3][elec_num]~ | in | Electron coordinates |
| ~double~ | ~nucl_coord[3][elec_num]~ | in | Nuclear coordinates | | ~double~ | ~nucl_coord[3][elec_num]~ | in | Nuclear coordinates |
| ~double~ | ~expo[prim_num]~ | in | Exponents of the primitives | | ~double~ | ~expo[prim_num]~ | in | Exponents of the primitives |
| ~double~ | ~coef[prim_num]~ | in | Coefficients of the primitives | | ~double~ | ~coef_normalized[prim_num]~ | in | Coefficients of the primitives |
| ~double~ | ~shell_vgl[shell_num][5][walk_num][elec_num]~ | out | Value, gradients and Laplacian of the shells | | ~double~ | ~shell_vgl[shell_num][5][walk_num][elec_num]~ | out | Value, gradients and Laplacian of the shells |
#+begin_src f90 :comments org :tangle (eval f) :noweb yes #+begin_src f90 :comments org :tangle (eval f) :noweb yes
integer function qmckl_compute_ao_basis_shell_gaussian_vgl_f(context, & integer function qmckl_compute_ao_basis_shell_gaussian_vgl_f(context, &
prim_num, shell_num, elec_num, nucl_num, walk_num, & prim_num, shell_num, elec_num, nucl_num, walk_num, &
nucleus_shell_num, nucleus_index, shell_prim_index, shell_prim_num, & nucleus_shell_num, nucleus_index, shell_prim_index, shell_prim_num, &
elec_coord, nucl_coord, expo, coef, shell_vgl) & elec_coord, nucl_coord, expo, coef_normalized, shell_vgl) &
result(info) result(info)
use qmckl use qmckl
implicit none implicit none
@ -1992,7 +2028,7 @@ integer function qmckl_compute_ao_basis_shell_gaussian_vgl_f(context, &
double precision , intent(in) :: elec_coord(elec_num,3,walk_num) double precision , intent(in) :: elec_coord(elec_num,3,walk_num)
double precision , intent(in) :: nucl_coord(nucl_num,3) double precision , intent(in) :: nucl_coord(nucl_num,3)
double precision , intent(in) :: expo(prim_num) double precision , intent(in) :: expo(prim_num)
double precision , intent(in) :: coef(prim_num) double precision , intent(in) :: coef_normalized(prim_num)
double precision , intent(out) :: shell_vgl(elec_num,walk_num,5,shell_num) double precision , intent(out) :: shell_vgl(elec_num,walk_num,5,shell_num)
integer*8 :: inucl, iprim, iwalk, ielec, ishell integer*8 :: inucl, iprim, iwalk, ielec, ishell
@ -2026,7 +2062,7 @@ integer function qmckl_compute_ao_basis_shell_gaussian_vgl_f(context, &
cycle cycle
end if end if
v = coef(iprim) * dexp(-ar2) v = coef_normalized(iprim) * dexp(-ar2)
two_a = -2.d0 * expo(iprim) * v two_a = -2.d0 * expo(iprim) * v
shell_vgl(ielec, iwalk, 1, ishell) = & shell_vgl(ielec, iwalk, 1, ishell) = &
@ -2071,7 +2107,7 @@ qmckl_exit_code qmckl_compute_ao_basis_shell_gaussian_vgl(
const double* elec_coord, const double* elec_coord,
const double* nucl_coord, const double* nucl_coord,
const double* expo, const double* expo,
const double* coef, const double* coef_normalized,
double* const shell_vgl); double* const shell_vgl);
#+end_src #+end_src
@ -2093,7 +2129,7 @@ qmckl_exit_code qmckl_compute_ao_basis_shell_gaussian_vgl(
elec_coord, & elec_coord, &
nucl_coord, & nucl_coord, &
expo, & expo, &
coef, & coef_normalized, &
shell_vgl) & shell_vgl) &
bind(C) result(info) bind(C) result(info)
@ -2113,7 +2149,7 @@ qmckl_exit_code qmckl_compute_ao_basis_shell_gaussian_vgl(
real (c_double ) , intent(in) :: elec_coord(elec_num,3,walk_num) real (c_double ) , intent(in) :: elec_coord(elec_num,3,walk_num)
real (c_double ) , intent(in) :: nucl_coord(elec_num,3) real (c_double ) , intent(in) :: nucl_coord(elec_num,3)
real (c_double ) , intent(in) :: expo(prim_num) real (c_double ) , intent(in) :: expo(prim_num)
real (c_double ) , intent(in) :: coef(prim_num) real (c_double ) , intent(in) :: coef_normalized(prim_num)
real (c_double ) , intent(out) :: shell_vgl(elec_num,walk_num,5,shell_num) real (c_double ) , intent(out) :: shell_vgl(elec_num,walk_num,5,shell_num)
integer(c_int32_t), external :: qmckl_compute_ao_basis_shell_gaussian_vgl_f integer(c_int32_t), external :: qmckl_compute_ao_basis_shell_gaussian_vgl_f
@ -2131,7 +2167,7 @@ qmckl_exit_code qmckl_compute_ao_basis_shell_gaussian_vgl(
elec_coord, & elec_coord, &
nucl_coord, & nucl_coord, &
expo, & expo, &
coef, & coef_normalized, &
shell_vgl) shell_vgl)
end function qmckl_compute_ao_basis_shell_gaussian_vgl end function qmckl_compute_ao_basis_shell_gaussian_vgl
@ -2254,18 +2290,19 @@ printf(" shell_vgl[14][2][1][15] %25.15e\n", shell_vgl[14][2][1][15]);
printf(" shell_vgl[14][3][1][15] %25.15e\n", shell_vgl[14][3][1][15]); printf(" shell_vgl[14][3][1][15] %25.15e\n", shell_vgl[14][3][1][15]);
printf(" shell_vgl[14][4][1][15] %25.15e\n", shell_vgl[14][4][1][15]); printf(" shell_vgl[14][4][1][15] %25.15e\n", shell_vgl[14][4][1][15]);
assert( fabs(shell_vgl[1][0][0][26] - ( 1.875568658202993e-01)) < 1.e-14 ); assert( fabs(shell_vgl[1][0][0][26] - ( 3.564393437193868e-02)) < 1.e-14 );
assert( fabs(shell_vgl[1][1][0][26] - ( -2.615250164814435e-02)) < 1.e-14 ); assert( fabs(shell_vgl[1][1][0][26] - (-6.030177987072189e-03)) < 1.e-14 );
assert( fabs(shell_vgl[1][2][0][26] - ( -1.333535498894419e-01)) < 1.e-14 ); assert( fabs(shell_vgl[1][2][0][26] - (-3.074832579537582e-02)) < 1.e-14 );
assert( fabs(shell_vgl[1][3][0][26] - ( 1.218482800201208e-01)) < 1.e-14 ); assert( fabs(shell_vgl[1][3][0][26] - ( 2.809546963519935e-02)) < 1.e-14 );
assert( fabs(shell_vgl[1][4][0][26] - ( 3.197054084474042e-02)) < 1.e-14 ); assert( fabs(shell_vgl[1][4][0][26] - ( 1.896046117183968e-02)) < 1.e-14 );
assert( fabs(shell_vgl[14][0][1][15] - ( 4.509748459243634e-02)) < 1.e-14 ); assert( fabs(shell_vgl[14][0][1][15] - ( 5.928089771361000e-03)) < 1.e-14 );
assert( fabs(shell_vgl[14][1][1][15] - ( 3.203917730584210e-02)) < 1.e-14 ); assert( fabs(shell_vgl[14][1][1][15] - ( 4.355862296021654e-03)) < 1.e-14 );
assert( fabs(shell_vgl[14][2][1][15] - ( 2.887080725789477e-02)) < 1.e-14 ); assert( fabs(shell_vgl[14][2][1][15] - ( 3.925108924923650e-03)) < 1.e-14 );
assert( fabs(shell_vgl[14][3][1][15] - ( 5.836910453297223e-03)) < 1.e-14 ); assert( fabs(shell_vgl[14][3][1][15] - ( 7.935527784022099e-04)) < 1.e-14 );
assert( fabs(shell_vgl[14][4][1][15] - ( 1.572966698871693e-02)) < 1.e-14 ); assert( fabs(shell_vgl[14][4][1][15] - ( 2.708246573703548e-03)) < 1.e-14 );
} }
#+end_src #+end_src
* Polynomial part * Polynomial part

View File

@ -859,6 +859,20 @@ for (int64_t i=0 ; i<3*elec_num ; ++i) {
qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* const distance); qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* const distance);
#+end_src #+end_src
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
interface
integer(c_int32_t) function qmckl_get_electron_ee_distance(context, distance) &
bind(C)
use, intrinsic :: iso_c_binding
import
implicit none
integer (c_int64_t) , intent(in) , value :: context
real (c_double ) , intent(out) :: distance(*)
end function
end interface
#+end_src
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none #+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* const distance) qmckl_exit_code qmckl_get_electron_ee_distance(qmckl_context context, double* const distance)
{ {
@ -1559,6 +1573,19 @@ rc = qmckl_get_electron_ee_distance_rescaled_deriv_e(context, ee_distance_rescal
qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* distance); qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* distance);
#+end_src #+end_src
#+begin_src f90 :tangle (eval fh_func) :comments org :exports none
interface
integer(c_int32_t) function qmckl_get_electron_en_distance(context, distance) &
bind(C)
use, intrinsic :: iso_c_binding
import
implicit none
integer (c_int64_t) , intent(in) , value :: context
real (c_double ) , intent(out) :: distance(*)
end function
end interface
#+end_src
#+begin_src c :comments org :tangle (eval c) :noweb yes :exports none #+begin_src c :comments org :tangle (eval c) :noweb yes :exports none
qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* distance) qmckl_exit_code qmckl_get_electron_en_distance(qmckl_context context, double* distance)
{ {