mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-22 04:14:49 +01:00
Flush
This commit is contained in:
parent
f72973b32f
commit
7ea3123ebe
@ -2567,6 +2567,12 @@ assert(qmckl_electron_provided(context));
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
for (int64_t i=0 ; i<walk_num*elec_num*elec_num*(cord_num+1) ; i++) {
|
||||
if (fabs(ee_distance_rescaled_hpc[i] - ee_distance_rescaled_doc[i]) > 1.e-10) {
|
||||
printf("i = %ld\n", i);
|
||||
printf("ee_distance_rescaled_hpc = %f\n", ee_distance_rescaled_hpc[i]);
|
||||
printf("ee_distance_rescaled_doc = %f\n", ee_distance_rescaled_doc[i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(ee_distance_rescaled_hpc[i] - ee_distance_rescaled_doc[i]) < 1.e-10);
|
||||
}
|
||||
}
|
||||
@ -2957,6 +2963,7 @@ assert(qmckl_electron_provided(context));
|
||||
printf("nw=%d i=%d j=%d k=%d\n", nw, i, j, k);
|
||||
printf("fd =%f\n", fd[nw][i][j][k]);
|
||||
printf("ee_distance_rescaled_gl=%f\n", ee_distance_rescaled_gl[nw][i][j][k]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(fd[nw][i][j][k] - ee_distance_rescaled_gl[nw][i][j][k]) < 1.e-8);
|
||||
}
|
||||
@ -2966,6 +2973,7 @@ assert(qmckl_electron_provided(context));
|
||||
printf("nw=%d i=%d j=%d k=%d\n", nw, i, j, k);
|
||||
printf("fd =%f\n", fd[nw][i][j][k]);
|
||||
printf("ee_distance_rescaled_gl=%f\n", ee_distance_rescaled_gl[nw][i][j][k]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(fd[nw][i][j][k] - ee_distance_rescaled_gl[nw][i][j][k]) < 1.e-6);
|
||||
}
|
||||
@ -2999,6 +3007,7 @@ assert(qmckl_electron_provided(context));
|
||||
printf("i=%ld\n", i);
|
||||
printf("ee_distance_rescaled_gl_doc=%f\n", ee_distance_rescaled_gl_doc[i]);
|
||||
printf("ee_distance_rescaled_gl_hpc=%f\n", ee_distance_rescaled_gl_hpc[i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(ee_distance_rescaled_gl_doc[i] - ee_distance_rescaled_gl_hpc[i]) < 1.e-8);
|
||||
}
|
||||
@ -3514,6 +3523,7 @@ assert(qmckl_jastrow_champ_provided(context));
|
||||
|
||||
// calculate factor_ee
|
||||
printf("%20.15f\n%20.15f\n",factor_ee[0],-16.83886184243964);
|
||||
fflush(stdout);
|
||||
assert(fabs(factor_ee[0]+16.83886184243964) < 1.e-12);
|
||||
|
||||
printf("factor_ee_hpc\n");
|
||||
@ -3558,6 +3568,7 @@ assert(qmckl_jastrow_champ_provided(context));
|
||||
printf("i=%ld\n", i);
|
||||
printf("factor_ee_doc=%f\n", factor_ee_doc[i]);
|
||||
printf("factor_ee_hpc=%f\n", factor_ee_hpc[i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(factor_ee_doc[i] - factor_ee_hpc[i]) < 1.e-8);
|
||||
}
|
||||
@ -4267,6 +4278,7 @@ assert(qmckl_jastrow_champ_provided(context));
|
||||
if (fabs(fd[nw][k][i] - factor_ee_gl[nw][k][i]) > 1.e-12) {
|
||||
printf("nw=%d i=%d k=%d\n", nw, i, k);
|
||||
printf("fd=%f factor_ee_gl=%f\n", fd[nw][k][i], factor_ee_gl[nw][k][i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(fd[nw][k][i] - factor_ee_gl[nw][k][i]) < 1.e-8);
|
||||
}
|
||||
@ -4274,9 +4286,8 @@ assert(qmckl_jastrow_champ_provided(context));
|
||||
if (fabs(fd[nw][k][i] - factor_ee_gl[nw][k][i]) > 1.e-12) {
|
||||
printf("nw=%d i=%d k=%d\n", nw, i, k);
|
||||
printf("fd=%f factor_ee_gl=%f\n", fd[nw][k][i], factor_ee_gl[nw][k][i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
printf("%.10f\t", fd[nw][k][i]);
|
||||
printf("%.10f\n", factor_ee_gl[nw][k][i]);
|
||||
assert(fabs(fd[nw][k][i] - factor_ee_gl[nw][k][i]) < 1.e-5);
|
||||
}
|
||||
}
|
||||
@ -4333,6 +4344,7 @@ assert(qmckl_jastrow_champ_provided(context));
|
||||
for (int64_t i = 0 ; i < walk_num*4*elec_num ; i++) {
|
||||
if (fabs(factor_ee_gl_hpc[i] - factor_ee_gl_doc[i]) > 1.e-12) {
|
||||
printf("i=%ld\nfactor_ee_gl_hpc=%f\nfactor_ee_gl_doc=%f\n", i, factor_ee_gl_hpc[i], factor_ee_gl_doc[i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(factor_ee_gl_hpc[i] - factor_ee_gl_doc[i]) < 1.e-8);
|
||||
}
|
||||
@ -4608,6 +4620,7 @@ rc = qmckl_get_jastrow_champ_asymp_jasa(context, asymp_jasa, type_nucl_num);
|
||||
|
||||
// calculate asymp_jasb
|
||||
printf("%e %e\n", asymp_jasa[0], -1.75529774);
|
||||
fflush(stdout);
|
||||
assert(fabs(-1.75529774 - asymp_jasa[0]) < 1.e-8);
|
||||
|
||||
#+end_src
|
||||
@ -5028,6 +5041,7 @@ assert(fabs(en_distance_rescaled[0][0][6] - 0.4726452953409436) < 1.e-12);
|
||||
for (int64_t i=0 ; i<walk_num*nucl_num*elec_num ; ++i) {
|
||||
if (fabs(en_distance_rescaled_doc[i] - en_distance_rescaled_hpc[i]) > 1.e-12) {
|
||||
printf("i = %ld, doc = %e, hpc = %e\n", i, en_distance_rescaled_doc[i], en_distance_rescaled_hpc[i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(en_distance_rescaled_doc[i] - en_distance_rescaled_hpc[i]) < 1.e-8);
|
||||
}
|
||||
@ -5514,12 +5528,14 @@ assert(qmckl_electron_provided(context));
|
||||
for (int k = 0; k < 3; k++){
|
||||
printf("%.10f\t", fd[nw][i][j][k]);
|
||||
printf("%.10f\n", en_distance_rescaled_gl[nw][i][j][k]);
|
||||
fflush(stdout);
|
||||
assert(fabs(fd[nw][i][j][k] - en_distance_rescaled_gl[nw][i][j][k]) < 1.e-8);
|
||||
}
|
||||
int k=3;
|
||||
if (i != j) {
|
||||
printf("%.10f\t", fd[nw][i][j][k]);
|
||||
printf("%.10f\n", en_distance_rescaled_gl[nw][i][j][k]);
|
||||
fflush(stdout);
|
||||
assert(fabs(fd[nw][i][j][k] - en_distance_rescaled_gl[nw][i][j][k]) < 1.e-6);
|
||||
}
|
||||
}
|
||||
@ -5546,6 +5562,10 @@ assert(qmckl_electron_provided(context));
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
for (int i = 0; i < walk_num*nucl_num*elec_num*4; i++) {
|
||||
if (fabs(en_distance_rescaled_gl_doc[i] - en_distance_rescaled_gl_hpc[i]) > 1.e-8) {
|
||||
printf("i = %d, doc = %e, hpc = %e\n", i, en_distance_rescaled_gl_doc[i], en_distance_rescaled_gl_hpc[i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(en_distance_rescaled_gl_doc[i] - en_distance_rescaled_gl_hpc[i]) < 1.e-8);
|
||||
}
|
||||
}
|
||||
@ -5984,6 +6004,7 @@ rc = qmckl_get_jastrow_champ_factor_en(context, factor_en,walk_num);
|
||||
|
||||
// calculate factor_en
|
||||
printf("%f %f\n", factor_en[0], 22.781375792083587);
|
||||
fflush(stdout);
|
||||
assert(fabs(22.781375792083587 - factor_en[0]) < 1.e-12);
|
||||
|
||||
{
|
||||
@ -6661,11 +6682,14 @@ assert(qmckl_jastrow_champ_provided(context));
|
||||
for (int k = 0; k < 3; k++){
|
||||
printf("%.10f\t", fd[nw][k][i]);
|
||||
printf("%.10f\n", factor_en_gl[nw][k][i]);
|
||||
fflush(stdout);
|
||||
assert(fabs(fd[nw][k][i] - factor_en_gl[nw][k][i]) < 1.e-8);
|
||||
}
|
||||
int k=3;
|
||||
printf("%.10f\t", fd[nw][k][i]);
|
||||
printf("%.10f\n", factor_en_gl[nw][k][i]);
|
||||
if (fabs(fd[nw][k][i] - factor_en_gl[nw][k][i]) > 1.e-5) {
|
||||
printf("i=%d doc=%f hpc=%f\n", i, fd[nw][k][i], factor_en_gl[nw][k][i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(fd[nw][k][i] - factor_en_gl[nw][k][i]) < 1.e-5);
|
||||
}
|
||||
}
|
||||
@ -6704,6 +6728,7 @@ assert(qmckl_jastrow_champ_provided(context));
|
||||
for (int64_t i = 0; i < walk_num*4*elec_num; i++) {
|
||||
if (fabs(factor_en_gl_doc[i] - factor_en_gl_hpc[i]) > 1.e-12) {
|
||||
printf("i=%ld doc=%f hpc=%f\n", i, factor_en_gl_doc[i], factor_en_gl_hpc[i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(factor_en_gl_doc[i] - factor_en_gl_hpc[i]) < 1.e-8);
|
||||
}
|
||||
@ -7270,6 +7295,10 @@ assert(fabs(een_rescaled_e[0][2][1][5]- 0.5257156022077619 ) < 1.e-12);
|
||||
for (int64_t j = 0; j < cord_num+1; j++) {
|
||||
for (int64_t k = 0; k < elec_num; k++) {
|
||||
for (int64_t l = 0; l < elec_num; l++) {
|
||||
if (fabs(een_rescaled_e_doc[i][j][k][l] - een_rescaled_e_hpc[i][j][k][l]) > 1.e-12) {
|
||||
printf("i=%ld j=%ld k=%ld l=%ld doc=%f hpc=%f\n", i, j, k, l, een_rescaled_e_doc[i][j][k][l], een_rescaled_e_hpc[i][j][k][l]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(een_rescaled_e_doc[i][j][k][l] - een_rescaled_e_hpc[i][j][k][l]) < 1.e-8);
|
||||
}
|
||||
}
|
||||
@ -7884,6 +7913,7 @@ assert(qmckl_electron_provided(context));
|
||||
for (int64_t i = 0; i < walk_num*(cord_num + 1)*elec_num*4*elec_num; i++) {
|
||||
if (fabs(een_rescaled_e_gl_doc[i] - een_rescaled_e_gl_hpc[i]) > 1.e-12) {
|
||||
printf("i = %ld, doc = %f, hpc = %f\n", i, een_rescaled_e_gl_doc[i], een_rescaled_e_gl_hpc[i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(een_rescaled_e_gl_doc[i] - een_rescaled_e_gl_hpc[i]) < 1.e-8);
|
||||
}
|
||||
@ -7892,7 +7922,7 @@ assert(qmckl_electron_provided(context));
|
||||
|
||||
{
|
||||
/* Finite difference test fails and I can't understand why... */
|
||||
/*
|
||||
|
||||
printf("een_distance_rescaled_e_gl\n");
|
||||
|
||||
double fd[walk_num][cord_num+1][elec_num][4][elec_num];
|
||||
@ -7991,16 +8021,22 @@ assert(qmckl_electron_provided(context));
|
||||
for (int i = 0; i < elec_num; i++) {
|
||||
for (int j = 0; j < elec_num; j++) {
|
||||
for (int k = 0; k < 3; k++){
|
||||
printf("%2d %2d %2d %2d %2d\t", nw, c, i, k, j);
|
||||
printf("%.10e\t", fd[nw][c][i][k][j]);
|
||||
printf("%.10e\n", een_distance_rescaled_e_gl[nw][c][i][k][j]);
|
||||
if (fabs(fd[nw][c][i][k][j] - een_distance_rescaled_e_gl[nw][c][i][k][j]) > 1.e-10) {
|
||||
printf("%2d %2d %2d %2d %2d\t", nw, c, i, k, j);
|
||||
printf("%.10e\t", fd[nw][c][i][k][j]);
|
||||
printf("%.10e\n", een_distance_rescaled_e_gl[nw][c][i][k][j]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(fd[nw][c][i][k][j] - een_distance_rescaled_e_gl[nw][c][i][k][j]) < 1.e-8);
|
||||
}
|
||||
int k=3;
|
||||
if (i != j) {
|
||||
printf("%2d %2d %2d %2d %2d\t", nw, c, i, k, j);
|
||||
printf("%.10e\t", fd[nw][c][i][k][j]);
|
||||
printf("%.10e\n", een_distance_rescaled_e_gl[nw][c][i][k][j]);
|
||||
if (fabs(fd[nw][c][i][k][j] - een_distance_rescaled_e_gl[nw][c][i][k][j]) > 1.e-8) {
|
||||
printf("%2d %2d %2d %2d %2d\t", nw, c, i, k, j);
|
||||
printf("%.10e\t", fd[nw][c][i][k][j]);
|
||||
printf("%.10e\n", een_distance_rescaled_e_gl[nw][c][i][k][j]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(fd[nw][c][i][k][j] - een_distance_rescaled_e_gl[nw][c][i][k][j]) < 1.e-6);
|
||||
}
|
||||
}
|
||||
@ -8008,7 +8044,7 @@ assert(qmckl_electron_provided(context));
|
||||
}
|
||||
}
|
||||
printf("OK\n");
|
||||
*/
|
||||
|
||||
}
|
||||
|
||||
#+end_src
|
||||
@ -10247,9 +10283,11 @@ double dtmp_c[walk_num][cord_num][cord_num+1][nucl_num][4][elec_num];
|
||||
rc = qmckl_get_jastrow_champ_dtmp_c(context, &(dtmp_c[0][0][0][0][0][0]), sizeof(dtmp_c)/sizeof(double));
|
||||
|
||||
printf("%e\n%e\n", tmp_c[0][0][1][0][0], 3.954384);
|
||||
fflush(stdout);
|
||||
assert(fabs(tmp_c[0][0][1][0][0] - 3.954384) < 1e-6);
|
||||
|
||||
printf("%e\n%e\n", dtmp_c[0][1][0][0][0][0],3.278657e-01);
|
||||
fflush(stdout);
|
||||
assert(fabs(dtmp_c[0][1][0][0][0][0] - 3.278657e-01 ) < 1e-6);
|
||||
#+end_src
|
||||
|
||||
@ -11777,6 +11815,18 @@ TODO
|
||||
factor_een_gl_doc);
|
||||
assert(rc == QMCKL_SUCCESS);
|
||||
|
||||
assert(walk_num == 2);
|
||||
assert(elec_num == 10);
|
||||
assert(nucl_num == 2);
|
||||
assert(cord_num == 5);
|
||||
assert(dim_c_vector == 23);
|
||||
|
||||
assert(ctx->electron.walker.num == walk_num);
|
||||
assert(ctx->electron.num == elec_num);
|
||||
assert(ctx->nucleus.num == nucl_num);
|
||||
assert(ctx->jastrow_champ.cord_num == cord_num);
|
||||
assert(ctx->jastrow_champ.dim_c_vector == dim_c_vector);
|
||||
|
||||
double factor_een_gl_hpc[walk_num*4*elec_num];
|
||||
memset(&(factor_een_gl_hpc[0]), 0, walk_num*4*elec_num*sizeof(double));
|
||||
rc = qmckl_compute_jastrow_champ_factor_een_gl(context,
|
||||
@ -11798,6 +11848,7 @@ TODO
|
||||
printf("i = %ld\n", i);
|
||||
printf("factor_een_gl_doc = %20.15e\n", factor_een_gl_doc[i]);
|
||||
printf("factor_een_gl_hpc = %20.15e\n", factor_een_gl_hpc[i]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert(fabs(factor_een_gl_doc[i] - factor_een_gl_hpc[i]) < 1e-8);
|
||||
}
|
||||
@ -12163,7 +12214,13 @@ assert(qmckl_jastrow_champ_provided(context));
|
||||
|
||||
|
||||
for (int64_t i=0 ; i< walk_num ; ++i) {
|
||||
assert (total_j[i] - exp(factor_ee[i] + factor_en[i] + factor_een[i]) < 1.e-12);
|
||||
if (fabs(total_j[i] - exp(factor_ee[i] + factor_en[i] + factor_een[i])) > 1e-12) {
|
||||
printf("i = %ld\n", i);
|
||||
printf("total_j = %20.15e\n", total_j[i]);
|
||||
printf("exp(factor_ee + factor_en + factor_een) = %20.15e\n", exp(factor_ee[i] + factor_en[i] + factor_een[i]));
|
||||
fflush(stdout);
|
||||
}
|
||||
assert (fabs(total_j[i] - exp(factor_ee[i] + factor_en[i] + factor_een[i])) < 1.e-8);
|
||||
}
|
||||
}
|
||||
|
||||
@ -12586,7 +12643,15 @@ assert(qmckl_jastrow_champ_provided(context));
|
||||
for (int64_t m=0 ; m<4; ++m) {
|
||||
for (int64_t e=0 ; e<elec_num; ++e) {
|
||||
if (m < 3) { /* test only gradients */
|
||||
assert (total_j_deriv[k][m][e]/total_j[k] - (factor_ee_gl[k][m][e] + factor_en_gl[k][m][e] + factor_een_gl[k][m][e]) < 1.e-12);
|
||||
if (fabs(total_j_deriv[k][m][e]/total_j[k] - (factor_ee_gl[k][m][e] + factor_en_gl[k][m][e] + factor_een_gl[k][m][e])) > 1e-12) {
|
||||
printf("k = %ld\n", k);
|
||||
printf("m = %ld\n", m);
|
||||
printf("e = %ld\n", e);
|
||||
printf("total_j_deriv = %20.15e\n", total_j_deriv[k][m][e]/total_j[k]);
|
||||
printf("factor_ee_gl + factor_en_gl + factor_een_gl = %20.15e\n", factor_ee_gl[k][m][e] + factor_en_gl[k][m][e] + factor_een_gl[k][m][e]);
|
||||
fflush(stdout);
|
||||
}
|
||||
assert (fabs(total_j_deriv[k][m][e]/total_j[k] - (factor_ee_gl[k][m][e] + factor_en_gl[k][m][e] + factor_een_gl[k][m][e])) < 1.e-12);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1152,7 +1152,7 @@ N2
|
||||
|
||||
Nuclear coordinates are stored in atomic units in transposed format.
|
||||
|
||||
#+begin_src c :tangle (concat tests "n2.h")
|
||||
#+begin_src c
|
||||
#define n2_nucl_num ((int64_t) 2)
|
||||
|
||||
double n2_charge[n2_nucl_num] = { 5., 5.};
|
||||
@ -1168,7 +1168,7 @@ double n2_nucl_coord[3][n2_nucl_num] =
|
||||
|
||||
Electron coordinates are stored in atomic units in normal format.
|
||||
|
||||
#+begin_src c :tangle (concat tests "n2.h")
|
||||
#+begin_src c
|
||||
#define n2_elec_up_num ((int64_t) 5)
|
||||
#define n2_elec_dn_num ((int64_t) 5)
|
||||
#define n2_elec_num ((int64_t) 10)
|
||||
@ -1203,7 +1203,7 @@ double n2_elec_coord[n2_walk_num][n2_elec_num][3] = { {
|
||||
This test is mainly for the Jastrow factor and was supplied by
|
||||
Ramon Panades Baruetta.
|
||||
|
||||
#+begin_src c :tangle (concat tests "n2.h")
|
||||
#+begin_src c
|
||||
/* Jastrow related */
|
||||
|
||||
#define n2_type_nucl_num ((int64_t) 1)
|
||||
|
Loading…
Reference in New Issue
Block a user