From 8c35202b29f9c0c4e676b647a42a81ccaab801d4 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Sun, 11 Feb 2018 18:51:35 +0100 Subject: [PATCH] Accelerated scalar RR --- Basis/TwoElectronRR.ml | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) diff --git a/Basis/TwoElectronRR.ml b/Basis/TwoElectronRR.ml index 3a4f82d..e620999 100644 --- a/Basis/TwoElectronRR.ml +++ b/Basis/TwoElectronRR.ml @@ -76,26 +76,45 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d) let f1 = expo_inv_p *. (Coordinate.coord center_pq xyz) and f2 = expo_b *. expo_inv_p *. (Coordinate.coord center_ab xyz) in + let result = Array.create_float maxsze in if amxyz < 1 then - let v1 = - vrr0 am (totAngMom_a-1) - in + begin + let v1 = + vrr0 am (totAngMom_a-1) + in + for m=0 to maxm-1 do + result.(m) <- f1 *. v1.(m+1) -. f2 *. v1.(m) + done; + result.(maxm) <- -. f2 *. v1.(maxm) + (* Array.init maxsze (fun m -> if m = maxm then 0. else (f1 *. v1.(m+1) ) -. f2 *. v1.(m) ) + *) + end else - let v3 = - vrr0 amm (totAngMom_a-2) - in - let v1 = - vrr0 am (totAngMom_a-1) - in - let f3 = (float_of_int amxyz) *. expo_inv_p *. 0.5 in + begin + let v3 = + vrr0 amm (totAngMom_a-2) + in + let v1 = + vrr0 am (totAngMom_a-1) + in + let f3 = (float_of_int amxyz) *. expo_inv_p *. 0.5 in + for m=0 to maxm-1 do + result.(m) <- f1 *. v1.(m+1) -. f2 *. v1.(m) + +. f3 *. (v3.(m) +. expo_inv_p *. v3.(m+1)) + done; + result.(maxm) <- f3 *. v3.(maxm) + end; + result + (* Array.init maxsze (fun m -> (if m = maxm then 0. else (f1 *. v1.(m+1) ) -. f2 *. v1.(m) ) +. f3 *. (v3.(m) +. if m = maxm then 0. else expo_inv_p *. v3.(m+1)) ) + *) in Zmap.add map_1d key result; result