10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-06 22:23:42 +01:00

Documentation

This commit is contained in:
Anthony Scemama 2018-02-25 00:53:09 +01:00
parent 8918f49302
commit 24d2eb7e47
12 changed files with 75 additions and 21 deletions

View File

@ -192,9 +192,9 @@ let of_basis basis =
let xl = to_powers powers_l in
let key =
if swap then
Zkey.of_powers (Zkey.Twelve (xk,xl,xi,xj))
Zkey.of_powers_twelve xk xl xi xj
else
Zkey.of_powers (Zkey.Twelve (xi,xj,xk,xl))
Zkey.of_powers_twelve xi xj xk xl
in
let value =
Zmap.find cls key

View File

@ -140,7 +140,7 @@ let of_basis basis =
let i_c = shell.(i).index + i_c + 1 in
let xi = to_powers powers_i in
let key =
Zkey.of_powers (Zkey.Six (xi,xj))
Zkey.of_powers_six xi xj
in
let value =
try Zmap.find cls key

View File

@ -79,7 +79,7 @@ let of_basis_nuclei basis nuclei =
let j_c = shell.(j).index + j_c + 1 in
let xj = to_powers powers_j in
let key =
Zkey.of_powers (Zkey.Six (xi,xj))
Zkey.of_powers_six xi xj
in
let value =
Zmap.find cls key

View File

@ -37,7 +37,7 @@ let hvrr_one_e angMom_a angMom_b
match angMom_a.Po.tot with
| 0 -> zero_m_array
| _ ->
let key = Zkey.of_powers (Zkey.Three angMom_a) in
let key = Zkey.of_powers_three angMom_a in
try Zmap.find map key with
| Not_found ->

View File

@ -12,7 +12,7 @@ let make_lowdin ?(thresh=1.e-12) ~overlap =
let u_vec, u_val = diagonalize_symm overlap in
Vec.iter (fun x -> if x < thresh then
invalid_arg "Orthonormalization.make_lowdin") u_val;
invalid_arg (__FILE__^": make_lowdin") ) u_val;
let u_val = Vec.reci (Vec.sqrt u_val) in

View File

@ -114,7 +114,7 @@ let of_basis basis =
let i_c = shell.(i).index + i_c + 1 in
let xi = to_powers powers_i in
let key =
Zkey.of_powers (Zkey.Six (xi,xj))
Zkey.of_powers_six xi xj
in
let value =
try Zmap.find cls key

View File

@ -96,12 +96,11 @@ let zkey_array a =
begin
match a with
| Singlet l1 ->
List.map (fun x -> Zkey.of_powers (Zkey.Three x)) (keys_1d @@ to_int l1)
List.map (fun x -> Zkey.of_powers_three x) (keys_1d @@ to_int l1)
| Doublet (l1, l2) ->
List.map (fun a ->
List.map (fun b ->
Zkey.of_powers (Zkey.Six (a,b))) (keys_1d @@ to_int l2)
List.map (fun b -> Zkey.of_powers_six a b) (keys_1d @@ to_int l2)
) (keys_1d @@ to_int l1)
|> List.concat
@ -110,7 +109,7 @@ let zkey_array a =
List.map (fun a ->
List.map (fun b ->
List.map (fun c ->
Zkey.of_powers (Zkey.Nine (a,b,c))) (keys_1d @@ to_int l3)
Zkey.of_powers_nine a b c) (keys_1d @@ to_int l3)
) (keys_1d @@ to_int l2)
|> List.concat
) (keys_1d @@ to_int l1)
@ -122,7 +121,7 @@ let zkey_array a =
List.map (fun b ->
List.map (fun c ->
List.map (fun d ->
Zkey.of_powers (Zkey.Twelve (a,b,c,d))) (keys_1d @@ to_int l4)
Zkey.of_powers_twelve a b c d) (keys_1d @@ to_int l4)
) (keys_1d @@ to_int l3)
|> List.concat
) (keys_1d @@ to_int l2)

View File

@ -18,6 +18,6 @@ let make ?multiplicity:(multiplicity=1) ?charge:(charge=0) nuclei =
let n_alpha = n_elec - n_beta in
let result = { n_alpha ; n_beta ; multiplicity } in
if multiplicity <> (n_alpha - n_beta)+1 then
invalid_arg "Electrons.make";
invalid_arg (__FILE__^": make");
result

View File

@ -1,7 +1,7 @@
type t = float
let of_float x =
assert ( x >= 0. );
if x < 0. then invalid_arg (__FILE__^": of_float");
x
external to_float : t -> float = "%identity"

View File

@ -1,3 +1,4 @@
(** Floats >= 0. *)
type t = private float
val of_float : float -> t
val to_float : t -> float

View File

@ -5,7 +5,11 @@ let of_int_tuple t =
match t with
| (x,y,z) -> { x ; y ; z ; tot=x+y+z }
in
assert (result.tot >= 0);
if result.x < 0 ||
result.y < 0 ||
result.z < 0 ||
result.tot < 0 then
invalid_arg (__FILE__^": of_int_tuple");
result
let to_int_tuple { x ; y ; z ; _ } = (x,y,z)

View File

@ -1,7 +1,57 @@
type t = private { x: int ; y : int ; z : int ; tot : int }
val of_int_tuple : int * int * int -> t
val to_int_tuple : t -> int * int * int
val get : Coordinate.axis -> t -> int
val incr : Coordinate.axis -> t -> t
val decr : Coordinate.axis -> t -> t
(** Contains powers of x, y and z describing the polynomials in atomic basis sets. *)
type t = private {
x : int ;
y : int ;
z : int ;
tot : int ; (* x + y + z *)
}
val of_int_tuple : int * int * int -> t
(** Example:
[of_int_tuple (2,3,1) -> { x=2 ; y=3 ; z=1 ; tot=6 }]
@raise Invalid_argument if x, y or z < 0.
*)
val to_int_tuple : t -> int * int * int
(** Example:
[to_int_tuple { x=2 ; y=3 ; z=1 ; tot=6 } -> (2,3,1) ]
*)
val get : Coordinate.axis -> t -> int
(** Example:
[Powers.get Coordinate.Y { x=2 ; y=3 ; z=1 ; tot=6 } -> 3]
*)
val incr : Coordinate.axis -> t -> t
(** Returns a new {!Powers.t} with the power on the given axis incremented.
Example:
{[
Powers.incr Coordinate.Y { x=2 ; y=3 ; z=1 ; tot=6 } ->
{ x=2 ; y=4 ; z=1 ; tot=7 }
]}
*)
val decr : Coordinate.axis -> t -> t
(** Returns a new {!Powers.t} with the power on the given axis decremented.
As opposed to {!of_int_tuple}, the values may become negative.
Example:
{[
Powers.incr Coordinate.Y { x=2 ; y=3 ; z=1 ; tot=6 } ->
{ x=2 ; y=2 ; z=1 ; tot=5 }
]}
*)