10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-10 06:23:31 +01:00

Documentation

This commit is contained in:
Anthony Scemama 2018-03-15 19:11:59 +01:00
parent 03c5d1d64a
commit 80f00debe8
3 changed files with 56 additions and 73 deletions

View File

@ -39,13 +39,13 @@ Format.printf "@[<2>shell_b :@ %a@]@;" Cs.pp s_b;
let shell_pairs =
Array.mapi (fun i p_a ->
let c_a = (Cs.coef s_a).(i) in
let make = make i p_a in
let make = make p_a in
Array.mapi (fun j p_b ->
let c_b = (Cs.coef s_b).(j) in
let coef = c_a *. c_b in
assert (coef <> 0.);
let cutoff = cutoff /. abs_float coef in
coef, make j p_b cutoff) (Cs.prim s_b)) (Cs.prim s_a)
coef, make p_b cutoff) (Cs.prim s_b)) (Cs.prim s_a)
|> Array.to_list
|> Array.concat
|> Array.to_list

View File

@ -15,8 +15,6 @@ type t = {
totAngMom : AngularMomentum.t;
shell_a : PrimitiveShell.t;
shell_b : PrimitiveShell.t;
(*TODO*)
i : int; j : int;
}
exception Null_contribution
@ -25,18 +23,20 @@ module Am = AngularMomentum
module Co = Coordinate
module Ps = PrimitiveShell
(** Returns an integer characteristic of a primitive shell pair *)
let hash a =
Hashtbl.hash a
let equivalent a b =
a = b
(*
Hashtbl.hash (a.expo, a.center_a, a.center_ab, a.coef, ContractedShell.totAngMom a.shell_a, ContractedShell.totAngMom a.shell_b)
*)
a.expo = b.expo &&
a.totAngMom = b.totAngMom &&
a.norm_coef = b.norm_coef &&
a.center = b.center &&
a.center_minus_a = b.center_minus_a &&
a.a_minus_b = b.a_minus_b
(** Comparison function, used for sorting *)
let cmp a b =
hash a - hash b
@ -63,20 +63,16 @@ let create_make_of p_a p_b =
Am.( Ps.totAngMom p_a + Ps.totAngMom p_b )
in
(* TODO *)
function i ->
function p_a ->
let norm_coef_a =
Ps.norm_coef p_a
in
let alpha_a = (* p_a_expo_center *)
let alpha_a =
Co.( Ps.expo p_a |. Ps.center p_a )
in
(*TODO *)
function j ->
function p_b ->
let norm_coef =
@ -113,7 +109,7 @@ let create_make_of p_a p_b =
in
Some {
i ; j ; totAngMom ;
totAngMom ;
expo ; expo_inv ; center ; center_minus_a ; a_minus_b ;
a_minus_b_sq ; norm_coef ; norm_coef_scale ; shell_a = p_a;
shell_b = p_b }
@ -126,7 +122,7 @@ let make p_a p_b =
let f =
create_make_of p_a p_b
in
match f 0 p_a 0 p_b 0. with
match f p_a p_b 0. with
| Some result -> result
| None -> assert false

View File

@ -22,50 +22,27 @@ where
\end{align*}
%}
Following Ref [1], we define three quantities associated with the shells on centers A and B:
{%
\begin{align*}
\sigma_P & = \frac{1}{\alpha + \beta} \\
\mathbf{P} & = \left( \alpha \mathbf{A} + \beta \mathbf{B} \right) \, \sigma_P \\
U_P & = (\pi\,\sigma_P)^{3/2} \exp \left( \alpha \beta \sigma_P |\mathbf{A}-\mathbf{B}|^2 \right)
\end{align*}
%}
{!a_minus_b}, {!a_minus_b_sq} and {!norm_coef_scale} depend only on the
centering of the two shells, and {!totAngMom} only depends on the angular
momenta of the two shells. Hence, these quantities need to be computed only
once when a {!ContractedShellPair.t} is built. Hence, there is the
{!create_make_of} function which creates a [make] function which is suitable
for a {!ContractedShellPair.t}.
References:
[1] {{:http://dx.doi.org/10.1002/qua.560400604} P.M. Gill, B.G. Johnson, and J.A. Pople, International Journal of Quantum Chemistry 40, 745 (1991)}.
*)
type t = {
expo : float; (* alpha + beta *)
expo_inv : float; (* 1/(alpha + beta) *)
center : Coordinate.t; (* P = (alpha * A + beta B)/(alpha+beta) *)
center_minus_a : Coordinate.t; (* P - A *)
a_minus_b : Coordinate.t; (* A - B *)
a_minus_b_sq : float; (* |A-B|^2 *)
norm_coef_scale : float array lazy_t;
norm_coef : float; (* norm_coef_a * norm_coef_b * g, with
g = (pi/(alpha+beta))^(3/2) exp (-|A-B|^2 * alpha*beta/(alpha+beta)) *)
totAngMom : AngularMomentum.t;
shell_a : PrimitiveShell.t;
shell_b : PrimitiveShell.t;
i : int; (*TODO remove *)
j : int; (*TODO remove *)
}
type t
val make : PrimitiveShell.t -> PrimitiveShell.t -> t
(** Creates a primitive shell pair using two primitive shells. *)
val create_make_of : PrimitiveShell.t -> PrimitiveShell.t ->
(int -> PrimitiveShell.t -> int -> PrimitiveShell.t -> float -> t option)
(* TODO
(PrimitiveShell.t -> PrimitiveShell.t -> float -> t option)
*)
(** Creates a make function [PrimitiveShell.t -> PrimitiveShell.t -> float -> t] in which
all the quantities common to the shell and independent of the exponent
are pre-computed.
@ -75,30 +52,39 @@ val create_make_of : PrimitiveShell.t -> PrimitiveShell.t ->
*)
val equivalent : t -> t -> bool
val hash : t -> int
val cmp : t -> t -> int
val monocentric : t -> bool
val center : t -> Coordinate.t
(** Coordinates of the center {%$\mathbf{P}$%}. *)
val norm_coef_scale : t -> float array
val expo : t -> float
(** {% \\[ \alpha + \beta \\] %}*)
val expo_inv : t -> float
(** {% \\[ \frac{1}{\alpha + \beta} \\] %}*)
val totAngMom : t -> AngularMomentum.t
(** Total angular momentum of the shell pair: sum of the angular momenta of
the shells.
the shells. *)
val center : t -> Coordinate.t
(** Coordinates of the center {% $\mathbf{P}$ %}. *)
val monocentric : t -> bool
(** True if both shells of the pair have the same center. *)
val shell_a : t -> PrimitiveShell.t
(** Returns the first primitive shell that was used to build the shell pair. *)
val shell_b : t -> PrimitiveShell.t
(** Returns the second primitive shell that was used to build the shell pair. *)
val norm_coef : t -> float
(** Normalization coefficient of the shell pair. *)
val norm_coef_scale : t -> float array
(** Normalization factor, characteristic of the powers of x, y and z of
both shells of the pair. It is the outer product of the 2
{!PrimitiveShell.norm_coef_scale} arrays of the shells consituting the
pair.
*)
val expo : t -> float
(** Exponent of the Gaussian output of the Gaussian product : {% \\[ \alpha + \beta \\] %}*)
val expo_inv : t -> float
(** Inverse of the exponent : {% \\[ \sigma_P = \frac{1}{\alpha + \beta} \\] %}*)
val a_minus_b : t -> Coordinate.t
(** {% $\mathbf{A}-\mathbf{B}$ %} *)
@ -108,12 +94,13 @@ val a_minus_b_sq : t -> float
val center_minus_a : t -> Coordinate.t
(** {% $\mathbf{P}-\mathbf{A}$ %} *)
val norm_coef : t -> float
(** Normalization coefficient of the shell pair. *)
val shell_a : t -> PrimitiveShell.t
(** Returns the first primitive shell that was used to build the shell pair. *)
val equivalent : t -> t -> bool
(** True if two primitive shell pairs are equivalent. *)
val shell_b : t -> PrimitiveShell.t
(** Returns the second primitive shell that was used to build the shell pair. *)
val hash : t -> int
(** Returns an integer characteristic of the shell pair. *)
val cmp : t -> t -> int
(** Arbitray comparison function for sorting. *)