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

Added qmckl_electron

This commit is contained in:
Anthony Scemama 2021-04-21 01:56:47 +02:00
parent 03c0abbf4e
commit e18655b147
7 changed files with 488 additions and 27 deletions

View File

@ -38,3 +38,5 @@ jobs:
git submodule update --init --recursive git submodule update --init --recursive
- name: make - name: make
run: make -C src/ check run: make -C src/ check
- name: make
run: make distcheck

View File

@ -42,6 +42,7 @@ gradients and Laplacian of the atomic basis functions.
#+begin_src c :tangle (eval h_private_type) #+begin_src c :tangle (eval h_private_type)
#ifndef QMCKL_AO_HPT #ifndef QMCKL_AO_HPT
#define QMCKL_AO_HPT #define QMCKL_AO_HPT
#include <stdbool.h>
#+end_src #+end_src
#+begin_src c :tangle (eval c_test) :noweb yes #+begin_src c :tangle (eval c_test) :noweb yes
@ -56,6 +57,7 @@ MunitResult test_<<filename()>>() {
#include <stdint.h> #include <stdint.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include <stdbool.h>
#include <assert.h> #include <assert.h>
#include "qmckl_error_type.h" #include "qmckl_error_type.h"
@ -129,7 +131,6 @@ coefficient = [ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421,
#+begin_src c :comments org :tangle (eval h_private_type) #+begin_src c :comments org :tangle (eval h_private_type)
typedef struct qmckl_ao_basis_struct { typedef struct qmckl_ao_basis_struct {
int32_t provided;
int32_t uninitialized; int32_t uninitialized;
int64_t shell_num; int64_t shell_num;
int64_t prim_num; int64_t prim_num;
@ -140,6 +141,7 @@ typedef struct qmckl_ao_basis_struct {
double * shell_factor; double * shell_factor;
double * exponent ; double * exponent ;
double * coefficient ; double * coefficient ;
bool provided;
char type; char type;
} qmckl_ao_basis_struct; } qmckl_ao_basis_struct;
#+end_src #+end_src
@ -147,7 +149,7 @@ typedef struct qmckl_ao_basis_struct {
The ~uninitialized~ integer contains one bit set to one for each The ~uninitialized~ integer contains one bit set to one for each
initialization function which has not bee called. It becomes equal initialization function which has not bee called. It becomes equal
to zero after all initialization functions have been called. The to zero after all initialization functions have been called. The
struct is then initialized and ~provided == 1~. struct is then initialized and ~provided == true~.
** Access functions ** Access functions
@ -168,7 +170,7 @@ double* qmckl_get_ao_basis_coefficient (const qmckl_context context);
#+end_src #+end_src
#+begin_src c :comments org :tangle (eval h_func) #+begin_src c :comments org :tangle (eval h_func)
int32_t qmckl_ao_basis_provided (const qmckl_context context); bool qmckl_ao_basis_provided (const qmckl_context context);
#+end_src #+end_src
#+NAME:post #+NAME:post
@ -371,10 +373,10 @@ double* qmckl_get_ao_basis_coefficient (const qmckl_context context) {
} }
int32_t qmckl_ao_basis_provided(const qmckl_context context) { bool qmckl_ao_basis_provided(const qmckl_context context) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) { if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return 0; return false;
} }
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context; qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
@ -414,10 +416,7 @@ qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
#+NAME:post2 #+NAME:post2
#+begin_src c #+begin_src c
ctx->ao_basis.uninitialized &= ~mask; ctx->ao_basis.uninitialized &= ~mask;
ctx->ao_basis.provided = (ctx->ao_basis.uninitialized == 0);
if (ctx->ao_basis.uninitialized == 0) {
ctx->ao_basis.provided = 1;
}
return QMCKL_SUCCESS; return QMCKL_SUCCESS;
#+end_src #+end_src
@ -829,51 +828,51 @@ double coefficient [prim_num] =
qmckl_exit_code rc; qmckl_exit_code rc;
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_type (context, typ); rc = qmckl_set_ao_basis_type (context, typ);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_num (context, shell_num); rc = qmckl_set_ao_basis_shell_num (context, shell_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_prim_num (context, prim_num); rc = qmckl_set_ao_basis_prim_num (context, prim_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_center (context, shell_center); rc = qmckl_set_ao_basis_shell_center (context, shell_center);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_ang_mom (context, shell_ang_mom); rc = qmckl_set_ao_basis_shell_ang_mom (context, shell_ang_mom);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_factor (context, shell_factor); rc = qmckl_set_ao_basis_shell_factor (context, shell_factor);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_center (context, shell_prim_num); rc = qmckl_set_ao_basis_shell_center (context, shell_prim_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_prim_num (context, shell_prim_num); rc = qmckl_set_ao_basis_shell_prim_num (context, shell_prim_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_shell_prim_index (context, shell_prim_index); rc = qmckl_set_ao_basis_shell_prim_index (context, shell_prim_index);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_exponent (context, exponent); rc = qmckl_set_ao_basis_exponent (context, exponent);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 0); munit_assert(!qmckl_ao_basis_provided(context));
rc = qmckl_set_ao_basis_coefficient (context, coefficient); rc = qmckl_set_ao_basis_coefficient (context, coefficient);
munit_assert_int64(rc, ==, QMCKL_SUCCESS); munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert_int(qmckl_ao_basis_provided(context), ==, 1); munit_assert(qmckl_ao_basis_provided(context));
#+end_src #+end_src

View File

@ -20,6 +20,7 @@ MunitResult test_<<filename()>>() {
#include "qmckl_error_private_type.h" #include "qmckl_error_private_type.h"
#include "qmckl_memory_private_type.h" #include "qmckl_memory_private_type.h"
#include "qmckl_numprec_private_type.h" #include "qmckl_numprec_private_type.h"
#include "qmckl_electron_private_type.h"
#include "qmckl_ao_private_type.h" #include "qmckl_ao_private_type.h"
#+end_src #+end_src
@ -93,11 +94,14 @@ typedef struct qmckl_context_struct {
/* Memory allocation */ /* Memory allocation */
qmckl_memory_struct memory; qmckl_memory_struct memory;
/* Current date */
uint64_t date;
/* -- Molecular system -- */ /* -- Molecular system -- */
qmckl_electron_struct electron;
qmckl_ao_basis_struct ao_basis; qmckl_ao_basis_struct ao_basis;
/* To be implemented: /* To be implemented:
qmckl_electron_struct electron;
qmckl_nucleus_struct nucleus; qmckl_nucleus_struct nucleus;
qmckl_mo_struct mo; qmckl_mo_struct mo;
qmckl_determinant_struct det; qmckl_determinant_struct det;
@ -106,6 +110,10 @@ typedef struct qmckl_context_struct {
} qmckl_context_struct; } qmckl_context_struct;
#+end_src #+end_src
The context keeps a ``date'' that allows to check which data needs
to be recomputed. The date is incremented when the electron
coordinates are updated.
When a new element is added to the context, the functions When a new element is added to the context, the functions
[[Creation][qmckl_context_create]], [[Destroy][qmckl_context_destroy]] and [[Copy][qmckl_context_copy]] [[Creation][qmckl_context_create]], [[Destroy][qmckl_context_destroy]] and [[Copy][qmckl_context_copy]]
should be updated inorder to make deep copies. should be updated inorder to make deep copies.
@ -199,6 +207,7 @@ qmckl_context qmckl_context_create() {
ctx->numprec.range = QMCKL_DEFAULT_RANGE; ctx->numprec.range = QMCKL_DEFAULT_RANGE;
ctx->ao_basis.uninitialized = (1 << 10) - 1; ctx->ao_basis.uninitialized = (1 << 10) - 1;
ctx->electron.uninitialized = (1 << 4) - 1;
/* Allocate qmckl_memory_struct */ /* Allocate qmckl_memory_struct */
{ {

446
src/qmckl_electron.org Normal file
View File

@ -0,0 +1,446 @@
#+TITLE: Electrons
#+SETUPFILE: ../docs/theme.setup
#+INCLUDE: ../tools/lib.org
In conventional QMC simulations, up-spin and down-spin electrons are
different. The ~electron~ data structure contains the number of
up-spin and down-spin electrons, and the electron coordinates.
* Headers :noexport:
#+begin_src elisp :noexport :results none
(org-babel-lob-ingest "../tools/lib.org")
#+end_src
#+begin_src c :tangle (eval h_private_type)
#ifndef QMCKL_ELECTRON_HPT
#define QMCKL_ELECTRON_HPT
#include <stdbool.h>
#+end_src
#+begin_src c :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"
MunitResult test_<<filename()>>() {
qmckl_context context;
context = qmckl_context_create();
#+end_src
#+begin_src c :tangle (eval c)
#include <stdint.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#include <assert.h>
#include "qmckl_error_type.h"
#include "qmckl_context_type.h"
#include "qmckl_context_private_type.h"
#include "qmckl_memory_private_type.h"
#include "qmckl_error_func.h"
#include "qmckl_memory_private_func.h"
#include "qmckl_memory_func.h"
#include "qmckl_context_func.h"
#+end_src
* Context
The following data stored in the context:
| ~date~ | uint64_t | Last modification date of the coordinates |
| ~uninitialized~ | int32_t | Keeps bit set for uninitialized data |
| ~num~ | int64_t | Total number of electrons |
| ~up_num~ | int64_t | Number of up-spin electrons |
| ~down_num~ | int64_t | Number of down-spin electrons |
| ~walk_num~ | int64_t | Number of walkers |
| ~provided~ | bool | If true, ~electron~ is valid |
| ~coord_new~ | double[walk_num][3][num] | New set of electron coordinates |
| ~coord_old~ | double[walk_num][3][num] | Old set of electron coordinates |
** Data structure
#+begin_src c :comments org :tangle (eval h_private_type)
typedef struct qmckl_electron_struct {
int64_t date;
int64_t num;
int64_t up_num;
int64_t down_num;
int64_t walk_num;
double* coord_new;
double* coord_old;
int32_t uninitialized;
bool provided;
} qmckl_electron_struct;
#+end_src
The ~uninitialized~ integer contains one bit set to one for each
initialization function which has not bee called. It becomes equal
to zero after all initialization functions have been called. The
struct is then initialized and ~provided == true~.
** Access functions
Access to scalars copies the values at the passed address, and
for array values a pointer to the array is returned.
#+begin_src c :comments org :tangle (eval h_private_func)
int64_t qmckl_get_electron_num (const qmckl_context context);
int64_t qmckl_get_electron_up_num (const qmckl_context context);
int64_t qmckl_get_electron_down_num (const qmckl_context context);
int64_t qmckl_get_electron_walk_num (const qmckl_context context);
double* qmckl_get_electron_coord_new (const qmckl_context context);
double* qmckl_get_electron_coord_old (const qmckl_context context);
#+end_src
#+begin_src c :comments org :tangle (eval h_func)
bool qmckl_electron_provided (const qmckl_context context);
#+end_src
#+NAME:post
#+begin_src c
if ( (ctx->electron.uninitialized & mask) != 0) {
return NULL;
}
#+end_src
#+begin_src c :comments org :tangle (eval c) :noweb yes
int64_t qmckl_get_electron_num (const qmckl_context context) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return (char) 0;
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
int32_t mask = 1;
if ( (ctx->electron.uninitialized & mask) != 0) {
return (int64_t) 0;
}
assert (ctx->electron.num > (int64_t) 0);
return ctx->electron.num;
}
int64_t qmckl_get_electron_up_num (const qmckl_context context) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return (int64_t) 0;
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
int32_t mask = 1 << 1;
if ( (ctx->electron.uninitialized & mask) != 0) {
return (int64_t) 0;
}
assert (ctx->electron.up_num > (int64_t) 0);
return ctx->electron.up_num;
}
int64_t qmckl_get_electron_down_num (const qmckl_context context) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return (int64_t) 0;
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
int32_t mask = 1 << 2;
if ( (ctx->electron.uninitialized & mask) != 0) {
return (int64_t) 0;
}
assert (ctx->electron.down_num >= (int64_t) 0);
return ctx->electron.down_num;
}
int64_t qmckl_get_electron_walk_num (const qmckl_context context) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return (int64_t) 0;
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
int32_t mask = 1 << 3;
if ( (ctx->electron.uninitialized & mask) != 0) {
return (int64_t) 0;
}
assert (ctx->electron.walk_num > (int64_t) 0);
return ctx->electron.walk_num;
}
bool qmckl_electron_provided(const qmckl_context context) {
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return false;
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
assert (ctx != NULL);
return ctx->electron.provided;
}
#+end_src
** Initialization functions
To set the data relative to the electrons in the context, the
following functions need to be called. When the data structure is
initialized, the ~coord_new~ and ~coord_old~ arrays are both allocated.
#+begin_src c :comments org :tangle (eval h_func)
qmckl_exit_code qmckl_set_electron_num (qmckl_context context, const int64_t up_num, const int64_t down_num);
qmckl_exit_code qmckl_set_electron_walk_num (qmckl_context context, const int64_t walk_num);
qmckl_exit_code qmckl_set_electron_coord (qmckl_context context, const double* coord);
#+end_src
#+NAME:pre2
#+begin_src c
if (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
return QMCKL_NULL_CONTEXT;
}
qmckl_context_struct* const ctx = (qmckl_context_struct* const) context;
#+end_src
#+NAME:post2
#+begin_src c
ctx->electron.uninitialized &= ~mask;
ctx->electron.provided = (ctx->electron.uninitialized == 0);
if (ctx->electron.provided) {
if (ctx->electron.coord_new != NULL) {
qmckl_free(context, ctx->electron.coord_new);
ctx->electron.coord_new = NULL;
}
if (ctx->electron.coord_old != NULL) {
qmckl_free(context, ctx->electron.coord_old);
ctx->electron.coord_old = NULL;
}
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
mem_info.size = ctx->electron.num * ctx->electron.walk_num * 3 * sizeof(double);
double* coord_new = (double*) qmckl_malloc(context, mem_info);
if (coord_new == NULL) {
return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED,
"qmckl_set_electron_num",
NULL);
}
ctx->electron.coord_new = coord_new;
double* coord_old = (double*) qmckl_malloc(context, mem_info);
if (coord_old == NULL) {
return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED,
"qmckl_set_electron_num",
NULL);
}
ctx->electron.coord_old = coord_old;
}
return QMCKL_SUCCESS;
#+end_src
To set the number of electrons, we give the number of up-spin and
down-spin electrons to the context.
#+begin_src c :comments org :tangle (eval c) :noweb yes
qmckl_exit_code qmckl_set_electron_num(qmckl_context context,
const int64_t up_num,
const int64_t down_num) {
<<pre2>>
if (up_num <= 0) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_2,
"qmckl_set_electron_num",
"up_num <= 0");
}
if (down_num <= 0) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_3,
"qmckl_set_electron_num",
"down_num <= 0");
}
int32_t mask = (1 << 3) -1;
ctx->electron.up_num = up_num;
ctx->electron.down_num = down_num;
ctx->electron.num = up_num + down_num;
<<post2>>
}
#+end_src
Then, we set the number of walkers:
#+begin_src c :comments org :tangle (eval c) :noweb yes
qmckl_exit_code qmckl_set_electron_walk_num(qmckl_context context, const int64_t walk_num) {
<<pre2>>
if (walk_num <= 0) {
return qmckl_failwith( context,
QMCKL_INVALID_ARG_2,
"qmckl_set_electron_walk_num",
"walk_num <= 0");
}
int32_t mask = 1 << 3;
ctx->electron.walk_num = walk_num;
<<post2>>
}
#+end_src
The following function sets the electron coordinates of all the
walkers. When this is done, the pointers to the old and new sets
of coordinates are swapped, and the new coordinates are
overwritten.
#+begin_src c :comments org :tangle (eval c) :noweb yes
qmckl_exit_code qmckl_set_electron_coord(qmckl_context context, const double* coord) {
<<pre2>>
const int64_t num = qmckl_get_electron_num(context);
if (num == 0L) {
return qmckl_failwith( context,
QMCKL_FAILURE,
"qmckl_set_electron_coord",
"num is not set");
}
const int64_t walk_num = qmckl_get_electron_walk_num(context);
if (walk_num == 0L) {
return qmckl_failwith( context,
QMCKL_FAILURE,
"qmckl_set_electron_coord",
"walk_num is not set");
}
/* If num and walk_num are set, the arrays should be allocated */
assert (ctx->electron.coord_old != NULL);
assert (ctx->electron.coord_new != NULL);
/* Increment the date of the context */
ctx->date += 1UL;
/* Swap pointers */
double * swap;
swap = ctx->electron.coord_old;
ctx->electron.coord_old = ctx->electron.coord_new;
ctx->electron.coord_new = swap;
memcpy(ctx->electron.coord_new, coord, walk_num * num * 3 * sizeof(double));
ctx->electron.date = ctx->date;
return QMCKL_SUCCESS;
}
#+end_src
** Test
#+begin_src c :tangle (eval c_test)
/* Reference input data */
#define up_num ((int64_t) 3)
#define down_num ((int64_t) 2)
#define walk_num ((int64_t) 2)
#define num (up_num+down_num)
double coord[walk_num*3*num] =
{ 7.303633091022677881e+00, 1.375868694453235719e+01, 1.167371490471771217e-01,
4.547755371567960836e+00, 3.245907105524011182e+00, 2.410764357550297110e-01,
5.932816068137344523e+00, 1.491671465549257469e+01, 3.825374039119375236e-01,
7.347336142660052083e+00, 1.341946976062362129e+00, 1.648917914228352322e+00,
5.735221530102248444e+00, 1.064667491680036271e+01, 4.227201772236627297e-01,
8.099550978782254163e+00, 6.861498941099086757e+00, 4.015884841159429036e-02,
1.014757367558326173e+01, 5.219335322173662917e+00, 5.037004126899931322e-02,
1.484094322159507051e+01, 9.777903829455864226e+00, 5.243007994024882767e-02,
9.081723054990456845e+00, 5.499568496038920173e+00, 2.910446438899221347e-02,
2.583154239492383653e+00, 1.442282811294904432e+00, 6.387191629878670451e-02 };
/* --- */
qmckl_exit_code rc;
munit_assert(!qmckl_electron_provided(context));
rc = qmckl_set_electron_num (context, up_num, down_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(!qmckl_electron_provided(context));
rc = qmckl_set_electron_walk_num (context, walk_num);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
munit_assert(qmckl_electron_provided(context));
rc = qmckl_set_electron_coord (context, coord);
munit_assert_int64(rc, ==, QMCKL_SUCCESS);
#+end_src
* End of files :noexport:
#+begin_src c :tangle (eval h_private_type)
#endif
#+end_src
*** Test
#+begin_src c :tangle (eval c_test)
if (qmckl_context_destroy(context) != QMCKL_SUCCESS)
return QMCKL_FAILURE;
return MUNIT_OK;
}
#+end_src
**✸ Compute file names
#+begin_src emacs-lisp
; The following is required to compute the file names
(setq pwd (file-name-directory buffer-file-name))
(setq name (file-name-nondirectory (substring buffer-file-name 0 -4)))
(setq f (concat pwd name "_f.f90"))
(setq fh (concat pwd name "_fh.f90"))
(setq c (concat pwd name ".c"))
(setq h (concat name ".h"))
(setq h_private (concat name "_private.h"))
(setq c_test (concat pwd "test_" name ".c"))
(setq f_test (concat pwd "test_" name "_f.f90"))
; Minted
(require 'ox-latex)
(setq org-latex-listings 'minted)
(add-to-list 'org-latex-packages-alist '("" "listings"))
(add-to-list 'org-latex-packages-alist '("" "color"))
#+end_src
#+RESULTS:
| | color |
| | listings |
# -*- mode: org -*-
# vim: syntax=c

View File

@ -2,6 +2,7 @@ qmckl.org
qmckl_error.org qmckl_error.org
qmckl_context.org qmckl_context.org
qmckl_memory.org qmckl_memory.org
qmckl_electron.org
qmckl_ao.org qmckl_ao.org
qmckl_distance.org qmckl_distance.org
test_qmckl.org test_qmckl.org

View File

@ -20,8 +20,9 @@ grep begin_src $FILES \
| qmckl_error | | qmckl_error |
| qmckl_context | | qmckl_context |
| qmckl_memory | | qmckl_memory |
| qmckl_distance | | qmckl_electron |
| qmckl_ao | | qmckl_ao |
| qmckl_distance |
We generate the function headers We generate the function headers
#+begin_src sh :var files=test-files :exports output :results drawer #+begin_src sh :var files=test-files :exports output :results drawer
@ -42,8 +43,9 @@ echo "#+end_src"
MunitResult test_qmckl_error(); MunitResult test_qmckl_error();
MunitResult test_qmckl_context(); MunitResult test_qmckl_context();
MunitResult test_qmckl_memory(); MunitResult test_qmckl_memory();
MunitResult test_qmckl_distance(); MunitResult test_qmckl_electron();
MunitResult test_qmckl_ao(); MunitResult test_qmckl_ao();
MunitResult test_qmckl_distance();
#+end_src #+end_src
:end: :end:
@ -66,8 +68,9 @@ echo "#+end_src"
{ (char*) "test_qmckl_error", test_qmckl_error, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL}, { (char*) "test_qmckl_error", test_qmckl_error, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_context", test_qmckl_context, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL}, { (char*) "test_qmckl_context", test_qmckl_context, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_memory", test_qmckl_memory, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL}, { (char*) "test_qmckl_memory", test_qmckl_memory, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_distance", test_qmckl_distance, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL}, { (char*) "test_qmckl_electron", test_qmckl_electron, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_ao", test_qmckl_ao, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL}, { (char*) "test_qmckl_ao", test_qmckl_ao, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
{ (char*) "test_qmckl_distance", test_qmckl_distance, NULL,NULL,MUNIT_TEST_OPTION_NONE,NULL},
#+end_src #+end_src
:end: :end:

View File

@ -78,11 +78,12 @@ cat << EOF > ${OUTPUT}
* *
*/ */
#ifndef __QMCKL_H__ #ifndef QMCKL_H
#define __QMCKL_H__ #define QMCKL_H
#include <stdlib.h> #include <stdlib.h>
#include <stdint.h> #include <stdint.h>
#include <stdbool.h>
EOF EOF
for i in ${HEADERS} for i in ${HEADERS}