From 53843c894ec6f321bceaaaf6e9eba21c8b439a0b Mon Sep 17 00:00:00 2001 From: scemama Date: Fri, 5 Mar 2021 02:46:54 +0000 Subject: [PATCH] deploy: 56f5d9d56d91ce0242fd2b19d94e29439163583a --- index.html | 1323 +++++++++++++++++++++++++++++++++------------------- 1 file changed, 834 insertions(+), 489 deletions(-) diff --git a/index.html b/index.html index dc07312..dd7d4f8 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 @@ -261,67 +261,67 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Introduction

+
+

1 Introduction

The ultimate goal of QMCkl is to provide a high-performance @@ -333,7 +333,7 @@ optimized libraries.

-Literate programming is particularly adapted in this context. +Literate programming is particularly adapted in this context. Source files are written in org-mode format, to provide useful comments and LaTex formulas close to the code. There exists multiple possibilities to convert org-mode files into different formats such @@ -348,21 +348,21 @@ compiled.

-
-

1.1 Language used

+
+

1.1 Language used

-Fortran is one of the most common languages used by the community, +Fortran is one of the most common languages used by the community, and is simple enough to make the algorithms readable. Hence we -propose in this pedagogical implementation of QMCkl to use Fortran +propose in this pedagogical implementation of QMCkl to use Fortran to express the algorithms. For specific internal functions where -the C language is more natural, C is used. +the C language is more natural, C is used.

-As Fortran modules generate compiler-dependent files, the use of +As Fortran modules generate compiler-dependent files, the use of modules is restricted to the internal use of the library, otherwise -the compliance with C is violated. +the compliance with C is violated.

@@ -373,8 +373,8 @@ justified.

-
-

1.2 Source code editing

+
+

1.2 Source code editing

Any text editor can be used to edit org-mode files. For a better @@ -409,27 +409,27 @@ And pandoc can convert multiple markdown formats into org-mode.

-
-

1.3 Writing in Fortran

+
+

1.3 Writing in Fortran

-The Fortran source files should provide a C interface using -iso_c_binding. The name of the Fortran source files should end +The Fortran source files should provide a C interface using +iso_c_binding. The name of the Fortran source files should end with _f.f90 to be properly handled by the Makefile. The names of -the functions defined in fortran should be the same as those -exposed in the API suffixed by _f. Fortran interface files +the functions defined in fortran should be the same as those +exposed in the API suffixed by _f. Fortran interface files should also be written in the qmckl_f.f90 file.

-For more guidelines on using Fortran to generate a C interface, see +For more guidelines on using Fortran to generate a C interface, see this link.

-
-

1.4 Coding style

+
+

1.4 Coding style

To improve readability, we maintain a consistent coding style in @@ -437,8 +437,8 @@ the library.

    -
  • For C source files, we will use (decide on a coding style)
  • -
  • For Fortran source files, we will use (decide on a coding +
  • For C source files, we will use (decide on a coding style)
  • +
  • For Fortran source files, we will use (decide on a coding style)
@@ -448,8 +448,8 @@ Coding style can be automatically checked with -

1.5 Design of the library

+
+

1.5 Design of the library

The proposed API should allow the library to: @@ -465,8 +465,8 @@ functions (see below).

-
-

1.5.1 Naming conventions

+
-
-

1.5.2 Application programming interface

+
+

1.5.2 Application programming interface

The application programming interface (API) is designed to be -compatible with the C programming language (not C++), to ensure +compatible with the C programming language (not C++), to ensure that the library will be easily usable in any language. This implies that only the following data types are allowed in the API:

@@ -507,7 +507,7 @@ implies that only the following data types are allowed in the API:
  • Pointers should be represented as 64-bit integers (even on 32-bit architectures)
  • ASCII strings are represented as a pointers to a character -arrays and terminated by a zero character (C convention).
  • +arrays and terminated by a zero character (C convention).

    @@ -515,14 +515,14 @@ Complex numbers can be represented by an array of 2 floats.

    -To facilitate the use in other languages than C, we provide some +To facilitate the use in other languages than C, we provide some bindings in other languages in other repositories.

    -
    -

    1.5.3 Global state

    +
    +

    1.5.3 Global state

    Global variables should be avoided in the library, because it is @@ -535,22 +535,22 @@ QMCkl functions.

    -The internal structure of the context is not specified, to give a +The internal structure of the context is not specified, to give a maximum of freedom to the different implementations. Modifying the state is done by setters and getters, prefixed by -qmckl_context_set_ an qmckl_context_get_. When a context +qmckl_context_set_ an qmckl_context_get_. When a context variable is modified by a setter, a copy of the old data structure is made and updated, and the pointer to the new data structure is returned, such that the old contexts can still be accessed. It is also possible to modify the state in an impure fashion, using the -qmckl_context_update_ functions. The context and its old +qmckl_context_update_ functions. The context and its old versions can be destroyed with qmckl_context_destroy.

    -
    -

    1.5.4 Low-level functions

    +
    +

    1.5.4 Low-level functions

    Low-level functions are very simple functions which are leaves of @@ -565,8 +565,8 @@ if they need temporary memory it should be provided in input.

    -
    -

    1.5.5 High-level functions

    +
    +

    1.5.5 High-level functions

    High-level functions are at the top of the function call tree. @@ -584,8 +584,8 @@ the context variable.

    -
    -

    1.5.6 Numerical precision

    +
    +

    1.5.6 Numerical precision

    The number of bits of precision required for a function should be @@ -599,8 +599,8 @@ variable.

    -
    -

    1.6 Algorithms

    +
    +

    1.6 Algorithms

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

    -
    -

    1.7 Rules for the API

    +
    +

    1.7 Rules for the API

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

    2 Documentation

    +
    +

    2 Documentation

    -
    -

    2.1 qmckl.h header file

    +
    +

    2.1 qmckl.h header file

    -This file produces the qmckl.h header file, which is to be included -when qmckl functions are used. +The qmckl.h header file has to be included in C codes when +QMCkl functions are used: +#+BEGINSRC C :tangle none +#include "qmckl.h" +#+ENDSRC f90

    +

    -We also create here the qmckl_f.f90 which is the Fortran interface file. +In Fortran programs, the qmckl_f.f90 interface file should be +included in the source code using the library, and the Fortran codes +should use the qmckl module as +#+BEGINSRC f90 :tangle none +use qmckl +#+ENDSRC f90

    - -
    -

    2.1.1 Constants

    -
    -
    -
      -
    1. Success/failure
      -
      -

      -These are the codes returned by the functions to indicate success -or failure. All such functions should have as a return type qmckl_exit_code. -

      - -
      -
      #define QMCKL_SUCCESS 0
      -#define QMCKL_FAILURE 1
      -
      -typedef int32_t qmckl_exit_code;
      -typedef int64_t qmckl_context ;
      -
      -
      -
      -
      integer, parameter :: QMCKL_SUCCESS = 0
      -integer, parameter :: QMCKL_FAILURE = 0
      -
      -
      -
      -
    2. - -
    3. Precision-related constants
      -
      -

      -Controlling numerical precision enables optimizations. Here, the -default parameters determining the target numerical precision and -range are defined. -

      - -
      -
      #define QMCKL_DEFAULT_PRECISION 53
      -#define QMCKL_DEFAULT_RANGE     11
      -
      -
      - -
      -
      integer, parameter :: QMCKL_DEFAULT_PRECISION = 53
      -integer, parameter :: QMCKL_DEFAULT_RANGE = 11
      -
      -
      -
      -
    4. -
    -
    -
    -
    -

    2.2 Memory management

    +
    +

    2.2 Context

    -We override the allocation functions to enable the possibility of -optimized libraries to fine-tune the memory allocation. -

    - -

    -2 files are produced: -

    -
      -
    • a source file : qmckl_memory.c
    • -
    • a test file : test_qmckl_memory.c
    • -
    -
    - -
    -

    2.2.1 qmckl_malloc

    -
    -

    -Memory allocation function, letting the library choose how the -memory will be allocated, and a pointer is returned to the user. -The context is passed to let the library store data related to the -allocation inside the context. -

    - -
    -
    void* qmckl_malloc(const qmckl_context ctx, const size_t size);
    -
    -
    - -
    -
    interface
    -   type (c_ptr) function qmckl_malloc (context, size) bind(C)
    -     use, intrinsic :: iso_c_binding
    -     integer (c_int64_t), intent(in), value :: context
    -     integer (c_int64_t), intent(in), value :: size
    -   end function qmckl_malloc
    -end interface
    -
    -
    -
    - -
      -
    1. Source
      -
      -
      -
      void* qmckl_malloc(const qmckl_context ctx, const size_t size) {
      -  if (ctx == (qmckl_context) 0) {}; /* Avoid unused argument warning */
      -  void * result = malloc( (size_t) size );
      -  assert (result != NULL) ;
      -  return result;
      -}
      -
      -
      -
      -
      -
    2. -
    -
    - -
    -

    2.2.2 qmckl_free

    -
    -
    -
    void* qmckl_free(void *ptr);
    -
    -
    - -
    -
    interface
    -   type (c_ptr) function qmckl_free (ptr) bind(C)
    -     use, intrinsic :: iso_c_binding
    -     type (c_ptr), intent(in), value :: ptr
    -   end function qmckl_free
    -end interface
    -
    -
    -
    -
      -
    1. Source
      -
      -
      -
      void* qmckl_free(void *ptr) {
      -  assert (ptr != NULL);
      -  free(ptr);
      -  return NULL;
      -}
      -
      -
      -
      -
      -
    2. -
    -
    -
    -
    -

    2.3 Context

    -
    -

    -This file is written in C because it is more natural to express the -context in C than in Fortran. +This file is written in C because it is more natural to express the +context in C than in Fortran.

    @@ -811,27 +670,51 @@ context in C than in Fortran.

    -
    -

    2.3.1 Context

    -
    +
    +

    2.2.1 Context

    +

    -The context variable is a handle for the state of the library, and +The context variable is a handle for the state of the library, and is stored in the following data structure, which can't be seen outside of the library. To simplify compatibility with other languages, the pointer to the internal data structure is converted into a 64-bit signed integer, defined in the qmckl_context type. -A value of 0 for the context is equivalent to a NULL pointer. +A value of 0 for the context is equivalent to a NULL pointer.

    -
    +
    typedef int64_t qmckl_context ;
     
      -
    1. Basis set data structure
      -
      +
    2. Data for error handling
      +
      +

      +We define here the the data structure containing the strings +necessary for error handling. +

      + +
      +
      #define  QMCKL_MAX_FUN_LEN  256
      +#define  QMCKL_MAX_MSG_LEN  1024
      +
      +typedef struct qmckl_error_struct {
      +
      +  qmckl_exit_code exit_code;
      +  char function[QMCKL_MAX_FUN_LEN];
      +  char message [QMCKL_MAX_MSG_LEN];
      +
      +} qmckl_error_struct;
      +
      +
      +
      +
    3. + + +
    4. Basis set data structure
      +

      Data structure for the info related to the atomic orbitals basis set. @@ -840,27 +723,27 @@ basis set.

      typedef struct qmckl_ao_basis_struct {
       
      -  int64_t   shell_num;      
      -  int64_t   prim_num;      
      -  int64_t * shell_center;  
      -  int32_t * shell_ang_mom; 
      -  double  * shell_factor;  
      -  double  * exponent    ;  
      -  double  * coefficient ;  
      +  int64_t   shell_num;
      +  int64_t   prim_num;
      +  int64_t * shell_center;
      +  int32_t * shell_ang_mom;
      +  double  * shell_factor;
      +  double  * exponent    ;
      +  double  * coefficient ;
         int64_t * shell_prim_num;
      -  char      type;          
      +  char      type;
       
       } qmckl_ao_basis_struct;
       
      -
    5. -
    6. Source
      -
      +
        +
      1. Source
        +

        The tag is used internally to check if the memory domain pointed -by a pointer is a valid context. +by a pointer is a valid context.

        @@ -869,7 +752,7 @@ by a pointer is a valid context. struct qmckl_context_struct * prev; /* Molecular system */ - // struct qmckl_nucleus_struct * nucleus; + // struct qmckl_nucleus_struct * nucleus; // struct qmckl_electron_struct * electron; struct qmckl_ao_basis_struct * ao_basis; // struct qmckl_mo_struct * mo; @@ -880,6 +763,9 @@ by a pointer is a valid context. int32_t precision; int32_t range; + /* Error handling */ + struct qmckl_error_struct * error; + } qmckl_context_struct; #define VALID_TAG 0xBEEFFACE @@ -888,12 +774,104 @@ by a pointer is a valid context.
      2. +
      +
    7. -
    8. qmckl_context_check
      -
      +
    9. qmckl_context_update_error
      +
      +
      +
      qmckl_exit_code
      +qmckl_context_update_error(qmckl_context context, const qmckl_exit_code exit_code, const char* function, const char* message);
      +
      +
      +
      + +
        +
      1. Source
        +
        +
        +
        qmckl_exit_code
        +qmckl_context_update_error(qmckl_context context, const qmckl_exit_code exit_code, const char* function, const char* message)
        +{
        +  assert (context != 0);
        +  assert (function != NULL);
        +  assert (message != NULL);
        +  assert (exit_code > 0);
        +  assert (exit_code < QMCKL_INVALID_EXIT_CODE);
        +
        +  qmckl_context_struct* ctx = (qmckl_context_struct*) context;
        +  if (ctx == NULL) return QMCKL_FAILURE;
        +
        +  if (ctx->error != NULL) {
        +    free(ctx->error);
        +    ctx->error = NULL;
        +  }
        +
        +  qmckl_error_struct* error = (qmckl_error_struct*) qmckl_malloc (context, sizeof(qmckl_error_struct));
        +  error->exit_code = exit_code;
        +  strcpy(error->function, function);
        +  strcpy(error->message, message);
        +
        +  ctx->error = error;
        +
        +  return QMCKL_SUCCESS;
        +}
        +
        +
        +
        +
      2. + +
      3. TODO Test
      4. +
      +
    10. + +
    11. qmckl_context_set_error
      +
      +
      +
      qmckl_context
      +qmckl_context_set_error(qmckl_context context, const qmckl_exit_code exit_code, const char* function, const char* message);
      +
      +
      +
      + +
        +
      1. Source
        +
        +
        +
        qmckl_context
        +qmckl_context_set_error(qmckl_context context, const qmckl_exit_code exit_code, const char* function, const char* message)
        +{
        +  assert (context != 0);
        +  assert (function != NULL);
        +  assert (message != NULL);
        +  assert (exit_code > 0);
        +  assert (exit_code < QMCKL_INVALID_EXIT_CODE);
        +
        +  qmckl_context new_context = qmckl_context_copy(context);
        +  if (new_context == 0) return context;
        +
        +  if (qmckl_context_update_error(new_context, exit_code,
        +                                 function, message) != QMCKL_SUCCESS) {
        +    return context;
        +  }
        +
        +  return new_context;
        +}
        +
        +
        +
        +
      2. + +
      3. TODO Test
      4. +
      +
    12. + + +
    13. qmckl_context_check
      +

      -Checks if the domain pointed by the pointer is a valid context. -Returns the input qmckl_context if the context is valid, 0 +Checks if the domain pointed by the pointer is a valid context. +Returns the input qmckl_context if the context is valid, 0 otherwise.

      @@ -904,8 +882,8 @@ otherwise.
        -
      1. Source
        -
        +
      2. Source
        +
        qmckl_context qmckl_context_check(const qmckl_context context) {
         
        @@ -924,13 +902,13 @@ otherwise.
         
    14. -
    15. qmckl_context_create
      -
      +
    16. qmckl_context_create
      +

      -To create a new context, use qmckl_context_create(). +To create a new context, use qmckl_context_create().

        -
      • On success, returns a pointer to a context using the qmckl_context type
      • +
      • On success, returns a pointer to a context using the qmckl_context type
      • Returns 0 upon failure to allocate the internal data structure

        @@ -943,8 +921,8 @@ Returns 0 upon failure to allocate the internal data structure
        -
      1. Source
        -
        +
      2. Source
        +
        qmckl_context qmckl_context_create() {
         
        @@ -959,6 +937,7 @@ Returns 0 upon failure to allocate the internal data structure
           context->precision = QMCKL_DEFAULT_PRECISION;
           context->range     = QMCKL_DEFAULT_RANGE;
           context->tag       = VALID_TAG;
        +  context->error     = NULL;
         
           return (qmckl_context) context;
         }
        @@ -967,8 +946,8 @@ Returns 0 upon failure to allocate the internal data structure
         
      3. -
      4. Fortran interface
        -
        +
      5. Fortran interface
        +
        interface
            integer (c_int64_t) function qmckl_context_create() bind(C)
        @@ -982,17 +961,17 @@ Returns 0 upon failure to allocate the internal data structure
         
    17. -
    18. qmckl_context_copy
      -
      +
    19. qmckl_context_copy
      +

      -This function makes a shallow copy of the current context. +This function makes a shallow copy of the current context.

        -
      • Copying the 0-valued context returns 0
      • -
      • On success, returns a pointer to the new context using the qmckl_context type
      • +
      • Copying the 0-valued context returns 0
      • +
      • On success, returns a pointer to the new context using the qmckl_context type
      • Returns 0 upon failure to allocate the internal data structure -for the new context +for the new context

        @@ -1003,8 +982,8 @@ for the new context
          -
        1. Source
          -
          +
        2. Source
          +
          qmckl_context qmckl_context_copy(const qmckl_context context) {
           
          @@ -1016,7 +995,7 @@ for the new context
           
             qmckl_context_struct* old_context = (qmckl_context_struct*) checked_context;
           
          -  qmckl_context_struct* new_context = 
          +  qmckl_context_struct* new_context =
               (qmckl_context_struct*) qmckl_malloc (context, sizeof(qmckl_context_struct));
             if (new_context == NULL) {
               return (qmckl_context) 0;
          @@ -1027,6 +1006,7 @@ for the new context
             new_context->precision = old_context->precision;
             new_context->range     = old_context->range;
             new_context->tag       = VALID_TAG;
          +  new_context->error     = old_context->error;
           
             return (qmckl_context) new_context;
           }
          @@ -1036,8 +1016,8 @@ for the new context
           
        3. -
        4. Fortran interface
          -
          +
        5. Fortran interface
          +
          interface
              integer (c_int64_t) function qmckl_context_copy(context) bind(C)
          @@ -1052,16 +1032,16 @@ for the new context
           
      • -
      • qmckl_context_previous
        -
        +
      • qmckl_context_previous
        +

        -Returns the previous context +Returns the previous context

          -
        • On success, returns the ancestor of the current context
        • -
        • Returns 0 for the initial context
        • +
        • On success, returns the ancestor of the current context
        • +
        • Returns 0 for the initial context
        • -Returns 0 for the 0-valued context +Returns 0 for the 0-valued context

          @@ -1072,8 +1052,8 @@ Returns 0 for the 0-valued context
            -
          1. Source
            -
            +
          2. Source
            +
            qmckl_context qmckl_context_previous(const qmckl_context context) {
             
            @@ -1090,8 +1070,8 @@ Returns 0 for the 0-valued context
             
          3. -
          4. Fortran interface
            -
            +
          5. Fortran interface
            +
            interface
                integer (c_int64_t) function qmckl_context_previous(context) bind(C)
            @@ -1106,16 +1086,16 @@ Returns 0 for the 0-valued context
             
        • -
        • qmckl_context_destroy
          -
          +
        • qmckl_context_destroy
          +

          -Destroys the current context, leaving the ancestors untouched. +Destroys the current context, leaving the ancestors untouched.

            -
          • Succeeds if the current context is properly destroyed
          • +
          • Succeeds if the current context is properly destroyed
          • Fails otherwise
          • -
          • Fails if the 0-valued context is given in argument
          • -
          • Fails if the the pointer is not a valid context
          • +
          • Fails if the 0-valued context is given in argument
          • +
          • Fails if the the pointer is not a valid context
          @@ -1125,8 +1105,8 @@ Destroys the current context, leaving the ancestors untouched.
            -
          1. Source
            -
            +
          2. Source
            +
            qmckl_exit_code qmckl_context_destroy(const qmckl_context context) {
             
            @@ -1137,16 +1117,15 @@ Destroys the current context, leaving the ancestors untouched.
               if (ctx == NULL) return QMCKL_FAILURE;
             
               ctx->tag = INVALID_TAG;
            -  qmckl_free(ctx);
            -  return QMCKL_SUCCESS;
            +  return qmckl_free(context,ctx);
             }
             
          3. -
          4. Fortran interface
            -
            +
          5. Fortran interface
            +
            interface
                integer (c_int32_t) function qmckl_context_destroy(context) bind(C)
            @@ -1160,14 +1139,11 @@ Destroys the current context, leaving the ancestors untouched.
             
        • -
    -
    -
    -

    2.3.2 Basis set

    -
    +
  • Basis set
    +

    -For H2 with the following basis set, +For H2 with the following basis set,

    @@ -1175,7 +1151,7 @@ HYDROGEN
     S   5
     1         3.387000E+01           6.068000E-03
     2         5.095000E+00           4.530800E-02
    -3         1.159000E+00           2.028220E-01                                                 
    +3         1.159000E+00           2.028220E-01
     4         3.258000E-01           5.039030E-01
     5         1.027000E-01           3.834210E-01
     S   1
    @@ -1210,12 +1186,12 @@ COEFFICIENT = [ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421,
                     0.503903, 0.383421, 1.0, 1.0, 1.0, 1.0, 1.0]
     
    +
  • -
      -
    1. qmckl_context_update_ao_basis
      -
      +
    2. qmckl_context_update_ao_basis
      +

      -Updates the data describing the AO basis set into the context. +Updates the data describing the AO basis set into the context.

      @@ -1282,7 +1258,7 @@ Updates the data describing the AO basis set into the context.
      qmckl_exit_code
       qmckl_context_update_ao_basis(qmckl_context   context     , const char      type,
      -                              const int64_t   shell_num   , const int64_t   prim_num, 
      +                              const int64_t   shell_num   , const int64_t   prim_num,
                                     const int64_t * SHELL_CENTER, const int32_t * SHELL_ANG_MOM,
                                     const double  * SHELL_FACTOR, const int64_t * SHELL_PRIM_NUM,
                                     const int64_t * SHELL_PRIM_INDEX,
      @@ -1292,12 +1268,12 @@ Updates the data describing the AO basis set into the context.
       
        -
      1. Source
        -
        +
      2. Source
        +
        qmckl_exit_code
         qmckl_context_update_ao_basis(qmckl_context   context     , const char      type,
        -                              const int64_t   shell_num   , const int64_t   prim_num, 
        +                              const int64_t   shell_num   , const int64_t   prim_num,
                                       const int64_t * SHELL_CENTER, const int32_t * SHELL_ANG_MOM,
                                       const double  * SHELL_FACTOR, const int64_t * SHELL_PRIM_NUM,
                                       const int64_t * SHELL_PRIM_INDEX,
        @@ -1335,52 +1311,52 @@ Updates the data describing the AO basis set into the context.
         
           basis->shell_center  = (int64_t*) malloc (shell_num * sizeof(int64_t));
           if (basis->shell_center == NULL) {
        -    free(basis);
        +    qmckl_free(context, basis);
             return QMCKL_FAILURE;
           }
         
           basis->shell_ang_mom = (int32_t*) malloc (shell_num * sizeof(int32_t));
           if (basis->shell_ang_mom == NULL) {
        -    free(basis->shell_center);
        -    free(basis);
        +    qmckl_free(context, basis->shell_center);
        +    qmckl_free(context, basis);
             return QMCKL_FAILURE;
           }
         
           basis->shell_prim_num= (int64_t*) malloc (shell_num * sizeof(int64_t));
           if (basis->shell_prim_num == NULL) {
        -    free(basis->shell_ang_mom);
        -    free(basis->shell_center);
        -    free(basis);
        +    qmckl_free(context, basis->shell_ang_mom);
        +    qmckl_free(context, basis->shell_center);
        +    qmckl_free(context, basis);
             return QMCKL_FAILURE;
           }
         
           basis->shell_factor  = (double *) malloc (shell_num * sizeof(double ));
           if (basis->shell_factor == NULL) {
        -    free(basis->shell_prim_num);
        -    free(basis->shell_ang_mom);
        -    free(basis->shell_center);
        -    free(basis);
        +    qmckl_free(context, basis->shell_prim_num);
        +    qmckl_free(context, basis->shell_ang_mom);
        +    qmckl_free(context, basis->shell_center);
        +    qmckl_free(context, basis);
             return QMCKL_FAILURE;
           }
         
           basis->exponent      = (double *) malloc (prim_num  * sizeof(double ));
           if (basis->exponent == NULL) {
        -    free(basis->shell_factor);
        -    free(basis->shell_prim_num);
        -    free(basis->shell_ang_mom);
        -    free(basis->shell_center);
        -    free(basis);
        +    qmckl_free(context, basis->shell_factor);
        +    qmckl_free(context, basis->shell_prim_num);
        +    qmckl_free(context, basis->shell_ang_mom);
        +    qmckl_free(context, basis->shell_center);
        +    qmckl_free(context, basis);
             return QMCKL_FAILURE;
           }
         
           basis->coefficient   = (double *) malloc (prim_num  * sizeof(double ));
           if (basis->coefficient == NULL) {
        -    free(basis->exponent);
        -    free(basis->shell_factor);
        -    free(basis->shell_prim_num);
        -    free(basis->shell_ang_mom);
        -    free(basis->shell_center);
        -    free(basis);
        +    qmckl_free(context, basis->exponent);
        +    qmckl_free(context, basis->shell_factor);
        +    qmckl_free(context, basis->shell_prim_num);
        +    qmckl_free(context, basis->shell_ang_mom);
        +    qmckl_free(context, basis->shell_center);
        +    qmckl_free(context, basis);
             return QMCKL_FAILURE;
           }
         
        @@ -1389,7 +1365,7 @@ Updates the data describing the AO basis set into the context.
         
           basis->type      = type;
           basis->shell_num = shell_num;
        -  basis->prim_num  = prim_num;      
        +  basis->prim_num  = prim_num;
         
           for (i=0 ; i<shell_num ; i++) {
             basis->shell_center  [i] = SHELL_CENTER  [i];
        @@ -1411,8 +1387,8 @@ Updates the data describing the AO basis set into the context.
         
      3. -
      4. Fortran interface
        -
        +
      5. Fortran interface
        +
        interface
            integer (c_int32_t) function qmckl_context_update_ao_basis(context, &
        @@ -1437,14 +1413,14 @@ Updates the data describing the AO basis set into the context.
         
      6. -
      7. TODO Test
      8. +
      9. TODO Test
      -
    3. qmckl_context_set_ao_basis
      -
      +
    4. qmckl_context_set_ao_basis
      +

      -Sets the data describing the AO basis set into the context. +Sets the data describing the AO basis set into the context.

    5. @@ -1511,7 +1487,7 @@ Sets the data describing the AO basis set into the context.
      qmckl_context
       qmckl_context_set_ao_basis(const qmckl_context context     , const char      type,
      -                           const int64_t       shell_num   , const int64_t   prim_num, 
      +                           const int64_t       shell_num   , const int64_t   prim_num,
                                  const int64_t *     SHELL_CENTER, const int32_t * SHELL_ANG_MOM,
                                  const double  *     SHELL_FACTOR, const int64_t * SHELL_PRIM_NUM,
                                  const int64_t *     SHELL_PRIM_INDEX,
      @@ -1521,12 +1497,12 @@ Sets the data describing the AO basis set into the context.
       
        -
      1. Source
        -
        +
      2. Source
        +
        qmckl_context
         qmckl_context_set_ao_basis(const qmckl_context context     , const char      type,
        -                           const int64_t       shell_num   , const int64_t   prim_num, 
        +                           const int64_t       shell_num   , const int64_t   prim_num,
                                    const int64_t *     SHELL_CENTER, const int32_t * SHELL_ANG_MOM,
                                    const double  *     SHELL_FACTOR, const int64_t * SHELL_PRIM_NUM,
                                    const int64_t *     SHELL_PRIM_INDEX,
        @@ -1536,8 +1512,8 @@ Sets the data describing the AO basis set into the context.
           qmckl_context new_context = qmckl_context_copy(context);
           if (new_context == 0) return 0;
         
        -  if (qmckl_context_update_ao_basis(context, type, shell_num, prim_num, 
        -                                    SHELL_CENTER, SHELL_ANG_MOM, SHELL_FACTOR, 
        +  if (qmckl_context_update_ao_basis(new_context, type, shell_num, prim_num,
        +                                    SHELL_CENTER, SHELL_ANG_MOM, SHELL_FACTOR,
                                             SHELL_PRIM_NUM, SHELL_PRIM_INDEX, EXPONENT,
                                             COEFFICIENT
                                             ) == QMCKL_FAILURE)
        @@ -1550,8 +1526,8 @@ Sets the data describing the AO basis set into the context.
         
      3. -
      4. Fortran interface
        -
        +
      5. Fortran interface
        +
        interface
            integer (c_int64_t) function qmckl_context_set_ao_basis(context, &
        @@ -1576,15 +1552,12 @@ Sets the data describing the AO basis set into the context.
         
      6. -
      7. TODO Test
      8. +
      9. TODO Test
      - - -
      -

      2.3.3 Precision

      -
      +
    6. Precision
      +

      The following functions set and get the expected required precision and range. precision should be an integer between 2 @@ -1592,18 +1565,18 @@ and 53, and range should be an integer between 2 and 11.

      -The setter functions functions return a new context as a 64-bit +The setter functions functions return a new context as a 64-bit integer. The getter functions return the value, as a 32-bit integer. The update functions return QMCKL_SUCCESS or QMCKL_FAILURE.

      +
    7. -
        -
      1. qmckl_context_update_precision
        -
        +
      2. qmckl_context_update_precision
        +

        -Modifies the parameter for the numerical precision in a given context. +Modifies the parameter for the numerical precision in a given context.

        qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, const int precision);
        @@ -1612,8 +1585,8 @@ Modifies the parameter for the numerical precision in a given context.
         
          -
        1. Source
          -
          +
        2. Source
          +
          qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, const int precision) {
           
          @@ -1631,8 +1604,8 @@ Modifies the parameter for the numerical precision in a given context.
           
        3. -
        4. Fortran interface
          -
          +
        5. Fortran interface
          +
          interface
              integer (c_int32_t) function qmckl_context_update_precision(context, precision) bind(C)
          @@ -1647,10 +1620,10 @@ Modifies the parameter for the numerical precision in a given context.
           
      3. -
      4. qmckl_context_update_range
        -
        +
      5. qmckl_context_update_range
        +

        -Modifies the parameter for the numerical range in a given context. +Modifies the parameter for the numerical range in a given context.

        qmckl_exit_code qmckl_context_update_range(const qmckl_context context, const int range);
        @@ -1659,8 +1632,8 @@ Modifies the parameter for the numerical range in a given context.
         
          -
        1. Source
          -
          +
        2. Source
          +
          qmckl_exit_code qmckl_context_update_range(const qmckl_context context, const int range) {
           
          @@ -1678,8 +1651,8 @@ Modifies the parameter for the numerical range in a given context.
           
        3. -
        4. Fortran interface
          -
          +
        5. Fortran interface
          +
          interface
              integer (c_int32_t) function qmckl_context_update_range(context, range) bind(C)
          @@ -1694,10 +1667,10 @@ Modifies the parameter for the numerical range in a given context.
           
      6. -
      7. qmckl_context_set_precision
        -
        +
      8. qmckl_context_set_precision
        +

        -Returns a copy of the context with a different precision parameter. +Returns a copy of the context with a different precision parameter.

        qmckl_context qmckl_context_set_precision(const qmckl_context context, const int precision);
        @@ -1706,14 +1679,14 @@ Returns a copy of the context with a different precision parameter.
         
          -
        1. Source
          -
          +
        2. Source
          +
          qmckl_context qmckl_context_set_precision(const qmckl_context context, const int precision) {
             qmckl_context new_context = qmckl_context_copy(context);
             if (new_context == 0) return 0;
           
          -  if (qmckl_context_update_precision(context, precision) == QMCKL_FAILURE) return 0;
          +  if (qmckl_context_update_precision(new_context, precision) == QMCKL_FAILURE) return 0;
           
             return new_context;
           }
          @@ -1722,8 +1695,8 @@ Returns a copy of the context with a different precision parameter.
           
        3. -
        4. Fortran interface
          -
          +
        5. Fortran interface
          +
          interface
              integer (c_int64_t) function qmckl_context_set_precision(context, precision) bind(C)
          @@ -1738,10 +1711,10 @@ Returns a copy of the context with a different precision parameter.
           
      9. -
      10. qmckl_context_set_range
        -
        +
      11. qmckl_context_set_range
        +

        -Returns a copy of the context with a different precision parameter. +Returns a copy of the context with a different precision parameter.

        qmckl_context qmckl_context_set_range(const qmckl_context context, const int range);
        @@ -1750,14 +1723,14 @@ Returns a copy of the context with a different precision parameter.
         
          -
        1. Source
          -
          +
        2. Source
          +
          qmckl_context qmckl_context_set_range(const qmckl_context context, const int range) {
             qmckl_context new_context = qmckl_context_copy(context);
             if (new_context == 0) return 0;
           
          -  if (qmckl_context_update_range(context, range) == QMCKL_FAILURE) return 0;
          +  if (qmckl_context_update_range(new_context, range) == QMCKL_FAILURE) return 0;
           
             return new_context;
           }
          @@ -1766,8 +1739,8 @@ Returns a copy of the context with a different precision parameter.
           
        3. -
        4. Fortran interface
          -
          +
        5. Fortran interface
          +
          interface
              integer (c_int64_t) function qmckl_context_set_range(context, range) bind(C)
          @@ -1783,10 +1756,10 @@ Returns a copy of the context with a different precision parameter.
           
      12. -
      13. qmckl_context_get_precision
        -
        +
      14. qmckl_context_get_precision
        +

        -Returns the value of the numerical precision in the context +Returns the value of the numerical precision in the context

        int32_t qmckl_context_get_precision(const qmckl_context context);
        @@ -1795,8 +1768,8 @@ Returns the value of the numerical precision in the context
         
          -
        1. Source
          -
          +
        2. Source
          +
          int qmckl_context_get_precision(const qmckl_context context) {
             const qmckl_context_struct* ctx = (qmckl_context_struct*) context;
          @@ -1807,8 +1780,8 @@ Returns the value of the numerical precision in the context
           
        3. -
        4. Fortran interface
          -
          +
        5. Fortran interface
          +
          interface
              integer (c_int32_t) function qmckl_context_get_precision(context) bind(C)
          @@ -1822,10 +1795,10 @@ Returns the value of the numerical precision in the context
           
      15. -
      16. qmckl_context_get_range
        -
        +
      17. qmckl_context_get_range
        +

        -Returns the value of the numerical range in the context +Returns the value of the numerical range in the context

        int32_t qmckl_context_get_range(const qmckl_context context);
        @@ -1834,8 +1807,8 @@ Returns the value of the numerical range in the context
         
          -
        1. Source
          -
          +
        2. Source
          +
          int qmckl_context_get_range(const qmckl_context context) {
             const qmckl_context_struct* ctx = (qmckl_context_struct*) context;
          @@ -1846,8 +1819,8 @@ Returns the value of the numerical range in the context
           
        3. -
        4. Fortran interface
          -
          +
        5. Fortran interface
          +
          interface
              integer (c_int32_t) function qmckl_context_get_range(context) bind(C)
          @@ -1862,8 +1835,8 @@ Returns the value of the numerical range in the context
           
      18. -
      19. qmckl_context_get_epsilon
        -
        +
      20. qmckl_context_get_epsilon
        +

        Returns \(\epsilon = 2^{1-n}\) where n is the precision

        @@ -1874,8 +1847,8 @@ Returns \(\epsilon = 2^{1-n}\) where n is the precision
          -
        1. Source
          -
          +
        2. Source
          +
          double qmckl_context_get_epsilon(const qmckl_context context) {
             const qmckl_context_struct* ctx = (qmckl_context_struct*) context;
          @@ -1886,8 +1859,8 @@ Returns \(\epsilon = 2^{1-n}\) where n is the precision
           
        3. -
        4. Fortran interface
          -
          +
        5. Fortran interface
          +
          interface
              real (c_double) function qmckl_context_get_epsilon(context) bind(C)
          @@ -1904,10 +1877,382 @@ Returns \(\epsilon = 2^{1-n}\) where n is the precision
           
      -
      -

      2.4 Computation of distances

      +
      +

      2.3 Error handling

      +
      +

      +This file is written in C because it is more natural to express the +error handling in C than in Fortran. +

      + +

      +2 files are produced: +

      +
        +
      • a source file : qmckl_error.c
      • +
      • a test file : test_qmckl_error.c
      • +
      +
      + +
      +

      2.3.1 Error handling

      +
      +

      +The library should never make the calling programs abort, nor +perform any input/output operations. This decision has to be taken +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;
      +
      +
      + +

      +The exit code returns the completion status of the function to the +calling program. When a function call completed successfully, the +QMCKL_SUCCESS exit code is returned. If one of the functions of +the library fails to complete the requested task, an appropriate +error code is returned to the program. +

      + +

      +Here is the complete list of exit codes. +

      + +
      + + +++ ++ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
      QMCKL_SUCCESS0
      QMCKL_INVALID_ARG_11
      QMCKL_INVALID_ARG_22
      QMCKL_INVALID_ARG_33
      QMCKL_INVALID_ARG_44
      QMCKL_INVALID_ARG_55
      QMCKL_INVALID_ARG_66
      QMCKL_INVALID_ARG_77
      QMCKL_INVALID_ARG_88
      QMCKL_INVALID_ARG_99
      QMCKL_INVALID_ARG_1010
      QMCKL_NULL_CONTEXT101
      QMCKL_FAILURE102
      QMCKL_ERRNO103
      QMCKL_INVALID_EXIT_CODE104
      + +
      +
      """ This script generates the C and Fortran constants for the error
      +    codes from the org-mode table.
      +"""
      +
      +result = [ "#+BEGIN_SRC C :comments org :tangle qmckl.h" ] 
      +for (text, code) in table:
      +    text=text.replace("~","")
      +    result += [ f"#define  {text:30s} {code:d}" ]
      +result += [ "#+END_SRC" ]
      +    
      +result += [ "" ] 
      +
      +result += [ "#+BEGIN_SRC f90 :comments org :tangle qmckl_f.f90" ]
      +for (text, code) in table:
      +    text=text.replace("~","")
      +    result += [ f"   integer, parameter :: {text:30s} = {code:d}" ]
      +result += [ "#+END_SRC" ]
      +
      +return '\n'.join(result)
      +
      +
      +
      + +
      +
      #define  QMCKL_SUCCESS                  0
      +#define  QMCKL_INVALID_ARG_1            1
      +#define  QMCKL_INVALID_ARG_2            2
      +#define  QMCKL_INVALID_ARG_3            3
      +#define  QMCKL_INVALID_ARG_4            4
      +#define  QMCKL_INVALID_ARG_5            5
      +#define  QMCKL_INVALID_ARG_6            6
      +#define  QMCKL_INVALID_ARG_7            7
      +#define  QMCKL_INVALID_ARG_8            8
      +#define  QMCKL_INVALID_ARG_9            9
      +#define  QMCKL_INVALID_ARG_10           10
      +#define  QMCKL_NULL_CONTEXT             101
      +#define  QMCKL_FAILURE                  102
      +#define  QMCKL_ERRNO                    103
      +#define  QMCKL_INVALID_EXIT_CODE        104
      +
      +
      + +
      +
      integer, parameter :: QMCKL_SUCCESS                  = 0
      +integer, parameter :: QMCKL_INVALID_ARG_1            = 1
      +integer, parameter :: QMCKL_INVALID_ARG_2            = 2
      +integer, parameter :: QMCKL_INVALID_ARG_3            = 3
      +integer, parameter :: QMCKL_INVALID_ARG_4            = 4
      +integer, parameter :: QMCKL_INVALID_ARG_5            = 5
      +integer, parameter :: QMCKL_INVALID_ARG_6            = 6
      +integer, parameter :: QMCKL_INVALID_ARG_7            = 7
      +integer, parameter :: QMCKL_INVALID_ARG_8            = 8
      +integer, parameter :: QMCKL_INVALID_ARG_9            = 9
      +integer, parameter :: QMCKL_INVALID_ARG_10           = 10
      +integer, parameter :: QMCKL_NULL_CONTEXT             = 101
      +integer, parameter :: QMCKL_FAILURE                  = 102
      +integer, parameter :: QMCKL_ERRNO                    = 103
      +integer, parameter :: QMCKL_INVALID_EXIT_CODE        = 104
      +
      +
      + +

      +To make a function fail, the qmckl_failwith function should be +called, such that information about the failure is stored in +the context. The desired exit code is given as an argument, as +well as the name of the function and an error message. The return +code of the function is the desired return code. +

      + +
      +
      qmckl_exit_code qmckl_failwith(qmckl_context context,
      +                               const qmckl_exit_code exit_code,
      +                               const char* function,
      +                               const char* message) ;
      +
      +
      + +
      +
      qmckl_exit_code qmckl_failwith(qmckl_context context,
      +                               const qmckl_exit_code exit_code,
      +                               const char* function,
      +                               const char* message) {
      +  if (context == 0) return QMCKL_NULL_CONTEXT;
      +  assert (exit_code > 0);
      +  assert (exit_code < QMCKL_INVALID_EXIT_CODE);
      +  assert (function != NULL);
      +  assert (message  != NULL);
      +  assert (strlen(function) < QMCKL_MAX_FUN_LEN);
      +  assert (strlen(message)  < QMCKL_MAX_MSG_LEN);
      +
      +  context = qmckl_context_set_error(context, exit_code, function, message);
      +  return exit_code;
      +}
      +
      +
      +
      + +

      +For example, this function can be used as +

      +
      +
      if (x < 0) {
      +  return qmckl_failwith(context,
      +                        QMCKL_INVALID_ARG_2,
      +                        "qmckl_function", 
      +                        "Expected x >= 0");
      + }
      +
      +
      +
      +
    + +
    +

    2.3.2 Multi-precision related constants

    +
    +

    +Controlling numerical precision enables optimizations. Here, the +default parameters determining the target numerical precision and +range are defined. +

    + +
    +
    #define QMCKL_DEFAULT_PRECISION 53
    +#define QMCKL_DEFAULT_RANGE     11
    +
    +
    + +
    +
    integer, parameter :: QMCKL_DEFAULT_PRECISION = 53
    +integer, parameter :: QMCKL_DEFAULT_RANGE = 11
    +
    +
    +
    +
    +
    +
    +

    2.4 Memory management

    +We override the allocation functions to enable the possibility of +optimized libraries to fine-tune the memory allocation. +

    + +

    +2 files are produced: +

    +
      +
    • a source file : qmckl_memory.c
    • +
    • a test file : test_qmckl_memory.c
    • +
    +
    + +
    +

    2.4.1 qmckl_malloc

    +
    +

    +Memory allocation function, letting the library choose how the +memory will be allocated, and a pointer is returned to the user. +The context is passed to let the library store data related to the +allocation inside the context. +

    + +
    +
    void* qmckl_malloc(const qmckl_context ctx, const size_t size);
    +
    +
    + +
    +
    interface
    +   type (c_ptr) function qmckl_malloc (context, size) bind(C)
    +     use, intrinsic :: iso_c_binding
    +     integer (c_int64_t), intent(in), value :: context
    +     integer (c_int64_t), intent(in), value :: size
    +   end function qmckl_malloc
    +end interface
    +
    +
    +
    + +
      +
    1. Source
      +
      +
      +
      void* qmckl_malloc(const qmckl_context ctx, const size_t size) {
      +  if (ctx == (qmckl_context) 0) {}; /* Avoid unused argument warning */
      +  void * result = malloc( (size_t) size );
      +  assert (result != NULL) ;
      +  return result;
      +}
      +
      +
      +
      +
      +
    2. +
    +
    + +
    +

    2.4.2 qmckl_free

    +
    +

    +The context is passed, in case some important information has been +stored related to memory allocation and needs to be updated. +

    + +
    +
    qmckl_exit_code qmckl_free(qmckl_context context, void *ptr);
    +
    +
    + +
    +
    interface
    +   integer (c_int32_t) function qmckl_free (context, ptr) bind(C)
    +     use, intrinsic :: iso_c_binding
    +     integer (c_int64_t), intent(in), value :: context
    +     type (c_ptr), intent(in), value :: ptr
    +   end function qmckl_free
    +end interface
    +
    +
    +
    + +
      +
    1. Source
      +
      +
      +
      qmckl_exit_code qmckl_free(qmckl_context context, void *ptr) {
      +  if (context == 0) return QMCKL_INVALID_ARG_1;
      +  if (ptr == NULL)  return QMCKL_INVALID_ARG_2;
      +  free(ptr);
      +  return QMCKL_SUCCESS;
      +}
      +
      +
      +
      +
    2. +
    +
    +
    +
    +

    2.5 Computation of distances

    +
    +

    Function for the computation of distances between particles.

    @@ -1916,18 +2261,18 @@ Function for the computation of distances between particles.

    • a source file : qmckl_distance.f90
    • -
    • a C test file : test_qmckl_distance.c
    • -
    • a Fortran test file : test_qmckl_distance_f.f90
    • +
    • a C test file : test_qmckl_distance.c
    • +
    • a Fortran test file : test_qmckl_distance_f.f90
    -
    -

    2.4.1 Squared distance

    -
    +
    +

    2.5.1 Squared distance

    +
      -
    1. qmckl_distance_sq
      -
      +
    2. qmckl_distance_sq
      +

      Computes the matrix of the squared distances between all pairs of points in two sets, one point within each set: @@ -1938,8 +2283,8 @@ points in two sets, one point within each set:

        -
      1. Arguments
        -
        +
      2. Arguments
        +
        @@ -2021,8 +2366,8 @@ points in two sets, one point within each set: -
      3. Requirements
        -
        +
      4. Requirements
        +
        • context is not 0
        • m > 0
        • @@ -2039,8 +2384,8 @@ points in two sets, one point within each set:
      5. -
      6. Performance
        -
        +
      7. Performance
        +

        This function might be more efficient when A and B are transposed. @@ -2058,8 +2403,8 @@ transposed.

      8. -
      9. Source
        -
        +
      10. Source
        +
        integer function qmckl_distance_sq_f(context, transa, transb, m, n, A, LDA, B, LDB, C, LDC) result(info)
           implicit none
        @@ -2194,9 +2539,9 @@ transposed.
         
         
        -
        -

        2.5 Atomic Orbitals

        -
        +
        +

        2.6 Atomic Orbitals

        +

        This files contains all the routines for the computation of the values, gradients and Laplacian of the atomic basis functions. @@ -2207,14 +2552,14 @@ values, gradients and Laplacian of the atomic basis functions.

        • a source file : qmckl_ao.f90
        • -
        • a C test file : test_qmckl_ao.c
        • -
        • a Fortran test file : test_qmckl_ao_f.f90
        • +
        • a C test file : test_qmckl_ao.c
        • +
        • a Fortran test file : test_qmckl_ao_f.f90
        -
        -

        2.5.1 Polynomials

        -
        +
        +

        2.6.1 Polynomials

        +

        \[ P_l(\mathbf{r},\mathbf{R}_i) = (x-X_i)^a (y-Y_i)^b (z-Z_i)^c @@ -2243,8 +2588,8 @@ values, gradients and Laplacian of the atomic basis functions.

          -
        1. qmckl_ao_power
          -
          +
        2. qmckl_ao_power
          +

          Computes all the powers of the n input data up to the given maximum value given in input for each of the \(n\) points: @@ -2256,8 +2601,8 @@ maximum value given in input for each of the \(n\) points:

            -
          1. Arguments
            -
            +
          2. Arguments
            +
      11. @@ -2309,8 +2654,8 @@ maximum value given in input for each of the \(n\) points: -
      12. Requirements
        -
        +
      13. Requirements
        +
        • context is not 0
        • n > 0
        • @@ -2322,8 +2667,8 @@ maximum value given in input for each of the \(n\) points:
      14. -
      15. Header
        -
        +
      16. Header
        +
        qmckl_exit_code qmckl_ao_power(const qmckl_context context,
                         const int64_t n, 
        @@ -2334,8 +2679,8 @@ maximum value given in input for each of the \(n\) points:
         
      17. -
      18. Source
        -
        +
      19. Source
        +
        integer function qmckl_ao_power_f(context, n, X, LMAX, P, ldp) result(info)
           implicit none
        @@ -2376,8 +2721,8 @@ maximum value given in input for each of the \(n\) points:
         
      20. -
      21. qmckl_ao_polynomial_vgl
        -
        +
      22. qmckl_ao_polynomial_vgl
        +

        Computes the values, gradients and Laplacians at a given point of all polynomials with an angular momentum up to lmax. @@ -2385,8 +2730,8 @@ all polynomials with an angular momentum up to lmax.

          -
        1. Arguments
          -
          +
        2. Arguments
          +
      23. @@ -2431,7 +2776,7 @@ all polynomials with an angular momentum up to lmax. - + @@ -2456,8 +2801,8 @@ all polynomials with an angular momentum up to lmax. -
      24. Requirements
        -
        +
      25. Requirements
        +
        • context is not 0
        • n > 0
        • @@ -2470,19 +2815,19 @@ all polynomials with an angular momentum up to lmax.
        • L is allocated with at least \(3 \times n \times 4\) bytes
        • VGL is allocated with at least \(5 \times n \times 8\) bytes
        • On output, n should be equal to (lmax+1)(lmax+2)(lmax+3)/6
        • -
        • On output, the powers are given in the following order (l=a+b+c): +
        • On output, the powers are given in the following order (l=a+b+c):
          • Increase values of l
          • Within a given value of l, alphabetical order of the -string made by a*"x" + b*"y" + c*"z" (in Python notation). -For example, with a=0, b=2 and c=1 the string is "yyz"
          • +string made by a*"x" + b*"y" + c*"z" (in Python notation). +For example, with a=0, b=2 and c=1 the string is "yyz"
      26. -
      27. Error codes
        -
        +
      28. Error codes
        +
      29. L(ldl,n) outputContains a,b,c for all n resultsContains a,b,c for all n results
        @@ -2494,7 +2839,7 @@ For example, with a=0, b=2 and c=1 the string is "yyz" - + @@ -2516,8 +2861,8 @@ For example, with a=0, b=2 and c=1 the string is "yyz" -
      30. Header
        -
        +
      31. Header
        +
        qmckl_exit_code qmckl_ao_polynomial_vgl(const qmckl_context context,
                         const double *X, const double *R,
        @@ -2529,8 +2874,8 @@ For example, with a=0, b=2 and c=1 the string is "yyz"
      32. -
      33. Source
        -
        +
      34. Source
        +
        integer function qmckl_ao_polynomial_vgl_f(context, X, R, lmax, n, L, ldl, VGL, ldv) result(info)
           implicit none
        @@ -2667,13 +3012,13 @@ For example, with a=0, b=2 and c=1 the string is "yyz"
      35. -
        -

        2.5.2 Gaussian basis functions

        -
        +
        +

        2.6.2 Gaussian basis functions

        +
          -
        1. qmckl_ao_gaussian_vgl
          -
          +
        2. qmckl_ao_gaussian_vgl
          +

          Computes the values, gradients and Laplacians at a given point of n Gaussian functions centered at the same point: @@ -2689,8 +3034,8 @@ Computes the values, gradients and Laplacians at a given point of

            -
          1. Arguments
            -
            +
          2. Arguments
            +
        -1Null contextNull context
        @@ -2748,8 +3093,8 @@ Computes the values, gradients and Laplacians at a given point of -
      36. Requirements
        -
        +
      37. Requirements
        +
        • context is not 0
        • n > 0
        • @@ -2763,8 +3108,8 @@ Computes the values, gradients and Laplacians at a given point of
      38. -
      39. Header
        -
        +
      40. Header
        +
        qmckl_exit_code qmckl_ao_gaussian_vgl(const qmckl_context context,
                         const double *X, const double *R,
        @@ -2775,8 +3120,8 @@ Computes the values, gradients and Laplacians at a given point of
         
      41. -
      42. Source
        -
        +
      43. Source
        +
        integer function qmckl_ao_gaussian_vgl_f(context, X, R, n, A, VGL, ldv) result(info)
           implicit none
        @@ -2847,14 +3192,14 @@ Computes the values, gradients and Laplacians at a given point of
         
        -
        -

        2.5.3 TODO Slater basis functions

        +
        +

        2.6.3 TODO Slater basis functions

        -
        -

        3 Acknowledgments

        +
        +

        3 Acknowledgments

        euflag.jpg @@ -2864,7 +3209,7 @@ Computes the values, gradients and Laplacians at a given point of

        -

        Created: 2021-02-19 Fri 00:40

        +

        Created: 2021-03-05 Fri 02:46

        Validate