mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-31 08:36:11 +01:00
1-body jastrow dimensioned by nucl type
This commit is contained in:
parent
5a6d064ce0
commit
da2d8f6250
@ -2658,11 +2658,10 @@ qmckl_exit_code qmckl_finalize_basis(qmckl_context context) {
|
||||
|
||||
#ifdef HAVE_HPC
|
||||
rc = qmckl_finalize_basis_hpc(context);
|
||||
#else
|
||||
rc = QMCKL_SUCCESS;
|
||||
if (rc != QMCKL_SUCCESS) return rc;
|
||||
#endif
|
||||
|
||||
return rc;
|
||||
return qmckl_context_touch(context);
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
@ -139,11 +139,11 @@ int main() {
|
||||
|---------------------------+---------------------------------------+--------+-------------------------------------------------------------------|
|
||||
| ~uninitialized~ | ~int32_t~ | in | Keeps bits set for uninitialized data |
|
||||
| ~rescale_factor_ee~ | ~double~ | in | The distance scaling factor |
|
||||
| ~rescale_factor_en~ | ~double[nucl_num]~ | in | The distance scaling factor |
|
||||
| ~rescale_factor_en~ | ~double[type_nucl_num]~ | in | The distance scaling factor |
|
||||
| ~aord_num~ | ~int64_t~ | in | The number of a coeffecients |
|
||||
| ~bord_num~ | ~int64_t~ | in | The number of b coeffecients |
|
||||
| ~cord_num~ | ~int64_t~ | in | The number of c coeffecients |
|
||||
| ~type_nucl_num~ | ~int64_t~ | in | Number of Nucleii types |
|
||||
| ~type_nucl_num~ | ~int64_t~ | in | Number of Nuclei types |
|
||||
| ~type_nucl_vector~ | ~int64_t[nucl_num]~ | in | IDs of types of Nuclei |
|
||||
| ~a_vector~ | ~double[aord_num + 1][type_nucl_num]~ | in | a polynomial coefficients |
|
||||
| ~b_vector~ | ~double[bord_num + 1]~ | in | b polynomial coefficients |
|
||||
@ -167,7 +167,7 @@ int main() {
|
||||
|-------------------------------------+-------------------------------------------------------------------+---------------------------------------------------------------------------------------------------------|
|
||||
| ~dim_c_vector~ | ~int64_t~ | Number of unique C coefficients |
|
||||
| ~dim_c_vector_date~ | ~uint64_t~ | Number of unique C coefficients |
|
||||
| ~asymp_jasa~ | ~double[nucl_num]~ | Asymptotic component |
|
||||
| ~asymp_jasa~ | ~double[type_nucl_num]~ | Asymptotic component |
|
||||
| ~asymp_jasa_date~ | ~uint64_t~ | Ladt modification of the asymptotic component |
|
||||
| ~asymp_jasb~ | ~double[2]~ | Asymptotic component (up- or down-spin) |
|
||||
| ~asymp_jasb_date~ | ~uint64_t~ | Ladt modification of the asymptotic component |
|
||||
@ -882,10 +882,10 @@ qmckl_set_jastrow_rescale_factor_en(qmckl_context context,
|
||||
}
|
||||
|
||||
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
|
||||
mem_info.size = ctx->nucleus.num * sizeof(double);
|
||||
mem_info.size = ctx->jastrow.type_nucl_num * sizeof(double);
|
||||
ctx->jastrow.rescale_factor_en = (double*) qmckl_malloc(context, mem_info);
|
||||
|
||||
for (int64_t i=0 ; i<ctx->nucleus.num ; ++i) {
|
||||
for (int64_t i=0 ; i<ctx->jastrow.type_nucl_num ; ++i) {
|
||||
if (rescale_factor_en[i] <= 0.0) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
@ -948,7 +948,8 @@ qmckl_exit_code qmckl_finalize_jastrow(qmckl_context context) {
|
||||
ctx->jastrow.gpu_offload = true; // ctx->electron.num > 100;
|
||||
#endif
|
||||
|
||||
qmckl_exit_code rc = QMCKL_SUCCESS;
|
||||
|
||||
qmckl_exit_code rc = qmckl_context_touch(context);
|
||||
return rc;
|
||||
|
||||
|
||||
@ -1415,7 +1416,7 @@ qmckl_get_jastrow_rescale_factor_en (const qmckl_context context,
|
||||
return QMCKL_NOT_PROVIDED;
|
||||
}
|
||||
|
||||
if (size_max < ctx->nucleus.num) {
|
||||
if (size_max < ctx->jastrow.type_nucl_num) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_3,
|
||||
"qmckl_get_jastrow_rescale_factor_en",
|
||||
@ -1423,7 +1424,7 @@ qmckl_get_jastrow_rescale_factor_en (const qmckl_context context,
|
||||
}
|
||||
|
||||
assert(ctx->jastrow.rescale_factor_en != NULL);
|
||||
for (int64_t i=0 ; i<ctx->nucleus.num ; ++i) {
|
||||
for (int64_t i=0 ; i<ctx->jastrow.type_nucl_num ; ++i) {
|
||||
rescale_factor_en[i] = ctx->jastrow.rescale_factor_en[i];
|
||||
}
|
||||
|
||||
@ -1961,7 +1962,7 @@ assert(rc == QMCKL_SUCCESS);
|
||||
double k_ee = 0.;
|
||||
double k_en[2] = { 0., 0. };
|
||||
rc = qmckl_check(context,
|
||||
qmckl_set_jastrow_rescale_factor_en(context, rescale_factor_en, nucl_num)
|
||||
qmckl_set_jastrow_rescale_factor_en(context, rescale_factor_en, type_nucl_num)
|
||||
);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
@ -1977,10 +1978,10 @@ assert(rc == QMCKL_SUCCESS);
|
||||
assert(k_ee == rescale_factor_ee);
|
||||
|
||||
rc = qmckl_check(context,
|
||||
qmckl_get_jastrow_rescale_factor_en (context, &(k_en[0]), nucl_num)
|
||||
qmckl_get_jastrow_rescale_factor_en (context, &(k_en[0]), type_nucl_num)
|
||||
);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
for (int i=0 ; i<nucl_num ; ++i) {
|
||||
for (int i=0 ; i<type_nucl_num ; ++i) {
|
||||
assert(k_en[i] == rescale_factor_en[i]);
|
||||
}
|
||||
|
||||
@ -2167,7 +2168,7 @@ qmckl_exit_code qmckl_provide_jastrow_factor_ee(qmckl_context context)
|
||||
| ~elec_num~ | ~int64_t~ | in | Number of electrons |
|
||||
| ~up_num~ | ~int64_t~ | in | Number of alpha electrons |
|
||||
| ~bord_num~ | ~int64_t~ | in | Number of coefficients |
|
||||
| ~b_vector~ | ~double[bord_num+1]~ | in | List of coefficients |
|
||||
| ~b_vector~ | ~double[bord_num+1]~ | in | List of coefficients |
|
||||
| ~ee_distance_rescaled~ | ~double[walk_num][elec_num][elec_num]~ | in | Electron-electron distances |
|
||||
| ~asymp_jasb~ | ~double[2]~ | in | Electron-electron distances |
|
||||
| ~factor_ee~ | ~double[walk_num]~ | out | Electron-electron distances |
|
||||
@ -2526,7 +2527,7 @@ qmckl_exit_code qmckl_provide_jastrow_factor_ee_deriv_e(qmckl_context context)
|
||||
| ~elec_num~ | ~int64_t~ | in | Number of electrons |
|
||||
| ~up_num~ | ~int64_t~ | in | Number of alpha electrons |
|
||||
| ~bord_num~ | ~int64_t~ | in | Number of coefficients |
|
||||
| ~b_vector~ | ~double[bord_num+1]~ | in | List of coefficients |
|
||||
| ~b_vector~ | ~double[bord_num+1]~ | in | List of coefficients |
|
||||
| ~ee_distance_rescaled~ | ~double[walk_num][elec_num][elec_num]~ | in | Electron-electron distances |
|
||||
| ~ee_distance_rescaled_deriv_e~ | ~double[walk_num][4][elec_num][elec_num]~ | in | Electron-electron distances |
|
||||
| ~factor_ee_deriv_e~ | ~double[walk_num][4][elec_num]~ | out | Electron-electron distances |
|
||||
@ -3017,7 +3018,7 @@ qmckl_get_jastrow_asymp_jasa(qmckl_context context,
|
||||
qmckl_context_struct* const ctx = (qmckl_context_struct*) context;
|
||||
assert (ctx != NULL);
|
||||
|
||||
int64_t sze = ctx->nucleus.num;
|
||||
int64_t sze = ctx->jastrow.type_nucl_num;
|
||||
if (size_max < sze) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_3,
|
||||
@ -3081,7 +3082,7 @@ qmckl_exit_code qmckl_provide_jastrow_asymp_jasa(qmckl_context context)
|
||||
if (ctx->jastrow.asymp_jasa == NULL) {
|
||||
|
||||
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
|
||||
mem_info.size = ctx->nucleus.num * sizeof(double);
|
||||
mem_info.size = ctx->jastrow.type_nucl_num * sizeof(double);
|
||||
double* asymp_jasa = (double*) qmckl_malloc(context, mem_info);
|
||||
|
||||
if (asymp_jasa == NULL) {
|
||||
@ -3097,7 +3098,7 @@ qmckl_exit_code qmckl_provide_jastrow_asymp_jasa(qmckl_context context)
|
||||
ctx->jastrow.aord_num,
|
||||
ctx->jastrow.a_vector,
|
||||
ctx->jastrow.rescale_factor_en,
|
||||
ctx->nucleus.num,
|
||||
ctx->jastrow.type_nucl_num,
|
||||
ctx->jastrow.asymp_jasa);
|
||||
if (rc != QMCKL_SUCCESS) {
|
||||
return rc;
|
||||
@ -3118,27 +3119,27 @@ qmckl_exit_code qmckl_provide_jastrow_asymp_jasa(qmckl_context context)
|
||||
:END:
|
||||
|
||||
#+NAME: qmckl_asymp_jasa_args
|
||||
| Variable | Type | In/Out | Description |
|
||||
|---------------------+----------------------+--------+----------------------------|
|
||||
| ~context~ | ~qmckl_context~ | in | Global state |
|
||||
| ~aord_num~ | ~int64_t~ | in | Order of the polynomial |
|
||||
| ~a_vector~ | ~double[aord_num+1]~ | in | Values of a |
|
||||
| ~rescale_factor_en~ | ~double~ | in | Electron nucleus distances |
|
||||
| ~nucl_num~ | ~int64_t~ | in | Number of nuclei |
|
||||
| ~asymp_jasa~ | ~double[nucl_num]~ | out | Asymptotic value |
|
||||
| Variable | Type | In/Out | Description |
|
||||
|---------------------+-------------------------------------+--------+----------------------------|
|
||||
| ~context~ | ~qmckl_context~ | in | Global state |
|
||||
| ~aord_num~ | ~int64_t~ | in | Order of the polynomial |
|
||||
| ~a_vector~ | ~double[type_nucl_num][aord_num+1]~ | in | Values of a |
|
||||
| ~rescale_factor_en~ | ~double~ | in | Electron nucleus distances |
|
||||
| ~type_nucl_num~ | ~int64_t~ | in | Number of nucleus types |
|
||||
| ~asymp_jasa~ | ~double[type_nucl_num]~ | out | Asymptotic value |
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_jastrow_asymp_jasa_f(context, aord_num, a_vector, &
|
||||
rescale_factor_en, nucl_num, asymp_jasa) &
|
||||
rescale_factor_en, type_nucl_num, asymp_jasa) &
|
||||
result(info)
|
||||
use qmckl
|
||||
implicit none
|
||||
integer(qmckl_context), intent(in) :: context
|
||||
integer*8 , intent(in) :: aord_num
|
||||
double precision , intent(in) :: a_vector(aord_num + 1)
|
||||
integer*8 , intent(in) :: nucl_num
|
||||
double precision , intent(in) :: rescale_factor_en(nucl_num)
|
||||
double precision , intent(out) :: asymp_jasa(nucl_num)
|
||||
integer*8 , intent(in) :: type_nucl_num
|
||||
double precision , intent(in) :: a_vector(aord_num + 1, type_nucl_num)
|
||||
double precision , intent(in) :: rescale_factor_en(type_nucl_num)
|
||||
double precision , intent(out) :: asymp_jasa(type_nucl_num)
|
||||
|
||||
integer*8 :: i, j, p
|
||||
double precision :: kappa_inv, x, asym_one
|
||||
@ -3156,16 +3157,16 @@ integer function qmckl_compute_jastrow_asymp_jasa_f(context, aord_num, a_vector,
|
||||
return
|
||||
endif
|
||||
|
||||
do i=1,nucl_num
|
||||
do i=1,type_nucl_num
|
||||
|
||||
kappa_inv = 1.0d0 / rescale_factor_en(i)
|
||||
|
||||
asymp_jasa(i) = a_vector(1) * kappa_inv / (1.0d0 + a_vector(2) * kappa_inv)
|
||||
asymp_jasa(i) = a_vector(1,i) * kappa_inv / (1.0d0 + a_vector(2,i) * kappa_inv)
|
||||
|
||||
x = kappa_inv
|
||||
do p = 1, aord_num
|
||||
x = x * kappa_inv
|
||||
asymp_jasa(i) = asymp_jasa(i) + a_vector(p + 1) * x
|
||||
asymp_jasa(i) = asymp_jasa(i) + a_vector(p + 1, i) * x
|
||||
end do
|
||||
|
||||
end do
|
||||
@ -3179,7 +3180,7 @@ qmckl_exit_code qmckl_compute_jastrow_asymp_jasa (
|
||||
const int64_t aord_num,
|
||||
const double* a_vector,
|
||||
double* const rescale_factor_en,
|
||||
const int64_t nucl_num,
|
||||
const int64_t type_nucl_num,
|
||||
double* const asymp_jasa ) {
|
||||
|
||||
if (context == QMCKL_NULL_CONTEXT){
|
||||
@ -3190,14 +3191,14 @@ qmckl_exit_code qmckl_compute_jastrow_asymp_jasa (
|
||||
return QMCKL_INVALID_ARG_2;
|
||||
}
|
||||
|
||||
for (int i = 0 ; i <= nucl_num; ++i) {
|
||||
for (int i = 0 ; i <= type_nucl_num; ++i) {
|
||||
const double kappa_inv = 1.0 / rescale_factor_en[i];
|
||||
asymp_jasa[i] = a_vector[0] * kappa_inv / (1.0 + a_vector[1] * kappa_inv);
|
||||
asymp_jasa[i] = a_vector[0 + aord_num*i] * kappa_inv / (1.0 + a_vector[1 + aord_num*i] * kappa_inv);
|
||||
|
||||
double x = kappa_inv;
|
||||
for (int p = 1; p < aord_num; ++p){
|
||||
x *= kappa_inv;
|
||||
asymp_jasa[i] = asymp_jasa[i] + a_vector[p + 1] * x;
|
||||
asymp_jasa[i] = asymp_jasa[i] + a_vector[p + 1 + aord_num*i] * x;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3213,7 +3214,7 @@ qmckl_exit_code qmckl_compute_jastrow_asymp_jasa (
|
||||
const int64_t aord_num,
|
||||
const double* a_vector,
|
||||
double* const rescale_factor_en,
|
||||
const int64_t nucl_num,
|
||||
const int64_t type_nucl_num,
|
||||
double* const asymp_jasa );
|
||||
#+end_src
|
||||
|
||||
@ -3556,14 +3557,13 @@ qmckl_exit_code qmckl_compute_factor_en (
|
||||
factor_en[nw] = 0.0;
|
||||
for (int a = 0; a < nucl_num; ++a ) {
|
||||
for (int i = 0; i < elec_num; ++i ) {
|
||||
// x = ee_distance_rescaled[j * (walk_num * elec_num) + i * (walk_num) + nw];
|
||||
x = en_distance_rescaled[i + a * elec_num + nw * (elec_num * nucl_num)];
|
||||
x1 = x;
|
||||
power_ser = 0.0;
|
||||
|
||||
for (int p = 2; p < aord_num+1; ++p) {
|
||||
x = x * x1;
|
||||
power_ser = power_ser + a_vector[(p+1)-1 + (type_nucl_vector[a]-1) * aord_num] * x;
|
||||
power_ser = power_ser + a_vector[p+ (type_nucl_vector[a]-1) * aord_num] * x;
|
||||
}
|
||||
|
||||
factor_en[nw] = factor_en[nw] + a_vector[0 + (type_nucl_vector[a]-1)*aord_num] * x1 / \
|
||||
@ -5576,6 +5576,8 @@ qmckl_exit_code qmckl_provide_en_distance_rescaled(qmckl_context context)
|
||||
qmckl_compute_en_distance_rescaled(context,
|
||||
ctx->electron.num,
|
||||
ctx->nucleus.num,
|
||||
ctx->jastrow.type_nucl_num,
|
||||
ctx->jastrow.type_nucl_vector,
|
||||
ctx->jastrow.rescale_factor_en,
|
||||
ctx->electron.walker.num,
|
||||
ctx->electron.walker.point.coord.data,
|
||||
@ -5605,15 +5607,17 @@ qmckl_exit_code qmckl_provide_en_distance_rescaled(qmckl_context context)
|
||||
| ~context~ | ~qmckl_context~ | in | Global state |
|
||||
| ~elec_num~ | ~int64_t~ | in | Number of electrons |
|
||||
| ~nucl_num~ | ~int64_t~ | in | Number of nuclei |
|
||||
| ~rescale_factor_en~ | ~double[nucl_num]~ | in | The factor for rescaled distances |
|
||||
| ~type_nucl_num~ | ~int64_t~ | in | Number of types of nuclei |
|
||||
| ~type_nucl_vector~ | ~int64_t[nucl_num]~ | in | Number of types of nuclei |
|
||||
| ~rescale_factor_en~ | ~double[type_nucl_num]~ | in | The factor for rescaled distances |
|
||||
| ~walk_num~ | ~int64_t~ | in | Number of walkers |
|
||||
| ~elec_coord~ | ~double[3][walk_num][elec_num]~ | in | Electron coordinates |
|
||||
| ~nucl_coord~ | ~double[3][elec_num]~ | in | Nuclear coordinates |
|
||||
| ~en_distance_rescaled~ | ~double[walk_num][nucl_num][elec_num]~ | out | Electron-nucleus distances |
|
||||
| | | | |
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
integer function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_num, rescale_factor_en, walk_num, elec_coord, &
|
||||
integer function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_num, type_nucl_num, &
|
||||
type_nucl_vector, rescale_factor_en, walk_num, elec_coord, &
|
||||
nucl_coord, en_distance_rescaled) &
|
||||
result(info)
|
||||
use qmckl
|
||||
@ -5621,7 +5625,9 @@ integer function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_nu
|
||||
integer(qmckl_context), intent(in) :: context
|
||||
integer*8 , intent(in) :: elec_num
|
||||
integer*8 , intent(in) :: nucl_num
|
||||
double precision , intent(in) :: rescale_factor_en(nucl_num)
|
||||
integer*8 , intent(in) :: type_nucl_num
|
||||
integer*8 , intent(in) :: type_nucl_vector(nucl_num)
|
||||
double precision , intent(in) :: rescale_factor_en(type_nucl_num)
|
||||
integer*8 , intent(in) :: walk_num
|
||||
double precision , intent(in) :: elec_coord(elec_num,walk_num,3)
|
||||
double precision , intent(in) :: nucl_coord(nucl_num,3)
|
||||
@ -5657,7 +5663,7 @@ integer function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_nu
|
||||
do k=1,walk_num
|
||||
info = qmckl_distance_rescaled(context, 'T', 'T', elec_num, 1_8, &
|
||||
elec_coord(1,k,1), elec_num*walk_num, coord, 1_8, &
|
||||
en_distance_rescaled(1,i,k), elec_num, rescale_factor_en(i))
|
||||
en_distance_rescaled(1,i,k), elec_num, rescale_factor_en(type_nucl_vector(i)))
|
||||
if (info /= QMCKL_SUCCESS) then
|
||||
return
|
||||
endif
|
||||
@ -5672,6 +5678,8 @@ qmckl_exit_code qmckl_compute_en_distance_rescaled (
|
||||
const qmckl_context context,
|
||||
const int64_t elec_num,
|
||||
const int64_t nucl_num,
|
||||
const int64_t type_nucl_num,
|
||||
int64_t* const type_nucl_vector,
|
||||
const double* rescale_factor_en,
|
||||
const int64_t walk_num,
|
||||
const double* elec_coord,
|
||||
@ -5687,6 +5695,8 @@ qmckl_exit_code qmckl_compute_en_distance_rescaled (
|
||||
(context, &
|
||||
elec_num, &
|
||||
nucl_num, &
|
||||
type_nucl_num, &
|
||||
type_nucl_vector, &
|
||||
rescale_factor_en, &
|
||||
walk_num, &
|
||||
elec_coord, &
|
||||
@ -5700,7 +5710,9 @@ qmckl_exit_code qmckl_compute_en_distance_rescaled (
|
||||
integer (c_int64_t) , intent(in) , value :: context
|
||||
integer (c_int64_t) , intent(in) , value :: elec_num
|
||||
integer (c_int64_t) , intent(in) , value :: nucl_num
|
||||
real (c_double ) , intent(in) :: rescale_factor_en(nucl_num)
|
||||
integer (c_int64_t) , intent(in) , value :: type_nucl_num
|
||||
integer (c_int64_t) , intent(in) :: type_nucl_vector(nucl_num)
|
||||
real (c_double ) , intent(in) :: rescale_factor_en(type_nucl_num)
|
||||
integer (c_int64_t) , intent(in) , value :: walk_num
|
||||
real (c_double ) , intent(in) :: elec_coord(elec_num,walk_num,3)
|
||||
real (c_double ) , intent(in) :: nucl_coord(elec_num,3)
|
||||
@ -5711,6 +5723,8 @@ qmckl_exit_code qmckl_compute_en_distance_rescaled (
|
||||
(context, &
|
||||
elec_num, &
|
||||
nucl_num, &
|
||||
type_nucl_num, &
|
||||
type_nucl_vector, &
|
||||
rescale_factor_en, &
|
||||
walk_num, &
|
||||
elec_coord, &
|
||||
|
@ -297,8 +297,7 @@ qmckl_exit_code qmckl_finalize_mo_basis(qmckl_context context) {
|
||||
ctx->mo_basis.mo_value = NULL;
|
||||
ctx->mo_basis.mo_value_date = 0;
|
||||
}
|
||||
|
||||
return QMCKL_SUCCESS;
|
||||
return qmckl_context_touch(context);
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user