mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-07-25 04:07:24 +02:00
Added RS operators
This commit is contained in:
parent
8cb1d58a27
commit
99a78616fd
@ -1,4 +0,0 @@
|
||||
include Qcaml_common
|
||||
include Qcaml_particles
|
||||
include Qcaml_linear_algebra
|
||||
include Qcaml_gaussian_basis
|
65
gaussian_integrals/lib/eri_lr.ml
Normal file
65
gaussian_integrals/lib/eri_lr.ml
Normal file
@ -0,0 +1,65 @@
|
||||
(** Long-range electron-electron repulsion integrals.
|
||||
See Eq(52) in 10.1039/b605188j
|
||||
*)
|
||||
|
||||
open Qcaml_common
|
||||
open Qcaml_gaussian_basis
|
||||
open Qcaml_operators
|
||||
|
||||
module Csp = Contracted_shell_pair
|
||||
module Cspc = Contracted_shell_pair_couple
|
||||
|
||||
module T = struct
|
||||
|
||||
let name = "Long-range electron repulsion integrals"
|
||||
|
||||
open Zero_m_parameters
|
||||
|
||||
let zero_m z =
|
||||
let mu_erf =
|
||||
match z.operator with
|
||||
| Some (Operator.Range_sep mu) -> mu
|
||||
| _ -> assert false
|
||||
in
|
||||
let m = mu_erf *. mu_erf in
|
||||
let expo_pq_inv = z.expo_p_inv +. z.expo_q_inv in
|
||||
let fG_inv = expo_pq_inv +. 1. /. m in
|
||||
let fG = 1. /. fG_inv in
|
||||
assert (expo_pq_inv <> 0.);
|
||||
let t =
|
||||
if z.norm_pq_sq > Constants.integrals_cutoff then
|
||||
z.norm_pq_sq *. fG
|
||||
else 0.
|
||||
in
|
||||
let maxm = z.maxm in
|
||||
let result = Util.boys_function ~maxm t in
|
||||
let rec aux accu k = function
|
||||
| 0 -> result.(k) <- result.(k) *. accu
|
||||
| l ->
|
||||
begin
|
||||
result.(k) <- result.(k) *. accu;
|
||||
let new_accu = -. accu *. fG in
|
||||
(aux [@tailcall]) new_accu (k+1) (l-1)
|
||||
end
|
||||
in
|
||||
let f = Constants.two_over_sq_pi *. (sqrt fG) in
|
||||
aux f 0 maxm;
|
||||
result
|
||||
|
||||
let class_of_contracted_shell_pair_couple ?operator shell_pair_couple =
|
||||
let shell_p = Cspc.shell_pair_p shell_pair_couple
|
||||
and shell_q = Cspc.shell_pair_q shell_pair_couple
|
||||
in
|
||||
if Array.length (Csp.shell_pairs shell_p) +
|
||||
(Array.length (Csp.shell_pairs shell_q)) < 4 then
|
||||
Two_electron_rr.contracted_class_shell_pair_couple
|
||||
?operator ~zero_m shell_pair_couple
|
||||
else
|
||||
Two_electron_rr_vectorized.contracted_class_shell_pairs
|
||||
?operator ~zero_m shell_p shell_q
|
||||
|
||||
end
|
||||
|
||||
module M = Two_electron_integrals.Make(T)
|
||||
include M
|
||||
|
93
gaussian_integrals/lib/screened_eri.ml
Normal file
93
gaussian_integrals/lib/screened_eri.ml
Normal file
@ -0,0 +1,93 @@
|
||||
(** Screened Electron-electron repulsion integrals (Yukawa potential). Required for F12/r12. *)
|
||||
|
||||
open Qcaml_common
|
||||
open Qcaml_gaussian_basis
|
||||
open Qcaml_operators
|
||||
|
||||
module Csp = Contracted_shell_pair
|
||||
module Cspc = Contracted_shell_pair_couple
|
||||
|
||||
module T = struct
|
||||
|
||||
let name = "Screened electron repulsion integrals"
|
||||
|
||||
open Zero_m_parameters
|
||||
|
||||
let zero_m z =
|
||||
let expo_pq_inv = z.expo_p_inv +. z.expo_q_inv in
|
||||
assert (expo_pq_inv <> 0.);
|
||||
|
||||
let expo_G_inv, coef_G =
|
||||
let g =
|
||||
match z.operator with
|
||||
| Some (Operator.F12 f) -> f.F12_operator.gaussian
|
||||
| _ -> assert false
|
||||
in
|
||||
g.Gaussian_operator.expo_g_inv,
|
||||
g.Gaussian_operator.coef_g
|
||||
in
|
||||
|
||||
let expo_pq = 1. /. expo_pq_inv in
|
||||
let maxm = z.maxm in
|
||||
|
||||
let result = Array.init (maxm+1) (fun _ -> 0.) in
|
||||
Util.array_range 0 (Array.length coef_G)
|
||||
|> Array.iter (fun i ->
|
||||
let fG_inv = expo_pq_inv +. expo_G_inv.(i) in
|
||||
let fG = 1. /. fG_inv in
|
||||
let t =
|
||||
if z.norm_pq_sq > Constants.integrals_cutoff then
|
||||
z.norm_pq_sq *. (expo_pq -. fG)
|
||||
else 0.
|
||||
in
|
||||
let fm = Util.boys_function ~maxm t in
|
||||
|
||||
let tmp_array =
|
||||
let result = Array.init (maxm+1) (fun _ -> 1.) in
|
||||
Util.array_range 1 maxm
|
||||
|> Array.iter (fun k -> result.(k) <- result.(k-1) *. expo_pq *. expo_G_inv.(i));
|
||||
result
|
||||
in
|
||||
|
||||
let tmp_result = Array.init (maxm+1) (fun _ -> 0.) in
|
||||
let rec aux accu m = function
|
||||
| 0 -> tmp_result.(m) <- fm.(m) *. accu
|
||||
| j ->
|
||||
begin
|
||||
let f =
|
||||
Util.array_range 0 m
|
||||
|> Array.fold_left (fun v k ->
|
||||
v +. (Util.binom_float m k) *. tmp_array.(k) *. fm.(k)) 0.
|
||||
in
|
||||
tmp_result.(m) <- accu *. f;
|
||||
let new_accu = -. accu *. expo_pq in
|
||||
(aux [@tailcall]) new_accu (m+1) (j-1)
|
||||
end
|
||||
in
|
||||
let f =
|
||||
Constants.two_over_sq_pi *. (sqrt expo_pq) *. fG *.
|
||||
expo_G_inv.(i) *. exp (-.fG *. z.norm_pq_sq)
|
||||
in
|
||||
aux f 0 maxm;
|
||||
Array.iteri (fun k v ->
|
||||
result.(k) <- result.(k) +. coef_G.(i) *. v
|
||||
) tmp_result) ;
|
||||
result
|
||||
|
||||
let class_of_contracted_shell_pair_couple ?operator shell_pair_couple =
|
||||
let shell_p = Cspc.shell_pair_p shell_pair_couple
|
||||
and shell_q = Cspc.shell_pair_q shell_pair_couple
|
||||
in
|
||||
if Array.length (Csp.shell_pairs shell_p) +
|
||||
(Array.length (Csp.shell_pairs shell_q)) < 4 then
|
||||
Two_electron_rr.contracted_class_shell_pair_couple
|
||||
?operator ~zero_m shell_pair_couple
|
||||
else
|
||||
Two_electron_rr_vectorized.contracted_class_shell_pairs
|
||||
?operator ~zero_m shell_p shell_q
|
||||
|
||||
end
|
||||
|
||||
module M = Two_electron_integrals.Make(T)
|
||||
include M
|
||||
|
@ -19,7 +19,7 @@ module type Two_ei_structure =
|
||||
sig
|
||||
val name : string
|
||||
val class_of_contracted_shell_pair_couple :
|
||||
?operator:'a Operator.t -> Cspc.t -> float Zmap.t
|
||||
?operator:Operator.t -> Cspc.t -> float Zmap.t
|
||||
end
|
||||
|
||||
|
||||
|
@ -16,7 +16,7 @@ val name : string
|
||||
(** Name of the kind of integrals, for printing purposes. *)
|
||||
|
||||
val class_of_contracted_shell_pair_couple :
|
||||
?operator:'a Operator.t -> Contracted_shell_pair_couple.t -> float Zmap.t
|
||||
?operator:Operator.t -> Contracted_shell_pair_couple.t -> float Zmap.t
|
||||
(** Returns an integral class from a couple of contracted shells.
|
||||
The results is stored in a Zmap.
|
||||
*)
|
||||
@ -28,7 +28,7 @@ module Make : functor (T : Two_ei_structure) ->
|
||||
sig
|
||||
include module type of Four_idx_storage
|
||||
|
||||
val of_basis : ?operator:'a Operator.t -> Basis.t -> t
|
||||
val of_basis : ?operator:Operator.t -> Basis.t -> t
|
||||
(** Compute all ERI's for a given {!Basis.t}. *)
|
||||
|
||||
end
|
||||
|
@ -1,7 +1,7 @@
|
||||
open Qcaml_common
|
||||
open Qcaml_operators
|
||||
|
||||
type 'a t =
|
||||
type t =
|
||||
{
|
||||
expo_p_inv : float ;
|
||||
expo_q_inv : float ;
|
||||
@ -10,8 +10,8 @@ type 'a t =
|
||||
center_pq : Coordinate.t ;
|
||||
center_pa : Coordinate.t ;
|
||||
center_qc : Coordinate.t ;
|
||||
zero_m_func : 'a t -> float array ;
|
||||
operator : 'a Operator.t option;
|
||||
zero_m_func : t -> float array ;
|
||||
operator : Operator.t option;
|
||||
}
|
||||
|
||||
let zero ?operator zero_m_func =
|
||||
|
@ -1,6 +1,9 @@
|
||||
type 'a t =
|
||||
| F12 of F12_operator.t
|
||||
| Gaussian of Gaussian_operator.t
|
||||
type t =
|
||||
| F12 of F12_operator.t
|
||||
| Gaussian of Gaussian_operator.t
|
||||
| Range_sep of Rs_operator.t
|
||||
|
||||
let of_f12 f = F12 f
|
||||
let of_gaussian g = Gaussian g
|
||||
let of_range_separation mu = Range_sep mu
|
||||
|
||||
|
@ -1,9 +1,14 @@
|
||||
type 'a t =
|
||||
| F12 of F12_operator.t
|
||||
| Gaussian of Gaussian_operator.t
|
||||
type t =
|
||||
| F12 of F12_operator.t
|
||||
| Gaussian of Gaussian_operator.t
|
||||
| Range_sep of Rs_operator.t
|
||||
|
||||
val of_f12 : F12_operator.t -> F12_operator.t t
|
||||
val of_f12 : F12_operator.t -> t
|
||||
(** Creates a F12 operator *)
|
||||
|
||||
val of_gaussian: Gaussian_operator.t -> Gaussian_operator.t t
|
||||
val of_gaussian: Gaussian_operator.t -> t
|
||||
(** Creates a Gaussian operator *)
|
||||
|
||||
val of_range_separation: Rs_operator.t -> t
|
||||
(** Creates a range-separated operator *)
|
||||
|
||||
|
8
operators/lib/rs_operator.ml
Normal file
8
operators/lib/rs_operator.ml
Normal file
@ -0,0 +1,8 @@
|
||||
(** Type for range-separation parameter *)
|
||||
|
||||
type t = float
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user