mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-07 14:43:41 +01:00
Cleaned TwoElectronRRVectorized.ml
This commit is contained in:
parent
db00f8e27f
commit
8bfee5f8cf
@ -7,7 +7,8 @@ module Zm = struct
|
|||||||
|
|
||||||
let name = "Electron repulsion integrals"
|
let name = "Electron repulsion integrals"
|
||||||
|
|
||||||
let zero_m ~maxm ~expo_pq_inv ~norm_pq_sq =
|
let zero_m ~maxm ~expo_p_inv ~expo_q_inv ~norm_pq_sq =
|
||||||
|
let expo_pq_inv = expo_p_inv +. expo_q_inv in
|
||||||
assert (expo_pq_inv <> 0.);
|
assert (expo_pq_inv <> 0.);
|
||||||
let norm_pq_sq =
|
let norm_pq_sq =
|
||||||
if norm_pq_sq > integrals_cutoff then norm_pq_sq else 0.
|
if norm_pq_sq > integrals_cutoff then norm_pq_sq else 0.
|
||||||
|
@ -17,7 +17,8 @@ module Fis = FourIdxStorage
|
|||||||
module type Zero_mType =
|
module type Zero_mType =
|
||||||
sig
|
sig
|
||||||
val name : string
|
val name : string
|
||||||
val zero_m : maxm:int -> expo_pq_inv:float -> norm_pq_sq:float -> float array
|
val zero_m : maxm:int -> expo_p_inv:float -> expo_q_inv:float ->
|
||||||
|
norm_pq_sq:float -> float array
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
|
@ -11,7 +11,8 @@ module type Zero_mType =
|
|||||||
val name : string
|
val name : string
|
||||||
(** Name of the kind of integrals, for printing purposes. *)
|
(** Name of the kind of integrals, for printing purposes. *)
|
||||||
|
|
||||||
val zero_m : maxm:int -> expo_pq_inv:float -> norm_pq_sq:float -> float array
|
val zero_m : maxm:int -> expo_p_inv:float -> expo_q_inv:float ->
|
||||||
|
norm_pq_sq:float -> float array
|
||||||
(** The returned float array contains all the {% $(00|00)^m$ %} values, where
|
(** The returned float array contains all the {% $(00|00)^m$ %} values, where
|
||||||
[m] is the index of the array.
|
[m] is the index of the array.
|
||||||
|
|
||||||
|
@ -21,8 +21,8 @@ type four_idx_intermediates =
|
|||||||
{
|
{
|
||||||
expo_b : float ;
|
expo_b : float ;
|
||||||
expo_d : float ;
|
expo_d : float ;
|
||||||
expo_inv_p : float ;
|
expo_p_inv : float ;
|
||||||
expo_inv_q : float ;
|
expo_q_inv : float ;
|
||||||
center_ab : Co.t ;
|
center_ab : Co.t ;
|
||||||
center_cd : Co.t ;
|
center_cd : Co.t ;
|
||||||
center_pq : Co.t ;
|
center_pq : Co.t ;
|
||||||
@ -41,8 +41,8 @@ let rec hvrr_two_e
|
|||||||
let abcd = {
|
let abcd = {
|
||||||
expo_b = abcd.expo_d ;
|
expo_b = abcd.expo_d ;
|
||||||
expo_d = abcd.expo_b ;
|
expo_d = abcd.expo_b ;
|
||||||
expo_inv_p = abcd.expo_inv_q ;
|
expo_p_inv = abcd.expo_q_inv ;
|
||||||
expo_inv_q = abcd.expo_inv_p ;
|
expo_q_inv = abcd.expo_p_inv ;
|
||||||
center_ab = abcd.center_cd ;
|
center_ab = abcd.center_cd ;
|
||||||
center_cd = abcd.center_ab ;
|
center_cd = abcd.center_ab ;
|
||||||
center_pq = Co.neg abcd.center_pq ;
|
center_pq = Co.neg abcd.center_pq ;
|
||||||
@ -67,8 +67,8 @@ let rec hvrr_two_e
|
|||||||
| _ -> Co.Z
|
| _ -> Co.Z
|
||||||
in
|
in
|
||||||
|
|
||||||
let expo_inv_p = abcd.expo_inv_p
|
let expo_p_inv = abcd.expo_p_inv
|
||||||
and expo_inv_q = abcd.expo_inv_q
|
and expo_q_inv = abcd.expo_q_inv
|
||||||
and center_ab = abcd.center_ab
|
and center_ab = abcd.center_ab
|
||||||
and center_cd = abcd.center_cd
|
and center_cd = abcd.center_cd
|
||||||
and center_pq = abcd.center_pq
|
and center_pq = abcd.center_pq
|
||||||
@ -89,8 +89,8 @@ let rec hvrr_two_e
|
|||||||
let am = Po.decr xyz angMom_a in
|
let am = Po.decr xyz angMom_a in
|
||||||
let amxyz = Po.get xyz am in
|
let amxyz = Po.get xyz am in
|
||||||
|
|
||||||
let f1 = expo_inv_p *. Co.get xyz center_pq
|
let f1 = expo_p_inv *. Co.get xyz center_pq
|
||||||
and f2 = abcd.expo_b *. expo_inv_p *. Co.get xyz center_ab
|
and f2 = abcd.expo_b *. expo_p_inv *. Co.get xyz center_ab
|
||||||
in
|
in
|
||||||
let result = Array.create_float (maxsze - angMom_a.Po.tot) in
|
let result = Array.create_float (maxsze - angMom_a.Po.tot) in
|
||||||
if amxyz = 0 then
|
if amxyz = 0 then
|
||||||
@ -104,10 +104,10 @@ let rec hvrr_two_e
|
|||||||
let amm = Po.decr xyz am in
|
let amm = Po.decr xyz am in
|
||||||
let v3 = vrr0 amm in
|
let v3 = vrr0 amm in
|
||||||
let v1 = vrr0 am in
|
let v1 = vrr0 am in
|
||||||
let f3 = (float_of_int amxyz) *. expo_inv_p *. 0.5 in
|
let f3 = (float_of_int amxyz) *. expo_p_inv *. 0.5 in
|
||||||
Array.iteri (fun m _ ->
|
Array.iteri (fun m _ ->
|
||||||
result.(m) <- f1 *. v1.(m+1) -. f2 *. v1.(m)
|
result.(m) <- f1 *. v1.(m+1) -. f2 *. v1.(m)
|
||||||
+. f3 *. (v3.(m) +. expo_inv_p *. v3.(m+1)) ) result
|
+. f3 *. (v3.(m) +. expo_p_inv *. v3.(m+1)) ) result
|
||||||
end;
|
end;
|
||||||
result
|
result
|
||||||
in Zmap.add map_1d key result;
|
in Zmap.add map_1d key result;
|
||||||
@ -132,16 +132,16 @@ let rec hvrr_two_e
|
|||||||
let axyz = Po.get xyz angMom_a in
|
let axyz = Po.get xyz angMom_a in
|
||||||
|
|
||||||
let f1 =
|
let f1 =
|
||||||
-. abcd.expo_d *. expo_inv_q *. Co.get xyz center_cd
|
-. abcd.expo_d *. expo_q_inv *. Co.get xyz center_cd
|
||||||
and f2 =
|
and f2 =
|
||||||
expo_inv_q *. Co.get xyz center_pq
|
expo_q_inv *. Co.get xyz center_pq
|
||||||
in
|
in
|
||||||
let result = Array.make (maxsze - angMom_a.Po.tot - angMom_c.Po.tot) 0. in
|
let result = Array.make (maxsze - angMom_a.Po.tot - angMom_c.Po.tot) 0. in
|
||||||
if axyz > 0 then
|
if axyz > 0 then
|
||||||
begin
|
begin
|
||||||
let am = Po.decr xyz angMom_a in
|
let am = Po.decr xyz angMom_a in
|
||||||
let f5 =
|
let f5 =
|
||||||
(float_of_int axyz) *. expo_inv_p *. expo_inv_q *. 0.5
|
(float_of_int axyz) *. expo_p_inv *. expo_q_inv *. 0.5
|
||||||
in
|
in
|
||||||
if (abs_float f5 > cutoff) then
|
if (abs_float f5 > cutoff) then
|
||||||
let v5 =
|
let v5 =
|
||||||
@ -153,10 +153,10 @@ let rec hvrr_two_e
|
|||||||
if cmxyz > 0 then
|
if cmxyz > 0 then
|
||||||
begin
|
begin
|
||||||
let f3 =
|
let f3 =
|
||||||
(float_of_int cmxyz) *. expo_inv_q *. 0.5
|
(float_of_int cmxyz) *. expo_q_inv *. 0.5
|
||||||
in
|
in
|
||||||
if (abs_float f3 > cutoff) ||
|
if (abs_float f3 > cutoff) ||
|
||||||
(abs_float (f3 *. expo_inv_q) > cutoff) then
|
(abs_float (f3 *. expo_q_inv) > cutoff) then
|
||||||
begin
|
begin
|
||||||
let v3 =
|
let v3 =
|
||||||
let cmm = Po.decr xyz cm in
|
let cmm = Po.decr xyz cm in
|
||||||
@ -164,7 +164,7 @@ let rec hvrr_two_e
|
|||||||
in
|
in
|
||||||
Array.iteri (fun m _ ->
|
Array.iteri (fun m _ ->
|
||||||
result.(m) <- result.(m) +.
|
result.(m) <- result.(m) +.
|
||||||
f3 *. (v3.(m) +. expo_inv_q *. v3.(m+1)) ) result
|
f3 *. (v3.(m) +. expo_q_inv *. v3.(m+1)) ) result
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
if ( (abs_float f1 > cutoff) || (abs_float f2 > cutoff) ) then
|
if ( (abs_float f1 > cutoff) || (abs_float f2 > cutoff) ) then
|
||||||
@ -196,7 +196,7 @@ let rec hvrr_two_e
|
|||||||
let cm = Po.decr xyz angMom_c in
|
let cm = Po.decr xyz angMom_c in
|
||||||
let cmxyz = Po.get xyz cm in
|
let cmxyz = Po.get xyz cm in
|
||||||
|
|
||||||
let expo_inv_q_over_p = expo_inv_q /. expo_inv_p in
|
let expo_inv_q_over_p = expo_q_inv /. expo_p_inv in
|
||||||
let f =
|
let f =
|
||||||
Co.get xyz center_qc +. expo_inv_q_over_p *.
|
Co.get xyz center_qc +. expo_inv_q_over_p *.
|
||||||
Co.get xyz center_pa
|
Co.get xyz center_pa
|
||||||
@ -205,7 +205,7 @@ let rec hvrr_two_e
|
|||||||
|
|
||||||
let result =
|
let result =
|
||||||
if cmxyz < 1 then result else
|
if cmxyz < 1 then result else
|
||||||
let f = 0.5 *. (float_of_int cmxyz) *. expo_inv_q in
|
let f = 0.5 *. (float_of_int cmxyz) *. expo_q_inv in
|
||||||
if abs_float f < cutoff then 0. else
|
if abs_float f < cutoff then 0. else
|
||||||
let cmm = Po.decr xyz cm in
|
let cmm = Po.decr xyz cm in
|
||||||
let v3 = trr angMom_a cmm in
|
let v3 = trr angMom_a cmm in
|
||||||
@ -225,7 +225,7 @@ let rec hvrr_two_e
|
|||||||
in
|
in
|
||||||
let result =
|
let result =
|
||||||
if axyz < 1 then result else
|
if axyz < 1 then result else
|
||||||
let f = 0.5 *. (float_of_int axyz) *. expo_inv_q in
|
let f = 0.5 *. (float_of_int axyz) *. expo_q_inv in
|
||||||
if abs_float f < cutoff then result else
|
if abs_float f < cutoff then result else
|
||||||
let am = Po.decr xyz angMom_a in
|
let am = Po.decr xyz angMom_a in
|
||||||
let v2 = trr am cm in
|
let v2 = trr am cm in
|
||||||
@ -332,16 +332,15 @@ let contracted_class_shell_pair_couple ~zero_m shell_pair_couple : float Zmap.t
|
|||||||
and sp_cd = Pspc.shell_pair_q spc
|
and sp_cd = Pspc.shell_pair_q spc
|
||||||
in
|
in
|
||||||
|
|
||||||
let expo_inv_p = Psp.exponent_inv sp_ab
|
let expo_p_inv = Psp.exponent_inv sp_ab
|
||||||
in
|
in
|
||||||
|
|
||||||
let center_pq = Co.(Psp.center sp_ab |- Psp.center sp_cd) in
|
let center_pq = Co.(Psp.center sp_ab |- Psp.center sp_cd) in
|
||||||
let norm_pq_sq = Co.dot center_pq center_pq in
|
let norm_pq_sq = Co.dot center_pq center_pq in
|
||||||
let expo_inv_q = Psp.exponent_inv sp_cd in
|
let expo_q_inv = Psp.exponent_inv sp_cd in
|
||||||
let expo_pq_inv = expo_inv_p +. expo_inv_q in
|
|
||||||
|
|
||||||
let zero_m_array =
|
let zero_m_array =
|
||||||
zero_m ~maxm ~expo_pq_inv ~norm_pq_sq
|
zero_m ~maxm ~expo_p_inv ~expo_q_inv ~norm_pq_sq
|
||||||
in
|
in
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -382,7 +381,7 @@ let contracted_class_shell_pair_couple ~zero_m shell_pair_couple : float Zmap.t
|
|||||||
let coef_prod = coef_prod *. norm in
|
let coef_prod = coef_prod *. norm in
|
||||||
|
|
||||||
let abcd = {
|
let abcd = {
|
||||||
expo_b ; expo_d ; expo_inv_p ; expo_inv_q ;
|
expo_b ; expo_d ; expo_p_inv ; expo_q_inv ;
|
||||||
center_ab ; center_cd ; center_pq ;
|
center_ab ; center_cd ; center_pq ;
|
||||||
center_pa ; center_qc ; zero_m_array ;
|
center_pa ; center_qc ; zero_m_array ;
|
||||||
} in
|
} in
|
||||||
@ -444,16 +443,15 @@ let contracted_class_atomic_shell_pair_couple ~zero_m atomic_shell_pair_couple :
|
|||||||
and sp_cd = Pspc.shell_pair_q spc
|
and sp_cd = Pspc.shell_pair_q spc
|
||||||
in
|
in
|
||||||
|
|
||||||
let expo_inv_p = Psp.exponent_inv sp_ab
|
let expo_p_inv = Psp.exponent_inv sp_ab
|
||||||
in
|
in
|
||||||
|
|
||||||
let center_pq = Co.(Psp.center sp_ab |- Psp.center sp_cd) in
|
let center_pq = Co.(Psp.center sp_ab |- Psp.center sp_cd) in
|
||||||
let norm_pq_sq = Co.dot center_pq center_pq in
|
let norm_pq_sq = Co.dot center_pq center_pq in
|
||||||
let expo_inv_q = Psp.exponent_inv sp_cd in
|
let expo_q_inv = Psp.exponent_inv sp_cd in
|
||||||
let expo_pq_inv = expo_inv_p +. expo_inv_q in
|
|
||||||
|
|
||||||
let zero_m_array =
|
let zero_m_array =
|
||||||
zero_m ~maxm ~expo_pq_inv ~norm_pq_sq
|
zero_m ~maxm ~expo_p_inv ~expo_q_inv ~norm_pq_sq
|
||||||
in
|
in
|
||||||
|
|
||||||
begin
|
begin
|
||||||
@ -494,7 +492,7 @@ let contracted_class_atomic_shell_pair_couple ~zero_m atomic_shell_pair_couple :
|
|||||||
let coef_prod = coef_prod *. norm in
|
let coef_prod = coef_prod *. norm in
|
||||||
|
|
||||||
let abcd = {
|
let abcd = {
|
||||||
expo_b ; expo_d ; expo_inv_p ; expo_inv_q ;
|
expo_b ; expo_d ; expo_p_inv ; expo_q_inv ;
|
||||||
center_ab ; center_cd ; center_pq ;
|
center_ab ; center_cd ; center_pq ;
|
||||||
center_pa ; center_qc ; zero_m_array ;
|
center_pa ; center_qc ; zero_m_array ;
|
||||||
} in
|
} in
|
||||||
|
@ -23,17 +23,36 @@ let at_least_one_valid arr =
|
|||||||
Array.iter (fun x -> if (abs_float x > cutoff) then raise Found) arr ; false
|
Array.iter (fun x -> if (abs_float x > cutoff) then raise Found) arr ; false
|
||||||
with Found -> true
|
with Found -> true
|
||||||
|
|
||||||
|
type fou_idx_intermediate =
|
||||||
|
{
|
||||||
|
expo_b : float array;
|
||||||
|
expo_d : float array;
|
||||||
|
expo_p_inv : float array;
|
||||||
|
expo_q_inv : float array;
|
||||||
|
center_ab : Co.t ;
|
||||||
|
center_cd : Co.t ;
|
||||||
|
center_pq : Co.axis -> float array array;
|
||||||
|
center_pa : Co.axis -> float array;
|
||||||
|
center_qc : Co.axis -> float array;
|
||||||
|
zero_m_array : float array array array;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
(** Horizontal and Vertical Recurrence Relations (HVRR) *)
|
(** Horizontal and Vertical Recurrence Relations (HVRR) *)
|
||||||
let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
||||||
zero_m_array
|
abcd map_1d map_2d np nq
|
||||||
(expo_b, expo_d)
|
|
||||||
(expo_inv_p, expo_inv_q)
|
|
||||||
(center_ab, center_cd, center_pq)
|
|
||||||
(center_pa, center_qc)
|
|
||||||
map_1d map_2d np nq
|
|
||||||
=
|
=
|
||||||
|
|
||||||
|
let expo_p_inv = abcd.expo_p_inv
|
||||||
|
and expo_q_inv = abcd.expo_q_inv
|
||||||
|
and center_ab = abcd.center_ab
|
||||||
|
and center_cd = abcd.center_cd
|
||||||
|
and center_pq = abcd.center_pq
|
||||||
|
in
|
||||||
|
|
||||||
|
let zero_m_array = abcd.zero_m_array in
|
||||||
|
|
||||||
let maxm = Array.length zero_m_array - 1 in
|
let maxm = Array.length zero_m_array - 1 in
|
||||||
|
|
||||||
let get_xyz angMom =
|
let get_xyz angMom =
|
||||||
@ -62,10 +81,11 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
|
|
||||||
begin
|
begin
|
||||||
if abs_float cab >= cutoff then
|
if abs_float cab >= cutoff then
|
||||||
|
let expo_b = abcd.expo_b in
|
||||||
Array.iteri (fun m result_m ->
|
Array.iteri (fun m result_m ->
|
||||||
let v0 = v_am.(m) in
|
let v0 = v_am.(m) in
|
||||||
Array.iteri (fun l result_ml ->
|
Array.iteri (fun l result_ml ->
|
||||||
let f0 = -. expo_b.(l) *. expo_inv_p.(l) *. cab
|
let f0 = -. expo_b.(l) *. expo_p_inv.(l) *. cab
|
||||||
and v0_l = v0.(l)
|
and v0_l = v0.(l)
|
||||||
in
|
in
|
||||||
Array.iteri (fun k v0_lk ->
|
Array.iteri (fun k v0_lk ->
|
||||||
@ -87,14 +107,14 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
+. expo_inv_p_l *. center_pq_xyz_l.(k) *. p0_lk
|
+. expo_inv_p_l *. center_pq_xyz_l.(k) *. p0_lk
|
||||||
) p0_l
|
) p0_l
|
||||||
) result
|
) result
|
||||||
) expo_inv_p
|
) expo_p_inv
|
||||||
else
|
else
|
||||||
begin
|
begin
|
||||||
let amm = Po.decr xyz am in
|
let amm = Po.decr xyz am in
|
||||||
let amxyz = float_of_int amxyz in
|
let amxyz = float_of_int amxyz in
|
||||||
let v_amm = vrr0_v amm in
|
let v_amm = vrr0_v amm in
|
||||||
Array.iteri (fun l expo_inv_p_l ->
|
Array.iteri (fun l expo_inv_p_l ->
|
||||||
let f = amxyz *. expo_inv_p.(l) *. 0.5
|
let f = amxyz *. expo_p_inv.(l) *. 0.5
|
||||||
and center_pq_xyz_l = (center_pq xyz).(l)
|
and center_pq_xyz_l = (center_pq xyz).(l)
|
||||||
in
|
in
|
||||||
Array.iteri (fun m result_m ->
|
Array.iteri (fun m result_m ->
|
||||||
@ -111,7 +131,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
f *. (v1_l.(k) +. v2_l.(k) *. expo_inv_p_l)
|
f *. (v1_l.(k) +. v2_l.(k) *. expo_inv_p_l)
|
||||||
) p0.(l)
|
) p0.(l)
|
||||||
) result
|
) result
|
||||||
) expo_inv_p
|
) expo_p_inv
|
||||||
end;
|
end;
|
||||||
result
|
result
|
||||||
in
|
in
|
||||||
@ -139,8 +159,9 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
let f = -. (Co.get xyz center_cd) in
|
let f = -. (Co.get xyz center_cd) in
|
||||||
|
|
||||||
let f1 =
|
let f1 =
|
||||||
|
let expo_d = abcd.expo_d in
|
||||||
Array.init nq (fun k ->
|
Array.init nq (fun k ->
|
||||||
let x = expo_d.(k) *. expo_inv_q.(k) *. f in
|
let x = expo_d.(k) *. expo_q_inv.(k) *. f in
|
||||||
if ( (not !do_compute) && (abs_float x > cutoff) ) then
|
if ( (not !do_compute) && (abs_float x > cutoff) ) then
|
||||||
do_compute := true;
|
do_compute := true;
|
||||||
x)
|
x)
|
||||||
@ -163,7 +184,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
Array.init np (fun l ->
|
Array.init np (fun l ->
|
||||||
let cpq_l = (center_pq xyz).(l) in
|
let cpq_l = (center_pq xyz).(l) in
|
||||||
Array.init nq (fun k ->
|
Array.init nq (fun k ->
|
||||||
let x = expo_inv_q.(k) *. cpq_l.(k) in
|
let x = expo_q_inv.(k) *. cpq_l.(k) in
|
||||||
if (!do_compute) then x
|
if (!do_compute) then x
|
||||||
else (if abs_float x > cutoff then do_compute := true ; x)
|
else (if abs_float x > cutoff then do_compute := true ; x)
|
||||||
) )
|
) )
|
||||||
@ -212,7 +233,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
let fcm = (float_of_int (cxyz-1)) *. 0.5 in
|
let fcm = (float_of_int (cxyz-1)) *. 0.5 in
|
||||||
let f1 =
|
let f1 =
|
||||||
Array.init nq (fun k ->
|
Array.init nq (fun k ->
|
||||||
let x = fcm *. expo_inv_q.(k) in
|
let x = fcm *. expo_q_inv.(k) in
|
||||||
if (!do_compute) then x
|
if (!do_compute) then x
|
||||||
else (if abs_float x > cutoff then do_compute := true ; x)
|
else (if abs_float x > cutoff then do_compute := true ; x)
|
||||||
)
|
)
|
||||||
@ -240,7 +261,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
let v3 =
|
let v3 =
|
||||||
let f2 =
|
let f2 =
|
||||||
Array.init nq (fun k ->
|
Array.init nq (fun k ->
|
||||||
let x = expo_inv_q.(k) *. f1.(k) in
|
let x = expo_q_inv.(k) *. f1.(k) in
|
||||||
if (!do_compute) then x
|
if (!do_compute) then x
|
||||||
else (if abs_float x > cutoff then do_compute := true ; x)
|
else (if abs_float x > cutoff then do_compute := true ; x)
|
||||||
)
|
)
|
||||||
@ -334,12 +355,12 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
| Some p2 -> p2
|
| Some p2 -> p2
|
||||||
in
|
in
|
||||||
for l=0 to np-1 do
|
for l=0 to np-1 do
|
||||||
let fa = (float_of_int axyz) *. expo_inv_p.(l) *. 0.5 in
|
let fa = (float_of_int axyz) *. expo_p_inv.(l) *. 0.5 in
|
||||||
let p2_l = p2.(l)
|
let p2_l = p2.(l)
|
||||||
and v_l = v.(l)
|
and v_l = v.(l)
|
||||||
in
|
in
|
||||||
for k=0 to nq-1 do
|
for k=0 to nq-1 do
|
||||||
p2_l.(k) <- p2_l.(k) -. fa *. expo_inv_q.(k) *. v_l.(k)
|
p2_l.(k) <- p2_l.(k) -. fa *. expo_q_inv.(k) *. v_l.(k)
|
||||||
done
|
done
|
||||||
done;
|
done;
|
||||||
Some p2
|
Some p2
|
||||||
@ -367,7 +388,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
Array.mapi (fun l expo_inv_p_l ->
|
Array.mapi (fun l expo_inv_p_l ->
|
||||||
let expo_p_l = 1./.expo_inv_p_l in
|
let expo_p_l = 1./.expo_inv_p_l in
|
||||||
Array.mapi (fun k expo_inv_q_k ->
|
Array.mapi (fun k expo_inv_q_k ->
|
||||||
expo_inv_q_k *. expo_p_l) expo_inv_q ) expo_inv_p
|
expo_inv_q_k *. expo_p_l) expo_q_inv ) expo_p_inv
|
||||||
in
|
in
|
||||||
let result = None in
|
let result = None in
|
||||||
|
|
||||||
@ -382,7 +403,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
Some (Array.init np (fun l ->
|
Some (Array.init np (fun l ->
|
||||||
let v3_l = v3.(l) in
|
let v3_l = v3.(l) in
|
||||||
Array.mapi (fun k v3_lk ->
|
Array.mapi (fun k v3_lk ->
|
||||||
expo_inv_q.(k) *. f *. v3_lk) v3_l
|
expo_q_inv.(k) *. f *. v3_lk) v3_l
|
||||||
) )
|
) )
|
||||||
| Some result, None -> Some result
|
| Some result, None -> Some result
|
||||||
| Some result, Some v3 ->
|
| Some result, Some v3 ->
|
||||||
@ -390,7 +411,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
let result_l = result.(l) in
|
let result_l = result.(l) in
|
||||||
Array.iteri (fun k v3_lk ->
|
Array.iteri (fun k v3_lk ->
|
||||||
result_l.(k) <- result_l.(k) +.
|
result_l.(k) <- result_l.(k) +.
|
||||||
expo_inv_q.(k) *. f *. v3_lk) v3_l
|
expo_q_inv.(k) *. f *. v3_lk) v3_l
|
||||||
) v3 ; Some result)
|
) v3 ; Some result)
|
||||||
end
|
end
|
||||||
in
|
in
|
||||||
@ -460,14 +481,14 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
let result_l = result.(l) in
|
let result_l = result.(l) in
|
||||||
Array.iteri (fun k v2_lk ->
|
Array.iteri (fun k v2_lk ->
|
||||||
result_l.(k) <- result_l.(k) +.
|
result_l.(k) <- result_l.(k) +.
|
||||||
expo_inv_q.(k) *. f *. v2_lk) v2_l
|
expo_q_inv.(k) *. f *. v2_lk) v2_l
|
||||||
) v2; Some result)
|
) v2; Some result)
|
||||||
| None, None -> None
|
| None, None -> None
|
||||||
| None, Some v2 ->
|
| None, Some v2 ->
|
||||||
Some (Array.init np (fun l ->
|
Some (Array.init np (fun l ->
|
||||||
let v2_l = v2.(l) in
|
let v2_l = v2.(l) in
|
||||||
Array.mapi (fun k v2_lk ->
|
Array.mapi (fun k v2_lk ->
|
||||||
expo_inv_q.(k) *. f *. v2_lk) v2_l
|
expo_q_inv.(k) *. f *. v2_lk) v2_l
|
||||||
) )
|
) )
|
||||||
end
|
end
|
||||||
in
|
in
|
||||||
@ -599,9 +620,9 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
contracted_class.(0) <-
|
contracted_class.(0) <-
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
let expo_inv_p =
|
let expo_p_inv =
|
||||||
Vec.init np (fun ab -> Psp.exponent_inv sp.(ab-1))
|
Vec.init np (fun ab -> Psp.exponent_inv sp.(ab-1))
|
||||||
and expo_inv_q =
|
and expo_q_inv =
|
||||||
Vec.init nq (fun cd -> Psp.exponent_inv sq.(cd-1))
|
Vec.init nq (fun cd -> Psp.exponent_inv sq.(cd-1))
|
||||||
in
|
in
|
||||||
|
|
||||||
@ -615,8 +636,8 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
if (abs_float coef.{j,i} ) < 1.e-3*.cutoff then
|
if (abs_float coef.{j,i} ) < 1.e-3*.cutoff then
|
||||||
raise NullQuartet;
|
raise NullQuartet;
|
||||||
|
|
||||||
let expo_pq_inv =
|
let expo_p_inv, expo_q_inv =
|
||||||
expo_inv_p.{i} +. expo_inv_q.{j}
|
expo_p_inv.{i}, expo_q_inv.{j}
|
||||||
in
|
in
|
||||||
|
|
||||||
let center_pq =
|
let center_pq =
|
||||||
@ -627,7 +648,7 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
in
|
in
|
||||||
|
|
||||||
let zero_m_array =
|
let zero_m_array =
|
||||||
zero_m ~maxm:0 ~expo_pq_inv ~norm_pq_sq
|
zero_m ~maxm:0 ~expo_p_inv ~expo_q_inv ~norm_pq_sq
|
||||||
in
|
in
|
||||||
zero_m_array.(0)
|
zero_m_array.(0)
|
||||||
with NullQuartet -> 0.
|
with NullQuartet -> 0.
|
||||||
@ -644,9 +665,9 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
|
|
||||||
let norm = Cspc.norm_scales shell_pair_couple in
|
let norm = Cspc.norm_scales shell_pair_couple in
|
||||||
|
|
||||||
let expo_inv_p =
|
let expo_p_inv =
|
||||||
Array.map (fun shell_ab -> Psp.exponent_inv shell_ab) sp
|
Array.map (fun shell_ab -> Psp.exponent_inv shell_ab) sp
|
||||||
and expo_inv_q =
|
and expo_q_inv =
|
||||||
Array.map (fun shell_cd -> Psp.exponent_inv shell_cd) sq
|
Array.map (fun shell_cd -> Psp.exponent_inv shell_cd) sq
|
||||||
in
|
in
|
||||||
|
|
||||||
@ -729,8 +750,8 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
if (abs_float coef.(ab).(cd) < cutoff) then
|
if (abs_float coef.(ab).(cd) < cutoff) then
|
||||||
empty
|
empty
|
||||||
else
|
else
|
||||||
let expo_pq_inv =
|
let expo_p_inv, expo_q_inv =
|
||||||
expo_inv_p.(ab) +. expo_inv_q.(cd)
|
expo_p_inv.(ab), expo_q_inv.(cd)
|
||||||
in
|
in
|
||||||
let norm_pq_sq =
|
let norm_pq_sq =
|
||||||
let x = (center_pq X).(ab).(cd)
|
let x = (center_pq X).(ab).(cd)
|
||||||
@ -740,7 +761,7 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
x *. x +. y *. y +. z *. z
|
x *. x +. y *. y +. z *. z
|
||||||
in
|
in
|
||||||
|
|
||||||
zero_m ~maxm ~expo_pq_inv ~norm_pq_sq
|
zero_m ~maxm ~expo_p_inv ~expo_q_inv ~norm_pq_sq
|
||||||
) sq
|
) sq
|
||||||
in
|
in
|
||||||
(* Transpose result *)
|
(* Transpose result *)
|
||||||
@ -799,15 +820,17 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
if schwartz_p *. schwartz_q < cutoff2 then raise NullQuartet;
|
if schwartz_p *. schwartz_q < cutoff2 then raise NullQuartet;
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let abcd =
|
||||||
|
{ expo_b ; expo_d ; expo_p_inv ; expo_q_inv ;
|
||||||
|
center_ab = Csp.a_minus_b shell_p;
|
||||||
|
center_cd = Csp.a_minus_b shell_q ;
|
||||||
|
center_pq ; center_pa ;
|
||||||
|
center_qc ; zero_m_array }
|
||||||
|
in
|
||||||
|
|
||||||
let integral =
|
let integral =
|
||||||
hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
||||||
zero_m_array
|
abcd map_1d map_2d np nq
|
||||||
(expo_b, expo_d)
|
|
||||||
(expo_inv_p, expo_inv_q)
|
|
||||||
(Csp.a_minus_b shell_p,
|
|
||||||
Csp.a_minus_b shell_q, center_pq)
|
|
||||||
(center_pa, center_qc)
|
|
||||||
map_1d map_2d np nq
|
|
||||||
in
|
in
|
||||||
contracted_class.(i) <- contracted_class.(i) +. integral *. norm.(i)
|
contracted_class.(i) <- contracted_class.(i) +. integral *. norm.(i)
|
||||||
with NullQuartet -> ()
|
with NullQuartet -> ()
|
||||||
|
Loading…
Reference in New Issue
Block a user