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

Optimizations chop

This commit is contained in:
Anthony Scemama 2018-01-30 00:06:04 +01:00
parent b0a6353ade
commit fead8dce5b

View File

@ -53,13 +53,12 @@ let hvrr_two_e_vector m (angMom_a, angMom_b, angMom_c, angMom_d)
in in
am.(xyz) <- am.(xyz) - 1; am.(xyz) <- am.(xyz) - 1;
amm.(xyz) <- amm.(xyz) - 2; amm.(xyz) <- amm.(xyz) - 2;
if am.(xyz) < 0 then if am.(xyz) < 0 then empty else
empty
else
let v1 = let v1 =
let f = let f =
-. expo_b *. expo_inv_p *. (Coordinate.coord center_ab xyz) -. expo_b *. expo_inv_p *. (Coordinate.coord center_ab xyz)
in in
if (abs_float f < cutoff) then empty else
Array.mapi (fun k v1k -> f *. v1k) (vrr0_v m am (totAngMom_a-1) ) Array.mapi (fun k v1k -> f *. v1k) (vrr0_v m am (totAngMom_a-1) )
in in
let p1 = let p1 =
@ -67,9 +66,11 @@ let hvrr_two_e_vector m (angMom_a, angMom_b, angMom_c, angMom_d)
Array.mapi (fun k v2k -> v1.(k) +. expo_inv_p *. (Coordinate.coord center_pq.(k) xyz) *. v2k) (vrr0_v (m+1) am (totAngMom_a-1)) Array.mapi (fun k v2k -> v1.(k) +. expo_inv_p *. (Coordinate.coord center_pq.(k) xyz) *. v2k) (vrr0_v (m+1) am (totAngMom_a-1))
in in
if amm.(xyz) < 0 then p1 else if amm.(xyz) < 0 then p1 else
let f = (float_of_int am.(xyz)) *. expo_inv_p *. 0.5
in
if (abs_float f < cutoff) then empty else
let v1 = vrr0_v m amm (totAngMom_a-2) let v1 = vrr0_v m amm (totAngMom_a-2)
and v2 = vrr0_v (m+1) amm (totAngMom_a-2) and v2 = vrr0_v (m+1) amm (totAngMom_a-2)
and f = (float_of_int am.(xyz)) *. expo_inv_p *. 0.5
in in
Array.mapi (fun k _ -> p1.(k) +. Array.mapi (fun k _ -> p1.(k) +.
f *. (v1.(k) +. v2.(k) *. expo_inv_p ) ) coef_prod f *. (v1.(k) +. v2.(k) *. expo_inv_p ) ) coef_prod
@ -135,10 +136,14 @@ let hvrr_two_e_vector m (angMom_a, angMom_b, angMom_c, angMom_d)
) coef_prod ) coef_prod
in in
if (am.(xyz) < 0) || (cm.(xyz) < 0) then p2 else if (am.(xyz) < 0) || (cm.(xyz) < 0) then p2 else
let fa =
(float_of_int angMom_a.(xyz)) *. expo_inv_p *. 0.5
in
(*
if (abs_float fa < cutoff) then empty else
*)
let v = let v =
vrr_v (m+1) am cm (totAngMom_a-1) (totAngMom_c-1) vrr_v (m+1) am cm (totAngMom_a-1) (totAngMom_c-1)
and fa =
(float_of_int angMom_a.(xyz)) *. expo_inv_p *. 0.5
in in
Array.mapi (fun k _ -> Array.mapi (fun k _ ->
p2.(k) -. fa *. expo_inv_q.(k) *. v.(k) p2.(k) -. fa *. expo_inv_q.(k) *. v.(k)
@ -167,11 +172,13 @@ let hvrr_two_e_vector m (angMom_a, angMom_b, angMom_c, angMom_d)
| 1 -> let xyz = if angMom_b.(0) = 1 then 0 else if angMom_b.(1) = 1 then 1 else 2 in | 1 -> let xyz = if angMom_b.(0) = 1 then 0 else if angMom_b.(1) = 1 then 1 else 2 in
let ap = [| angMom_a.(0) ; angMom_a.(1) ; angMom_a.(2) |] in let ap = [| angMom_a.(0) ; angMom_a.(1) ; angMom_a.(2) |] in
ap.(xyz) <- ap.(xyz) + 1; ap.(xyz) <- ap.(xyz) + 1;
let f = Coordinate.coord center_ab xyz in
let v1 = let v1 =
vrr_v m ap angMom_c (totAngMom_a+1) totAngMom_c vrr_v m ap angMom_c (totAngMom_a+1) totAngMom_c
and v2 = in
if (abs_float f < cutoff) then v1 else
let v2 =
vrr_v m angMom_a angMom_c totAngMom_a totAngMom_c vrr_v m angMom_a angMom_c totAngMom_a totAngMom_c
and f = Coordinate.coord center_ab xyz
in in
Array.map2 (fun v1 v2 -> v1 +. v2 *. f) v1 v2 Array.map2 (fun v1 v2 -> v1 +. v2 *. f) v1 v2
| _ -> | _ ->
@ -188,9 +195,11 @@ let hvrr_two_e_vector m (angMom_a, angMom_b, angMom_c, angMom_d)
if (bm.(xyz) < 0) then empty else if (bm.(xyz) < 0) then empty else
let h1 = let h1 =
hrr0_v m ap bm angMom_c (totAngMom_a+1) (totAngMom_b-1) totAngMom_c hrr0_v m ap bm angMom_c (totAngMom_a+1) (totAngMom_b-1) totAngMom_c
and h2 = in
let f = (Coordinate.coord center_ab xyz) in
if (abs_float f < cutoff) then h1 else
let h2 =
hrr0_v m angMom_a bm angMom_c totAngMom_a (totAngMom_b-1) totAngMom_c hrr0_v m angMom_a bm angMom_c totAngMom_a (totAngMom_b-1) totAngMom_c
and f = (Coordinate.coord center_ab xyz)
in Array.map2 (fun h1 h2 -> h1 +. h2 *. f) h1 h2 in Array.map2 (fun h1 h2 -> h1 +. h2 *. f) h1 h2
and hrr_v m angMom_a angMom_b angMom_c angMom_d and hrr_v m angMom_a angMom_b angMom_c angMom_d