diff --git a/Basis/Basis.ml b/Basis/Basis.ml index f3488cb..6ff464b 100644 --- a/Basis/Basis.ml +++ b/Basis/Basis.ml @@ -18,7 +18,7 @@ let of_nuclei_and_general_basis n b = and coef = Array.map (fun General_basis.{exponent ; coefficient} -> coefficient) shell in - Contracted_shell.create ~expo ~coef ~totAngMom ~center ~index:0) + Contracted_shell.make ~expo ~coef ~totAngMom ~center ~index:0) ) n |> Array.to_list |> Array.concat diff --git a/Basis/Contracted_shell.ml b/Basis/Contracted_shell.ml index 2b294ff..a7f8fdc 100644 --- a/Basis/Contracted_shell.ml +++ b/Basis/Contracted_shell.ml @@ -1,17 +1,8 @@ open Util open Constants +open Contracted_shell_type -type t = { - expo : float array; - coef : float array; - center : Coordinate.t; - totAngMom : Angular_momentum.t; - size : int; - norm_coef : float array; - norm_coef_scale : float array; - index : int; - powers : Zkey.t array; -} +type t = Contracted_shell_type.t let size a = a.size let expo a i = a.expo.(i) @@ -21,10 +12,9 @@ let totAngMom a = a.totAngMom let norm_coef a i = a.norm_coef.(i) let norm_coef_scale a = a.norm_coef_scale let index a = a.index -let with_index a i = { a with index = i } +let with_index = Contracted_shell_type.with_index let powers a = a.powers - let to_string s = let coord = Coordinate.to_Bohr s.center @@ -72,24 +62,5 @@ let compute_norm_coef expo totAngMom = Array.map (fun x -> let f a = x *. (factor a) in f) expo -let create ~index ~expo ~coef ~center ~totAngMom = - assert (Array.length expo = Array.length coef); - assert (Array.length expo > 0); - let norm_coef_func = - compute_norm_coef expo totAngMom - in - 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 = - Array.map (fun a -> - (norm_coef_func.(0) (Zkey.to_int_array ~kind:Zkey.Kind_3 a)) /. norm_coef.(0) - ) powers - in - { index ; expo ; coef ; center ; totAngMom ; size=Array.length expo ; norm_coef ; - norm_coef_scale ; powers } - +let make = Contracted_shell_type.make diff --git a/Basis/Contracted_shell.mli b/Basis/Contracted_shell.mli index b0bdd46..55bf153 100644 --- a/Basis/Contracted_shell.mli +++ b/Basis/Contracted_shell.mli @@ -1,4 +1,4 @@ -type t +type t = Contracted_shell_type.t (** Returns the number of contracted Gaussians *) @@ -46,7 +46,7 @@ val powers : t -> Zkey.t array val to_string : t -> string (** Creates a contracted shell *) -val create : +val make : index:int -> expo:float array -> coef:float array -> diff --git a/Utils/Positive_float.ml b/Utils/Positive_float.ml index 6f3faea..fbf46c0 100644 --- a/Utils/Positive_float.ml +++ b/Utils/Positive_float.ml @@ -4,9 +4,11 @@ let of_float x = assert ( x >= 0. ); x -let to_float x = x +external to_float : t -> float = "%identity" -let to_string x = string_of_float @@ to_float x +let to_string x = + let f = to_float x in string_of_float f -let of_string x = of_float @@ float_of_string x +let of_string x = + let f = float_of_string x in of_float f diff --git a/Utils/Positive_float.mli b/Utils/Positive_float.mli index b0b6e73..2d3d60b 100644 --- a/Utils/Positive_float.mli +++ b/Utils/Positive_float.mli @@ -1,4 +1,4 @@ -type t +type t = private float val of_float : float -> t val to_float : t -> float val to_string : t -> string