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

66 lines
2.0 KiB
OCaml
Raw Normal View History

2018-01-17 18:19:38 +01:00
open Util
2018-02-02 01:25:10 +01:00
open Constants
2018-02-13 13:55:16 +01:00
open Contracted_shell_type
2018-02-13 17:36:25 +01:00
open Coordinate
2018-01-17 18:19:38 +01:00
2018-02-13 13:55:16 +01:00
type t = Contracted_shell_type.t
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-02-06 18:12:19 +01:00
let index a = a.index
2018-02-13 13:55:16 +01:00
let with_index = Contracted_shell_type.with_index
2018-01-19 17:42:12 +01:00
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-02-13 17:36:25 +01:00
let coord = 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
2018-02-06 18:12:19 +01:00
| Angular_momentum.S -> sprintf "%3d " (s.index+1)
| _ -> sprintf "%3d-%-3d" (s.index+1) (s.index+(Array.length s.powers))
2018-01-19 17:42:12 +01:00
) ^
( sprintf "%1s %8.3f %8.3f %8.3f " (Angular_momentum.to_string s.totAngMom)
2018-02-13 17:36:25 +01:00
(get X coord) (get Y coord) (get Z coord) ) ^
2018-01-18 17:39:10 +01:00
(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-02-13 13:55:16 +01:00
let make = Contracted_shell_type.make
2018-01-19 17:42:12 +01:00