2020-10-14 00:57:25 +02:00
|
|
|
* QMCkl source code
|
|
|
|
|
|
|
|
** Introduction
|
|
|
|
|
2020-10-14 09:54:12 +02:00
|
|
|
The main objective of present library is documentation. Therefore,
|
|
|
|
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 as
|
|
|
|
HTML or pdf.
|
2020-10-16 13:58:05 +02:00
|
|
|
For a tutorial on literate programming with org-mode, follow
|
2020-10-14 09:54:12 +02:00
|
|
|
[[http://www.howardism.org/Technical/Emacs/literate-programming-tutorial.html][this link]].
|
|
|
|
|
|
|
|
The code is extracted from the org files using Emacs as a command-line
|
|
|
|
tool in the =Makefile=, and then the produced files are compiled.
|
|
|
|
|
2020-10-16 13:58:05 +02:00
|
|
|
If the name of the file is =xxx.org=, the name of the produced C
|
|
|
|
files should be =xxx.c= and =xxx.h= and the name of the produced
|
|
|
|
Fortran files should be =xxx.f90=
|
|
|
|
|
2020-10-14 09:54:12 +02:00
|
|
|
*** Source code editing
|
|
|
|
|
|
|
|
Any text editor can be used to edit org-mode files. For a better
|
|
|
|
user experience Emacs is recommended.
|
|
|
|
For users hating Emacs, it is good to know that Emacs can behave
|
|
|
|
like Vim when switched into ``Evil'' mode. There also exists
|
2020-10-16 13:58:05 +02:00
|
|
|
[[https://www.spacemacs.org][Spacemacs]] which helps the transition for Vim users.
|
2020-10-14 09:54:12 +02:00
|
|
|
|
|
|
|
For users with a preference for Jupyter notebooks, the following
|
|
|
|
script can convert jupyter notebooks to org-mode files:
|
|
|
|
|
|
|
|
#+BEGIN_SRC sh tangle: nb_to_org.sh
|
|
|
|
#!/bin/bash
|
2020-10-16 13:58:05 +02:00
|
|
|
# $ nb_to_org.sh notebook.ipynb
|
|
|
|
# produces the org-mode file notebook.org
|
2020-10-14 09:54:12 +02:00
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
nb=$(basename $1 .ipynb)
|
|
|
|
jupyter nbconvert --to markdown ${nb}.ipynb --output ${nb}.md
|
|
|
|
pandoc ${nb}.md -o ${nb}.org
|
|
|
|
rm ${nb}.md
|
|
|
|
#+END_SRC
|
|
|
|
|
|
|
|
And pandoc can convert multiple markdown formats into org-mode.
|
|
|
|
|
|
|
|
*** 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
|
|
|
|
with =_f.f90= to be properly handled by the Makefile.
|
2020-10-16 13:58:05 +02:00
|
|
|
|
2020-10-14 00:57:25 +02:00
|
|
|
** Documentation
|
2020-10-14 00:52:50 +02:00
|
|
|
|
2020-10-14 09:55:08 +02:00
|
|
|
- [[qmckl_context.org][Context]]
|
2020-10-14 00:52:50 +02:00
|
|
|
|
|
|
|
|