mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-11-05 05:34:06 +01:00
Fixed memory leak in een_rescaled_e_ij
This commit is contained in:
parent
ebed18a205
commit
8a0a7585f9
@ -4843,8 +4843,6 @@ integer function qmckl_compute_een_rescaled_e_doc_f( &
|
||||
double precision :: x
|
||||
integer*8 :: i, j, k, l, nw
|
||||
|
||||
allocate(een_rescaled_e_ij(elec_num * (elec_num - 1) / 2, cord_num + 1))
|
||||
|
||||
info = QMCKL_SUCCESS
|
||||
|
||||
if (context == QMCKL_NULL_CONTEXT) then
|
||||
@ -4867,6 +4865,8 @@ integer function qmckl_compute_een_rescaled_e_doc_f( &
|
||||
return
|
||||
endif
|
||||
|
||||
allocate(een_rescaled_e_ij(elec_num * (elec_num - 1) / 2, cord_num + 1))
|
||||
|
||||
! Prepare table of exponentiated distances raised to appropriate power
|
||||
een_rescaled_e = 0.0d0
|
||||
do nw = 1, walk_num
|
||||
@ -4965,18 +4965,6 @@ qmckl_exit_code qmckl_compute_een_rescaled_e_hpc (
|
||||
const double* ee_distance,
|
||||
double* const een_rescaled_e ) {
|
||||
|
||||
double *een_rescaled_e_ij;
|
||||
double x;
|
||||
const int64_t elec_pairs = (elec_num * (elec_num - 1)) / 2;
|
||||
const int64_t len_een_ij = elec_pairs * (cord_num + 1);
|
||||
int64_t k;
|
||||
|
||||
// number of element for the een_rescaled_e_ij[N_e*(N_e-1)/2][cord+1]
|
||||
// probably in C is better [cord+1, Ne*(Ne-1)/2]
|
||||
//elec_pairs = (elec_num * (elec_num - 1)) / 2;
|
||||
//len_een_ij = elec_pairs * (cord_num + 1);
|
||||
een_rescaled_e_ij = (double *) malloc (len_een_ij * sizeof(double));
|
||||
|
||||
if (context == QMCKL_NULL_CONTEXT) {
|
||||
return QMCKL_INVALID_CONTEXT;
|
||||
}
|
||||
@ -5000,6 +4988,23 @@ qmckl_exit_code qmckl_compute_een_rescaled_e_hpc (
|
||||
een_rescaled_e[kk]= 0.0;
|
||||
}
|
||||
|
||||
double x;
|
||||
const int64_t elec_pairs = (elec_num * (elec_num - 1)) / 2;
|
||||
const int64_t len_een_ij = elec_pairs * (cord_num + 1);
|
||||
int64_t k;
|
||||
|
||||
// number of elements for the een_rescaled_e_ij[N_e*(N_e-1)/2][cord+1]
|
||||
// probably in C is better [cord+1, Ne*(Ne-1)/2]
|
||||
// elec_pairs = (elec_num * (elec_num - 1)) / 2;
|
||||
// len_een_ij = elec_pairs * (cord_num + 1);
|
||||
double* een_rescaled_e_ij = (double *) malloc (len_een_ij * sizeof(double));
|
||||
if (een_rescaled_e_ij == NULL) {
|
||||
return qmckl_failwith( context,
|
||||
QMCKL_ALLOCATION_FAILED,
|
||||
"qmckl_compute_een_rescaled_e_hpc",
|
||||
NULL);
|
||||
}
|
||||
|
||||
/*
|
||||
for (int nw = 0; nw < walk_num; ++nw) {
|
||||
for (int l = 0; l < (cord_num + 1); ++l) {
|
||||
|
Loading…
Reference in New Issue
Block a user