10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-07 14:43:41 +01:00
QCaml/Basis/AtomicShellPair.ml

71 lines
1.8 KiB
OCaml
Raw Normal View History

2018-03-20 18:20:40 +01:00
open Util
open Constants
exception Null_contribution
type t =
{
2019-02-26 12:47:23 +01:00
contracted_shell_pairs : ContractedShellPair.t list;
2018-03-20 18:20:40 +01:00
atomic_shell_a : AtomicShell.t;
atomic_shell_b : AtomicShell.t;
}
module Am = AngularMomentum
module As = AtomicShell
module Co = Coordinate
module Cs = ContractedShell
2018-03-21 18:54:56 +01:00
module Csp = ContractedShellPair
2018-03-20 18:20:40 +01:00
(** Creates an atomic shell pair : an array of pairs of contracted shells.
*)
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 =
List.map (fun s_a ->
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
2018-03-21 18:54:56 +01:00
|> List.concat
2018-03-22 00:29:14 +01:00
|> 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
let atomic_shell_a x = x.atomic_shell_a
let atomic_shell_b x = x.atomic_shell_b
2018-03-21 18:54:56 +01:00
let contracted_shell_pairs x = x.contracted_shell_pairs
2018-03-20 18:20:40 +01:00
let monocentric x = Csp.monocentric @@ List.hd x.contracted_shell_pairs
2018-03-21 18:54:56 +01:00
let a_minus_b x = Csp.a_minus_b @@ List.hd x.contracted_shell_pairs
2018-03-20 18:20:40 +01:00
2018-03-21 18:54:56 +01:00
let a_minus_b_sq x = Csp.a_minus_b_sq @@ List.hd x.contracted_shell_pairs
2018-03-20 18:20:40 +01:00
2018-03-21 18:54:56 +01:00
let ang_mom x = Csp.ang_mom @@ List.hd x.contracted_shell_pairs
2018-03-20 18:20:40 +01:00
2018-03-21 18:54:56 +01:00
let norm_scales x = Csp.norm_scales @@ List.hd x.contracted_shell_pairs
2018-03-20 18:20:40 +01:00
(** The array of all shell pairs with their correspondance in the list
of contracted shells.
*)
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 ->
Array.mapi (fun j shell_b ->
make ~cutoff shell_a shell_b)
(Array.sub basis 0 (i+1))
) basis