diff --git a/org/qmckl_ao.org b/org/qmckl_ao.org index 28aab78..da9cbf1 100644 --- a/org/qmckl_ao.org +++ b/org/qmckl_ao.org @@ -5062,8 +5062,8 @@ for (int32_t ldl=3 ; ldl<=5 ; ++ldl) { for (int32_t k=0 ; k<5 ; ++k) { for (int32_t l=0 ; l +#include #ifdef HAVE_CONFIG_H #include "config.h" #endif @@ -1256,7 +1257,6 @@ print(C.T) rc = qmckl_double_of_matrix(context, C, cnew, 15); assert(rc == QMCKL_SUCCESS); - #include for (int i=0 ; i<15 ; ++i) { printf("%f %f\n", cnew[i], c[i]); assert (c[i] == cnew[i]); diff --git a/org/qmckl_context.org b/org/qmckl_context.org index 792a2cf..6a35789 100644 --- a/org/qmckl_context.org +++ b/org/qmckl_context.org @@ -62,6 +62,7 @@ int main() { #include #include #include +#include #include "qmckl.h" #include "qmckl_context_private_type.h" @@ -69,6 +70,8 @@ int main() { #+end_src + + * Context handling 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. 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_context_touch (const qmckl_context context); #+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 # Header - #+begin_src c :comments org :tangle (eval h_func) + #+begin_src c :comments org :tangle (eval h_func) qmckl_context qmckl_context_create(); #+end_src @@ -250,7 +253,9 @@ qmckl_context qmckl_context_create() { rc = pthread_mutexattr_init(&attr); assert (rc == 0); +#ifdef PTHREAD_MUTEX_RECURSIVE (void) pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); +#endif rc = pthread_mutex_init ( &(ctx->mutex), &attr); assert (rc == 0); @@ -261,30 +266,30 @@ qmckl_context qmckl_context_create() { /* Initialize data */ { ctx->tag = VALID_TAG; - + const qmckl_context context = (const qmckl_context) ctx; assert ( qmckl_context_check(context) != QMCKL_NULL_CONTEXT ); - + qmckl_exit_code rc; - + ctx->numprec.precision = QMCKL_DEFAULT_PRECISION; ctx->numprec.range = QMCKL_DEFAULT_RANGE; rc = qmckl_init_point(context); assert (rc == QMCKL_SUCCESS); - + rc = qmckl_init_electron(context); assert (rc == QMCKL_SUCCESS); - + rc = qmckl_init_nucleus(context); assert (rc == QMCKL_SUCCESS); - + rc = qmckl_init_ao_basis(context); assert (rc == QMCKL_SUCCESS); - + rc = qmckl_init_mo_basis(context); assert (rc == QMCKL_SUCCESS); - + rc = qmckl_init_determinant(context); assert (rc == QMCKL_SUCCESS); } @@ -335,7 +340,7 @@ assert( qmckl_context_check(context) == context ); ~lock_count~ attribute. # 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_unlock(qmckl_context context); #+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. # Header - #+begin_src c :comments org :tangle (eval h_func) + #+begin_src c :comments org :tangle (eval h_func) qmckl_exit_code qmckl_context_destroy (const qmckl_context context); #+end_src