mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-12-23 12:57:20 +01:00
Fixed memory lead in malloc caught by valgrind. #22
This commit is contained in:
parent
9df44ee026
commit
4c20982d6f
@ -2492,7 +2492,7 @@ qmckl_exit_code qmckl_provide_factor_en_deriv_e(qmckl_context context)
|
|||||||
if (ctx->jastrow.factor_en_deriv_e == NULL) {
|
if (ctx->jastrow.factor_en_deriv_e == NULL) {
|
||||||
|
|
||||||
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
|
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
|
||||||
mem_info.size = ctx->electron.walk_num * sizeof(double);
|
mem_info.size = ctx->electron.walk_num * 4 * ctx->electron.num * sizeof(double);
|
||||||
double* factor_en_deriv_e = (double*) qmckl_malloc(context, mem_info);
|
double* factor_en_deriv_e = (double*) qmckl_malloc(context, mem_info);
|
||||||
|
|
||||||
if (factor_en_deriv_e == NULL) {
|
if (factor_en_deriv_e == NULL) {
|
||||||
@ -2816,10 +2816,11 @@ print("factor_en_deriv_e[3][0]:",factor_en_deriv_e[3][0])
|
|||||||
/* Check if Jastrow is properly initialized */
|
/* Check if Jastrow is properly initialized */
|
||||||
assert(qmckl_jastrow_provided(context));
|
assert(qmckl_jastrow_provided(context));
|
||||||
|
|
||||||
|
// calculate factor_en_deriv_e
|
||||||
double factor_en_deriv_e[walk_num][4][elec_num];
|
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]));
|
rc = qmckl_get_jastrow_factor_en_deriv_e(context, &(factor_en_deriv_e[0][0][0]));
|
||||||
|
|
||||||
// calculate factor_en
|
// 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][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][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][2][0]-0.17548337641865783) < 1.e-12);
|
||||||
|
Loading…
Reference in New Issue
Block a user