10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-13 09:33:41 +01:00
QCaml/gaussian/lib/atomic_shell_pair.ml

82 lines
1.8 KiB
OCaml
Raw Normal View History

2024-01-17 14:24:28 +01:00
(** Type *)
2020-10-09 09:47:57 +02:00
open Common
2018-03-20 18:20:40 +01:00
type t =
{
2020-09-26 12:02:53 +02:00
contracted_shell_pairs : Contracted_shell_pair.t list;
atomic_shell_a : Atomic_shell.t;
atomic_shell_b : Atomic_shell.t;
2018-03-20 18:20:40 +01:00
}
2020-09-26 12:02:53 +02:00
module Am = Angular_momentum
module As = Atomic_shell
2018-03-20 18:20:40 +01:00
module Co = Coordinate
2020-09-26 12:02:53 +02:00
module Cs = Contracted_shell
module Csp = Contracted_shell_pair
2018-03-20 18:20:40 +01:00
2021-01-20 23:55:34 +01:00
2024-01-17 14:24:28 +01:00
(** Access *)
2021-01-20 23:55:34 +01:00
let atomic_shell_a x = x.atomic_shell_a
let atomic_shell_b x = x.atomic_shell_b
let contracted_shell_pairs x = x.contracted_shell_pairs
let monocentric x =
Csp.monocentric @@ List.hd x.contracted_shell_pairs
let a_minus_b x =
Csp.a_minus_b @@ List.hd x.contracted_shell_pairs
let a_minus_b_sq x =
Csp.a_minus_b_sq @@ List.hd x.contracted_shell_pairs
let ang_mom x =
Csp.ang_mom @@ List.hd x.contracted_shell_pairs
let norm_scales x =
Csp.norm_scales @@ List.hd x.contracted_shell_pairs
2024-01-17 14:24:28 +01:00
(** Creation *)
2021-01-20 23:55:34 +01:00
2018-03-21 18:54:56 +01:00
let make ?(cutoff=Constants.epsilon) atomic_shell_a atomic_shell_b =
2018-03-20 18:20:40 +01:00
let l_a = Array.to_list (As.contracted_shells atomic_shell_a)
and l_b = Array.to_list (As.contracted_shells atomic_shell_b)
in
let contracted_shell_pairs =
2020-03-26 17:43:11 +01:00
List.concat_map (fun s_a ->
2018-03-20 18:20:40 +01:00
List.map (fun s_b ->
2018-03-22 00:29:14 +01:00
if Cs.index s_b <= Cs.index s_a then
Csp.make ~cutoff s_a s_b
else
None
2018-03-20 18:20:40 +01:00
) l_b
) l_a
2020-09-26 12:02:53 +02:00
|> Util.list_some
2018-03-20 18:20:40 +01:00
in
2018-03-21 18:54:56 +01:00
match contracted_shell_pairs with
| [] -> None
| _ -> Some { atomic_shell_a ; atomic_shell_b ; contracted_shell_pairs }
2018-03-20 18:20:40 +01:00
2018-03-21 18:54:56 +01:00
let of_atomic_shell_array ?(cutoff=Constants.epsilon) basis =
2018-03-20 18:20:40 +01:00
Array.mapi (fun i shell_a ->
2020-09-26 12:02:53 +02:00
Array.map (fun shell_b ->
2018-03-20 18:20:40 +01:00
make ~cutoff shell_a shell_b)
(Array.sub basis 0 (i+1))
) basis
2021-01-20 23:55:34 +01:00
2024-01-17 14:24:28 +01:00
(** Printers *)
2021-01-20 23:55:34 +01:00
let pp ppf s =
let open Format in
fprintf ppf "@[%a@ %a@]"
Atomic_shell.pp s.atomic_shell_a
Atomic_shell.pp s.atomic_shell_b
2024-01-17 14:24:28 +01:00