Added values of ContractedShell

This commit is contained in:
Anthony Scemama 2020-04-17 00:36:50 +02:00
parent a7a07bd1d9
commit 0b1c375fe0
3 changed files with 42 additions and 1 deletions

View File

@ -77,6 +77,41 @@ let primitives x = x.prim
let zkey_array x = Ps.zkey_array x.prim.(0)
let values t point =
(* Radial part *)
let r = Co.( point |- t.center ) in
let r2 = Co.dot r r in
let radial =
let rec aux accu = function
| -1 -> accu
| i -> let new_accu =
t.norm_coef.(i) *. t.coef.(i) *. exp(-. t.expo.(i) *. r2) +. accu
in aux new_accu (i-1)
in
aux 0. (Array.length t.expo - 1)
in
(* Angular part *)
let n = Am.to_int t.ang_mom in
let x = Array.create_float (n+1) in
let y = Array.create_float (n+1) in
let z = Array.create_float (n+1) in
let fill arr v =
arr.(0) <- 1.;
for i=1 to n do
arr.(i) <- arr.(i-1) *. v
done;
in
fill x r.x; fill y r.y; fill z r.z;
let powers =
Am.zkey_array (Am.Singlet t.ang_mom)
in
Array.mapi (fun i a ->
let p = Zkey.to_int_array a in
t.norm_coef_scale.(i) *. x.(p.(0)) *. y.(p.(1)) *. z.(p.(2)) *. radial
) powers
(** {2 Printers} *)

View File

@ -69,6 +69,12 @@ val zkey_array : t -> Zkey.t array
(** Returns the array of Zkeys associated with the contracted shell. *)
val values : t -> Coordinate.t -> float array
(** Evaluates the all the functions of the [ContractedShell] at a given
Cartesian coordinate. The order in which the functions are stored corresponds
[AngularMomentum.(zkey_array @@ Singlet t.ang_mom)]
*)
(** {2 Printers} *)
val pp : Format.formatter -> t -> unit

View File

@ -43,7 +43,7 @@ val to_int : t -> int
Example:
{[
AngularMomentum.of_int 3 -> AngularMomentum.F
AngularMomentum.to_int D -> 2
]}
*)