10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-07-31 17:44:12 +02:00
QCaml/gaussian/lib/atomic_shell_pair.ml

97 lines
3.6 KiB
OCaml
Raw Normal View History

2021-01-20 23:55:34 +01:00
(* [[file:~/QCaml/gaussian/atomic_shell_pair.org::*Type][Type:2]] *)
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
2021-01-20 23:55:34 +01:00
(* Type:2 ends here *)
2018-03-20 18:20:40 +01:00
2021-01-20 23:55:34 +01:00
(* | ~atomic_shell_a~ | Returns the first ~Atomic_shell.t~ which was used to build the atomic shell pair. |
* | ~atomic_shell_b~ | Returns the second ~Atomic_shell.t~ which was used to build the atomic shell pair. |
* | ~contracted_shell_pairs~ | Returns an array of ~ContractedShellPair.t~, containing all the pairs of contracted functions used to build the atomic shell pair. |
* | ~norm_scales~ | norm_coef.(i) / norm_coef.(0) |
* | ~ang_mom~ | Total angular Momentum |
* | ~monocentric~ | If true, the two atomic shells have the same center. |
* | ~a_minus_b~ | Returns $A-B$ |
* | ~a_minus_b_sq~ | Returns $\vert A-B \vert^2$ | *)
(* [[file:~/QCaml/gaussian/atomic_shell_pair.org::*Access][Access:2]] *)
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
(* Access:2 ends here *)
(* Creates all possible atomic shell pairs from an array of atomic shells.
* If an atomic shell pair is not significant, sets the value to ~None~. *)
(* [[file:~/QCaml/gaussian/atomic_shell_pair.org::*Creation][Creation:3]] *)
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
(* Creation:3 ends here *)
(* [[file:~/QCaml/gaussian/atomic_shell_pair.org::*Printers][Printers:2]] *)
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
(* Printers:2 ends here *)