1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-06-18 11:15:38 +02:00

Include lib.org

This commit is contained in:
Anthony Scemama 2021-04-09 11:26:04 +02:00
parent 7397dac788
commit ff8330f8f9
7 changed files with 61 additions and 85 deletions

View File

@ -1,5 +1,6 @@
#+TITLE: Atomic Orbitals
#+SETUPFILE: ../docs/theme.setup
#+INCLUDE: ../tools/lib.org
The atomic basis set is defined as a list of shells. Each shell $s$ is
centered on a nucleus $A$, possesses a given angular momentum $l$ and a
@ -34,11 +35,6 @@ gradients and Laplacian of the atomic basis functions.
* Headers :noexport:
#+NAME: filename
#+begin_src elisp :tangle no
(file-name-nondirectory (substring buffer-file-name 0 -4))
#+end_src
#+begin_src c :tangle (eval h_private_type)
#ifndef QMCKL_AO_HPT
#define QMCKL_AO_HPT

View File

@ -1,14 +1,9 @@
#+TITLE: Context
#+SETUPFILE: ../docs/theme.setup
#+INCLUDE: ../tools/lib.org
* Headers :noexport:
#+NAME: filename
#+begin_src elisp tangle: no
(file-name-nondirectory (substring buffer-file-name 0 -4))
#+end_src
#+begin_src c :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"

View File

@ -1,20 +1,11 @@
#+TITLE: Inter-particle distances
#+SETUPFILE: ../docs/theme.setup
#+INCLUDE: ../tools/lib.org
Functions for the computation of distances between particles.
* Headers :noexport:
#+NAME: filename
#+begin_src elisp tangle: no
(file-name-nondirectory (substring buffer-file-name 0 -4))
#+end_src
#+begin_src elisp :noexport :results none
(org-babel-lob-ingest "../tools/lib.org")
#+end_src
#+begin_src c :comments link :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"

View File

@ -1,13 +1,9 @@
#+TITLE: Error handling
#+SETUPFILE: ../docs/theme.setup
#+INCLUDE: ../tools/lib.org
* Headers :noexport:
#+NAME: filename
#+begin_src elisp tangle: no
(file-name-nondirectory (substring buffer-file-name 0 -4))
#+end_src
#+begin_src c :tangle (eval h_private_type)
#ifndef QMCKL_ERROR_HPT
#define QMCKL_ERROR_HPT

View File

@ -1,5 +1,6 @@
#+TITLE: Memory management
#+SETUPFILE: ../docs/theme.setup
#+INCLUDE: ../tools/lib.org
We override the allocation functions to enable the possibility of
optimized libraries to fine-tune the memory allocation.
@ -7,11 +8,6 @@ optimized libraries to fine-tune the memory allocation.
* Headers :noexport:
#+NAME: filename
#+begin_src elisp tangle: no
(file-name-nondirectory (substring buffer-file-name 0 -4))
#+end_src
#+begin_src c :tangle (eval c)
#include <stdint.h>
#include <stdlib.h>

View File

@ -1,14 +1,9 @@
#+TITLE: Numerical precision
#+SETUPFILE: ../docs/theme.setup
#+INCLUDE: ../tools/lib.org
* Headers :noexport:
#+NAME: filename
#+begin_src elisp tangle: no
(file-name-nondirectory (substring buffer-file-name 0 -4))
#+end_src
#+begin_src c :tangle (eval c_test) :noweb yes
#include "qmckl.h"
#include "munit.h"

View File

@ -1,34 +1,42 @@
# -*- mode: org -*-
* Function to get the value of a property.
#+NAME: get_value
#+begin_src elisp :var key="Type"
* Library of org-mode functions :noexport:
** Defines the name of the current file
#+NAME: filename
#+begin_src elisp :tangle no
(file-name-nondirectory (substring buffer-file-name 0 -4))
#+end_src
** Function to get the value of a property.
#+NAME: get_value
#+begin_src elisp :var key="Type"
(setq x (org-property-values key))
(pop x)
#+end_src
#+end_src
#+RESULTS: get_value
#+RESULTS: get_value
* Table of function arguments
** Table of function arguments
#+NAME: test
| qmckl_context | context | in | Global state |
| char | transa | in | Array ~A~ is ~'N'~: Normal, ~'T'~: Transposed |
| char | transb | in | Array ~B~ is ~'N'~: Normal, ~'T'~: Transposed |
| int64_t | m | in | Number of points in the first set |
| int64_t | n | in | Number of points in the second set |
| double | A[3][lda] | in | Array containing the $m \times 3$ matrix $A$ |
| int64_t | lda | in | Leading dimension of array ~A~ |
| double | B[3][ldb] | in | Array containing the $n \times 3$ matrix $B$ |
| int64_t | ldb | in | Leading dimension of array ~B~ |
| double | C[n][ldc] | out | Array containing the $m \times n$ matrix $C$ |
| int64_t | ldc | in | Leading dimension of array ~C~ |
#+NAME: test
| qmckl_context | context | in | Global state |
| char | transa | in | Array ~A~ is ~'N'~: Normal, ~'T'~: Transposed |
| char | transb | in | Array ~B~ is ~'N'~: Normal, ~'T'~: Transposed |
| int64_t | m | in | Number of points in the first set |
| int64_t | n | in | Number of points in the second set |
| double | A[3][lda] | in | Array containing the $m \times 3$ matrix $A$ |
| int64_t | lda | in | Leading dimension of array ~A~ |
| double | B[3][ldb] | in | Array containing the $n \times 3$ matrix $B$ |
| int64_t | ldb | in | Leading dimension of array ~B~ |
| double | C[n][ldc] | out | Array containing the $m \times n$ matrix $C$ |
| int64_t | ldc | in | Leading dimension of array ~C~ |
** Fortran-C type conversions
*** Fortran-C type conversions
#+NAME:f_of_c
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
#+NAME:f_of_c
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
f_of_c_d = { '' : ''
, 'qmckl_context' : 'integer (qmckl_context)'
, 'qmckl_exit_code' : 'integer (qmckl_exit_code)'
@ -38,10 +46,10 @@ f_of_c_d = { '' : ''
, 'double' : 'real (c_double )'
, 'char' : 'character'
}
#+END_SRC
#+END_SRC
#+NAME:c_of_f
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
#+NAME:c_of_f
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
ctypeid_d = { '' : ''
, 'qmckl_context' : 'integer (qmckl_context)'
, 'qmckl_exit_code' : 'integer (qmckl_exit_code)'
@ -51,12 +59,12 @@ ctypeid_d = { '' : ''
, 'real*8' : 'real(c_double)'
, 'character' : 'character(c_char)'
}
#+END_SRC
#+END_SRC
** Parse the table
*** Parse the table
#+NAME: parse_table
#+BEGIN_SRC python :results none :noweb yes :exports none
#+NAME: parse_table
#+BEGIN_SRC python :results none :noweb yes :exports none
def parse_table(table):
result = []
@ -86,12 +94,12 @@ def parse_table(table):
result.append(d)
return result
#+END_SRC
#+END_SRC
** Generates a C header
*** Generates a C header
#+NAME: generate_c_header
#+BEGIN_SRC python :var table=[] :var rettyp=[] :var fname=[] :results drawer :noweb yes :wrap "src c :tangle (eval h_func) :comments org"
#+NAME: generate_c_header
#+BEGIN_SRC python :var table=[] :var rettyp=[] :var fname=[] :results drawer :noweb yes :wrap "src c :tangle (eval h_func) :comments org"
<<parse_table>>
results = []
@ -116,18 +124,18 @@ template = f"""{rettyp} {fname} (
{results} ); """
return template
#+END_SRC
#+END_SRC
#+RESULTS: generate_c_header
#+begin_src c :tangle (eval h_func) :comments org
#+RESULTS: generate_c_header
#+begin_src c :tangle (eval h_func) :comments org
[] [] (
);
#+end_src
#+end_src
** Generates a C interface to the Fortran function
*** Generates a C interface to the Fortran function
#+NAME: generate_c_interface
#+BEGIN_SRC python :var table=[] :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
#+NAME: generate_c_interface
#+BEGIN_SRC python :var table=[] :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval f) :comments org :exports none"
<<c_of_f>>
<<f_of_c>>
<<parse_table>>
@ -176,13 +184,12 @@ results += [ ""
]
results='\n'.join(results)
return results
#+END_SRC
#+END_SRC
*** Generates a Fortran interface to the C function
** Generates a Fortran interface to the C function
#+NAME: generate_f_interface
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval fh) :comments org :exports none"
#+NAME: generate_f_interface
#+BEGIN_SRC python :var table=test :var rettyp="integer" :var fname=[] :results value :noweb yes :wrap "src f90 :tangle (eval fh) :comments org :exports none"
<<c_of_f>>
<<f_of_c>>
<<parse_table>>
@ -228,8 +235,8 @@ results += [ ""
]
results='\n'.join(results)
return results
#+END_SRC
#+END_SRC
#+RESULTS: generate_c_interface
#+begin_src f90 :tangle (eval f) :comments org :exports none
#+end_src
#+RESULTS: generate_c_interface
#+begin_src f90 :tangle (eval f) :comments org :exports none
#+end_src