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

Removed calloc

This commit is contained in:
Anthony Scemama 2023-11-29 02:10:20 +01:00
parent c6d193887a
commit 4df54f21c7
2 changed files with 29 additions and 20 deletions

View File

@ -3578,6 +3578,8 @@ function qmckl_compute_ao_basis_primitive_gaussian_vgl &
use, intrinsic :: iso_c_binding
use qmckl_constants
use qmckl, only: qmckl_get_numprec_epsilon
implicit none
integer (qmckl_context), intent(in) , value :: context
integer (c_int64_t) , intent(in) , value :: prim_num
@ -3596,7 +3598,7 @@ function qmckl_compute_ao_basis_primitive_gaussian_vgl &
info = QMCKL_SUCCESS
! Don't compute exponentials when the result will be almost zero.
cutoff = 27.631021115928547d0 ! -dlog(1.d-12)
cutoff = -dlog(qmckl_get_numprec_epsilon(context))
do inucl=1,nucl_num
! C is zero-based, so shift bounds by one
@ -3880,6 +3882,7 @@ function qmckl_compute_ao_basis_shell_gaussian_vgl( &
use, intrinsic :: iso_c_binding
use qmckl_constants
use qmckl, only: qmckl_get_numprec_epsilon
implicit none
integer (qmckl_context), intent(in) , value :: context
@ -3908,7 +3911,7 @@ function qmckl_compute_ao_basis_shell_gaussian_vgl( &
! Don't compute exponentials when the result will be almost zero.
! TODO : Use numerical precision here
cutoff = 27.631021115928547d0 !-dlog(1.d-12)
cutoff = -dlog(qmckl_get_numprec_epsilon(context))
do ipoint = 1, point_num

View File

@ -1309,18 +1309,23 @@ qmckl_compute_mo_basis_mo_value_hpc_sp (const qmckl_context context,
}
#ifdef HAVE_OPENMP
#pragma omp parallel for
#pragma omp parallel
#endif
{
int64_t* __attribute__((aligned(64))) idx = calloc((size_t) ao_num, sizeof(int64_t));
float* __attribute__((aligned(64))) av1 = calloc((size_t) ao_num, sizeof(float));
assert (idx != NULL);
assert (av1 != NULL);
#ifdef HAVE_OPENMP
#pragma omp for
#endif
for (int64_t ipoint=0 ; ipoint < point_num ; ++ipoint) {
double* restrict const vgl1 = &(mo_value[ipoint*mo_num]);
const double* restrict avgl1 = &(ao_value[ipoint*ao_num]);
// memset(vgl_sp, 0, mo_num*sizeof(float));
int64_t* __attribute__((aligned(64))) idx = calloc((size_t) ao_num, sizeof(int64_t));
float* __attribute__((aligned(64))) av1 = calloc((size_t) ao_num, sizeof(float));
float* __attribute__((aligned(64))) vgl_sp = calloc((size_t) mo_num, sizeof(float));
assert (idx != NULL);
assert (av1 != NULL);
assert (vgl_sp != NULL);
int64_t nidx=0;
@ -1374,9 +1379,10 @@ qmckl_compute_mo_basis_mo_value_hpc_sp (const qmckl_context context,
for (int64_t i=0 ; i<mo_num ; ++i) {
vgl1[i] = (double) vgl_sp[i];
}
free(av1);
free(idx);
free(vgl_sp);
}
free(av1);
free(idx);
}
free(coefficient_t_sp);
return QMCKL_SUCCESS;