10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-07 06:33:39 +01:00
This commit is contained in:
Anthony Scemama 2018-02-03 17:16:14 +01:00
parent 6c6bcb462f
commit 6c59ebfd05

View File

@ -73,28 +73,36 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
(* 11_580_843 *) (* 11_580_843 *)
match (totAngMom_a, totAngMom_c) with match (totAngMom_a, totAngMom_c) with
| (i,0) -> (* 959_629 *) if (i>0) then vrr0 (angMom_a.(0),angMom_a.(1),angMom_a.(2)) totAngMom_a else zero_m_array | (i,0) -> (* 959_629 *) if (i>0) then vrr0 angMom_a totAngMom_a else zero_m_array
| (_,_) -> | (_,_) ->
(* 10_621_214 *) let maxsze = maxm+1 in (* 10_621_214 *) let maxsze = maxm+1 in
let key = Zkey.of_int_tuple (Zkey.Six let key = Zkey.of_int_tuple (Zkey.Six (angMom_a, angMom_c) ) in
((angMom_a.(0)+1, angMom_a.(1)+1, angMom_a.(2)+1),
(angMom_c.(0)+1, angMom_c.(1)+1, angMom_c.(2)+1)) )
in
try Zmap.find map_2d key with try Zmap.find map_2d key with
| Not_found -> | Not_found ->
let result = let result =
let cm = [| angMom_c.(0) ; angMom_c.(1) ; angMom_c.(2) |] in let am, cm, cmm, axyz, cxyz, xyz =
let xyz = let angMom_ax, angMom_ay, angMom_az = angMom_a
and angMom_cx, angMom_cy, angMom_cz = angMom_c in
match angMom_c with match angMom_c with
| [|_;0;0|] -> (* 321_984 *) 0 | (_,0,0) -> (* 321_984 *)
| [|_;_;0|] -> (* 612_002 *) 1 (angMom_ax-1, angMom_ay, angMom_az),
| _ -> (* 1_067_324 *) 2 (angMom_cx-1, angMom_cy, angMom_cz),
(angMom_cx-2, angMom_cy, angMom_cz),
angMom_ax,angMom_cx, 0
| (_,_,0) -> (* 612_002 *)
(angMom_ax, angMom_ay-1, angMom_az),
(angMom_cx, angMom_cy-1, angMom_cz),
(angMom_cx, angMom_cy-2, angMom_cz),
angMom_ay,angMom_cy, 1
| _ -> (* 1_067_324 *)
(angMom_ax, angMom_ay, angMom_az-1),
(angMom_cx, angMom_cy, angMom_cz-1),
(angMom_cx, angMom_cy, angMom_cz-2),
angMom_az,angMom_cz, 2
in in
cm.(xyz) <- cm.(xyz) - 1; if cxyz < 1 then empty else
if cm.(xyz) < 0 then empty else
let f1 = let f1 =
-. expo_d *. expo_inv_q *. (Coordinate.coord center_cd xyz) -. expo_d *. expo_inv_q *. (Coordinate.coord center_cd xyz)
in in
@ -110,14 +118,12 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
(* 9_232_029 *) f1 *. v1.(m) -. (if m = maxm then 0. else f2 *. v1.(m+1)) ) (* 9_232_029 *) f1 *. v1.(m) -. (if m = maxm then 0. else f2 *. v1.(m+1)) )
in in
let result = let result =
if cm.(xyz) < 1 then result else if cxyz < 2 then result else
let f3 = let f3 =
(float_of_int cm.(xyz)) *. expo_inv_q *. 0.5 (float_of_int (cxyz-1)) *. expo_inv_q *. 0.5
in in
if (abs_float f3 < cutoff) && (abs_float (f3 *. expo_inv_q) < cutoff) then result else if (abs_float f3 < cutoff) && (abs_float (f3 *. expo_inv_q) < cutoff) then result else
( (
let cmm = [| angMom_c.(0) ; angMom_c.(1) ; angMom_c.(2) |] in
cmm.(xyz) <- cmm.(xyz) - 2;
let v3 = let v3 =
vrr angMom_a cmm totAngMom_a (totAngMom_c-2) vrr angMom_a cmm totAngMom_a (totAngMom_c-2)
in in
@ -126,11 +132,9 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
) )
in in
let result = let result =
let am = [| angMom_a.(0) ; angMom_a.(1) ; angMom_a.(2) |] in if axyz < 1 || cxyz < 1 then result else
am.(xyz) <- am.(xyz) - 1;
if am.(xyz) lor cm.(xyz) < 0 then result else
let f5 = let f5 =
(float_of_int angMom_a.(xyz)) *. expo_inv_p *. expo_inv_q *. 0.5 (float_of_int axyz) *. expo_inv_p *. expo_inv_q *. 0.5
in in
if (abs_float f5 < cutoff) then result else if (abs_float f5 < cutoff) then result else
let v5 = let v5 =
@ -154,20 +158,20 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
(* 8_448_486 *) (* 8_448_486 *)
match totAngMom_b with match totAngMom_b with
| 0 -> (* 0 *) (vrr angMom_a angMom_c totAngMom_a totAngMom_c).(0) | 0 -> (* 0 *) (vrr (angMom_a.(0) ,angMom_a.(1) ,angMom_a.(2)) (angMom_c.(0) ,angMom_c.(1) ,angMom_c.(2)) totAngMom_a totAngMom_c).(0)
| 1 -> | 1 ->
(* 5_045_008 *) let xyz = if angMom_b.(0) = 1 then 0 else if angMom_b.(1) = 1 then 1 else 2 in (* 5_045_008 *) 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 v1 = let v1 =
vrr ap angMom_c (totAngMom_a+1) totAngMom_c vrr (ap.(0),ap.(1),ap.(2)) (angMom_c.(0) ,angMom_c.(1) ,angMom_c.(2)) (totAngMom_a+1) totAngMom_c
in in
let f2 = let f2 =
(Coordinate.coord center_ab xyz) (Coordinate.coord center_ab xyz)
in in
if (abs_float f2 < cutoff) then v1.(0) else if (abs_float f2 < cutoff) then v1.(0) else
let v2 = let v2 =
vrr angMom_a angMom_c totAngMom_a totAngMom_c vrr (angMom_a.(0) ,angMom_a.(1) ,angMom_a.(2)) (angMom_c.(0) ,angMom_c.(1) ,angMom_c.(2)) totAngMom_a totAngMom_c
in in
v1.(0) +. f2 *. v2.(0) v1.(0) +. f2 *. v2.(0)
| _ -> | _ ->
@ -201,7 +205,7 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
match (totAngMom_b, totAngMom_d) with match (totAngMom_b, totAngMom_d) with
| (_,0) -> (* 3_608_781 *) if (totAngMom_b = 0) then | (_,0) -> (* 3_608_781 *) if (totAngMom_b = 0) then
(vrr angMom_a angMom_c totAngMom_a totAngMom_c).(0) (vrr (angMom_a.(0) ,angMom_a.(1) ,angMom_a.(2)) (angMom_c.(0) ,angMom_c.(1) ,angMom_c.(2)) totAngMom_a totAngMom_c).(0)
else else
hrr0 angMom_a angMom_b angMom_c totAngMom_a totAngMom_b totAngMom_c hrr0 angMom_a angMom_b angMom_c totAngMom_a totAngMom_b totAngMom_c
| (_,_) -> | (_,_) ->