diff --git a/README.html b/README.html index d74124d..d399ca4 100644 --- a/README.html +++ b/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + QMCkl source code documentation @@ -348,7 +348,7 @@ and bug reports should be submitted at

Author: TREX CoE

-

Created: 2021-03-28 Sun 23:18

+

Created: 2021-03-28 Sun 23:40

Validate

diff --git a/index.html b/index.html index d74124d..d399ca4 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + QMCkl source code documentation @@ -348,7 +348,7 @@ and bug reports should be submitted at

Author: TREX CoE

-

Created: 2021-03-28 Sun 23:18

+

Created: 2021-03-28 Sun 23:40

Validate

diff --git a/qmckl.html b/qmckl.html index 481245e..7672341 100644 --- a/qmckl.html +++ b/qmckl.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Introduction @@ -333,30 +333,30 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Using QMCkl

+
+

1 Using QMCkl

The qmckl.h header file has to be included in C codes when @@ -385,12 +385,12 @@ Both files are located in the include/ directory.

-
-

2 Developing in QMCkl

+
+

2 Developing in QMCkl

-
-

2.1 Literate programming

+
+

2.1 Literate programming

In a traditional source code, most of the lines of source files of a program @@ -436,8 +436,8 @@ interactively, in the same spirit as Jupyter notebooks.

-
-

2.2 Source code editing

+
+

2.2 Source code editing

For a tutorial on literate programming with org-mode, follow this link. @@ -469,8 +469,8 @@ org-mode.

-
-

2.3 Choice of the programming language

+
+

2.3 Choice of the programming language

Most of the codes of the TREX CoE are written in Fortran with some scripts in @@ -518,8 +518,8 @@ For more guidelines on using Fortran to generate a C interface, see

-
-

2.4 Coding rules

+
+

2.4 Coding rules

The authors should follow the recommendations of the @@ -535,8 +535,8 @@ freed

-
-

2.5 Design of the library

+
+

2.5 Design of the library

The proposed API should allow the library to: deal with memory transfers @@ -547,8 +547,8 @@ functions (see below).

-
-

2.6 Naming conventions

+
+

2.6 Naming conventions

To avoid namespace collisions, we use qmckl_ as a prefix for all exported @@ -573,8 +573,8 @@ form is allowed.

-
-

2.7 Application programming interface

+
+

2.7 Application programming interface

In the C language, the number of bits used by the integer types can change @@ -607,15 +607,15 @@ bindings in other languages in other repositories.

-
-

2.8 Global state

+
+

2.8 Global state

Global variables should be avoided in the library, because it is possible that one single program needs to use multiple instances of the library. To solve this problem we propose to use a pointer to a context variable, built by the library with the -qmckl_context_create function. The =context= contains the global +qmckl_context_create function. The =context= contains the global state of the library, and is used as the first argument of many QMCkl functions.

@@ -635,8 +635,8 @@ versions can be destroyed with qmckl_context_destroy.
-
-

2.9 Low-level functions

+
+

2.9 Low-level functions

Low-level functions are very simple functions which are leaves of @@ -645,14 +645,14 @@ the function call tree (they don't call any other QMCkl function).

These functions are pure, and unaware of the QMCkl -context. They are not allowed to allocate/deallocate memory, and +context. They are not allowed to allocate/deallocate memory, and if they need temporary memory it should be provided in input.

-
-

2.10 High-level functions

+
+

2.10 High-level functions

High-level functions are at the top of the function call tree. @@ -665,27 +665,27 @@ temporary storage, to simplify the use of accelerators.

The high-level functions should be pure, unless the introduction of non-purity is justified. All the side effects should be made in -the context variable. +the context variable.

-
-

2.11 Numerical precision

+
+

2.11 Numerical precision

The number of bits of precision required for a function should be given as an input of low-level computational functions. This input will be used to define the values of the different thresholds that might be used to avoid computing unnecessary noise. High-level -functions will use the precision specified in the context +functions will use the precision specified in the context variable.

-
-

2.12 Algorithms

+
+

2.12 Algorithms

Reducing the scaling of an algorithm usually implies also reducing @@ -698,8 +698,8 @@ implemented adapted to different problem sizes.

-
-

2.13 Rules for the API

+
+

2.13 Rules for the API

  • stdint should be used for integers (int32_t, int64_t)
  • @@ -713,7 +713,7 @@ implemented adapted to different problem sizes.

Author: TREX CoE

-

Created: 2021-03-28 Sun 23:18

+

Created: 2021-03-28 Sun 23:40

Validate

diff --git a/qmckl_ao.html b/qmckl_ao.html index 917cb8a..04fa775 100644 --- a/qmckl_ao.html +++ b/qmckl_ao.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Atomic Orbitals @@ -333,14 +333,14 @@ for the JavaScript code in this tag.

Table of Contents

@@ -389,12 +389,12 @@ In this section we describe the kernels used to compute the values, gradients and Laplacian of the atomic basis functions.

-
-

1 Polynomial part

+
+

1 Polynomial part

-
-

1.1 Powers of \(x-X_i\)

+
+

1.1 Powers of \(x-X_i\)

The qmckl_ao_power function computes all the powers of the n @@ -574,8 +574,8 @@ Requirements:

-
-

1.2 Value, Gradient and Laplacian of a polynomial

+
+

1.2 Value, Gradient and Laplacian of a polynomial

A polynomial is centered on a nucleus \(\mathbf{R}_i\) @@ -960,8 +960,8 @@ munit_assert_int(0, ==, test_qmckl_ao_polynomial_vgl(context));

-
-

2 Gaussian basis functions

+
+

2 Gaussian basis functions

qmckl_ao_gaussian_vgl computes the values, gradients and @@ -1193,13 +1193,13 @@ Requirements :

-
-

3 TODO Slater basis functions

+
+

3 TODO Slater basis functions

Author: TREX CoE

-

Created: 2021-03-28 Sun 23:18

+

Created: 2021-03-28 Sun 23:40

Validate

diff --git a/qmckl_context.html b/qmckl_context.html index 863c717..9b8f21c 100644 --- a/qmckl_context.html +++ b/qmckl_context.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Context @@ -333,51 +333,51 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Context handling

+
+

1 Context handling

The context appears as an immutable data structure: modifying a @@ -419,8 +419,8 @@ and ctx is a qmckl_context_struct* pointer.

-
-

1.1 Data structure

+
+

1.1 Data structure

The main data structure contains pointers to other data structures, @@ -430,7 +430,7 @@ pointers.

-
typedef struct qmckl_context_struct {
+
typedef struct qmckl_context_struct {
 
   /* Pointer to the previous context, before modification */
   struct qmckl_context_struct * prev;
@@ -510,8 +510,8 @@ if the context is valid, QMCKL_NULL_CONTEXT otherwise.
 
-
-

1.2 Creation

+
+

1.2 Creation

To create a new context, qmckl_context_create() should be used. @@ -549,8 +549,8 @@ To create a new context, qmckl_context_create() should be used.

-
-

1.3 Access to the previous context

+
+

1.3 Access to the previous context

qmckl_context_previous returns the previous context. It returns @@ -572,8 +572,8 @@ To create a new context, qmckl_context_create() should be used.

-
-

1.4 Locking

+
+

1.4 Locking

For thread safety, the context may be locked/unlocked. The lock is @@ -633,8 +633,8 @@ number of times the thread has locked it is saved in the

-
-

1.5 Copy

+
+

1.5 Copy

qmckl_context_copy makes a shallow copy of a context. It returns @@ -680,8 +680,8 @@ number of times the thread has locked it is saved in the

-
-

1.6 Destroy

+
+

1.6 Destroy

The context is destroyed with qmckl_context_destroy, leaving the ancestors untouched. @@ -736,12 +736,12 @@ It frees the context, and returns the previous context.

-
-

2 Memory allocation handling

+
+

2 Memory allocation handling

-
-

2.1 Data structure

+
+

2.1 Data structure

Pointers to all allocated memory domains are stored in the context, @@ -750,7 +750,7 @@ computation of the amount of currently used memory by the library.

-
typedef struct qmckl_memory_struct {
+
typedef struct qmckl_memory_struct {
   struct qmckl_memory_struct * next    ;
   void                       * pointer ;
   size_t                       size    ;
@@ -760,8 +760,8 @@ computation of the amount of currently used memory by the library.
 
-
-

2.2 Append memory

+
+

2.2 Append memory

The following function, called in qmckl_memory.c, appends a new @@ -819,8 +819,8 @@ immediately with QMCKL_SUCCESS.

-
-

2.3 Remove memory

+
+

2.3 Remove memory

The following function, called in qmckl_memory.c, removes a @@ -859,11 +859,7 @@ immediately with QMCKL_SUCCESS. qmckl_unlock(context); - if (alloc != NULL) { - return QMCKL_SUCCESS; - } else { - return QMCKL_DEALLOCATION_FAILED; - } + return QMCKL_SUCCESS; }

@@ -871,15 +867,15 @@ immediately with QMCKL_SUCCESS.
-
-

3 Error handling

+
+

3 Error handling

-
-

3.1 Data structure

+
+

3.1 Data structure

-
#define  QMCKL_MAX_FUN_LEN   256
+
#define  QMCKL_MAX_FUN_LEN   256
 #define  QMCKL_MAX_MSG_LEN  1024
 
 typedef struct qmckl_error_struct {
@@ -894,8 +890,8 @@ immediately with QMCKL_SUCCESS.
 
-
-

3.2 Updating errors

+
+

3.2 Updating errors

The error is updated in the context using @@ -1044,8 +1040,8 @@ For example, this function can be used as

-
-

4 Control of the numerical precision

+
+

4 Control of the numerical precision

Controlling numerical precision enables optimizations. Here, the @@ -1053,7 +1049,7 @@ default parameters determining the target numerical precision and range are defined.

- +
@@ -1098,7 +1094,7 @@ range are defined.
-
typedef struct qmckl_precision_struct {
+
typedef struct qmckl_precision_struct {
   int  precision;
   int  range;
 } qmckl_precision_struct;
@@ -1119,8 +1115,8 @@ integer. The update functions return QMCKL_SUCCESS or
 

-
-

4.1 Precision

+
+

4.1 Precision

qmckl_context_update_precision modifies the parameter for the @@ -1240,8 +1236,8 @@ different precision parameter.

-
-

4.2 Range

+
+

4.2 Range

qmckl_context_update_range modifies the parameter for the numerical range in a given context. @@ -1348,8 +1344,8 @@ different precision parameter.

-
-

4.3 Helper functions

+
+

4.3 Helper functions

qmckl_context_get_epsilon returns \(\epsilon = 2^{1-n}\) where n is the precision. @@ -1365,8 +1361,8 @@ different precision parameter.

-
-

5 TODO Basis set

+
+

5 TODO Basis set

For H2 with the following basis set, @@ -1413,11 +1409,11 @@ COEFFICIENT = [ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421,

-
-

5.1 Data structure

+
+

5.1 Data structure

-
typedef struct qmckl_ao_basis_struct {
+
typedef struct qmckl_ao_basis_struct {
 
   int64_t   shell_num;
   int64_t   prim_num;
@@ -1435,8 +1431,8 @@ COEFFICIENT = [ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421,
 
-
-

5.2 qmckl_context_update_ao_basis

+
+

5.2 qmckl_context_update_ao_basis

Updates the data describing the AO basis set into the context. @@ -1520,8 +1516,8 @@ Updates the data describing the AO basis set into the context.

-
-

5.2.1 Source

+
+

5.2.1 Source

qmckl_exit_code
@@ -1668,8 +1664,8 @@ Updates the data describing the AO basis set into the context.
 
-
-

5.2.2 Fortran interface

+
+

5.2.2 Fortran interface

interface
@@ -1695,13 +1691,13 @@ Updates the data describing the AO basis set into the context.
 
-
-

5.2.3 TODO Test

+
+

5.2.3 TODO Test

-
-

5.3 qmckl_context_set_ao_basis

+
+

5.3 qmckl_context_set_ao_basis

Sets the data describing the AO basis set into the context. @@ -1780,8 +1776,8 @@ Sets the data describing the AO basis set into the context.

-
-

5.3.1 Source

+
+

5.3.1 Source

qmckl_context
@@ -1810,8 +1806,8 @@ Sets the data describing the AO basis set into the context.
 
-
-

5.3.2 Fortran interface

+
+

5.3.2 Fortran interface

interface
@@ -1837,15 +1833,15 @@ Sets the data describing the AO basis set into the context.
 
-
-

5.3.3 TODO Test

+
+

5.3.3 TODO Test

Author: TREX CoE

-

Created: 2021-03-28 Sun 23:18

+

Created: 2021-03-28 Sun 23:40

Validate

diff --git a/qmckl_distance.html b/qmckl_distance.html index ca1c234..6f4d952 100644 --- a/qmckl_distance.html +++ b/qmckl_distance.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Inter-particle distances @@ -333,14 +333,14 @@ for the JavaScript code in this tag.

Table of Contents

+
@@ -463,8 +463,8 @@ between all pairs of points in two sets, one point within each set:
-
-

1.1.1 Requirements

+
+

1.1.1 Requirements

  • context is not QMCKL_NULL_CONTEXT
  • @@ -482,8 +482,8 @@ between all pairs of points in two sets, one point within each set:
-
-

1.1.2 C header

+
+

1.1.2 C header

qmckl_exit_code qmckl_distance_sq (
@@ -503,8 +503,8 @@ between all pairs of points in two sets, one point within each set:
 
-
-

1.1.3 Source

+
+

1.1.3 Source

integer function qmckl_distance_sq_f(context, transa, transb, m, n, A, LDA, B, LDB, C, LDC) result(info)
@@ -637,8 +637,8 @@ between all pairs of points in two sets, one point within each set:
 
-
-

1.1.4 Performance

+
+

1.1.4 Performance

This function might be more efficient when A and B are @@ -651,7 +651,7 @@ transposed.

Author: TREX CoE

-

Created: 2021-03-28 Sun 23:18

+

Created: 2021-03-28 Sun 23:40

Validate

diff --git a/qmckl_error.html b/qmckl_error.html index ea0b511..6347d80 100644 --- a/qmckl_error.html +++ b/qmckl_error.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Error handling @@ -311,14 +311,14 @@ for the JavaScript code in this tag.

Table of Contents

    -
  • +
-
-

-
+
+

+

The library should never make the calling programs abort, nor perform any input/output operations. This decision has to be taken @@ -329,7 +329,7 @@ by the developer of the code calling the library. All the functions return with an exit code, defined as

-
typedef int32_t qmckl_exit_code;
+
typedef int32_t qmckl_exit_code;
 
@@ -345,7 +345,7 @@ error code is returned to the program. Here is the complete list of exit codes.

- +
@@ -483,67 +483,72 @@ The text strings are extracted from the previous table.

-
void qmckl_string_of_error(qmckl_exit_code error, char string[128]) {
+
const char* qmckl_string_of_error(const qmckl_exit_code error) {
   switch (error) {
   case QMCKL_SUCCESS:
-              strncpy(string,"Success",128);
+              return "Success";
             break;
   case QMCKL_INVALID_ARG_1:
-              strncpy(string,"Invalid argument 1",128);
+              return "Invalid argument 1";
             break;
   case QMCKL_INVALID_ARG_2:
-              strncpy(string,"Invalid argument 2",128);
+              return "Invalid argument 2";
             break;
   case QMCKL_INVALID_ARG_3:
-              strncpy(string,"Invalid argument 3",128);
+              return "Invalid argument 3";
             break;
   case QMCKL_INVALID_ARG_4:
-              strncpy(string,"Invalid argument 4",128);
+              return "Invalid argument 4";
             break;
   case QMCKL_INVALID_ARG_5:
-              strncpy(string,"Invalid argument 5",128);
+              return "Invalid argument 5";
             break;
   case QMCKL_INVALID_ARG_6:
-              strncpy(string,"Invalid argument 6",128);
+              return "Invalid argument 6";
             break;
   case QMCKL_INVALID_ARG_7:
-              strncpy(string,"Invalid argument 7",128);
+              return "Invalid argument 7";
             break;
   case QMCKL_INVALID_ARG_8:
-              strncpy(string,"Invalid argument 8",128);
+              return "Invalid argument 8";
             break;
   case QMCKL_INVALID_ARG_9:
-              strncpy(string,"Invalid argument 9",128);
+              return "Invalid argument 9";
             break;
   case QMCKL_INVALID_ARG_10:
-              strncpy(string,"Invalid argument 10",128);
+              return "Invalid argument 10";
             break;
   case QMCKL_FAILURE:
-              strncpy(string,"Failure",128);
+              return "Failure";
             break;
   case QMCKL_ERRNO:
-              strncpy(string,strerror(errno),128);
+              return strerror(errno);
             break;
   case QMCKL_INVALID_CONTEXT:
-              strncpy(string,"Invalid context",128);
+              return "Invalid context";
             break;
   case QMCKL_ALLOCATION_FAILED:
-              strncpy(string,"Allocation failed",128);
+              return "Allocation failed";
             break;
   case QMCKL_DEALLOCATION_FAILED:
-              strncpy(string,"De-allocation failed",128);
+              return "De-allocation failed";
             break;
   case QMCKL_INVALID_EXIT_CODE:
-              strncpy(string,"Invalid exit code",128);
+              return "Invalid exit code";
             break;
   }
+  return "Unknown error";
+}
+
+void qmckl_string_of_error_f(const qmckl_exit_code error, char result[128]) {
+  strncpy(result, qmckl_string_of_error(error), 128);
 }
 
interface
-   subroutine qmckl_string_of_error (error, string) bind(C)
+   subroutine qmckl_string_of_error (error, string) bind(C, name='qmckl_string_of_error_f')
      use, intrinsic :: iso_c_binding
      integer (c_int32_t), intent(in), value :: error
      character, intent(out) :: string(128)
@@ -556,7 +561,7 @@ The text strings are extracted from the previous table.
 

Author: TREX CoE

-

Created: 2021-03-28 Sun 23:18

+

Created: 2021-03-28 Sun 23:40

Validate

diff --git a/qmckl_memory.html b/qmckl_memory.html index e384cb1..8daecb6 100644 --- a/qmckl_memory.html +++ b/qmckl_memory.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - +Memory management @@ -311,7 +311,7 @@ for the JavaScript code in this tag.

Table of Contents

    -
  • +
@@ -321,9 +321,9 @@ optimized libraries to fine-tune the memory allocation.

-
-

-
+
+

+

Memory allocation inside the library should be done with qmckl_malloc. It lets the library choose how the memory will be @@ -434,7 +434,7 @@ allocation and needs to be updated.

Author: TREX CoE

-

Created: 2021-03-28 Sun 23:18

+

Created: 2021-03-28 Sun 23:40

Validate

diff --git a/test_qmckl.html b/test_qmckl.html index 6d2cbd3..0b79223 100644 --- a/test_qmckl.html +++ b/test_qmckl.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Testing @@ -311,7 +311,7 @@ for the JavaScript code in this tag.

Author: TREX CoE

-

Created: 2021-03-28 Sun 23:18

+

Created: 2021-03-28 Sun 23:40

Validate