mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-08-28 23:42:00 +02:00
Documentation and printing
This commit is contained in:
parent
7cccb60549
commit
8aaf6da208
@ -56,8 +56,8 @@ let to_string b =
|
||||
-----------------------------------------------------------------------
|
||||
"
|
||||
^
|
||||
( Array.map (fun i ->
|
||||
Cs.to_string i) b
|
||||
( Array.map (fun p -> Format.(fprintf str_formatter "%a" Cs.pp p;
|
||||
flush_str_formatter ())) b
|
||||
|> Array.to_list
|
||||
|> String.concat line
|
||||
)
|
||||
|
@ -14,9 +14,9 @@ val to_string : t -> string
|
||||
val of_nuclei_and_general_basis : Nuclei.t -> GeneralBasis.t -> t
|
||||
(** Takes an array of {!Nuclei.t}, and a {!GeneralBasis.t} (such as cc-pVDZ
|
||||
for instance) and creates the corresponding atomic basis set.
|
||||
All the {!Element.t}s of the array of {!Nuclei.t} are searched in
|
||||
All the {!Element.t}'s of the array of {!Nuclei.t} are searched in
|
||||
the {!GeneralBasis.t}, and the basis is built by creating
|
||||
{!ContractedShell.t}s centered on the nuclei with the exponents
|
||||
{!ContractedShell.t}'s centered on the nuclei with the exponents
|
||||
and contraction coefficients given by the {!GeneralBasis.t}.
|
||||
*)
|
||||
|
||||
|
@ -56,20 +56,6 @@ let with_index a i =
|
||||
{ a with index = i }
|
||||
|
||||
|
||||
let to_string s =
|
||||
let coord = s.center in
|
||||
let open Printf in
|
||||
(match s.totAngMom with
|
||||
| Am.S -> sprintf "%3d " (s.index+1)
|
||||
| _ -> sprintf "%3d-%-3d" (s.index+1) (s.index+(Array.length s.norm_coef_scale))
|
||||
) ^
|
||||
( sprintf "%1s %8.3f %8.3f %8.3f " (Am.to_string s.totAngMom)
|
||||
(get X coord) (get Y coord) (get Z coord) ) ^
|
||||
(Array.map2 (fun e c -> sprintf "%16.8e %16.8e" e c) s.expo s.coef
|
||||
|> Array.to_list |> String.concat (sprintf "\n%36s" " ") )
|
||||
|
||||
|
||||
|
||||
let expo x = x.expo
|
||||
|
||||
let coef x = x.coef
|
||||
@ -93,8 +79,9 @@ let prim x = x.prim
|
||||
|
||||
(** {2 Printers} *)
|
||||
|
||||
let pp ppf x =
|
||||
let open Format in
|
||||
open Format
|
||||
|
||||
let pp_debug ppf x =
|
||||
fprintf ppf "@[<2>{@ ";
|
||||
fprintf ppf "@[<2>expo =@ %a ;@]@ " pp_float_array_size x.expo;
|
||||
fprintf ppf "@[<2>coef =@ %a ;@]@ " pp_float_array_size x.coef;
|
||||
@ -105,3 +92,14 @@ let pp ppf x =
|
||||
fprintf ppf "@[<2>index =@ %d ;@]@ " x.index;
|
||||
fprintf ppf "}@,@]"
|
||||
|
||||
let pp ppf s =
|
||||
(match s.totAngMom with
|
||||
| Am.S -> fprintf ppf "@[%3d@] " (s.index+1)
|
||||
| _ -> fprintf ppf "@[%3d-%-3d@]" (s.index+1) (s.index+(Array.length s.norm_coef_scale))
|
||||
);
|
||||
fprintf ppf "@[%a@ %a@]@[" Am.pp_string s.totAngMom Co.pp s.center;
|
||||
Array.iter2 (fun e c -> fprintf ppf "@[%16.8e %16.8e@]@;" e c) s.expo s.coef;
|
||||
fprintf ppf "@]"
|
||||
|
||||
|
||||
|
||||
|
@ -28,9 +28,6 @@ where:
|
||||
|
||||
type t
|
||||
|
||||
val to_string : t -> string
|
||||
(** Pretty-printing of the contracted shell in a string. *)
|
||||
|
||||
val make : ?index:int -> (float * PrimitiveShell.t) array -> t
|
||||
(** Creates a contracted shell from a list of coefficients and primitives. *)
|
||||
|
||||
|
2
Makefile
2
Makefile
@ -6,7 +6,7 @@ PKGS=
|
||||
OCAMLCFLAGS="-g -warn-error A"
|
||||
OCAMLOPTFLAGS="opt -O3 -nodynlink -remove-unused-arguments -rounds 16 -inline 100 -inline-max-unroll 100"
|
||||
#ODOC_LTXHTML_DIR=qpackage.docdir/ltx
|
||||
ODOCFLAGS=-docflags "-g ltxhtml.cma -sort"
|
||||
ODOCFLAGS=-docflags "-g ltxhtml.cma -sort -css-style $(PWD)/style.css -colorize-code"
|
||||
OCAMLBUILD=ocamlbuild -j 0 -cflags $(OCAMLCFLAGS) -lflags $(OCAMLCFLAGS) $(ODOCFLAGS) -Is $(INCLUDE_DIRS) -ocamlopt $(OCAMLOPTFLAGS)
|
||||
MLLFILES=$(wildcard */*.mll) $(wildcard *.mll) Utils/math_functions.c
|
||||
MLYFILES=$(wildcard */*.mly) $(wildcard *.mly)
|
||||
|
@ -8,24 +8,31 @@ exception AngularMomentumError of string
|
||||
(** Raised when the {!AngularMomentum.t} element can't be created.
|
||||
*)
|
||||
|
||||
|
||||
val of_char : char -> t
|
||||
(** Returns an {!AngularMomentum.t} when a shell is given as a character (case
|
||||
insensitive).
|
||||
|
||||
Example:
|
||||
|
||||
[AngularMomentum.of_char 'p' -> AngularMomentum.P]
|
||||
{[
|
||||
AngularMomentum.of_char 'p' -> AngularMomentum.P
|
||||
]}
|
||||
*)
|
||||
|
||||
val to_string : t -> string
|
||||
(**
|
||||
[AngularMomentum.(to_string D) -> "D"]
|
||||
{[
|
||||
AngularMomentum.(to_string D) -> "D"
|
||||
]}
|
||||
*)
|
||||
|
||||
|
||||
val to_char : t -> char
|
||||
(**
|
||||
[AngularMomentum.(to_char D) -> 'D']
|
||||
{[
|
||||
AngularMomentum.(to_char D) -> 'D'
|
||||
]}
|
||||
*)
|
||||
|
||||
|
||||
@ -35,7 +42,9 @@ val to_int : t -> int
|
||||
|
||||
Example:
|
||||
|
||||
[AngularMomentum.of_int 3 -> AngularMomentum.F]
|
||||
{[
|
||||
AngularMomentum.of_int 3 -> AngularMomentum.F
|
||||
]}
|
||||
*)
|
||||
|
||||
val of_int : int -> t
|
||||
@ -44,7 +53,9 @@ val of_int : int -> t
|
||||
|
||||
Example:
|
||||
|
||||
[AngularMomentum.of_int 3 -> AngularMomentum.F]
|
||||
{[
|
||||
AngularMomentum.of_int 3 -> AngularMomentum.F
|
||||
]}
|
||||
*)
|
||||
|
||||
type kind =
|
||||
@ -59,7 +70,9 @@ val n_functions : t -> int
|
||||
|
||||
Example:
|
||||
|
||||
[AngularMomentum.n_functions D -> 6]
|
||||
{[
|
||||
AngularMomentum.n_functions D -> 6
|
||||
]}
|
||||
*)
|
||||
|
||||
|
||||
@ -69,7 +82,7 @@ val zkey_array : kind -> Zkey.t array
|
||||
|
||||
Example:
|
||||
|
||||
{[
|
||||
{[
|
||||
AngularMomentum.( zkey_array Doublet (P,S) ) ->
|
||||
[| {Zkey.left = 0; right = 1125899906842624} ;
|
||||
{Zkey.left = 0; right = 1099511627776} ;
|
||||
@ -84,9 +97,9 @@ val zkey_array : kind -> Zkey.t array
|
||||
in
|
||||
Array.map (fun (a,b) -> {!Zkey.of_powers_six} a b)
|
||||
[| (x,s) ; (y,s) ; (z,s) |]
|
||||
]}
|
||||
]}
|
||||
|
||||
*)
|
||||
*)
|
||||
|
||||
val ( + ) : t -> t -> t
|
||||
val ( - ) : t -> t -> t
|
||||
|
@ -8,6 +8,5 @@ type t = private {
|
||||
|
||||
|
||||
val make : Point.t -> t
|
||||
(** Create from a {!Point.t}. *)
|
||||
|
||||
|
||||
|
@ -1,10 +1,11 @@
|
||||
type t = float
|
||||
|
||||
let of_float x = x
|
||||
external of_float : float -> t = "%identity"
|
||||
external to_float : t -> float = "%identity"
|
||||
|
||||
let of_int i = float_of_int i
|
||||
let of_string s = float_of_string s
|
||||
|
||||
let to_float x = x
|
||||
let to_int x = int_of_float x
|
||||
let to_string x =
|
||||
if x >= 0. then
|
||||
@ -23,3 +24,9 @@ let ( * ) a b =
|
||||
|
||||
let ( / ) a b =
|
||||
(to_float a) /. b |> of_float
|
||||
|
||||
let pp ppf x =
|
||||
if x > 0. then
|
||||
Format.fprintf ppf "@[+%f@]" (to_float x)
|
||||
else
|
||||
Format.fprintf ppf "@[%f@]" (to_float x)
|
||||
|
@ -1,18 +1,25 @@
|
||||
(** This type should be used for all charges in the program (electrons, nuclei,...). *)
|
||||
|
||||
type t = private float
|
||||
type t
|
||||
|
||||
(** {2 Conversions} *)
|
||||
|
||||
val of_float : float -> t
|
||||
val of_int : int -> t
|
||||
val of_string: string -> t
|
||||
|
||||
val to_float : t -> float
|
||||
val of_float : float -> t
|
||||
|
||||
val to_int : t -> int
|
||||
val of_int : int -> t
|
||||
|
||||
val to_string: t -> string
|
||||
val of_string: string -> t
|
||||
|
||||
(** {2 Operations} *)
|
||||
|
||||
val ( + ) : t -> t -> t
|
||||
val ( - ) : t -> t -> t
|
||||
val ( * ) : t -> float -> t
|
||||
val ( / ) : t -> float -> t
|
||||
|
||||
(** {2 Printers } *)
|
||||
|
||||
val pp : Format.formatter -> t -> unit
|
||||
|
||||
|
@ -1,6 +1,7 @@
|
||||
(** All constants used in the program.
|
||||
*)
|
||||
|
||||
(** {2 Thresholds } *)
|
||||
|
||||
val epsilon : float
|
||||
(** Value below which a float is considered null. Default is {% $\epsilon$ %} = 10{^-20}. *)
|
||||
@ -8,6 +9,8 @@ val epsilon : float
|
||||
val integrals_cutoff : float
|
||||
(** Cutoff value for integrals. Default is 10{^-15}. *)
|
||||
|
||||
(** {2 Mathematical constants } *)
|
||||
|
||||
val pi : float
|
||||
(** {% $\pi$ %} = 3.141_592_653_589_793_12 *)
|
||||
|
||||
@ -23,8 +26,11 @@ val pi_inv : float
|
||||
val two_over_sq_pi : float
|
||||
(** {% $\frac{2}{\sqrt{\pi}}$ %} *)
|
||||
|
||||
(** {2 Physical constants} *)
|
||||
|
||||
val a0 : float
|
||||
(** Bohr radius : {% $a_0$ %} = 0.529_177_210_671_2 Angstrom *)
|
||||
|
||||
val a0_inv : float
|
||||
(** {% $\frac{1}{a_0}$ %} *)
|
||||
|
||||
|
@ -77,11 +77,16 @@ let get axis { Bohr.x ; y ; z } =
|
||||
| Z -> z
|
||||
|
||||
|
||||
open Format
|
||||
let pp ppf c =
|
||||
let open Bohr in
|
||||
fprintf ppf "@[@[%8.4f@] @[%8.4f@] @[%8.4f@]@]" c.x c.y c.z
|
||||
|
||||
let pp_bohr ppf c =
|
||||
let open Bohr in
|
||||
Format.fprintf ppf "@[(@[%10f@], @[%10f@], @[%10f@] Bohr)@]" c.x c.y c.z
|
||||
fprintf ppf "@[(@[%10f@], @[%10f@], @[%10f@] Bohr)@]" c.x c.y c.z
|
||||
|
||||
let pp_angstrom ppf c =
|
||||
let c = bohr_to_angstrom c in
|
||||
let open Angstrom in
|
||||
Format.fprintf ppf "@[(@[%10f@], @[%10f@], @[%10f@] Angs)@]" c.x c.y c.z
|
||||
fprintf ppf "@[(@[%10f@], @[%10f@], @[%10f@] Angs)@]" c.x c.y c.z
|
||||
|
@ -84,6 +84,8 @@ val norm : Bohr.t -> float
|
||||
|
||||
(** {2 Printers} *)
|
||||
|
||||
val pp: Format.formatter -> Bohr.t -> unit
|
||||
|
||||
val pp_bohr: Format.formatter -> Bohr.t -> unit
|
||||
|
||||
val pp_angstrom : Format.formatter -> Bohr.t -> unit
|
||||
|
86
style.css
Normal file
86
style.css
Normal file
@ -0,0 +1,86 @@
|
||||
img.ltxhtml { vertical-align : middle }
|
||||
.keyword { font-weight : bold ; color : Red }
|
||||
.keywordsign { color : #C04600 }
|
||||
.comment { color : Green }
|
||||
.constructor { color : Blue }
|
||||
.type { color : #5C6585 }
|
||||
.string { color : Maroon }
|
||||
.warning { color : Red ; font-weight : bold }
|
||||
.info { margin-left : 3em; margin-right: 3em }
|
||||
.param_info { margin-top: 4px; margin-left : 3em; margin-right : 3em }
|
||||
.code { color : #465F91 ; }
|
||||
.typetable { border-style : hidden }
|
||||
.paramstable { border-style : hidden ; padding: 5pt 5pt}
|
||||
tr { }
|
||||
td.typefieldcomment { font-size: smaller ;}
|
||||
div.sig_block {margin-left: 2em}
|
||||
*:target { background: yellow; }
|
||||
body {
|
||||
font: 10pt sans-serif;
|
||||
color: black;
|
||||
text-align: left;
|
||||
padding: 5px;
|
||||
margin: 1.375em 5%;
|
||||
min-width: 40ex;
|
||||
max-width: 100ex;
|
||||
background-color: White;
|
||||
}
|
||||
h1 {
|
||||
font-size : 1.5em;
|
||||
text-align: left;
|
||||
margin-top: 0.5em;
|
||||
padding-top: 0.8em;
|
||||
margin-bottom: 1.0em;
|
||||
padding-bottom: 0.0em;
|
||||
border-top-style:solid;
|
||||
border-width:1px;
|
||||
border-color:#AAA;
|
||||
}
|
||||
h2 {
|
||||
font-size : 1.3em;
|
||||
text-align: left;
|
||||
margin-top: 0.5em;
|
||||
padding-top: 0.8em;
|
||||
margin-bottom: 1.0em;
|
||||
padding-bottom: 0.0em;
|
||||
border-top-style:solid;
|
||||
border-width:1px;
|
||||
border-color:#AAA;
|
||||
}
|
||||
h3 {
|
||||
font-size : 1.2em;
|
||||
text-align: left;
|
||||
margin-top: 0.5em;
|
||||
padding-top: 0.8em;
|
||||
margin-bottom: 1.0em;
|
||||
padding-bottom: 0.0em;
|
||||
font-style: italic;
|
||||
font-weight: normal
|
||||
}
|
||||
a {color: #416DFF; text-decoration: none}
|
||||
a:hover {background-color: #ddd; text-decoration: underline}
|
||||
pre
|
||||
{
|
||||
font-family: monospace;
|
||||
}
|
||||
pre.verbatim, pre.codepre {
|
||||
padding: 1.0em;
|
||||
padding-right: 1.0em;
|
||||
background-color:#F8F8F8;
|
||||
}
|
||||
.indextable {
|
||||
border: 1px #ddd solid;
|
||||
border-collapse: collapse;
|
||||
font-size: 1.0em;
|
||||
}
|
||||
.indextable td, .indextable th {border: 1px #ddd solid; min-width: 80px}
|
||||
.indextable td.module {background-color: #eee ; padding-left: 2px; padding-right: 2px}
|
||||
.indextable td.module a {color: #4E6272; text-decoration: none; display: block; width: 100%}
|
||||
.indextable td.module a:hover {text-decoration: underline; background-color: transparent}
|
||||
.deprecated {color: #888; font-style: italic}
|
||||
.indextable tr td div.info { margin-left: 2px; margin-right: 2px }
|
||||
ul.indexlist { margin-left: 0; padding-left: 0;}
|
||||
ul.indexlist li { list-style-type: none ; margin-left: 0; padding-left: 0; }
|
||||
ul.info-attributes {list-style: none; margin: 0; padding: 0; }
|
||||
div.info > p:first-child { margin-top:0; }
|
||||
div.info-desc > p:first-child { margin-top:0; margin-bottom:0; }
|
Loading…
Reference in New Issue
Block a user