1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-12-22 20:36:01 +01:00

Fix warnings

This commit is contained in:
Anthony Scemama 2022-01-08 15:36:07 +01:00
parent 1539a40dfe
commit 28dc3978f4
3 changed files with 93 additions and 85 deletions

View File

@ -601,7 +601,7 @@ qmckl_set_ao_basis_nucleus_shell_num (qmckl_context context,
if (size_max < nucl_num) { if (size_max < nucl_num) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_set_ao_basis_nucleus_shell_num", "qmckl_set_ao_basis_nucleus_shell_num",
"input array too small"); "input array too small");
} }
@ -663,7 +663,7 @@ qmckl_set_ao_basis_shell_ang_mom (qmckl_context context,
if (size_max < shell_num) { if (size_max < shell_num) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_set_ao_basis_shell_ang_mom", "qmckl_set_ao_basis_shell_ang_mom",
"input array too small"); "input array too small");
} }
@ -726,7 +726,7 @@ qmckl_set_ao_basis_shell_prim_num (qmckl_context context,
if (size_max < shell_num) { if (size_max < shell_num) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_set_ao_basis_shell_prim_num", "qmckl_set_ao_basis_shell_prim_num",
"input array too small"); "input array too small");
} }
@ -789,7 +789,7 @@ qmckl_set_ao_basis_shell_prim_index (qmckl_context context,
if (size_max < shell_num) { if (size_max < shell_num) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_set_ao_basis_shell_prim_index", "qmckl_set_ao_basis_shell_prim_index",
"input array too small"); "input array too small");
} }
@ -851,7 +851,7 @@ qmckl_set_ao_basis_shell_factor (qmckl_context context,
if (size_max < shell_num) { if (size_max < shell_num) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_set_ao_basis_shell_factor", "qmckl_set_ao_basis_shell_factor",
"input array too small"); "input array too small");
} }
@ -913,7 +913,7 @@ qmckl_set_ao_basis_exponent (qmckl_context context,
if (size_max < prim_num) { if (size_max < prim_num) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_set_ao_basis_exponent", "qmckl_set_ao_basis_exponent",
"input array too small"); "input array too small");
} }
@ -975,7 +975,7 @@ qmckl_set_ao_basis_coefficient (qmckl_context context,
if (size_max < prim_num) { if (size_max < prim_num) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_set_ao_basis_coefficient", "qmckl_set_ao_basis_coefficient",
"input array too small"); "input array too small");
} }
@ -1037,7 +1037,7 @@ qmckl_set_ao_basis_prim_factor (qmckl_context context,
if (size_max < prim_num) { if (size_max < prim_num) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_set_ao_basis_prim_factor", "qmckl_set_ao_basis_prim_factor",
"input array too small"); "input array too small");
} }
@ -1099,7 +1099,7 @@ qmckl_set_ao_basis_ao_factor (qmckl_context context,
if (size_max < ao_num) { if (size_max < ao_num) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_set_ao_basis_ao_factor", "qmckl_set_ao_basis_ao_factor",
"input array too small"); "input array too small");
} }
@ -2638,6 +2638,13 @@ qmckl_get_ao_basis_primitive_vgl (qmckl_context context,
NULL); NULL);
} }
if (size_max <= 0) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_3,
"qmckl_get_ao_basis_primitive_vgl",
"size_max <= 0");
}
qmckl_exit_code rc; qmckl_exit_code rc;
rc = qmckl_provide_ao_basis_primitive_vgl(context); rc = qmckl_provide_ao_basis_primitive_vgl(context);
@ -2646,14 +2653,14 @@ qmckl_get_ao_basis_primitive_vgl (qmckl_context context,
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context; qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL); assert (ctx != NULL);
size_t sze = ctx->ao_basis.prim_num * 5 * ctx->electron.num; int64_t sze = ctx->ao_basis.prim_num * 5 * ctx->electron.num;
if (size_max < sze) { if (size_max < sze) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_get_ao_basis_primitive_vgl", "qmckl_get_ao_basis_primitive_vgl",
"input array too small"); "input array too small");
} }
memcpy(primitive_vgl, ctx->ao_basis.primitive_vgl, sze * sizeof(double)); memcpy(primitive_vgl, ctx->ao_basis.primitive_vgl, (size_t) sze * sizeof(double));
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }
@ -2707,14 +2714,14 @@ qmckl_get_ao_basis_shell_vgl (qmckl_context context,
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context; qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL); assert (ctx != NULL);
size_t sze = ctx->ao_basis.shell_num * 5 * ctx->electron.num; int64_t sze = ctx->ao_basis.shell_num * 5 * ctx->electron.num;
if (size_max < sze) { if (size_max < sze) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_get_ao_basis_shell_vgl", "qmckl_get_ao_basis_shell_vgl",
"input array too small"); "input array too small");
} }
memcpy(shell_vgl, ctx->ao_basis.shell_vgl, sze * sizeof(double)); memcpy(shell_vgl, ctx->ao_basis.shell_vgl, (size_t)sze * sizeof(double));
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }
@ -2770,14 +2777,14 @@ qmckl_get_ao_basis_ao_vgl (qmckl_context context,
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context; qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL); assert (ctx != NULL);
size_t sze = ctx->ao_basis.ao_num * 5 * ctx->electron.num; int64_t sze = ctx->ao_basis.ao_num * 5 * ctx->electron.num;
if (size_max < sze) { if (size_max < sze) {
return qmckl_failwith( context, return qmckl_failwith( context,
QMCKL_FAILURE, QMCKL_INVALID_ARG_3,
"qmckl_get_ao_basis_ao_vgl", "qmckl_get_ao_basis_ao_vgl",
"input array too small"); "input array too small");
} }
memcpy(ao_vgl, ctx->ao_basis.ao_vgl, sze * sizeof(double)); memcpy(ao_vgl, ctx->ao_basis.ao_vgl, (size_t) sze * sizeof(double));
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
} }

View File

@ -836,7 +836,7 @@ subroutine adjugate_general(context, na, A, LDA, B, LDB, det_l)
integer :: inf integer :: inf
integer :: ipiv(LDA) integer :: ipiv(LDA)
integer :: lwork integer :: lwork
integer :: i, j integer(8) :: i, j
#+end_src #+end_src
@ -859,7 +859,7 @@ subroutine adjugate_general(context, na, A, LDA, B, LDB, det_l)
#+begin_src f90 :tangle (eval f) #+begin_src f90 :tangle (eval f)
det_l = 1.d0 det_l = 1.d0
j=0 j=0_8
do i=1,na do i=1,na
j = j+min(abs(ipiv(i)-i),1) j = j+min(abs(ipiv(i)-i),1)
det_l = det_l*B(i,i) det_l = det_l*B(i,i)
@ -871,7 +871,7 @@ subroutine adjugate_general(context, na, A, LDA, B, LDB, det_l)
number of permutations. number of permutations.
#+begin_src f90 :tangle (eval f) #+begin_src f90 :tangle (eval f)
if (iand(j,1) /= 0) then if (iand(j,1_8) /= 0_8) then
det_l = -det_l det_l = -det_l
endif endif
#+end_src #+end_src
@ -905,8 +905,8 @@ integer(qmckl_exit_code) function test_qmckl_adjugate(context) bind(C)
integer*8 :: i,j,l integer*8 :: i,j,l
double precision :: x, det_l, det_l_ref double precision :: x, det_l, det_l_ref
LDA = 6 LDA = 6_8
LDB = 6 LDB = 6_8
allocate( A(LDA,6), B(LDB,6)) allocate( A(LDA,6), B(LDB,6))

View File

@ -557,6 +557,7 @@ qmckl_exit_code qmckl_finalize_determinant(qmckl_context context) {
"qmckl_finalize_determinant", "qmckl_finalize_determinant",
NULL); NULL);
} }
return rc;
} }
#+end_src #+end_src