1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-23 12:57:20 +01:00

Activated tests 1. #22

This commit is contained in:
vijay gopal chilkuri 2021-07-07 19:46:18 +05:30
parent 48436607d6
commit 9d46ed28c5

View File

@ -993,171 +993,171 @@ qmckl_exit_code qmckl_finalize_jastrow(qmckl_context context) {
** Test
#+begin_src c :tangle (eval c_test)
/* Reference input data */
//int64_t walk_num = n2_walk_num;
//int64_t elec_num = n2_elec_num;
//int64_t elec_up_num = n2_elec_up_num;
//int64_t elec_dn_num = n2_elec_dn_num;
//double rescale_factor_kappa_ee = 1.0;
//double rescale_factor_kappa_en = 1.0;
//double nucl_rescale_factor_kappa = 1.0;
//double* elec_coord = &(n2_elec_coord[0][0][0]);
//
//const double* nucl_charge = n2_charge;
//int64_t nucl_num = n2_nucl_num;
//double* charge = n2_charge;
//double* nucl_coord = &(n2_nucl_coord[0][0]);
int64_t walk_num = n2_walk_num;
int64_t elec_num = n2_elec_num;
int64_t elec_up_num = n2_elec_up_num;
int64_t elec_dn_num = n2_elec_dn_num;
double rescale_factor_kappa_ee = 1.0;
double rescale_factor_kappa_en = 1.0;
double nucl_rescale_factor_kappa = 1.0;
double* elec_coord = &(n2_elec_coord[0][0][0]);
const double* nucl_charge = n2_charge;
int64_t nucl_num = n2_nucl_num;
double* charge = n2_charge;
double* nucl_coord = &(n2_nucl_coord[0][0]);
/* Provide Electron data */
qmckl_exit_code rc;
//assert(!qmckl_electron_provided(context));
//
//int64_t n;
//rc = qmckl_get_electron_num (context, &n);
//assert(rc == QMCKL_NOT_PROVIDED);
//
//rc = qmckl_get_electron_up_num (context, &n);
//assert(rc == QMCKL_NOT_PROVIDED);
//
//rc = qmckl_get_electron_down_num (context, &n);
//assert(rc == QMCKL_NOT_PROVIDED);
//
//
//rc = qmckl_set_electron_num (context, elec_up_num, elec_dn_num);
//assert(rc == QMCKL_SUCCESS);
//assert(!qmckl_electron_provided(context));
//
//rc = qmckl_get_electron_up_num (context, &n);
//assert(rc == QMCKL_SUCCESS);
//assert(n == elec_up_num);
//
//rc = qmckl_get_electron_down_num (context, &n);
//assert(rc == QMCKL_SUCCESS);
//assert(n == elec_dn_num);
//
//rc = qmckl_get_electron_num (context, &n);
//assert(rc == QMCKL_SUCCESS);
//assert(n == elec_num);
//
//double k_ee = 0.;
//double k_en = 0.;
//rc = qmckl_get_electron_rescale_factor_ee (context, &k_ee);
//assert(rc == QMCKL_SUCCESS);
//assert(k_ee == 1.0);
//
//rc = qmckl_get_electron_rescale_factor_en (context, &k_en);
//assert(rc == QMCKL_SUCCESS);
//assert(k_en == 1.0);
//
//rc = qmckl_set_electron_rescale_factor_en(context, rescale_factor_kappa_en);
//assert(rc == QMCKL_SUCCESS);
//
//rc = qmckl_set_electron_rescale_factor_ee(context, rescale_factor_kappa_ee);
//assert(rc == QMCKL_SUCCESS);
//
//rc = qmckl_get_electron_rescale_factor_ee (context, &k_ee);
//assert(rc == QMCKL_SUCCESS);
//assert(k_ee == rescale_factor_kappa_ee);
//
//rc = qmckl_get_electron_rescale_factor_en (context, &k_en);
//assert(rc == QMCKL_SUCCESS);
//assert(k_en == rescale_factor_kappa_en);
//
//
//int64_t w;
//rc = qmckl_get_electron_walk_num (context, &w);
//assert(rc == QMCKL_NOT_PROVIDED);
//
//
//rc = qmckl_set_electron_walk_num (context, walk_num);
//assert(rc == QMCKL_SUCCESS);
//
//rc = qmckl_get_electron_walk_num (context, &w);
//assert(rc == QMCKL_SUCCESS);
//assert(w == walk_num);
//
//assert(qmckl_electron_provided(context));
//
//rc = qmckl_set_electron_coord (context, 'N', elec_coord);
//assert(rc == QMCKL_SUCCESS);
//
//double elec_coord2[walk_num*3*elec_num];
//
//rc = qmckl_get_electron_coord (context, 'N', elec_coord2);
//assert(rc == QMCKL_SUCCESS);
//for (int64_t i=0 ; i<3*elec_num ; ++i) {
// assert( elec_coord[i] == elec_coord2[i] );
// }
//
//
///* Provide Nucleus data */
//
//assert(!qmckl_nucleus_provided(context));
//
//rc = qmckl_get_nucleus_num (context, &n);
//assert(rc == QMCKL_NOT_PROVIDED);
//
//
//rc = qmckl_set_nucleus_num (context, nucl_num);
//assert(rc == QMCKL_SUCCESS);
//assert(!qmckl_nucleus_provided(context));
//
//rc = qmckl_get_nucleus_num (context, &n);
//assert(rc == QMCKL_SUCCESS);
//assert(n == nucl_num);
//
//double k;
//rc = qmckl_get_nucleus_rescale_factor (context, &k);
//assert(rc == QMCKL_SUCCESS);
//assert(k == 1.0);
//
//
//rc = qmckl_set_nucleus_rescale_factor (context, nucl_rescale_factor_kappa);
//assert(rc == QMCKL_SUCCESS);
//
//rc = qmckl_get_nucleus_rescale_factor (context, &k);
//assert(rc == QMCKL_SUCCESS);
//assert(k == nucl_rescale_factor_kappa);
//
//double nucl_coord2[3*nucl_num];
//
//rc = qmckl_get_nucleus_coord (context, 'T', nucl_coord2);
//assert(rc == QMCKL_NOT_PROVIDED);
//
//rc = qmckl_set_nucleus_coord (context, 'T', &(nucl_coord[0]));
//assert(rc == QMCKL_SUCCESS);
//
//assert(!qmckl_nucleus_provided(context));
//
//rc = qmckl_get_nucleus_coord (context, 'N', nucl_coord2);
//assert(rc == QMCKL_SUCCESS);
//for (size_t k=0 ; k<3 ; ++k) {
// for (size_t i=0 ; i<nucl_num ; ++i) {
// assert( nucl_coord[nucl_num*k+i] == nucl_coord2[3*i+k] );
// }
//}
//
//rc = qmckl_get_nucleus_coord (context, 'T', nucl_coord2);
//assert(rc == QMCKL_SUCCESS);
//for (size_t i=0 ; i<3*nucl_num ; ++i) {
// assert( nucl_coord[i] == nucl_coord2[i] );
//}
//
//double nucl_charge2[nucl_num];
//
//rc = qmckl_get_nucleus_charge(context, nucl_charge2);
//assert(rc == QMCKL_NOT_PROVIDED);
//
//rc = qmckl_set_nucleus_charge(context, nucl_charge);
//assert(rc == QMCKL_SUCCESS);
//
//rc = qmckl_get_nucleus_charge(context, nucl_charge2);
//assert(rc == QMCKL_SUCCESS);
//for (size_t i=0 ; i<nucl_num ; ++i) {
// assert( nucl_charge[i] == nucl_charge2[i] );
// }
//assert(qmckl_nucleus_provided(context));
assert(!qmckl_electron_provided(context));
int64_t n;
rc = qmckl_get_electron_num (context, &n);
assert(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_get_electron_up_num (context, &n);
assert(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_get_electron_down_num (context, &n);
assert(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_set_electron_num (context, elec_up_num, elec_dn_num);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_electron_provided(context));
rc = qmckl_get_electron_up_num (context, &n);
assert(rc == QMCKL_SUCCESS);
assert(n == elec_up_num);
rc = qmckl_get_electron_down_num (context, &n);
assert(rc == QMCKL_SUCCESS);
assert(n == elec_dn_num);
rc = qmckl_get_electron_num (context, &n);
assert(rc == QMCKL_SUCCESS);
assert(n == elec_num);
double k_ee = 0.;
double k_en = 0.;
rc = qmckl_get_electron_rescale_factor_ee (context, &k_ee);
assert(rc == QMCKL_SUCCESS);
assert(k_ee == 1.0);
rc = qmckl_get_electron_rescale_factor_en (context, &k_en);
assert(rc == QMCKL_SUCCESS);
assert(k_en == 1.0);
rc = qmckl_set_electron_rescale_factor_en(context, rescale_factor_kappa_en);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_set_electron_rescale_factor_ee(context, rescale_factor_kappa_ee);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_get_electron_rescale_factor_ee (context, &k_ee);
assert(rc == QMCKL_SUCCESS);
assert(k_ee == rescale_factor_kappa_ee);
rc = qmckl_get_electron_rescale_factor_en (context, &k_en);
assert(rc == QMCKL_SUCCESS);
assert(k_en == rescale_factor_kappa_en);
int64_t w;
rc = qmckl_get_electron_walk_num (context, &w);
assert(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_set_electron_walk_num (context, walk_num);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_get_electron_walk_num (context, &w);
assert(rc == QMCKL_SUCCESS);
assert(w == walk_num);
assert(qmckl_electron_provided(context));
rc = qmckl_set_electron_coord (context, 'N', elec_coord);
assert(rc == QMCKL_SUCCESS);
double elec_coord2[walk_num*3*elec_num];
rc = qmckl_get_electron_coord (context, 'N', elec_coord2);
assert(rc == QMCKL_SUCCESS);
for (int64_t i=0 ; i<3*elec_num ; ++i) {
assert( elec_coord[i] == elec_coord2[i] );
}
/* Provide Nucleus data */
assert(!qmckl_nucleus_provided(context));
rc = qmckl_get_nucleus_num (context, &n);
assert(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_set_nucleus_num (context, nucl_num);
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_nucleus_provided(context));
rc = qmckl_get_nucleus_num (context, &n);
assert(rc == QMCKL_SUCCESS);
assert(n == nucl_num);
double k;
rc = qmckl_get_nucleus_rescale_factor (context, &k);
assert(rc == QMCKL_SUCCESS);
assert(k == 1.0);
rc = qmckl_set_nucleus_rescale_factor (context, nucl_rescale_factor_kappa);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_get_nucleus_rescale_factor (context, &k);
assert(rc == QMCKL_SUCCESS);
assert(k == nucl_rescale_factor_kappa);
double nucl_coord2[3*nucl_num];
rc = qmckl_get_nucleus_coord (context, 'T', nucl_coord2);
assert(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_set_nucleus_coord (context, 'T', &(nucl_coord[0]));
assert(rc == QMCKL_SUCCESS);
assert(!qmckl_nucleus_provided(context));
rc = qmckl_get_nucleus_coord (context, 'N', nucl_coord2);
assert(rc == QMCKL_SUCCESS);
for (size_t k=0 ; k<3 ; ++k) {
for (size_t i=0 ; i<nucl_num ; ++i) {
assert( nucl_coord[nucl_num*k+i] == nucl_coord2[3*i+k] );
}
}
rc = qmckl_get_nucleus_coord (context, 'T', nucl_coord2);
assert(rc == QMCKL_SUCCESS);
for (size_t i=0 ; i<3*nucl_num ; ++i) {
assert( nucl_coord[i] == nucl_coord2[i] );
}
double nucl_charge2[nucl_num];
rc = qmckl_get_nucleus_charge(context, nucl_charge2);
assert(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_set_nucleus_charge(context, nucl_charge);
assert(rc == QMCKL_SUCCESS);
rc = qmckl_get_nucleus_charge(context, nucl_charge2);
assert(rc == QMCKL_SUCCESS);
for (size_t i=0 ; i<nucl_num ; ++i) {
assert( nucl_charge[i] == nucl_charge2[i] );
}
assert(qmckl_nucleus_provided(context));
#+end_src