1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-06-30 00:44:52 +02:00

Added file names as properties

This commit is contained in:
Anthony Scemama 2020-12-24 17:41:28 +01:00
parent 913b50099b
commit 680a0880b4
3 changed files with 87 additions and 72 deletions

View File

@ -1,5 +1,6 @@
#+TITLE: QMCkl source code documentation
#+EXPORT_FILE_NAME: index.html
#+PROPERTY: comments org
#+SETUPFILE: https://fniessen.github.io/org-html-themes/org/theme-readtheorg.setup

View File

@ -1,4 +1,11 @@
** Atomic Orbitals
:PROPERTIES:
:f: qmckl_ao.f90
:c_test: test_qmckl_ao.c
:fh: qmckl_f.f90
:h: qmckl.h
:f_test: test_qmckl_ao_f.f90
:END:
This files contains all the routines for the computation of the
@ -10,7 +17,7 @@
- a Fortran test file : =test_qmckl_ao_f.f90=
*** Test :noexport:
#+BEGIN_SRC C :tangle test_qmckl_ao.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c_test" t)
#include "qmckl.h"
#include "munit.h"
MunitResult test_qmckl_ao() {
@ -67,7 +74,7 @@ MunitResult test_qmckl_ao() {
- ~LDP~ >= $\max_i$ ~LMAX[i]~
***** Header
#+BEGIN_SRC C :tangle qmckl.h
#+BEGIN_SRC C :tangle (org-entry-get nil "h" t)
qmckl_exit_code qmckl_ao_power(const qmckl_context context,
const int64_t n,
const double *X, const int32_t *LMAX,
@ -75,7 +82,7 @@ qmckl_exit_code qmckl_ao_power(const qmckl_context context,
#+END_SRC
***** Source
#+BEGIN_SRC f90 :tangle qmckl_ao.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "f" t)
integer function qmckl_ao_power_f(context, n, X, LMAX, P, ldp) result(info)
implicit none
integer*8 , intent(in) :: context
@ -110,7 +117,7 @@ end function qmckl_ao_power_f
#+END_SRC
***** C interface :noexport:
#+BEGIN_SRC f90 :tangle qmckl_ao.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "f" t)
integer(c_int32_t) function qmckl_ao_power(context, n, X, LMAX, P, ldp) &
bind(C) result(info)
use, intrinsic :: iso_c_binding
@ -127,7 +134,7 @@ integer(c_int32_t) function qmckl_ao_power(context, n, X, LMAX, P, ldp) &
end function qmckl_ao_power
#+END_SRC
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer(c_int32_t) function qmckl_ao_power(context, n, X, LMAX, P, ldp) bind(C)
use, intrinsic :: iso_c_binding
@ -142,7 +149,7 @@ end function qmckl_ao_power
#+END_SRC
***** Test :noexport:
#+BEGIN_SRC f90 :tangle test_qmckl_ao_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "f_test" t)
integer(c_int32_t) function test_qmckl_ao_power(context) bind(C)
use qmckl
implicit none
@ -187,7 +194,7 @@ integer(c_int32_t) function test_qmckl_ao_power(context) bind(C)
end function test_qmckl_ao_power
#+END_SRC
#+BEGIN_SRC C :tangle test_qmckl_ao.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c_test" t)
int test_qmckl_ao_power(qmckl_context context);
munit_assert_int(0, ==, test_qmckl_ao_power(context));
#+END_SRC
@ -237,7 +244,7 @@ munit_assert_int(0, ==, test_qmckl_ao_power(context));
| -4 | Inconsistent ~lmax~ |
***** Header
#+BEGIN_SRC C :tangle qmckl.h
#+BEGIN_SRC C :tangle (org-entry-get nil "h" t)
qmckl_exit_code qmckl_ao_polynomial_vgl(const qmckl_context context,
const double *X, const double *R,
const int32_t lmax, const int64_t *n,
@ -246,7 +253,7 @@ qmckl_exit_code qmckl_ao_polynomial_vgl(const qmckl_context context,
#+END_SRC
***** Source
#+BEGIN_SRC f90 :tangle qmckl_ao.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "f" t)
integer function qmckl_ao_polynomial_vgl_f(context, X, R, lmax, n, L, ldl, VGL, ldv) result(info)
implicit none
integer*8 , intent(in) :: context
@ -376,7 +383,7 @@ end function qmckl_ao_polynomial_vgl_f
#+END_SRC
***** C interface :noexport:
#+BEGIN_SRC f90 :tangle qmckl_ao.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "f" t)
integer(c_int32_t) function qmckl_ao_polynomial_vgl(context, X, R, lmax, n, L, ldl, VGL, ldv) &
bind(C) result(info)
use, intrinsic :: iso_c_binding
@ -396,7 +403,7 @@ end function qmckl_ao_polynomial_vgl
#+END_SRC
***** Fortran interface :noexport:
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer(c_int32_t) function qmckl_ao_polynomial_vgl(context, X, R, lmax, n, L, ldl, VGL, ldv) &
bind(C)
@ -413,7 +420,7 @@ end function qmckl_ao_polynomial_vgl
end interface
#+END_SRC
***** Test :noexport:
#+BEGIN_SRC f90 :tangle test_qmckl_ao_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "f_test" t)
integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context) bind(C)
use qmckl
implicit none
@ -508,7 +515,7 @@ integer(c_int32_t) function test_qmckl_ao_polynomial_vgl(context) bind(C)
end function test_qmckl_ao_polynomial_vgl
#+END_SRC
#+BEGIN_SRC C :tangle test_qmckl_ao.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c_test" t)
int test_qmckl_ao_polynomial_vgl(qmckl_context context);
munit_assert_int(0, ==, test_qmckl_ao_polynomial_vgl(context));
#+END_SRC
@ -548,7 +555,7 @@ munit_assert_int(0, ==, test_qmckl_ao_polynomial_vgl(context));
- ~VGL~ is allocated with at least $n \times 5 \times 8$ bytes
***** Header
#+BEGIN_SRC C :tangle qmckl.h
#+BEGIN_SRC C :tangle (org-entry-get nil "h" t)
qmckl_exit_code qmckl_ao_gaussian_vgl(const qmckl_context context,
const double *X, const double *R,
const int64_t *n, const int64_t *A,
@ -556,7 +563,7 @@ qmckl_exit_code qmckl_ao_gaussian_vgl(const qmckl_context context,
#+END_SRC
***** Source
#+BEGIN_SRC f90 :tangle qmckl_ao.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "f" t)
integer function qmckl_ao_gaussian_vgl_f(context, X, R, n, A, VGL, ldv) result(info)
implicit none
integer*8 , intent(in) :: context
@ -619,7 +626,7 @@ end function qmckl_ao_gaussian_vgl_f
#+END_SRC
***** C interface :noexport:
#+BEGIN_SRC f90 :tangle qmckl_ao.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "f" t)
integer(c_int32_t) function qmckl_ao_gaussian_vgl(context, X, R, n, A, VGL, ldv) &
bind(C) result(info)
use, intrinsic :: iso_c_binding
@ -636,7 +643,7 @@ integer(c_int32_t) function qmckl_ao_gaussian_vgl(context, X, R, n, A, VGL, ldv)
end function qmckl_ao_gaussian_vgl
#+END_SRC
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer(c_int32_t) function qmckl_ao_gaussian_vgl(context, X, R, n, A, VGL, ldv) &
bind(C)
@ -650,7 +657,7 @@ end function qmckl_ao_gaussian_vgl
end interface
#+END_SRC
***** Test :noexport:
#+BEGIN_SRC f90 :tangle test_qmckl_ao_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "f_test" t)
integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
use qmckl
implicit none
@ -717,7 +724,7 @@ integer(c_int32_t) function test_qmckl_ao_gaussian_vgl(context) bind(C)
end function test_qmckl_ao_gaussian_vgl
#+END_SRC
#+BEGIN_SRC C :tangle test_qmckl_ao.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c_test" t)
int test_qmckl_ao_gaussian_vgl(qmckl_context context);
munit_assert_int(0, ==, test_qmckl_ao_gaussian_vgl(context));
#+END_SRC
@ -728,7 +735,7 @@ munit_assert_int(0, ==, test_qmckl_ao_gaussian_vgl(context));
*** End of files :noexport:
***** Test
#+BEGIN_SRC C :tangle test_qmckl_ao.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c_test" t)
if (qmckl_context_destroy(context) != QMCKL_SUCCESS)
return QMCKL_FAILURE;
return MUNIT_OK;

View File

@ -1,4 +1,11 @@
** Context
:PROPERTIES:
:c: qmckl_context.c
:c_test: test_qmckl_context.c
:fh: qmckl_f.f90
:h: qmckl.h
:END:
This file is written in C because it is more natural to express the
context in C than in Fortran.
@ -8,11 +15,11 @@
- a test file : =test_qmckl_context.c=
*** Headers :noexport:
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
#include "qmckl.h"
#+END_SRC
#+BEGIN_SRC C :tangle test_qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c_test" t)
#include "qmckl.h"
#include "munit.h"
MunitResult test_qmckl_context() {
@ -30,7 +37,7 @@ MunitResult test_qmckl_context() {
# The following code block should be kept to insert comments into
# the qmckl.h file
#+BEGIN_SRC C :comments org :tangle qmckl.h :export none
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t) :export none
#+END_SRC
**** Basis set data structure
@ -38,7 +45,7 @@ MunitResult test_qmckl_context() {
Data structure for the info related to the atomic orbitals
basis set.
#+BEGIN_SRC C :comments org :tangle qmckl_context.c
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "c" t)
typedef struct qmckl_ao_basis_struct {
int64_t shell_num;
@ -59,7 +66,7 @@ typedef struct qmckl_ao_basis_struct {
The tag is used internally to check if the memory domain pointed
by a pointer is a valid context.
#+BEGIN_SRC C :comments org :tangle qmckl_context.c
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "c" t)
typedef struct qmckl_context_struct {
struct qmckl_context_struct * prev;
@ -83,7 +90,7 @@ typedef struct qmckl_context_struct {
#+END_SRC
**** Test :noexport:
#+BEGIN_SRC C :tangle test_qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c_test" t)
qmckl_context context;
qmckl_context new_context;
#+END_SRC
@ -95,12 +102,12 @@ qmckl_context new_context;
Returns the input ~qmckl_context~ if the context is valid, 0
otherwise.
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_context qmckl_context_check(const qmckl_context context) ;
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
qmckl_context qmckl_context_check(const qmckl_context context) {
if (context == (qmckl_context) 0) return (qmckl_context) 0;
@ -119,12 +126,12 @@ qmckl_context qmckl_context_check(const qmckl_context context) {
- On success, returns a pointer to a context using the ~qmckl_context~ type
- Returns ~0~ upon failure to allocate the internal data structure
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_context qmckl_context_create();
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
qmckl_context qmckl_context_create() {
qmckl_context_struct* context =
@ -144,7 +151,7 @@ qmckl_context qmckl_context_create() {
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int64_t) function qmckl_context_create() bind(C)
use, intrinsic :: iso_c_binding
@ -153,7 +160,7 @@ qmckl_context qmckl_context_create() {
#+END_SRC
***** Test :noexport:
#+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
#+BEGIN_SRC C :comments link :tangle (org-entry-get nil "c_test" t)
context = qmckl_context_create();
munit_assert_int64( context, !=, (qmckl_context) 0);
munit_assert_int64( qmckl_context_check(context), ==, context);
@ -167,12 +174,12 @@ munit_assert_int64( qmckl_context_check(context), ==, context);
- Returns 0 upon failure to allocate the internal data structure
for the new context
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_context qmckl_context_copy(const qmckl_context context);
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
qmckl_context qmckl_context_copy(const qmckl_context context) {
const qmckl_context checked_context = qmckl_context_check(context);
@ -201,7 +208,7 @@ qmckl_context qmckl_context_copy(const qmckl_context context) {
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int64_t) function qmckl_context_copy(context) bind(C)
use, intrinsic :: iso_c_binding
@ -211,7 +218,7 @@ qmckl_context qmckl_context_copy(const qmckl_context context) {
#+END_SRC
***** Test :noexport:
#+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
#+BEGIN_SRC C :comments link :tangle (org-entry-get nil "c_test" t)
new_context = qmckl_context_copy(context);
munit_assert_int64(new_context, !=, (qmckl_context) 0);
munit_assert_int64(new_context, !=, context);
@ -225,12 +232,12 @@ munit_assert_int64(qmckl_context_check(new_context), ==, new_context);
- Returns 0 for the initial context
- Returns 0 for the 0-valued context
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_context qmckl_context_previous(const qmckl_context context);
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
qmckl_context qmckl_context_previous(const qmckl_context context) {
const qmckl_context checked_context = qmckl_context_check(context);
@ -244,7 +251,7 @@ qmckl_context qmckl_context_previous(const qmckl_context context) {
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int64_t) function qmckl_context_previous(context) bind(C)
use, intrinsic :: iso_c_binding
@ -254,7 +261,7 @@ qmckl_context qmckl_context_previous(const qmckl_context context) {
#+END_SRC
***** Test :noexport:
#+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
#+BEGIN_SRC C :comments link :tangle (org-entry-get nil "c_test" t)
munit_assert_int64(qmckl_context_previous(new_context), !=, (qmckl_context) 0);
munit_assert_int64(qmckl_context_previous(new_context), ==, context);
munit_assert_int64(qmckl_context_previous(context), ==, (qmckl_context) 0);
@ -269,12 +276,12 @@ munit_assert_int64(qmckl_context_previous((qmckl_context) 0), ==, (qmckl_context
- Fails if the 0-valued context is given in argument
- Fails if the the pointer is not a valid context
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_exit_code qmckl_context_destroy(qmckl_context context);
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
qmckl_exit_code qmckl_context_destroy(const qmckl_context context) {
const qmckl_context checked_context = qmckl_context_check(context);
@ -290,7 +297,7 @@ qmckl_exit_code qmckl_context_destroy(const qmckl_context context) {
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int32_t) function qmckl_context_destroy(context) bind(C)
use, intrinsic :: iso_c_binding
@ -300,7 +307,7 @@ qmckl_exit_code qmckl_context_destroy(const qmckl_context context) {
#+END_SRC
***** Test :noexport:
#+BEGIN_SRC C :tangle test_qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c_test" t)
munit_assert_int64(qmckl_context_check(new_context), ==, new_context);
munit_assert_int64(new_context, !=, (qmckl_context) 0);
munit_assert_int32(qmckl_context_destroy(new_context), ==, QMCKL_SUCCESS);
@ -366,7 +373,7 @@ COEFFICIENT = [ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421,
| ~EXPONENT(prim_num)~ | Array of exponents |
| ~COEFFICIENT(prim_num)~ | Array of coefficients |
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_exit_code
qmckl_context_update_ao_basis(qmckl_context context , const char type,
const int64_t shell_num , const int64_t prim_num,
@ -377,7 +384,7 @@ qmckl_context_update_ao_basis(qmckl_context context , const char type
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
qmckl_exit_code
qmckl_context_update_ao_basis(qmckl_context context , const char type,
const int64_t shell_num , const int64_t prim_num,
@ -492,7 +499,7 @@ qmckl_context_update_ao_basis(qmckl_context context , const char type
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int32_t) function qmckl_context_update_ao_basis(context, &
typ, shell_num, prim_num, SHELL_CENTER, SHELL_ANG_MOM, SHELL_FACTOR, &
@ -530,7 +537,7 @@ qmckl_context_update_ao_basis(qmckl_context context , const char type
| ~EXPONENT(prim_num)~ | Array of exponents |
| ~COEFFICIENT(prim_num)~ | Array of coefficients |
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_context
qmckl_context_set_ao_basis(const qmckl_context context , const char type,
const int64_t shell_num , const int64_t prim_num,
@ -541,7 +548,7 @@ qmckl_context_set_ao_basis(const qmckl_context context , const char typ
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
qmckl_context
qmckl_context_set_ao_basis(const qmckl_context context , const char type,
const int64_t shell_num , const int64_t prim_num,
@ -566,7 +573,7 @@ qmckl_context_set_ao_basis(const qmckl_context context , const char typ
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int64_t) function qmckl_context_set_ao_basis(context, &
typ, shell_num, prim_num, SHELL_CENTER, SHELL_ANG_MOM, SHELL_FACTOR, &
@ -602,12 +609,12 @@ qmckl_context_set_ao_basis(const qmckl_context context , const char typ
**** ~qmckl_context_update_precision~
Modifies the parameter for the numerical precision in a given context.
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, const int precision);
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, const int precision) {
if (precision < 2) return QMCKL_FAILURE;
@ -622,7 +629,7 @@ qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, cons
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int32_t) function qmckl_context_update_precision(context, precision) bind(C)
use, intrinsic :: iso_c_binding
@ -635,12 +642,12 @@ qmckl_exit_code qmckl_context_update_precision(const qmckl_context context, cons
***** TODO Tests :noexport:
**** ~qmckl_context_update_range~
Modifies the parameter for the numerical range in a given context.
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_exit_code qmckl_context_update_range(const qmckl_context context, const int range);
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
qmckl_exit_code qmckl_context_update_range(const qmckl_context context, const int range) {
if (range < 2) return QMCKL_FAILURE;
@ -655,7 +662,7 @@ qmckl_exit_code qmckl_context_update_range(const qmckl_context context, const in
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int32_t) function qmckl_context_update_range(context, range) bind(C)
use, intrinsic :: iso_c_binding
@ -668,12 +675,12 @@ qmckl_exit_code qmckl_context_update_range(const qmckl_context context, const in
***** TODO Tests :noexport:
**** ~qmckl_context_set_precision~
Returns a copy of the context with a different precision parameter.
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_context qmckl_context_set_precision(const qmckl_context context, const int precision);
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
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;
@ -685,7 +692,7 @@ qmckl_context qmckl_context_set_precision(const qmckl_context context, const int
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int64_t) function qmckl_context_set_precision(context, precision) bind(C)
use, intrinsic :: iso_c_binding
@ -698,12 +705,12 @@ qmckl_context qmckl_context_set_precision(const qmckl_context context, const int
***** TODO Tests :noexport:
**** ~qmckl_context_set_range~
Returns a copy of the context with a different precision parameter.
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
qmckl_context qmckl_context_set_range(const qmckl_context context, const int range);
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
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;
@ -715,7 +722,7 @@ qmckl_context qmckl_context_set_range(const qmckl_context context, const int ran
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int64_t) function qmckl_context_set_range(context, range) bind(C)
use, intrinsic :: iso_c_binding
@ -729,12 +736,12 @@ qmckl_context qmckl_context_set_range(const qmckl_context context, const int ran
**** ~qmckl_context_get_precision~
Returns the value of the numerical precision in the context
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
int32_t qmckl_context_get_precision(const qmckl_context context);
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
int qmckl_context_get_precision(const qmckl_context context) {
const qmckl_context_struct* ctx = (qmckl_context_struct*) context;
return ctx->precision;
@ -742,7 +749,7 @@ int qmckl_context_get_precision(const qmckl_context context) {
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int32_t) function qmckl_context_get_precision(context) bind(C)
use, intrinsic :: iso_c_binding
@ -754,12 +761,12 @@ int qmckl_context_get_precision(const qmckl_context context) {
***** TODO Tests :noexport:
**** ~qmckl_context_get_range~
Returns the value of the numerical range in the context
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
int32_t qmckl_context_get_range(const qmckl_context context);
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
int qmckl_context_get_range(const qmckl_context context) {
const qmckl_context_struct* ctx = (qmckl_context_struct*) context;
return ctx->range;
@ -767,7 +774,7 @@ int qmckl_context_get_range(const qmckl_context context) {
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
integer (c_int32_t) function qmckl_context_get_range(context) bind(C)
use, intrinsic :: iso_c_binding
@ -780,12 +787,12 @@ int qmckl_context_get_range(const qmckl_context context) {
**** ~qmckl_context_get_epsilon~
Returns $\epsilon = 2^{1-n}$ where ~n~ is the precision
#+BEGIN_SRC C :comments org :tangle qmckl.h
#+BEGIN_SRC C :comments org :tangle (org-entry-get nil "h" t)
double qmckl_context_get_epsilon(const qmckl_context context);
#+END_SRC
***** Source
#+BEGIN_SRC C :tangle qmckl_context.c
#+BEGIN_SRC C :tangle (org-entry-get nil "c" t)
double qmckl_context_get_epsilon(const qmckl_context context) {
const qmckl_context_struct* ctx = (qmckl_context_struct*) context;
return pow(2.0,(double) 1-ctx->precision);
@ -793,7 +800,7 @@ double qmckl_context_get_epsilon(const qmckl_context context) {
#+END_SRC
***** Fortran interface
#+BEGIN_SRC f90 :tangle qmckl_f.f90
#+BEGIN_SRC f90 :tangle (org-entry-get nil "fh" t)
interface
real (c_double) function qmckl_context_get_epsilon(context) bind(C)
use, intrinsic :: iso_c_binding
@ -809,7 +816,7 @@ double qmckl_context_get_epsilon(const qmckl_context context) {
*** End of files :noexport:
***** Test
#+BEGIN_SRC C :comments link :tangle test_qmckl_context.c
#+BEGIN_SRC C :comments link :tangle (org-entry-get nil "c_test" t)
return MUNIT_OK;
}
#+END_SRC