10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-07 06:33:39 +01:00

Added constants.org

This commit is contained in:
Anthony Scemama 2020-12-27 16:55:53 +01:00
parent 0838da5bcc
commit 8efb05beb9
3 changed files with 171 additions and 38 deletions

102
common/constants.org Normal file
View File

@ -0,0 +1,102 @@
#+begin_src elisp tangle: no :results none
(setq pwd (file-name-directory buffer-file-name))
(setq name (file-name-nondirectory (substring buffer-file-name 0 -4)))
(setq lib (concat pwd "lib/"))
(setq testdir (concat pwd "test/"))
(setq mli (concat lib name ".mli"))
(setq ml (concat lib name ".ml"))
(setq test-ml (concat testdir name ".ml"))
(org-babel-tangle)
#+end_src
* Constants
:PROPERTIES:
:header-args: :noweb yes :comments both
:END:
All constants used in the program.
#+begin_src ocaml :tangle (eval mli)
#+end_src
#+begin_src ocaml :tangle (eval ml) :exports none
#+end_src
** Thresholds
*** ~epsilon~
Value below which a float is considered null. Default is
\epsilon = 2.10^{-15}.
#+begin_src ocaml :tangle (eval mli)
val epsilon : float
#+end_src
#+begin_src ocaml :tangle (eval ml) :exports none
let epsilon = 2.e-15
#+end_src
*** ~integrals_cutoff~
Cutoff value for integrals. Default is \epsilon .
#+begin_src ocaml :tangle (eval mli)
val integrals_cutoff : float
#+end_src
#+begin_src ocaml :tangle (eval ml) :exports none
let integrals_cutoff = epsilon
#+end_src
** Mathematical constants
| ~pi~ | $\pi = 3.141~592~653~589~793~12$ |
| ~two_pi~ | $2 \pi$ |
| ~sq_pi~ | $\sqrt{\pi}$ |
| ~sq_pi_over_two~ | $\sqrt{\pi} / 2$ |
| ~pi_inv~ | $1 / \pi$ |
| ~two_over_sq_pi~ | $2 / \sqrt{\pi}$ |
#+begin_src ocaml :tangle (eval mli)
val pi : float
val two_pi : float
val sq_pi : float
val sq_pi_over_two : float
val pi_inv : float
val two_over_sq_pi : float
#+end_src
#+begin_src ocaml :tangle (eval ml) :exports none
let pi = acos (-1.)
let two_pi = 2. *. pi
let sq_pi = sqrt pi
let sq_pi_over_two = sq_pi *. 0.5
let pi_inv = 1. /. pi
let two_over_sq_pi = 2. /. sq_pi
#+end_src
** Physical constants
| ~a0~ | Bohr's radius : $a_0 = 0.529~177~210~67(23)$ angstrom |
| ~a0_inv~ | $1 / a_0$ |
| ~ha_to_ev~ | Hartree to eV conversion factor : $27.211~386~02(17)$ |
| ~ev_to_ha~ | eV to Hartree conversion factor : 1 / ~ha_to_ev~ |
#+begin_src ocaml :tangle (eval mli)
val a0 : float
val a0_inv : float
val ha_to_ev : float
val ev_to_ha : float
#+end_src
#+begin_src ocaml :tangle (eval ml) :exports none
let a0 = 0.529_177_210_67
let a0_inv = 1. /. a0
let ha_to_ev = 27.211_386_02
let ev_to_ha = 1. /. ha_to_ev
#+end_src

View File

@ -1,15 +1,27 @@
let epsilon = 2.e-15 (* [[file:../constants.org::*Constants][Constants:2]] *)
let integrals_cutoff = epsilon
(** Constants *) (* Constants:2 ends here *)
(* [[file:../constants.org::*~epsilon~][~epsilon~:2]] *)
let epsilon = 2.e-15
(* ~epsilon~:2 ends here *)
(* [[file:../constants.org::*~integrals_cutoff~][~integrals_cutoff~:2]] *)
let integrals_cutoff = epsilon
(* ~integrals_cutoff~:2 ends here *)
(* [[file:../constants.org::*Mathematical constants][Mathematical constants:2]] *)
let pi = acos (-1.) let pi = acos (-1.)
let two_pi = 2. *. pi let two_pi = 2. *. pi
let sq_pi = sqrt pi let sq_pi = sqrt pi
let sq_pi_over_two = sq_pi *. 0.5 let sq_pi_over_two = sq_pi *. 0.5
let pi_inv = 1. /. pi let pi_inv = 1. /. pi
let two_over_sq_pi = 2. /. (sqrt pi) let two_over_sq_pi = 2. /. sq_pi
(* Mathematical constants:2 ends here *)
(* [[file:../constants.org::*Physical constants][Physical constants:2]] *)
let a0 = 0.529_177_210_67 let a0 = 0.529_177_210_67
let a0_inv = 1. /. a0 let a0_inv = 1. /. a0
let ha_to_ev = 27.211_386_02 let ha_to_ev = 27.211_386_02
let ev_to_ha = 1. /. ha_to_ev let ev_to_ha = 1. /. ha_to_ev
(* Physical constants:2 ends here *)

View File

@ -1,45 +1,64 @@
(** All constants used in the program. (* Constants
*) * :PROPERTIES:
* :header-args: :noweb yes :comments both
* :END:
*
* All constants used in the program. *)
(** {2 Thresholds } *)
(* [[file:../constants.org::*Constants][Constants:1]] *)
(* Constants:1 ends here *)
(* ~epsilon~
*
* Value below which a float is considered null. Default is
* \epsilon = 2.10^{-15}. *)
(* [[file:../constants.org::*~epsilon~][~epsilon~:1]] *)
val epsilon : float val epsilon : float
(** Value below which a float is considered null. Default is {% $\epsilon$ %} = 10{^-20}. *) (* ~epsilon~:1 ends here *)
(* ~integrals_cutoff~
*
* Cutoff value for integrals. Default is \epsilon . *)
(* [[file:../constants.org::*~integrals_cutoff~][~integrals_cutoff~:1]] *)
val integrals_cutoff : float val integrals_cutoff : float
(** Cutoff value for integrals. Default is 10{^-15}. *) (* ~integrals_cutoff~:1 ends here *)
(** {2 Mathematical constants } *) (* Mathematical constants
*
* | ~pi~ | $\pi = 3.141~592~653~589~793~12$ |
* | ~two_pi~ | $2 \pi$ |
* | ~sq_pi~ | $\sqrt{\pi}$ |
* | ~sq_pi_over_two~ | $\sqrt{\pi} / 2$ |
* | ~pi_inv~ | $1 / \pi$ |
* | ~two_over_sq_pi~ | $2 / \sqrt{\pi}$ | *)
(* [[file:../constants.org::*Mathematical constants][Mathematical constants:1]] *)
val pi : float val pi : float
(** {% $\pi$ %} = 3.141_592_653_589_793_12 *)
val two_pi : float val two_pi : float
(** {% $2\pi$ %} *)
val sq_pi : float val sq_pi : float
(** {% $\sqrt{\pi}$ %} *)
val sq_pi_over_two : float val sq_pi_over_two : float
(** {% $\frac{\sqrt{\pi}}{2}$ %} *)
val pi_inv : float val pi_inv : float
(** {% $\frac{1}{\pi}$ %} *)
val two_over_sq_pi : float val two_over_sq_pi : float
(** {% $\frac{2}{\sqrt{\pi}}$ %} *) (* Mathematical constants:1 ends here *)
(** {2 Physical constants} *) (* Physical constants
*
* | ~a0~ | Bohr's radius : $a_0 = 0.529~177~210~67(23)$ angstrom |
* | ~a0_inv~ | $1 / a_0$ |
* | ~ha_to_ev~ | Hartree to eV conversion factor : $27.211~386~02(17)$ |
* | ~ev_to_ha~ | eV to Hartree conversion factor : 1 / ~ha_to_ev~ | *)
(* [[file:../constants.org::*Physical constants][Physical constants:1]] *)
val a0 : float val a0 : float
(** Bohr radius : {% $a_0$ %} = 0.529 177 210 67(23) Angstrom *)
val a0_inv : float val a0_inv : float
(** {% $\frac{1}{a_0}$ %} *)
val ha_to_ev : float val ha_to_ev : float
(** Hartree to eV conversion factor :: 27.211 386 02(17) *)
val ev_to_ha : float val ev_to_ha : float
(** eV to Hartree conversion factor : 1/{ha_to_ev} *) (* Physical constants:1 ends here *)