2018-02-23 18:44:31 +01:00
|
|
|
open Util
|
|
|
|
open Constants
|
|
|
|
|
|
|
|
type t = {
|
2018-03-20 14:11:31 +01:00
|
|
|
expo : float array;
|
|
|
|
coef : float array;
|
|
|
|
center : Coordinate.t;
|
|
|
|
totAngMom : AngularMomentum.t;
|
|
|
|
norm_coef : float array;
|
|
|
|
norm_coef_scale : float array;
|
|
|
|
index : int;
|
|
|
|
prim : PrimitiveShell.t array;
|
2018-02-23 18:44:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
module Am = AngularMomentum
|
2018-03-15 15:25:49 +01:00
|
|
|
module Co = Coordinate
|
2018-03-14 16:22:08 +01:00
|
|
|
module Ps = PrimitiveShell
|
2018-02-23 18:44:31 +01:00
|
|
|
|
2018-03-13 18:24:00 +01:00
|
|
|
|
2018-03-14 16:22:08 +01:00
|
|
|
let make ?(index=0) lc =
|
|
|
|
assert (Array.length lc > 0);
|
2018-02-23 18:44:31 +01:00
|
|
|
|
2018-03-14 16:22:08 +01:00
|
|
|
let coef = Array.map fst lc
|
|
|
|
and prim = Array.map snd lc
|
|
|
|
in
|
2018-02-23 18:44:31 +01:00
|
|
|
|
2018-03-14 16:22:08 +01:00
|
|
|
let center = Ps.center prim.(0) in
|
|
|
|
let rec unique_center = function
|
|
|
|
| 0 -> true
|
|
|
|
| i -> if Ps.center prim.(i) = center then unique_center (i-1) else false
|
2018-02-23 18:44:31 +01:00
|
|
|
in
|
2018-03-14 16:22:08 +01:00
|
|
|
if not (unique_center (Array.length prim - 1)) then
|
|
|
|
invalid_arg "ContractedShell.make Coordinate.t differ";
|
|
|
|
|
|
|
|
let totAngMom = Ps.totAngMom prim.(0) in
|
|
|
|
let rec unique_angmom = function
|
|
|
|
| 0 -> true
|
|
|
|
| i -> if Ps.totAngMom prim.(i) = totAngMom then unique_angmom (i-1) else false
|
2018-02-23 18:44:31 +01:00
|
|
|
in
|
2018-03-14 16:22:08 +01:00
|
|
|
if not (unique_angmom (Array.length prim - 1)) then
|
|
|
|
invalid_arg "ContractedShell.make: AngularMomentum.t differ";
|
|
|
|
|
|
|
|
let expo = Array.map Ps.expo prim in
|
|
|
|
|
2018-02-23 18:44:31 +01:00
|
|
|
let norm_coef =
|
2018-03-14 16:22:08 +01:00
|
|
|
Array.map Ps.norm_coef prim
|
2018-02-23 18:44:31 +01:00
|
|
|
in
|
2018-03-14 16:22:08 +01:00
|
|
|
let norm_coef_scale = Ps.norm_coef_scale prim.(0)
|
2018-02-23 18:44:31 +01:00
|
|
|
in
|
2018-03-14 16:22:08 +01:00
|
|
|
{ index ; expo ; coef ; center ; totAngMom ; norm_coef ;
|
2018-03-14 21:51:27 +01:00
|
|
|
norm_coef_scale ; prim }
|
2018-02-23 18:44:31 +01:00
|
|
|
|
|
|
|
|
|
|
|
let with_index a i =
|
|
|
|
{ a with index = i }
|
|
|
|
|
|
|
|
|
2018-03-20 14:11:31 +01:00
|
|
|
let exponents x = x.expo
|
2018-02-23 18:44:31 +01:00
|
|
|
|
2018-03-20 14:11:31 +01:00
|
|
|
let coefficients x = x.coef
|
2018-03-13 18:56:28 +01:00
|
|
|
|
|
|
|
let center x = x.center
|
|
|
|
|
|
|
|
let totAngMom x = x.totAngMom
|
|
|
|
|
2018-03-20 14:11:31 +01:00
|
|
|
let size x = Array.length x.prim
|
2018-03-13 18:56:28 +01:00
|
|
|
|
2018-03-20 14:11:31 +01:00
|
|
|
let normalizations x = x.norm_coef
|
2018-03-13 18:56:28 +01:00
|
|
|
|
2018-03-20 14:11:31 +01:00
|
|
|
let norm_scales x = x.norm_coef_scale
|
2018-03-13 18:56:28 +01:00
|
|
|
|
|
|
|
let index x = x.index
|
|
|
|
|
|
|
|
let size_of_shell x = Array.length x.norm_coef_scale
|
2018-03-14 21:51:27 +01:00
|
|
|
|
2018-03-20 14:11:31 +01:00
|
|
|
let primitives x = x.prim
|
2018-03-15 15:25:49 +01:00
|
|
|
|
|
|
|
|
|
|
|
(** {2 Printers} *)
|
|
|
|
|
2018-03-16 00:23:47 +01:00
|
|
|
open Format
|
|
|
|
|
|
|
|
let pp_debug ppf x =
|
2018-03-15 15:25:49 +01:00
|
|
|
fprintf ppf "@[<2>{@ ";
|
|
|
|
fprintf ppf "@[<2>expo =@ %a ;@]@ " pp_float_array_size x.expo;
|
|
|
|
fprintf ppf "@[<2>coef =@ %a ;@]@ " pp_float_array_size x.coef;
|
|
|
|
fprintf ppf "@[<2>center =@ %a ;@]@ " Co.pp_angstrom x.center;
|
|
|
|
fprintf ppf "@[<2>totAngMom =@ %a ;@]@ " Am.pp_string x.totAngMom;
|
|
|
|
fprintf ppf "@[<2>norm_coef =@ %a ;@]@ " pp_float_array_size x.norm_coef;
|
|
|
|
fprintf ppf "@[<2>norm_coef_scale =@ %a ;@]@ " pp_float_array_size x.norm_coef_scale;
|
|
|
|
fprintf ppf "@[<2>index =@ %d ;@]@ " x.index;
|
|
|
|
fprintf ppf "}@,@]"
|
|
|
|
|
2018-03-16 00:23:47 +01:00
|
|
|
let pp ppf s =
|
|
|
|
(match s.totAngMom with
|
|
|
|
| Am.S -> fprintf ppf "@[%3d@] " (s.index+1)
|
|
|
|
| _ -> fprintf ppf "@[%3d-%-3d@]" (s.index+1) (s.index+(Array.length s.norm_coef_scale))
|
|
|
|
);
|
|
|
|
fprintf ppf "@[%a@ %a@]@[" Am.pp_string s.totAngMom Co.pp s.center;
|
|
|
|
Array.iter2 (fun e c -> fprintf ppf "@[%16.8e %16.8e@]@;" e c) s.expo s.coef;
|
|
|
|
fprintf ppf "@]"
|
|
|
|
|
|
|
|
|
|
|
|
|