32 KiB
Jastrow Factor
Functions for the calculation of the Jastrow factor \(f_{ee}, f_{en}, f_{een}\).
These are stored in the factor_ee
, factor_en
, and factor_een
variables.
The jastrow
structure contains all the information required to build
these factors along with their derivatives.
Context
The following data stored in the context:
int32_t |
uninitialized |
in | Keeps bit set for uninitialized data |
int64_t |
aord_num |
in | The number of a coeffecients |
int64_t |
bord_num |
in | The number of b coeffecients |
int64_t |
cord_num |
in | The number of c coeffecients |
uint64_t |
type_nuc_num |
in | Number of Nucleii types |
double |
aord_vector[aord_num + 1][type_nuc_num] |
in | Order of a polynomial coefficients |
double |
bord_vector[bord_num + 1] |
in | Order of b polynomial coefficients |
double |
cord_vector[cord_num][type_nuc_num] |
in | Order of c polynomial coefficients |
double |
factor_ee |
out | Jastrow factor: electron-electron part |
double |
factor_ee_date |
out | Jastrow factor: electron-electron part |
double |
factor_en |
out | Jastrow factor: electron-nucleus part |
double |
factor_en_date |
out | Jastrow factor: electron-nucleus part |
double |
factor_een |
out | Jastrow factor: electron-electron-nucleus part |
double |
factor_een_date |
out | Jastrow factor: electron-electron-nucleus part |
double |
factor_ee_deriv_e[4][nelec] |
out | Derivative of the Jastrow factor: electron-electron-nucleus part |
double |
factor_en_deriv_e[4][nelec] |
out | Derivative of the Jastrow factor: electron-electron-nucleus part |
double |
factor_een_deriv_e[4][nelec] |
out | Derivative of the Jastrow factor: electron-electron-nucleus part |
computed data:
int64_t |
dim_cord_vec |
Number of unique C coefficients |
double |
asymp_jasb[2] |
Asymptotic component |
int64_t |
asymp_jasb_date |
Asymptotic component |
double |
coord_vect_full[dim_cord_vec][nuc_num] |
vector of non-zero coefficients |
int64_t |
lkpm_of_cindex[4][dim_cord_vec] |
Transform l,k,p, and m into consecutive indices |
double |
tmp_c[elec_num][nuc_num][ncord + 1][ncord] |
vector of non-zero coefficients |
double |
dtmp_c[elec_num][4][nuc_num][ncord + 1][ncord] |
vector of non-zero coefficients |
For H2O we have the following data:
type_nuc_num = 1 aord_num = 5 bord_num = 5 cord_num = 23 dim_cord_vec = 23 aord_vector = [ 0.000000000000000E+000, 0.000000000000000E+000, -0.380512000000000E+000, -0.157996000000000E+000, -3.155800000000000E-002, 2.151200000000000E-002] bord_vector = [ 0.500000000000000E-000, 0.153660000000000E-000, 6.722620000000000E-002, 2.157000000000000E-002, 7.309600000000000E-003, 2.866000000000000E-003] cord_vector = [ 0.571702000000000E-000, -0.514253000000000E-000, -0.513043000000000E-000, 9.486000000000000E-003, -4.205000000000000E-003, 0.426325800000000E-000, 8.288150000000000E-002, 5.118600000000000E-003, -2.997800000000000E-003, -5.270400000000000E-003, -7.499999999999999E-005, -8.301649999999999E-002, 1.454340000000000E-002, 5.143510000000000E-002, 9.250000000000000E-004, -4.099100000000000E-003, 4.327600000000000E-003, -1.654470000000000E-003, 2.614000000000000E-003, -1.477000000000000E-003, -1.137000000000000E-003, -4.010475000000000E-002, 6.106710000000000E-003 ] cord_vector_full = [ [ 0.571702000000000E-000, -0.514253000000000E-000, -0.513043000000000E-000, 9.486000000000000E-003, -4.205000000000000E-003, 0.426325800000000E-000, 8.288150000000000E-002, 5.118600000000000E-003, -2.997800000000000E-003, -5.270400000000000E-003, -7.499999999999999E-005, -8.301649999999999E-002, 1.454340000000000E-002, 5.143510000000000E-002, 9.250000000000000E-004, -4.099100000000000E-003, 4.327600000000000E-003, -1.654470000000000E-003, 2.614000000000000E-003, -1.477000000000000E-003, -1.137000000000000E-003, -4.010475000000000E-002, 6.106710000000000E-003 ], [ 0.571702000000000E-000, -0.514253000000000E-000, -0.513043000000000E-000, 9.486000000000000E-003, -4.205000000000000E-003, 0.426325800000000E-000, 8.288150000000000E-002, 5.118600000000000E-003, -2.997800000000000E-003, -5.270400000000000E-003, -7.499999999999999E-005, -8.301649999999999E-002, 1.454340000000000E-002, 5.143510000000000E-002, 9.250000000000000E-004, -4.099100000000000E-003, 4.327600000000000E-003, -1.654470000000000E-003, 2.614000000000000E-003, -1.477000000000000E-003, -1.137000000000000E-003, -4.010475000000000E-002, 6.106710000000000E-003 ], ] lkpm_of_cindex = [ 1, 1, 2, 0, 0, 0, 2, 1, 1, 2, 3, 0, 2, 1, 3, 0, 0, 1, 3, 1, 1, 0, 3, 1, 1, 3, 4, 0, 2, 2, 4, 0, 0, 2, 4, 1, 3, 1, 4, 0, 1, 1, 4, 1, 2, 0, 4, 1, 0, 0, 4, 2, 1, 4, 5, 0, 2, 3, 5, 0, 0, 3, 5, 1, 3, 2, 5, 0, 1, 2, 5, 1, 4, 1, 5, 0, 2, 1, 5, 1, 0, 1, 5, 2, 3, 0, 5, 1, 1, 0, 5, 2 ]
Data structure
typedef struct qmckl_jastrow_struct{
int32_t uninitialized;
int64_t aord_num;
int64_t bord_num;
int64_t cord_num;
int64_t type_nuc_num;
int64_t asymp_jasb_date;
int64_t tmp_c_date;
int64_t dtmp_c_date;
int64_t factor_ee_date;
int64_t factor_en_date;
int64_t factor_een_date;
double * aord_vector;
double * bord_vector;
double * cord_vector;
double * asymp_jasb;
double * factor_ee;
double * factor_en;
double * factor_een;
double * factor_ee_deriv_e;
double * factor_en_deriv_e;
double * factor_een_deriv_e;
int64_t dim_cord_vec;
double * coord_vect_full;
double * tmp_c;
double * dtmp_c;
bool provided;
char * type;
} qmckl_jastrow_struct;
The uninitialized
integer contains one bit set to one for each
initialization function which has not been called. It becomes equal
to zero after all initialization functions have been called. The
struct is then initialized and provided == true
.
Some values are initialized by default, and are not concerned by
this mechanism.
qmckl_exit_code qmckl_init_jastrow(qmckl_context context);
qmckl_exit_code qmckl_init_jastrow(qmckl_context context) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return false;
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
ctx->jastrow.uninitialized = (1 << 6) - 1;
/* Default values */
return QMCKL_SUCCESS;
}
Access functions
Along with these core functions, calculation of the jastrow factor requires the following additional information to be set:
When all the data for the AOs have been provided, the following
function returns true
.
bool qmckl_jastrow_provided (const qmckl_context context);
#+NAME:post
Initialization functions
To prepare for the Jastrow and its derivative, all the following functions need to be called.
qmckl_exit_code qmckl_set_jastrow_ord_num (qmckl_context context, const int64_t aord_num, const int64_t bord_num, const int64_t cord_num);
qmckl_exit_code qmckl_set_jastrow_type_nuc_num (qmckl_context context, const int64_t type_nuc_num);
qmckl_exit_code qmckl_set_jastrow_aord_vector (qmckl_context context, const double * aord_vector);
qmckl_exit_code qmckl_set_jastrow_bord_vector (qmckl_context context, const double * bord_vector);
qmckl_exit_code qmckl_set_jastrow_cord_vector (qmckl_context context, const double * cord_vector);
qmckl_exit_code qmckl_set_jastrow_dependencies (qmckl_context context);
#+NAME:pre2
#+NAME:post2
When the required information is completely entered, other data structures are computed to accelerate the calculations. The intermediates factors are precontracted using BLAS LEVEL 3 operations for an optimal FLOP count.
Computation
The computed data is stored in the context so that it can be reused by different kernels. To ensure that the data is valid, for each computed data the date of the context is stored when it is computed. To know if some data needs to be recomputed, we check if the date of the dependencies are more recent than the date of the data to compute. If it is the case, then the data is recomputed and the current date is stored.
Asymptotic component for \(J_{ee}\)
Calculate the asymptotic component asymp_jasb
to be substracted from the final
electron-electron jastrow factor \(f_{ee}\). The asymptotic componenet is calculated
via the bord_vector
and the electron-electron rescale factor rescale_factor_kappa
.
\[ J_{asymp} = \frac{b_1 \kappa^-1}{1 + b_2 \kappa^-1} \]
Get
qmckl_exit_code qmckl_get_jastrow_asymp_jasb(qmckl_context context, double* const asymp_jasb);
Compute
qmckl_context | context | in | Global state |
int64_t | bord_num | in | Number of electrons |
double | bord_vector[bord_num + 1] | in | Number of walkers |
double | rescale_factor_kappa_ee | in | Electron coordinates |
double | asymp_jasb[2] | out | Electron-electron distances |
integer function qmckl_compute_asymp_jasb_f(context, bord_num, bord_vector, rescale_factor_kappa_ee, asymp_jasb) &
result(info)
use qmckl
implicit none
integer(qmckl_context), intent(in) :: context
integer*8 , intent(in) :: bord_num
double precision , intent(in) :: bord_vector(bord_num)
double precision , intent(in) :: rescale_factor_kappa_ee
double precision , intent(out) :: asymp_jasb(2)
integer*8 :: i, p
double precision :: kappa_inv, x, asym_one
kappa_inv = 1.0d0 / rescale_factor_kappa_ee
info = QMCKL_SUCCESS
if (context == QMCKL_NULL_CONTEXT) then
info = QMCKL_INVALID_CONTEXT
return
endif
if (bord_num <= 0) then
info = QMCKL_INVALID_ARG_2
return
endif
asym_one = bord_vector(1) * kappa_inv / (1.0d0 + bord_vector(2) * kappa_inv)
asymp_jasb(:) = (/asym_one, 0.5d0 * asym_one/)
do i = 1, 2
x = kappa_inv
do p = 2, bord_num
x = x * kappa_inv
asymp_jasb(i) = asymp_jasb(i) + bord_vector(p + 1) * x
end do
end do
end function qmckl_compute_asymp_jasb_f
qmckl_exit_code qmckl_compute_asymp_jasb (
const qmckl_context context,
const int64_t bord_num,
const double* bord_vector,
const double rescale_factor_kappa_ee,
double* const asymp_jasb );