From 938e9c18fbd1b857db78d0e83dc8c19be0a025c0 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 1 Feb 2018 17:46:10 +0100 Subject: [PATCH] Fixed --- Basis/TwoElectronRR.ml | 60 +++++++++++--------------------- Basis/TwoElectronRRVectorized.ml | 1 - 2 files changed, 21 insertions(+), 40 deletions(-) diff --git a/Basis/TwoElectronRR.ml b/Basis/TwoElectronRR.ml index 83ae3f0..35b6b29 100644 --- a/Basis/TwoElectronRR.ml +++ b/Basis/TwoElectronRR.ml @@ -191,46 +191,28 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d) v1.(0) +. f2 *. v2.(0) | _ -> -(* - let key = Zkey.of_int_tuple (Zkey.Nine ( - (angMom_a.(0)+1, angMom_a.(1)+1, angMom_a.(2)+1), - (angMom_b.(0)+1, angMom_b.(1)+1, angMom_b.(2)+1), - (angMom_c.(0)+1, angMom_c.(1)+1, angMom_c.(2)+1)) ) - in - - try (Zmap.find map key).(0) with - | Not_found -> - let result = ( - *) - let ap = [| angMom_a.(0) ; angMom_a.(1) ; angMom_a.(2) |] - and bm = [| angMom_b.(0) ; angMom_b.(1) ; angMom_b.(2) |] - and xyz = - match angMom_b with - | [|_;0;0|] -> 0 - | [|_;_;0|] -> 1 - | _ -> 2 - in - ap.(xyz) <- ap.(xyz) + 1; - bm.(xyz) <- bm.(xyz) - 1; - if (bm.(xyz) < 0) then 0. else - let h1 = - hrr0 ap bm angMom_c (totAngMom_a+1) (totAngMom_b-1) totAngMom_c - in - let f2 = - (Coordinate.coord center_ab xyz) - in - if (abs_float f2 < cutoff) then h1 else - let h2 = - hrr0 angMom_a bm angMom_c totAngMom_a (totAngMom_b-1) totAngMom_c - in - h1 +. f2 *. h2 - (* - ) + let ap = [| angMom_a.(0) ; angMom_a.(1) ; angMom_a.(2) |] + and bm = [| angMom_b.(0) ; angMom_b.(1) ; angMom_b.(2) |] + and xyz = + match angMom_b with + | [|_;0;0|] -> 0 + | [|_;_;0|] -> 1 + | _ -> 2 + in + ap.(xyz) <- ap.(xyz) + 1; + bm.(xyz) <- bm.(xyz) - 1; + if (bm.(xyz) < 0) then 0. else + let h1 = + hrr0 ap bm angMom_c (totAngMom_a+1) (totAngMom_b-1) totAngMom_c + in + let f2 = + (Coordinate.coord center_ab xyz) + in + if (abs_float f2 < cutoff) then h1 else + let h2 = + hrr0 angMom_a bm angMom_c totAngMom_a (totAngMom_b-1) totAngMom_c in - let result = [|result|] in - Zmap.add map key result; - result.(0) - *) + h1 +. f2 *. h2 and hrr angMom_a angMom_b angMom_c angMom_d totAngMom_a totAngMom_b totAngMom_c totAngMom_d = diff --git a/Basis/TwoElectronRRVectorized.ml b/Basis/TwoElectronRRVectorized.ml index 364575d..d813183 100644 --- a/Basis/TwoElectronRRVectorized.ml +++ b/Basis/TwoElectronRRVectorized.ml @@ -36,7 +36,6 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d) | 1 -> let i = if angMom_a.(0) = 1 then 0 else if angMom_a.(1) = 1 then 1 else 2 in let f = expo_b *. (Coordinate.coord center_ab i) in - if (abs_float f < cutoff) then empty else Array.mapi (fun k c -> c *. expo_inv_p *. ( (Coordinate.coord center_pq.(k) i) *. zero_m_array.(k).(m+1) -. f *. zero_m_array.(k).(m) ) ) coef_prod