10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-19 04:22:21 +01:00
QCaml/Basis/PrimitiveShell.ml

87 lines
2.1 KiB
OCaml
Raw Normal View History

2018-03-14 16:22:08 +01:00
open Util
open Constants
open Coordinate
type t = {
2018-03-20 15:16:24 +01:00
exponent : float;
normalization : float;
norm_scales : float array lazy_t;
2018-03-14 16:22:08 +01:00
center : Coordinate.t;
2018-03-21 15:01:39 +01:00
ang_mom : AngularMomentum.t;
2018-03-14 16:22:08 +01:00
}
module Am = AngularMomentum
2018-03-21 15:01:39 +01:00
let compute_norm_coef alpha ang_mom =
2018-03-14 16:22:08 +01:00
let atot =
2018-03-21 15:01:39 +01:00
Am.to_int ang_mom
2018-03-14 16:22:08 +01:00
in
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
let alpha_2 = alpha +. alpha in
(alpha_2 *. pi_inv)**(0.75) *. (pow (alpha_2 +. alpha_2) (atot/2))
else
let alpha_2 = alpha +. alpha in
(alpha_2 *. pi_inv)**(0.75) *. sqrt (pow (alpha_2 +. alpha_2) atot)
in
let f a =
expo *. (factor a)
in f
2018-03-21 15:01:39 +01:00
let make ang_mom center exponent =
2018-03-14 16:22:08 +01:00
let norm_coef_func =
2018-03-21 15:01:39 +01:00
compute_norm_coef exponent ang_mom
2018-03-14 16:22:08 +01:00
in
let norm =
2018-03-21 15:01:39 +01:00
1. /. norm_coef_func [| Am.to_int ang_mom ; 0 ; 0 |]
2018-03-14 16:22:08 +01:00
in
let powers =
2018-03-21 15:01:39 +01:00
Am.zkey_array (Am.Singlet ang_mom)
2018-03-14 16:22:08 +01:00
in
2018-03-20 15:16:24 +01:00
let norm_scales = lazy (
2018-03-14 16:22:08 +01:00
Array.map (fun a ->
(norm_coef_func (Zkey.to_int_array a)) *. norm
2018-03-14 16:22:08 +01:00
) powers )
in
2018-03-20 15:16:24 +01:00
let normalization = 1. /. norm in
2018-03-21 15:01:39 +01:00
{ exponent ; normalization ; norm_scales ; center ; ang_mom }
2018-03-14 16:22:08 +01:00
let to_string s =
let coord = s.center in
2018-03-21 15:01:39 +01:00
Printf.sprintf "%1s %8.3f %8.3f %8.3f %16.8e" (Am.to_string s.ang_mom)
2018-03-20 15:16:24 +01:00
(get X coord) (get Y coord) (get Z coord) s.exponent
2018-03-14 16:22:08 +01:00
(** Normalization coefficient of contracted function i, which depends on the
exponent and the angular momentum. Two conventions can be chosen : a single
2018-03-20 15:16:24 +01:00
normalization factor for all functions of the class, or a coefficient which
2018-03-14 16:22:08 +01:00
depends on the powers of x,y and z.
Returns, for each contracted function, an array of functions taking as
argument the [|x;y;z|] powers.
*)
2018-03-20 15:16:24 +01:00
let exponent x = x.exponent
2018-03-14 16:22:08 +01:00
let center x = x.center
2018-03-21 15:01:39 +01:00
let ang_mom x = x.ang_mom
2018-03-14 16:22:08 +01:00
2018-03-20 15:16:24 +01:00
let norm x = 1. /. x.normalization
2018-03-20 15:16:24 +01:00
let normalization x = x.normalization
2018-03-14 16:22:08 +01:00
2018-03-20 15:16:24 +01:00
let norm_scales x = Lazy.force x.norm_scales
let size_of_shell x = Array.length (norm_scales x)
2018-03-14 16:22:08 +01:00