2018-01-17 18:19:38 +01:00
|
|
|
open Util
|
|
|
|
|
|
|
|
type t = {
|
|
|
|
expo : float array;
|
|
|
|
coef : float array;
|
|
|
|
center : Coordinate.t;
|
|
|
|
totAngMom : Angular_momentum.t;
|
|
|
|
size : int;
|
2018-02-01 16:09:04 +01:00
|
|
|
norm_coef : float array;
|
|
|
|
norm_coef_scale : float Zmap.t;
|
2018-01-19 17:42:12 +01:00
|
|
|
indice : int;
|
|
|
|
powers : Zkey.t array;
|
2018-01-17 18:19:38 +01:00
|
|
|
}
|
|
|
|
|
2018-01-17 19:09:57 +01:00
|
|
|
let size a = a.size
|
|
|
|
let expo a i = a.expo.(i)
|
|
|
|
let coef a i = a.coef.(i)
|
|
|
|
let center a = a.center
|
|
|
|
let totAngMom a = a.totAngMom
|
|
|
|
let norm_coef a i = a.norm_coef.(i)
|
2018-02-01 16:09:04 +01:00
|
|
|
let norm_coef_scale a = a.norm_coef_scale
|
2018-01-19 17:42:12 +01:00
|
|
|
let indice a = a.indice
|
|
|
|
let powers a = a.powers
|
2018-01-17 18:19:38 +01:00
|
|
|
|
|
|
|
|
2018-01-18 00:21:05 +01:00
|
|
|
let to_string s =
|
2018-01-18 17:39:10 +01:00
|
|
|
let coord =
|
|
|
|
Coordinate.to_Bohr s.center
|
|
|
|
in
|
2018-01-18 00:21:05 +01:00
|
|
|
let open Printf in
|
2018-01-19 17:42:12 +01:00
|
|
|
(match s.totAngMom with
|
|
|
|
| Angular_momentum.S -> sprintf "%3d " (s.indice+1)
|
|
|
|
| _ -> sprintf "%3d-%-3d" (s.indice+1) (s.indice+(Array.length s.powers))
|
|
|
|
) ^
|
|
|
|
( sprintf "%1s %8.3f %8.3f %8.3f " (Angular_momentum.to_string s.totAngMom)
|
2018-01-18 17:39:10 +01:00
|
|
|
(Coordinate.x coord) (Coordinate.y coord) (Coordinate.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" " ") )
|
2018-01-18 00:21:05 +01:00
|
|
|
|
2018-01-17 18:19:38 +01:00
|
|
|
(** Normalization coefficient of contracted function i, which depends on the
|
|
|
|
exponent and the angular momentum. Two conventions can be chosen : a single
|
|
|
|
normalisation factor for all functions of the class, or a coefficient which
|
|
|
|
depends on the powers of x,y and z.
|
2018-01-31 14:37:51 +01:00
|
|
|
Returns, for each contracted function, an array of functions taking as
|
|
|
|
argument the [|x;y;z|] powers.
|
2018-01-17 18:19:38 +01:00
|
|
|
*)
|
2018-01-31 14:37:51 +01:00
|
|
|
let compute_norm_coef expo totAngMom =
|
2018-01-17 18:19:38 +01:00
|
|
|
let atot =
|
2018-01-31 14:37:51 +01:00
|
|
|
Angular_momentum.to_int totAngMom
|
2018-01-17 18:19:38 +01:00
|
|
|
in
|
2018-01-31 14:37:51 +01:00
|
|
|
let factor int_array =
|
|
|
|
let dfa = Array.map (fun j ->
|
|
|
|
( float_of_int (1 lsl j) *. fact j) /. fact (j+j)
|
|
|
|
) int_array
|
|
|
|
in
|
|
|
|
sqrt (dfa.(0) *.dfa.(1) *. dfa.(2))
|
|
|
|
in
|
|
|
|
let expo =
|
|
|
|
if atot mod 2 = 0 then
|
|
|
|
Array.map (fun alpha ->
|
|
|
|
let alpha_2 = alpha +. alpha in
|
|
|
|
(alpha_2 *. pi_inv)**(0.75) *. (pow (alpha_2 +. alpha_2) (atot/2))
|
|
|
|
) expo
|
|
|
|
else
|
|
|
|
Array.map (fun alpha ->
|
|
|
|
let alpha_2 = alpha +. alpha in
|
|
|
|
(alpha_2 *. pi_inv)**(0.75) *. sqrt (pow (alpha_2 +. alpha_2) atot)
|
|
|
|
) expo
|
|
|
|
in
|
|
|
|
Array.map (fun x -> let f a = x *. (factor a) in f) expo
|
|
|
|
|
2018-01-17 18:19:38 +01:00
|
|
|
|
2018-01-19 17:42:12 +01:00
|
|
|
let create ~indice ~expo ~coef ~center ~totAngMom =
|
2018-01-17 18:19:38 +01:00
|
|
|
assert (Array.length expo = Array.length coef);
|
|
|
|
assert (Array.length expo > 0);
|
2018-02-01 16:09:04 +01:00
|
|
|
let norm_coef_func =
|
2018-01-31 14:37:51 +01:00
|
|
|
compute_norm_coef expo totAngMom
|
2018-01-17 18:19:38 +01:00
|
|
|
in
|
2018-02-01 16:09:04 +01:00
|
|
|
let powers =
|
|
|
|
Angular_momentum.zkey_array (Angular_momentum.Singlet totAngMom)
|
|
|
|
in
|
|
|
|
let norm_coef =
|
|
|
|
Array.map (fun f -> f [| Angular_momentum.to_int totAngMom ; 0 ; 0 |]) norm_coef_func
|
|
|
|
in
|
|
|
|
let norm_coef_scale =
|
|
|
|
Zmap.create 13
|
|
|
|
in
|
|
|
|
Array.iter (fun a -> Zmap.add norm_coef_scale a ((norm_coef_func.(0) (Zkey.to_int_array ~kind:Zkey.Kind_3 a)) /. norm_coef.(0))) powers;
|
2018-01-31 14:37:51 +01:00
|
|
|
{ indice ; expo ; coef ; center ; totAngMom ; size=Array.length expo ; norm_coef ;
|
2018-02-01 16:09:04 +01:00
|
|
|
norm_coef_scale ; powers }
|
2018-01-17 18:19:38 +01:00
|
|
|
|
2018-01-19 17:42:12 +01:00
|
|
|
|