Skip to content

Commit

Permalink
Release v4.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
sunqm committed Oct 29, 2020
1 parent 993bfdd commit 7e63fb1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 10 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ cmake_minimum_required (VERSION 2.6)
project (cint C)
set(cint_VERSION_MAJOR "4")
set(cint_VERSION_MINOR "0")
set(cint_VERSION_PATCH "3")
set(cint_VERSION_PATCH "4")
set(cint_VERSION_TWEAK "0")
set(cint_VERSION "${cint_VERSION_MAJOR}.${cint_VERSION_MINOR}.${cint_VERSION_PATCH}")
set(cint_SOVERSION "${cint_VERSION_MAJOR}")
Expand Down
2 changes: 2 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
Version 4.0.4 (2020-10-29):
* Fix cache size bug in int3c1e
Version 4.0.3 (2020-10-27):
* Fix memory allocation in int3c1e
* Improve macro MALLOC_INSTACK
Expand Down
4 changes: 2 additions & 2 deletions README
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
libcint
=======

version 4.0.3
2020-10-27
version 4.0.4
2020-10-29


What is libcint
Expand Down
24 changes: 20 additions & 4 deletions src/cint3c1e.c
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,16 @@ FINT CINT3c1e_nuc_loop_nopt(double *gctr, CINTEnvVars *envs,
return !*kempty;
}

#define PAIRDATA_NON0IDX_SIZE(ps) \
FINT *bas = envs->bas; \
FINT *shls = envs->shls; \
FINT i_prim = bas(NPRIM_OF, shls[0]); \
FINT j_prim = bas(NPRIM_OF, shls[1]); \
FINT k_prim = bas(NPRIM_OF, shls[2]); \
FINT ps = (i_prim * x_ctr[0] \
+ j_prim * x_ctr[1] \
+ k_prim * x_ctr[2] \
+ envs->nf*3);

FINT CINT3c1e_cart_drv(double *out, FINT *dims, CINTEnvVars *envs, CINTOpt *opt,
double *cache, FINT int_type)
Expand All @@ -385,16 +395,18 @@ FINT CINT3c1e_cart_drv(double *out, FINT *dims, CINTEnvVars *envs, CINTOpt *opt,
FINT nc = envs->nf * x_ctr[0] * x_ctr[1] * x_ctr[2];
FINT n_comp = envs->ncomp_e1 * envs->ncomp_tensor;
if (out == NULL) {
PAIRDATA_NON0IDX_SIZE(pdata_size);
FINT leng = envs->g_size*3*((1<<envs->gbits)+1);
FINT len0 = envs->nf*n_comp;
FINT cache_size = leng + len0 + nc*n_comp*4;
FINT cache_size = leng + len0 + nc*n_comp*4 + pdata_size;
return cache_size;
}
double *stack = NULL;
if (cache == NULL) {
PAIRDATA_NON0IDX_SIZE(pdata_size);
FINT leng = envs->g_size*3*((1<<envs->gbits)+1);
FINT len0 = envs->nf*n_comp;
FINT cache_size = leng + len0 + nc*n_comp*4;
FINT cache_size = leng + len0 + nc*n_comp*4 + pdata_size;
stack = malloc(sizeof(double)*cache_size);
cache = stack;
}
Expand Down Expand Up @@ -472,16 +484,20 @@ FINT CINT3c1e_spheric_drv(double *out, FINT *dims, CINTEnvVars *envs, CINTOpt *o
FINT nc = envs->nf * x_ctr[0] * x_ctr[1] * x_ctr[2];
FINT n_comp = envs->ncomp_e1 * envs->ncomp_tensor;
if (out == NULL) {
PAIRDATA_NON0IDX_SIZE(pdata_size);
FINT leng = envs->g_size*3*((1<<envs->gbits)+1);
FINT len0 = envs->nf*n_comp;
FINT cache_size = MAX(leng+len0+nc*n_comp*4, nc*n_comp+envs->nf*3);
FINT cache_size = MAX(leng+len0+nc*n_comp*4 + pdata_size,
nc*n_comp+envs->nf*3);
return cache_size;
}
double *stack = NULL;
if (cache == NULL) {
PAIRDATA_NON0IDX_SIZE(pdata_size);
FINT leng = envs->g_size*3*((1<<envs->gbits)+1);
FINT len0 = envs->nf*n_comp;
FINT cache_size = MAX(leng+len0+nc*n_comp*4, nc*n_comp+envs->nf*3);
FINT cache_size = MAX(leng+len0+nc*n_comp*4 + pdata_size,
nc*n_comp+envs->nf*3);
stack = malloc(sizeof(double)*cache_size);
cache = stack;
}
Expand Down
5 changes: 2 additions & 3 deletions src/cint4c1e.c
Original file line number Diff line number Diff line change
Expand Up @@ -252,12 +252,11 @@ k_contracted: ;
FINT j_prim = bas(NPRIM_OF, shls[1]); \
FINT k_prim = bas(NPRIM_OF, shls[2]); \
FINT l_prim = bas(NPRIM_OF, shls[3]); \
FINT ps = ((i_prim*j_prim + k_prim*l_prim) * 5 \
+ i_prim * x_ctr[0] \
FINT ps = (i_prim * x_ctr[0] \
+ j_prim * x_ctr[1] \
+ k_prim * x_ctr[2] \
+ l_prim * x_ctr[3] \
+(i_prim+j_prim+k_prim+l_prim)*2 + envs->nf*3);
+ envs->nf*3);

FINT CINT4c1e_cart_drv(double *out, FINT *dims, CINTEnvVars *envs, CINTOpt *opt,
double *cache)
Expand Down

0 comments on commit 7e63fb1

Please sign in to comment.