mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 20:36:01 +01:00
Working on tests for determinants.#41
This commit is contained in:
parent
201e4e1315
commit
eff9ed7954
@ -594,7 +594,6 @@ qmckl_exit_code qmckl_get_det_vgl_beta(qmckl_context context, double * const det
|
||||
}
|
||||
#+end_src
|
||||
|
||||
|
||||
*** Provide
|
||||
|
||||
#+begin_src c :comments org :tangle (eval h_private_func) :noweb yes :exports none
|
||||
@ -793,15 +792,15 @@ qmckl_exit_code qmckl_provide_det_vgl_beta(qmckl_context context) {
|
||||
:END:
|
||||
|
||||
#+NAME: qmckl_compute_det_vgl_alpha_args
|
||||
| ~qmckl_context~ | ~context~ | in | Global state |
|
||||
| ~int64_t~ | ~det_num_alpha~ | in | Number of determinants |
|
||||
| ~int64_t~ | ~walk_num~ | in | Number of walkers |
|
||||
| ~int64_t~ | ~alpha_num~ | in | Number of electrons |
|
||||
| ~int64_t~ | ~beta_num~ | in | Number of electrons |
|
||||
| ~int64_t~ | ~elec_num~ | in | Number of electrons |
|
||||
| ~int64_t~ | ~mo_index_alpha[det_num_alpha][walk_num][alpha_num]~ | in | MO indices for electrons |
|
||||
| ~int64_t~ | ~mo_num~ | in | Number of MOs |
|
||||
| ~double~ | ~mo_vgl[5][walk_num][elec_num][mo_num]~ | in | Value, gradients and Laplacian of the MOs |
|
||||
| ~qmckl_context~ | ~context~ | in | Global state |
|
||||
| ~int64_t~ | ~det_num_alpha~ | in | Number of determinants |
|
||||
| ~int64_t~ | ~walk_num~ | in | Number of walkers |
|
||||
| ~int64_t~ | ~alpha_num~ | in | Number of electrons |
|
||||
| ~int64_t~ | ~beta_num~ | in | Number of electrons |
|
||||
| ~int64_t~ | ~elec_num~ | in | Number of electrons |
|
||||
| ~int64_t~ | ~mo_index_alpha[det_num_alpha][walk_num][alpha_num]~ | in | MO indices for electrons |
|
||||
| ~int64_t~ | ~mo_num~ | in | Number of MOs |
|
||||
| ~double~ | ~mo_vgl[5][walk_num][elec_num][mo_num]~ | in | Value, gradients and Laplacian of the MOs |
|
||||
| ~double~ | ~det_vgl_alpha[det_num_alpha][walk_num][5][alpha_num][alpha_num]~ | out | Value, gradients and Laplacian of the Det |
|
||||
|
||||
#+begin_src f90 :comments org :tangle (eval f) :noweb yes
|
||||
@ -1078,6 +1077,196 @@ end function qmckl_compute_det_vgl_beta_f
|
||||
#+end_src
|
||||
|
||||
*** Test
|
||||
|
||||
#+begin_src c :tangle (eval c_test) :exports none
|
||||
{
|
||||
#define walk_num chbrclf_walk_num
|
||||
#define elec_num chbrclf_elec_num
|
||||
#define shell_num chbrclf_shell_num
|
||||
#define ao_num chbrclf_ao_num
|
||||
|
||||
int64_t elec_up_num = chbrclf_elec_up_num;
|
||||
int64_t elec_dn_num = chbrclf_elec_dn_num;
|
||||
double* elec_coord = &(chbrclf_elec_coord[0][0][0]);
|
||||
const int64_t nucl_num = chbrclf_nucl_num;
|
||||
const double* nucl_charge = chbrclf_charge;
|
||||
const double* nucl_coord = &(chbrclf_nucl_coord[0][0]);
|
||||
|
||||
rc = qmckl_set_electron_num (context, elec_up_num, elec_dn_num);
|
||||
assert (rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_set_electron_walk_num (context, walk_num);
|
||||
assert (rc == QMCKL_SUCCESS);
|
||||
|
||||
assert(qmckl_electron_provided(context));
|
||||
|
||||
rc = qmckl_set_electron_coord (context, 'N', elec_coord);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_set_nucleus_num (context, nucl_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_set_nucleus_coord (context, 'T', &(nucl_coord[0]));
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_set_nucleus_charge(context, nucl_charge);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
assert(qmckl_nucleus_provided(context));
|
||||
|
||||
const int64_t * nucleus_index = &(chbrclf_basis_nucleus_index[0]);
|
||||
const int64_t * nucleus_shell_num = &(chbrclf_basis_nucleus_shell_num[0]);
|
||||
const int32_t * shell_ang_mom = &(chbrclf_basis_shell_ang_mom[0]);
|
||||
const int64_t * shell_prim_num = &(chbrclf_basis_shell_prim_num[0]);
|
||||
const int64_t * shell_prim_index = &(chbrclf_basis_shell_prim_index[0]);
|
||||
const double * shell_factor = &(chbrclf_basis_shell_factor[0]);
|
||||
const double * exponent = &(chbrclf_basis_exponent[0]);
|
||||
const double * coefficient = &(chbrclf_basis_coefficient[0]);
|
||||
const double * prim_factor = &(chbrclf_basis_prim_factor[0]);
|
||||
const double * ao_factor = &(chbrclf_basis_ao_factor[0]);
|
||||
|
||||
const char typ = 'G';
|
||||
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_type (context, typ);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_num (context, chbrclf_shell_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_prim_num (context, chbrclf_prim_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_nucleus_index (context, nucleus_index);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_nucleus_shell_num (context, nucleus_shell_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_ang_mom (context, shell_ang_mom);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_factor (context, shell_factor);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_prim_num (context, shell_prim_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_shell_prim_index (context, shell_prim_index);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_exponent (context, exponent);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_coefficient (context, coefficient);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
assert(!qmckl_ao_basis_provided(context));
|
||||
|
||||
rc = qmckl_set_ao_basis_prim_factor (context, prim_factor);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_set_ao_basis_ao_num(context, chbrclf_ao_num);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_set_ao_basis_ao_factor (context, ao_factor);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
assert(qmckl_ao_basis_provided(context));
|
||||
|
||||
|
||||
double ao_vgl[5][walk_num][elec_num][chbrclf_ao_num];
|
||||
|
||||
rc = qmckl_get_ao_vgl(context, &(ao_vgl[0][0][0][0]));
|
||||
assert (rc == QMCKL_SUCCESS);
|
||||
|
||||
/* Set up MO data */
|
||||
rc = qmckl_set_mo_basis_type(context, typ);
|
||||
assert (rc == QMCKL_SUCCESS);
|
||||
|
||||
const int64_t mo_num = chbrclf_mo_num;
|
||||
rc = qmckl_set_mo_basis_mo_num(context, mo_num);
|
||||
assert (rc == QMCKL_SUCCESS);
|
||||
|
||||
const double * mo_coefficient = &(chbrclf_mo_coef[0]);
|
||||
|
||||
rc = qmckl_set_mo_basis_coefficient(context, mo_coefficient);
|
||||
assert (rc == QMCKL_SUCCESS);
|
||||
|
||||
assert(qmckl_mo_basis_provided(context));
|
||||
|
||||
double mo_vgl[5][elec_num][chbrclf_mo_num];
|
||||
rc = qmckl_get_mo_basis_vgl(context, &(mo_vgl[0][0][0]));
|
||||
assert (rc == QMCKL_SUCCESS);
|
||||
|
||||
// Test overlap of MO
|
||||
//double point_x[10];
|
||||
//double point_y[10];
|
||||
//double point_z[10];
|
||||
//int32_t npoints=10;
|
||||
//// obtain points
|
||||
//double dr = 20./(npoints-1);
|
||||
//double dr3 = dr*dr*dr;
|
||||
//
|
||||
//for (int i=0;i<npoints;++i) {
|
||||
// point_x[i] = -10. + dr*i;
|
||||
// point_y[i] = -10. + dr*i;
|
||||
// point_z[i] = -10. + dr*i;
|
||||
//}
|
||||
//
|
||||
//double ovlmo1 = 0.0;
|
||||
//// Calculate overlap
|
||||
//for (int i=0;i<npoints;++i) {
|
||||
// fflush(stdout);
|
||||
// for (int j=0;j<npoints;++j) {
|
||||
// printf(" .. ");
|
||||
// for (int k=0;k<npoints;++k) {
|
||||
// printf(" . ");
|
||||
// // Set point
|
||||
// elec_coord[0] = point_x[i];
|
||||
// elec_coord[1] = point_y[j];
|
||||
// elec_coord[2] = point_z[k];
|
||||
// rc = qmckl_set_electron_coord (context, 'N', elec_coord);
|
||||
// assert(rc == QMCKL_SUCCESS);
|
||||
//
|
||||
// // Calculate value of MO (1st electron)
|
||||
// double mo_vgl[5][walk_num][elec_num][chbrclf_mo_num];
|
||||
// rc = qmckl_get_mo_basis_vgl(context, &(mo_vgl[0][0][0][0]));
|
||||
// assert (rc == QMCKL_SUCCESS);
|
||||
// ovlmo1 += mo_vgl[0][0][0][0]*mo_vgl[0][0][0][0]*dr3;
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
//printf("OVL MO1 = %10.15f\n",ovlmo1);
|
||||
|
||||
|
||||
printf("\n");
|
||||
printf(" mo_vgl mo_vgl[0][26][219] %25.15e\n", mo_vgl[0][2][3]);
|
||||
printf(" mo_vgl mo_vgl[1][26][219] %25.15e\n", mo_vgl[1][2][3]);
|
||||
printf(" mo_vgl mo_vgl[0][26][220] %25.15e\n", mo_vgl[0][2][3]);
|
||||
printf(" mo_vgl mo_vgl[1][26][220] %25.15e\n", mo_vgl[1][2][3]);
|
||||
printf(" mo_vgl mo_vgl[0][26][221] %25.15e\n", mo_vgl[0][2][3]);
|
||||
printf(" mo_vgl mo_vgl[1][26][221] %25.15e\n", mo_vgl[1][2][3]);
|
||||
printf(" mo_vgl mo_vgl[0][26][222] %25.15e\n", mo_vgl[0][2][3]);
|
||||
printf(" mo_vgl mo_vgl[1][26][222] %25.15e\n", mo_vgl[1][2][3]);
|
||||
printf(" mo_vgl mo_vgl[0][26][223] %25.15e\n", mo_vgl[0][2][3]);
|
||||
printf(" mo_vgl mo_vgl[1][26][223] %25.15e\n", mo_vgl[1][2][3]);
|
||||
printf(" mo_vgl mo_vgl[0][26][224] %25.15e\n", mo_vgl[0][2][3]);
|
||||
printf(" mo_vgl mo_vgl[1][26][224] %25.15e\n", mo_vgl[1][2][3]);
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
#+end_src
|
||||
|
||||
** Inverse of Determinant matrix
|
||||
:PROPERTIES:
|
||||
|
Loading…
Reference in New Issue
Block a user