1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2025-01-03 10:06:09 +01:00

Fix Clang build

This commit is contained in:
Anthony Scemama 2022-02-25 13:57:13 +01:00
parent 1a5b76157b
commit ff526a18cb
3 changed files with 22 additions and 17 deletions

View File

@ -5062,8 +5062,8 @@ for (int32_t ldl=3 ; ldl<=5 ; ++ldl) {
for (int32_t k=0 ; k<5 ; ++k) { for (int32_t k=0 ; k<5 ; ++k) {
for (int32_t l=0 ; l<n ; ++l) { for (int32_t l=0 ; l<n ; ++l) {
printf("VGL[%d][%d] = %e %e\n", k, l, VGL0[k][l], VGL1[k][l]); printf("VGL[%d][%d] = %e %e %e\n", k, l, VGL0[k][l], VGL1[k][l], VGL0[k][l]-VGL1[k][l]);
assert( VGL0[k][l] == VGL1[k][l] ); assert( fabs(1.-(VGL0[k][l]+1.e-100)/(VGL1[k][l]+1.e-100)) < 1.e-15 );
} }
} }
} }

View File

@ -46,7 +46,8 @@
#+begin_src c :comments link :tangle (eval c_test) :noweb yes #+begin_src c :comments link :tangle (eval c_test) :noweb yes
#include "qmckl.h" #include "qmckl.h"
#include "assert.h" #include <stdio.h>
#include <assert.h>
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
#include "config.h" #include "config.h"
#endif #endif
@ -1256,7 +1257,6 @@ print(C.T)
rc = qmckl_double_of_matrix(context, C, cnew, 15); rc = qmckl_double_of_matrix(context, C, cnew, 15);
assert(rc == QMCKL_SUCCESS); assert(rc == QMCKL_SUCCESS);
#include <stdio.h>
for (int i=0 ; i<15 ; ++i) { for (int i=0 ; i<15 ; ++i) {
printf("%f %f\n", cnew[i], c[i]); printf("%f %f\n", cnew[i], c[i]);
assert (c[i] == cnew[i]); assert (c[i] == cnew[i]);

View File

@ -62,6 +62,7 @@ int main() {
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#include <pthread.h>
#include "qmckl.h" #include "qmckl.h"
#include "qmckl_context_private_type.h" #include "qmckl_context_private_type.h"
@ -69,6 +70,8 @@ int main() {
#+end_src #+end_src
* Context handling * Context handling
The context variable is a handle for the state of the library, The context variable is a handle for the state of the library,
@ -185,9 +188,9 @@ qmckl_context qmckl_context_check(const qmckl_context context) {
should be updated in order to make deep copies. should be updated in order to make deep copies.
When the electron coordinates have changed, the context is touched When the electron coordinates have changed, the context is touched
using the following function. using the following function.
#+begin_src c :comments org :tangle (eval h_func) #+begin_src c :comments org :tangle (eval h_func)
qmckl_exit_code qmckl_exit_code
qmckl_context_touch (const qmckl_context context); qmckl_context_touch (const qmckl_context context);
#+end_src #+end_src
@ -222,7 +225,7 @@ qmckl_context_touch(const qmckl_context context)
- A new context always has all its members initialized with a NULL value - A new context always has all its members initialized with a NULL value
# Header # Header
#+begin_src c :comments org :tangle (eval h_func) #+begin_src c :comments org :tangle (eval h_func)
qmckl_context qmckl_context_create(); qmckl_context qmckl_context_create();
#+end_src #+end_src
@ -250,7 +253,9 @@ qmckl_context qmckl_context_create() {
rc = pthread_mutexattr_init(&attr); rc = pthread_mutexattr_init(&attr);
assert (rc == 0); assert (rc == 0);
#ifdef PTHREAD_MUTEX_RECURSIVE
(void) pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); (void) pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
#endif
rc = pthread_mutex_init ( &(ctx->mutex), &attr); rc = pthread_mutex_init ( &(ctx->mutex), &attr);
assert (rc == 0); assert (rc == 0);
@ -261,30 +266,30 @@ qmckl_context qmckl_context_create() {
/* Initialize data */ /* Initialize data */
{ {
ctx->tag = VALID_TAG; ctx->tag = VALID_TAG;
const qmckl_context context = (const qmckl_context) ctx; const qmckl_context context = (const qmckl_context) ctx;
assert ( qmckl_context_check(context) != QMCKL_NULL_CONTEXT ); assert ( qmckl_context_check(context) != QMCKL_NULL_CONTEXT );
qmckl_exit_code rc; qmckl_exit_code rc;
ctx->numprec.precision = QMCKL_DEFAULT_PRECISION; ctx->numprec.precision = QMCKL_DEFAULT_PRECISION;
ctx->numprec.range = QMCKL_DEFAULT_RANGE; ctx->numprec.range = QMCKL_DEFAULT_RANGE;
rc = qmckl_init_point(context); rc = qmckl_init_point(context);
assert (rc == QMCKL_SUCCESS); assert (rc == QMCKL_SUCCESS);
rc = qmckl_init_electron(context); rc = qmckl_init_electron(context);
assert (rc == QMCKL_SUCCESS); assert (rc == QMCKL_SUCCESS);
rc = qmckl_init_nucleus(context); rc = qmckl_init_nucleus(context);
assert (rc == QMCKL_SUCCESS); assert (rc == QMCKL_SUCCESS);
rc = qmckl_init_ao_basis(context); rc = qmckl_init_ao_basis(context);
assert (rc == QMCKL_SUCCESS); assert (rc == QMCKL_SUCCESS);
rc = qmckl_init_mo_basis(context); rc = qmckl_init_mo_basis(context);
assert (rc == QMCKL_SUCCESS); assert (rc == QMCKL_SUCCESS);
rc = qmckl_init_determinant(context); rc = qmckl_init_determinant(context);
assert (rc == QMCKL_SUCCESS); assert (rc == QMCKL_SUCCESS);
} }
@ -335,7 +340,7 @@ assert( qmckl_context_check(context) == context );
~lock_count~ attribute. ~lock_count~ attribute.
# Header # Header
#+begin_src c :comments org :tangle (eval h_func) #+begin_src c :comments org :tangle (eval h_func)
void qmckl_lock (qmckl_context context); void qmckl_lock (qmckl_context context);
void qmckl_unlock(qmckl_context context); void qmckl_unlock(qmckl_context context);
#+end_src #+end_src
@ -448,7 +453,7 @@ munit_assert_int64(qmckl_context_check(new_context), ==, new_context);
It frees the context, and returns the previous context. It frees the context, and returns the previous context.
# Header # Header
#+begin_src c :comments org :tangle (eval h_func) #+begin_src c :comments org :tangle (eval h_func)
qmckl_exit_code qmckl_exit_code
qmckl_context_destroy (const qmckl_context context); qmckl_context_destroy (const qmckl_context context);
#+end_src #+end_src