diff --git a/src/qmckl_ao.org b/src/qmckl_ao.org index 22026a5..2653737 100644 --- a/src/qmckl_ao.org +++ b/src/qmckl_ao.org @@ -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 diff --git a/src/qmckl_context.org b/src/qmckl_context.org index 8c6e8d4..c6ae818 100644 --- a/src/qmckl_context.org +++ b/src/qmckl_context.org @@ -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" diff --git a/src/qmckl_distance.org b/src/qmckl_distance.org index cdd2fa9..3b99f6c 100644 --- a/src/qmckl_distance.org +++ b/src/qmckl_distance.org @@ -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" diff --git a/src/qmckl_error.org b/src/qmckl_error.org index be4b293..4bfdfad 100644 --- a/src/qmckl_error.org +++ b/src/qmckl_error.org @@ -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 diff --git a/src/qmckl_memory.org b/src/qmckl_memory.org index d9a4657..c6bfe09 100644 --- a/src/qmckl_memory.org +++ b/src/qmckl_memory.org @@ -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 #include diff --git a/src/qmckl_numprec.org b/src/qmckl_numprec.org index a20537b..ea082de 100644 --- a/src/qmckl_numprec.org +++ b/src/qmckl_numprec.org @@ -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" diff --git a/tools/lib.org b/tools/lib.org index e6e5216..6c57ec0 100644 --- a/tools/lib.org +++ b/tools/lib.org @@ -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" <> 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" <> <> <> @@ -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" <> <> <> @@ -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