10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-22 04:13:33 +01:00

Checks on Zkey

This commit is contained in:
Anthony Scemama 2018-03-09 00:08:12 +01:00
commit 7d0f8efffa
10 changed files with 87 additions and 32 deletions

View File

@ -1,4 +1,4 @@
(** A contracted shell is the set of functions is given by (** Set of contracted Gaussians with a given {!AngularMomentum.t}
{% \\[ {% \\[
(x-X_A)^{n_x} (y-Y_A)^{n_y} (z-Z_A)^{n_z} \sum_{i=1}^{m} \mathcal{N}_i f_i d_i \exp \left( -\alpha_i |r-R_A|^2 \right) (x-X_A)^{n_x} (y-Y_A)^{n_y} (z-Z_A)^{n_z} \sum_{i=1}^{m} \mathcal{N}_i f_i d_i \exp \left( -\alpha_i |r-R_A|^2 \right)
@ -15,7 +15,7 @@ where:
- {% $\mathcal{N}_i$ %} is the normalization coefficient of the i-th primitive: - {% $\mathcal{N}_i$ %} is the normalization coefficient of the i-th primitive:
{% \\[ {% \\[
\mathcal{N}_i = \sqrt{\iiint \left[ (x-X_A)^{l} \exp (-\alpha_i |r-R_A|^2) \right]^2 \, dx dy dz} \mathcal{N}_i = \sqrt{\iiint \left[ (x-X_A)^{l} \exp (-\alpha_i |r-R_A|^2) \right]^2 \, dx\, dy\, dz}
\\] %} \\] %}
- {% $f_i$ %} is a scaling factor adjusting the normalization coefficient for the - {% $f_i$ %} is a scaling factor adjusting the normalization coefficient for the
@ -23,7 +23,7 @@ where:
{% \\[ {% \\[
f_i = \frac{1}{\mathcal{N}_i} f_i = \frac{1}{\mathcal{N}_i}
\sqrt{\iiint \left[ (x-X_A)^{n_x} (y-Y_A)^{n_y} (z-Z_A)^{n_z} \exp (-\alpha_i |r-R_A|^2) \right]^2 \, dx dy dz} \sqrt{\iiint \left[ (x-X_A)^{n_x} (y-Y_A)^{n_y} (z-Z_A)^{n_z} \exp (-\alpha_i |r-R_A|^2) \right]^2 \, dx\, dy\, dz}
\\] %} \\] %}
*) *)

16
Basis/GamessReader.ml Normal file
View File

@ -0,0 +1,16 @@
let read_basis filename =
let lexbuf =
let ic = open_in filename in
Lexing.from_channel ic
in
let rec aux accu =
try
let key, basis =
GamessParser.input BasisLexer.read_all lexbuf
in
aux ((key, basis)::accu)
with
| Parsing.Parse_error -> List.rev accu
in
aux []

View File

@ -21,7 +21,7 @@ This plugin allows to embed equations in the documentation generated by Ocamldoc
Download the source code [here](https://github.com/scemama/odoc-ltxhtml). Download the source code [here](https://github.com/scemama/odoc-ltxhtml).
```bash ```bash
git clone https://github.com/akabe/odoc-ltxhtml git clone https://github.com/scemama/odoc-ltxhtml
cd odoc-ltxhtml cd odoc-ltxhtml
make install make install
``` ```

View File

@ -5,8 +5,8 @@ LIBS=
PKGS= PKGS=
OCAMLCFLAGS="-g -warn-error A" OCAMLCFLAGS="-g -warn-error A"
OCAMLOPTFLAGS="opt -O3 -nodynlink -remove-unused-arguments -rounds 16 -inline 100 -inline-max-unroll 100" OCAMLOPTFLAGS="opt -O3 -nodynlink -remove-unused-arguments -rounds 16 -inline 100 -inline-max-unroll 100"
ODOC_LTXHTML_DIR=qpackage.docdir/ltx #ODOC_LTXHTML_DIR=qpackage.docdir/ltx
ODOCFLAGS=-docflags "-g ltxhtml.cma" ODOCFLAGS=-docflags "-g ltxhtml.cma -sort"
OCAMLBUILD=ocamlbuild -j 0 -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) $(ODOCFLAGS) -Is $(INCLUDE_DIRS) -ocamlopt $(OCAMLOPTFLAGS) OCAMLBUILD=ocamlbuild -j 0 -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) $(ODOCFLAGS) -Is $(INCLUDE_DIRS) -ocamlopt $(OCAMLOPTFLAGS)
MLLFILES=$(wildcard */*.mll) $(wildcard *.mll) Utils/math_functions.c MLLFILES=$(wildcard */*.mll) $(wildcard *.mll) Utils/math_functions.c
MLYFILES=$(wildcard */*.mly) $(wildcard *.mly) MLYFILES=$(wildcard */*.mly) $(wildcard *.mly)

View File

@ -1,4 +1,4 @@
(** Azimuthal quantum number, represented as s,p,d,... *) (** Azimuthal quantum number, represented as {% $s,p,d,\dots$ %} *)
type t = S | P | D | F | G | H | I | J | K | L | M | N | O type t = S | P | D | F | G | H | I | J | K | L | M | N | O

View File

@ -3,28 +3,28 @@
val epsilon : float val epsilon : float
(** Value below which a float is considered null. Default is 10{^-20}. *) (** Value below which a float is considered null. Default is {% $\epsilon$ %} = 10{^-20}. *)
val integrals_cutoff : float val integrals_cutoff : float
(** Cutoff value for integrals. Default is 10{^-15}. *) (** Cutoff value for integrals. Default is 10{^-15}. *)
val pi : float val pi : float
(** pi = 3.141_592_653_589_793_12 *) (** {% $\pi$ %} = 3.141_592_653_589_793_12 *)
val sq_pi : float val sq_pi : float
(** [sqrt pi] *) (** {% $\sqrt{\pi}$ %} *)
val sq_pi_over_two : float val sq_pi_over_two : float
(** [(sqrt pi) /. 2.] *) (** {% $\frac{\sqrt{\pi}}{2}$ %} *)
val pi_inv : float val pi_inv : float
(** [ 1. /. pi ] *) (** {% $\frac{1}{\pi}$ %} *)
val two_over_sq_pi : float val two_over_sq_pi : float
(** [ 2. /. (sqrt pi) ] *) (** {% $\frac{2}{\sqrt{\pi}}$ %} *)
val a0 : float val a0 : float
(** Bohr radius : a{_0} = 0.529_177_210_671_2 Angstrom *) (** Bohr radius : {% $a_0$ %} = 0.529_177_210_671_2 Angstrom *)
val a0_inv : float val a0_inv : float
(** [ 1. /. a0 ] *) (** {% $\frac{1}{a_0}$ %} *)

View File

@ -3,7 +3,7 @@
type t = { type t = {
n_alpha : int ; (** Number of alpha electrons *) n_alpha : int ; (** Number of alpha electrons *)
n_beta : int ; (** Number of beta electrons *) n_beta : int ; (** Number of beta electrons *)
multiplicity : int ; (** Spin multiplicity: 2S+1 *) multiplicity : int ; (** Spin multiplicity: {% $2S+1$ %} *)
} }

View File

@ -1,6 +1,6 @@
(** All utilities which should be included in all source files are defined here *) (** All utilities which should be included in all source files are defined here *)
(** {1 Functions from libm} *) (** {2 Functions from libm} *)
external erf_float : float -> float = "erf_float_bytecode" "erf_float" external erf_float : float -> float = "erf_float_bytecode" "erf_float"
[@@unboxed] [@@noalloc] [@@unboxed] [@@noalloc]
@ -16,7 +16,7 @@ external gamma_float : float -> float = "gamma_float_bytecode" "gamma_float"
(** {1 General functions} *) (** {2 General functions} *)
val fact : int -> float val fact : int -> float
(** Factorial function. (** Factorial function.
@ -33,7 +33,7 @@ val chop : float -> (unit -> float) -> float
(** {1 Functions related to the Boys function} *) (** {2 Functions related to the Boys function} *)
val incomplete_gamma : alpha:float -> float -> float val incomplete_gamma : alpha:float -> float -> float
(** {{:https://en.wikipedia.org/wiki/Incomplete_gamma_function} (** {{:https://en.wikipedia.org/wiki/Incomplete_gamma_function}
@ -48,7 +48,7 @@ val boys_function : maxm:int -> float -> float array
*) *)
(** {1 Extension of the Array module} *) (** {2 Extension of the Array module} *)
val array_sum : float array -> float val array_sum : float array -> float
(** Returns the sum of all the elements of the array *) (** Returns the sum of all the elements of the array *)
@ -57,7 +57,7 @@ val array_product : float array -> float
(** Returns the product of all the elements of the array *) (** Returns the product of all the elements of the array *)
(** {1 Linear algebra } *) (** {2 Linear algebra } *)
val diagonalize_symm : Lacaml.D.mat -> Lacaml.D.mat * Lacaml.D.vec val diagonalize_symm : Lacaml.D.mat -> Lacaml.D.mat * Lacaml.D.vec
(** Diagonalize a symmetric matrix. Returns the eigenvectors and the eigenvalues. *) (** Diagonalize a symmetric matrix. Returns the eigenvectors and the eigenvalues. *)

View File

@ -35,20 +35,39 @@ type kind =
| Nine of (Powers.t * Powers.t * Powers.t) | Nine of (Powers.t * Powers.t * Powers.t)
| Twelve of (Powers.t * Powers.t * Powers.t * Powers.t) | Twelve of (Powers.t * Powers.t * Powers.t * Powers.t)
let of_powers_three { x=a ; y=b ; z=c ; _ } = make 3 a <+ b <+ c let of_powers_three { x=a ; y=b ; z=c ; _ } =
assert (
let alpha = a lor b lor c in
alpha >= 0 && alpha < (1 lsl 15)
);
make 3 a <+ b <+ c
let of_powers_six { x=a ; y=b ; z=c ; _ } { x=d ; y=e ; z=f ; _ } = let of_powers_six { x=a ; y=b ; z=c ; _ } { x=d ; y=e ; z=f ; _ } =
make 6 a << b << c << d << e << f assert (
let alpha = a lor b lor c lor d lor e lor f in
let of_powers_twelve { x=a ; y=b ; z=c ; _ } { x=d ; y=e ; z=f ; _ } alpha >= 0 && alpha < (1 lsl 10)
{ x=g ; y=h ; z=i ; _ } { x=j ; y=k ; z=l ; _ } = );
make 12 a << b << c << d << e << f make 6 a << b << c << d << e << f
<| g << h << i << j << k << l
let of_powers_nine { x=a ; y=b ; z=c ; _ } { x=d ; y=e ; z=f ; _ } let of_powers_nine { x=a ; y=b ; z=c ; _ } { x=d ; y=e ; z=f ; _ }
{ x=g ; y=h ; z=i ; _ } = { x=g ; y=h ; z=i ; _ } =
make 9 a << b << c << d << e << f assert (
<| g << h << i let alpha = a lor b lor c lor d lor e lor f lor g lor h lor i in
alpha >= 0 && alpha < (1 lsl 10)
);
make 9 a << b << c << d << e << f
<| g << h << i
let of_powers_twelve { x=a ; y=b ; z=c ; _ } { x=d ; y=e ; z=f ; _ }
{ x=g ; y=h ; z=i ; _ } { x=j ; y=k ; z=l ; _ } =
assert (
let alpha = a lor b lor c lor d lor e lor f
lor g lor h lor i lor j lor k lor l
in
alpha >= 0 && alpha < (1 lsl 10)
);
make 12 a << b << c << d << e << f
<| g << h << i << j << k << l
let of_powers a = let of_powers a =

View File

@ -1,6 +1,26 @@
(** Encodes the powers of x, y, z in a compact form, suitable for being (** Encodes the powers of x, y, z in a compact form, suitable for being
used in a hash table. used as keys in a hash table.
*)
Internally, the {Zkey.t} is made of two integers, [left] and [right].
The small integers x, y and z are stored compactly in this 126-bits
space:
{[
Left Right
3 [--------------------------------------------------------------] [------------------|---------------|---------------|---------------]
x y z
6 [--------------------------------------------------------------] [---|----------|----------|----------|----------|----------|---------]
x1 y1 z1 x2 y2 z2
9 [---------------------------------|----------|----------|---------] [---|----------|----------|----------|----------|----------|---------]
x1 y1 z1 x2 y2 z2 x3 y3 z3
12 [---|----------|----------|----------|----------|----------|---------] [---|----------|----------|----------|----------|----------|---------]
x1 y1 z1 x2 y2 z2 x3 y3 z3 x4 y4 z4
]}
*)
type t type t