1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-06-30 00:44:52 +02:00

Reinstated all tests. #22

This commit is contained in:
vijay gopal chilkuri 2021-07-06 21:29:42 +05:30
parent 2055cc59be
commit 2af6e36252
2 changed files with 111 additions and 103 deletions

View File

@ -63,29 +63,33 @@ int main() {
The following data stored in the context:
| ~uninitialized~ | ~int32_t~ | Keeps bit set for uninitialized data |
| ~num~ | ~int64_t~ | Total number of electrons |
| ~up_num~ | ~int64_t~ | Number of up-spin electrons |
| ~down_num~ | ~int64_t~ | Number of down-spin electrons |
| ~walk_num~ | ~int64_t~ | Number of walkers |
| ~rescale_factor_kappa_ee~ | ~double~ | The distance scaling factor |
| ~rescale_factor_kappa_en~ | ~double~ | The distance scaling factor |
| ~provided~ | ~bool~ | If true, ~electron~ is valid |
| ~coord_new~ | ~double[walk_num][3][num]~ | New set of electron coordinates |
| ~coord_old~ | ~double[walk_num][3][num]~ | Old set of electron coordinates |
| ~coord_new_date~ | ~uint64_t~ | Last modification date of the coordinates |
| ~ee_distance~ | ~double[walk_num][num][num]~ | Electron-electron distances |
| ~ee_distance_date~ | ~uint64_t~ | Last modification date of the electron-electron distances |
| ~en_distance~ | ~double[walk_num][nucl_num][num]~ | Electron-nucleus distances |
| ~en_distance_date~ | ~uint64_t~ | Last modification date of the electron-electron distances |
| ~ee_distance_rescaled~ | ~double[walk_num][num][num]~ | Electron-electron rescaled distances |
| ~ee_distance_rescaled_date~ | ~uint64_t~ | Last modification date of the electron-electron distances |
| ~ee_distance_rescaled_deriv_e~ | ~double[walk_num][4][num][num]~ | Electron-electron rescaled distances derivatives |
| ~ee_distance_rescaled_deriv_e_date~ | ~uint64_t~ | Last modification date of the electron-electron distance derivatives |
| ~en_distance_rescaled~ | ~double[walk_num][nucl_num][num]~ | Electron-nucleus distances |
| ~en_distance_rescaled_date~ | ~uint64_t~ | Last modification date of the electron-electron distances |
| ~en_distance_rescaled_deriv_e~ | ~double[walk_num][4][nucl_num][num]~ | Electron-electron rescaled distances derivatives |
| ~en_distance_rescaled_deriv_e_date~ | ~uint64_t~ | Last modification date of the electron-electron distance derivatives |
| ~uninitialized~ | ~int32_t~ | Keeps bit set for uninitialized data |
| ~num~ | ~int64_t~ | Total number of electrons |
| ~up_num~ | ~int64_t~ | Number of up-spin electrons |
| ~down_num~ | ~int64_t~ | Number of down-spin electrons |
| ~walk_num~ | ~int64_t~ | Number of walkers |
| ~rescale_factor_kappa_ee~ | ~double~ | The distance scaling factor |
| ~rescale_factor_kappa_en~ | ~double~ | The distance scaling factor |
| ~provided~ | ~bool~ | If true, ~electron~ is valid |
| ~coord_new~ | ~double[walk_num][3][num]~ | New set of electron coordinates |
| ~coord_old~ | ~double[walk_num][3][num]~ | Old set of electron coordinates |
| ~coord_new_date~ | ~uint64_t~ | Last modification date of the coordinates |
| ~ee_distance~ | ~double[walk_num][num][num]~ | Electron-electron distances |
| ~ee_distance_date~ | ~uint64_t~ | Last modification date of the electron-electron distances |
| ~en_distance~ | ~double[walk_num][nucl_num][num]~ | Electron-nucleus distances |
| ~en_distance_date~ | ~uint64_t~ | Last modification date of the electron-electron distances |
| ~ee_distance_rescaled~ | ~double[walk_num][num][num]~ | Electron-electron rescaled distances |
| ~ee_distance_rescaled_date~ | ~uint64_t~ | Last modification date of the electron-electron distances |
| ~ee_distance_rescaled_deriv_e~ | ~double[walk_num][4][num][num]~ | Electron-electron rescaled distances derivatives |
| ~ee_distance_rescaled_deriv_e_date~ | ~uint64_t~ | Last modification date of the electron-electron distance derivatives |
| ~en_distance_rescaled~ | ~double[walk_num][nucl_num][num]~ | Electron-nucleus distances |
| ~en_distance_rescaled_date~ | ~uint64_t~ | Last modification date of the electron-electron distances |
| ~en_distance_rescaled_deriv_e~ | ~double[walk_num][4][nucl_num][num]~ | Electron-electron rescaled distances derivatives |
| ~en_distance_rescaled_deriv_e_date~ | ~uint64_t~ | Last modification date of the electron-electron distance derivatives |
| ~een_distance_rescaled~ | ~double[walk_num][nucl_num][num]~ | Electron-nucleus distances |
| ~een_distance_rescaled_date~ | ~uint64_t~ | Last modification date of the electron-electron distances |
| ~een_distance_rescaled_deriv_e~ | ~double[walk_num][4][nucl_num][num]~ | Electron-electron rescaled distances derivatives |
| ~een_distance_rescaled_deriv_e_date~ | ~uint64_t~ | Last modification date of the electron-electron distance derivatives |
** Data structure
@ -100,10 +104,12 @@ typedef struct qmckl_electron_struct {
int64_t coord_new_date;
int64_t ee_distance_date;
int64_t en_distance_date;
int64_t een_distance_date;
int64_t ee_distance_rescaled_date;
int64_t ee_distance_rescaled_deriv_e_date;
int64_t en_distance_rescaled_date;
int64_t en_distance_rescaled_deriv_e_date;
int64_t een_distance_rescaled_deriv_e_date;
double* coord_new;
double* coord_old;
double* ee_distance;
@ -112,6 +118,8 @@ typedef struct qmckl_electron_struct {
double* ee_distance_rescaled_deriv_e;
double* en_distance_rescaled;
double* en_distance_rescaled_deriv_e;
double* een_distance_rescaled;
double* een_distance_rescaled_deriv_e;
int32_t uninitialized;
bool provided;
} qmckl_electron_struct;

View File

@ -1368,46 +1368,46 @@ print("asymp_jasb[1] : ", asymp_jasb[1])
: asymp_jasb[1] : 0.31567342786262853
#+begin_src c :tangle (eval c_test)
//assert(qmckl_electron_provided(context));
//
//int64_t type_nucl_num = n2_type_nucl_num;
//int64_t* type_nucl_vector = &(n2_type_nucl_vector[0]);
//int64_t aord_num = n2_aord_num;
//int64_t bord_num = n2_bord_num;
//int64_t cord_num = n2_cord_num;
//double* aord_vector = &(n2_aord_vector[0][0]);
//double* bord_vector = &(n2_bord_vector[0]);
//double* cord_vector = &(n2_cord_vector[0][0]);
//
///* Initialize the Jastrow data */
//rc = qmckl_init_jastrow(context);
//assert(!qmckl_jastrow_provided(context));
//
///* Set the data */
//rc = qmckl_set_jastrow_ord_num(context, aord_num, bord_num, cord_num);
//assert(rc == QMCKL_SUCCESS);
//rc = qmckl_set_jastrow_type_nucl_num(context, type_nucl_num);
//assert(rc == QMCKL_SUCCESS);
//rc = qmckl_set_jastrow_type_nucl_vector(context, type_nucl_vector, nucl_num);
//assert(rc == QMCKL_SUCCESS);
//rc = qmckl_set_jastrow_aord_vector(context, aord_vector);
//assert(rc == QMCKL_SUCCESS);
//rc = qmckl_set_jastrow_bord_vector(context, bord_vector);
//assert(rc == QMCKL_SUCCESS);
//rc = qmckl_set_jastrow_cord_vector(context, cord_vector);
//assert(rc == QMCKL_SUCCESS);
//rc = qmckl_set_jastrow_dependencies(context);
//assert(rc == QMCKL_SUCCESS);
//
///* Check if Jastrow is properly initialized */
//assert(qmckl_jastrow_provided(context));
//
//double asymp_jasb[2];
//rc = qmckl_get_jastrow_asymp_jasb(context, asymp_jasb);
//
//// calculate asymp_jasb
//assert(fabs(asymp_jasb[0]-0.5323750557252571) < 1.e-12);
//assert(fabs(asymp_jasb[1]-0.31567342786262853) < 1.e-12);
assert(qmckl_electron_provided(context));
int64_t type_nucl_num = n2_type_nucl_num;
int64_t* type_nucl_vector = &(n2_type_nucl_vector[0]);
int64_t aord_num = n2_aord_num;
int64_t bord_num = n2_bord_num;
int64_t cord_num = n2_cord_num;
double* aord_vector = &(n2_aord_vector[0][0]);
double* bord_vector = &(n2_bord_vector[0]);
double* cord_vector = &(n2_cord_vector[0][0]);
/* Initialize the Jastrow data */
rc = qmckl_init_jastrow(context);
assert(!qmckl_jastrow_provided(context));
/* Set the data */
rc = qmckl_set_jastrow_ord_num(context, aord_num, bord_num, cord_num);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_jastrow_type_nucl_num(context, type_nucl_num);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_jastrow_type_nucl_vector(context, type_nucl_vector, nucl_num);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_jastrow_aord_vector(context, aord_vector);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_jastrow_bord_vector(context, bord_vector);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_jastrow_cord_vector(context, cord_vector);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_jastrow_dependencies(context);
assert(rc == QMCKL_SUCCESS);
/* Check if Jastrow is properly initialized */
assert(qmckl_jastrow_provided(context));
double asymp_jasb[2];
rc = qmckl_get_jastrow_asymp_jasb(context, asymp_jasb);
// calculate asymp_jasb
assert(fabs(asymp_jasb[0]-0.5323750557252571) < 1.e-12);
assert(fabs(asymp_jasb[1]-0.31567342786262853) < 1.e-12);
#+end_src
@ -1699,14 +1699,14 @@ print("factor_ee :",factor_ee)
#+begin_src c :tangle (eval c_test)
///* Check if Jastrow is properly initialized */
//assert(qmckl_jastrow_provided(context));
//
//double factor_ee[walk_num];
//rc = qmckl_get_jastrow_factor_ee(context, factor_ee);
//
//// calculate factor_ee
//assert(fabs(factor_ee[0]+4.282760865958113) < 1.e-12);
/* Check if Jastrow is properly initialized */
assert(qmckl_jastrow_provided(context));
double factor_ee[walk_num];
rc = qmckl_get_jastrow_factor_ee(context, factor_ee);
// calculate factor_ee
assert(fabs(factor_ee[0]+4.282760865958113) < 1.e-12);
#+end_src
@ -2118,18 +2118,18 @@ print(factor_ee_deriv_e)
#+begin_src c :tangle (eval c_test)
///* Check if Jastrow is properly initialized */
//assert(qmckl_jastrow_provided(context));
//
//// calculate factor_ee_deriv_e
//double factor_ee_deriv_e[walk_num][4][elec_num];
//rc = qmckl_get_jastrow_factor_ee_deriv_e(context, &(factor_ee_deriv_e[0][0][0]));
//
//// check factor_ee_deriv_e
//assert(fabs(factor_ee_deriv_e[0][0][0]-0.16364894652107934) < 1.e-12);
//assert(fabs(factor_ee_deriv_e[0][1][0]+0.6927548119830084 ) < 1.e-12);
//assert(fabs(factor_ee_deriv_e[0][2][0]-0.073267755223968 ) < 1.e-12);
//assert(fabs(factor_ee_deriv_e[0][3][0]-1.5111672803213185 ) < 1.e-12);
/* Check if Jastrow is properly initialized */
assert(qmckl_jastrow_provided(context));
// calculate factor_ee_deriv_e
double factor_ee_deriv_e[walk_num][4][elec_num];
rc = qmckl_get_jastrow_factor_ee_deriv_e(context, &(factor_ee_deriv_e[0][0][0]));
// check factor_ee_deriv_e
assert(fabs(factor_ee_deriv_e[0][0][0]-0.16364894652107934) < 1.e-12);
assert(fabs(factor_ee_deriv_e[0][1][0]+0.6927548119830084 ) < 1.e-12);
assert(fabs(factor_ee_deriv_e[0][2][0]-0.073267755223968 ) < 1.e-12);
assert(fabs(factor_ee_deriv_e[0][3][0]-1.5111672803213185 ) < 1.e-12);
#+end_src
@ -2414,14 +2414,14 @@ print("factor_en :",factor_en)
#+begin_src c :tangle (eval c_test)
///* Check if Jastrow is properly initialized */
//assert(qmckl_jastrow_provided(context));
//
//double factor_en[walk_num];
//rc = qmckl_get_jastrow_factor_en(context, factor_en);
//
//// calculate factor_en
//assert(fabs(factor_en[0]+5.865822569188727) < 1.e-12);
/* Check if Jastrow is properly initialized */
assert(qmckl_jastrow_provided(context));
double factor_en[walk_num];
rc = qmckl_get_jastrow_factor_en(context, factor_en);
// calculate factor_en
assert(fabs(factor_en[0]+5.865822569188727) < 1.e-12);
#+end_src
@ -2813,18 +2813,18 @@ print("factor_en_deriv_e[3][0]:",factor_en_deriv_e[3][0])
#+begin_src c :tangle (eval c_test)
///* Check if Jastrow is properly initialized */
//assert(qmckl_jastrow_provided(context));
//
//// calculate factor_en_deriv_e
//double factor_en_deriv_e[walk_num][4][elec_num];
//rc = qmckl_get_jastrow_factor_en_deriv_e(context, &(factor_en_deriv_e[0][0][0]));
//
//// check factor_en_deriv_e
//assert(fabs(factor_en_deriv_e[0][0][0]-0.11609919541763383) < 1.e-12);
//assert(fabs(factor_en_deriv_e[0][1][0]+0.23301394780804574) < 1.e-12);
//assert(fabs(factor_en_deriv_e[0][2][0]-0.17548337641865783) < 1.e-12);
//assert(fabs(factor_en_deriv_e[0][3][0]+0.9667363412285741 ) < 1.e-12);
/* Check if Jastrow is properly initialized */
assert(qmckl_jastrow_provided(context));
// calculate factor_en_deriv_e
double factor_en_deriv_e[walk_num][4][elec_num];
rc = qmckl_get_jastrow_factor_en_deriv_e(context, &(factor_en_deriv_e[0][0][0]));
// check factor_en_deriv_e
assert(fabs(factor_en_deriv_e[0][0][0]-0.11609919541763383) < 1.e-12);
assert(fabs(factor_en_deriv_e[0][1][0]+0.23301394780804574) < 1.e-12);
assert(fabs(factor_en_deriv_e[0][2][0]-0.17548337641865783) < 1.e-12);
assert(fabs(factor_en_deriv_e[0][3][0]+0.9667363412285741 ) < 1.e-12);
#+end_src