10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-07-25 12:17:25 +02:00

Merge branch 'tuples'

This commit is contained in:
Anthony Scemama 2018-02-03 18:21:33 +01:00
commit e3aecbff7d
2 changed files with 32 additions and 28 deletions

View File

@ -397,3 +397,8 @@ let xto_file ~filename basis =
*) *)

View File

@ -2,7 +2,6 @@ open Util
open Constants open Constants
let cutoff2 = cutoff *. cutoff let cutoff2 = cutoff *. cutoff
let debug = false
exception NullQuartet exception NullQuartet
@ -37,6 +36,7 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
(Coordinate.coord center_pq 0) (Coordinate.coord center_pq 1) (Coordinate.coord center_pq 2) (Coordinate.coord center_pq 0) (Coordinate.coord center_pq 1) (Coordinate.coord center_pq 2)
end; end;
<<<<<<< HEAD
(** Vertical recurrence relations *) (** Vertical recurrence relations *)
let rec vrr0 angMom_a totAngMom_a = let rec vrr0 angMom_a totAngMom_a =
if debug then if debug then
@ -44,6 +44,7 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
let (x,y,z) = angMom_a in let (x,y,z) = angMom_a in
Printf.printf "vrr0: %d : %d %d %d\n" totAngMom_a x y z Printf.printf "vrr0: %d : %d %d %d\n" totAngMom_a x y z
end; end;
match totAngMom_a with match totAngMom_a with
| 0 -> zero_m_array | 0 -> zero_m_array
| _ -> | _ ->
@ -97,34 +98,32 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
match (totAngMom_a, totAngMom_c) with match (totAngMom_a, totAngMom_c) with
| (i,0) -> if (i>0) then vrr0 angMom_a totAngMom_a else zero_m_array | (i,0) -> if (i>0) then vrr0 angMom_a totAngMom_a else zero_m_array
| (_,_) -> | (_,_) ->
let maxsze = maxm+1 in
let key = Zkey.of_int_tuple (Zkey.Six (angMom_a, angMom_c) ) in let key = Zkey.of_int_tuple (Zkey.Six (angMom_a, angMom_c) ) in
try Zmap.find map_2d key with try Zmap.find map_2d key with
| Not_found -> | Not_found ->
let result = let result =
let am, cm, cmm, axyz, cxyz, xyz = let am, cm, cmm, axyz, cmxyz, xyz =
let angMom_ax, angMom_ay, angMom_az = angMom_a let angMom_ax, angMom_ay, angMom_az = angMom_a
and angMom_cx, angMom_cy, angMom_cz = angMom_c in and angMom_cx, angMom_cy, angMom_cz = angMom_c in
if (angMom_cz > 0) then match angMom_c with
(angMom_ax, angMom_ay, angMom_az-1), | (_,0,0) -> (* 321_984 *)
(angMom_cx, angMom_cy, angMom_cz-1),
(angMom_cx, angMom_cy, angMom_cz-2),
angMom_az,angMom_cz, 2
else if (angMom_cy > 0) then
(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
else
(angMom_ax-1, angMom_ay, angMom_az), (angMom_ax-1, angMom_ay, angMom_az),
(angMom_cx-1, angMom_cy, angMom_cz), (angMom_cx-1, angMom_cy, angMom_cz),
(angMom_cx-2, angMom_cy, angMom_cz), (angMom_cx-2, angMom_cy, angMom_cz),
angMom_ax,angMom_cx, 0 angMom_ax,angMom_cx-1, 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
| _ -> (* 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-1, 2
in in
(* if cmxyz < 0 then empty else
if cxyz < 1 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
@ -140,9 +139,9 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
f1 *. v1.(m) -. (if m = maxm then 0. else f2 *. v1.(m+1)) ) f1 *. v1.(m) -. (if m = maxm then 0. else f2 *. v1.(m+1)) )
in in
let result = let result =
if cxyz < 2 then result else if cmxyz < 1 then result else
let f3 = let f3 =
(float_of_int (cxyz-1)) *. expo_inv_q *. 0.5 (float_of_int cmxyz) *. 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
( (
@ -154,7 +153,7 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
) )
in in
let result = let result =
if axyz < 1 || cxyz < 1 then result else if (axyz < 1) || (cmxyz < 0) then result else
let f5 = let f5 =
(float_of_int axyz) *. expo_inv_p *. expo_inv_q *. 0.5 (float_of_int axyz) *. expo_inv_p *. expo_inv_q *. 0.5
in in
@ -215,9 +214,9 @@ let hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
and angMom_bx, angMom_by, angMom_bz = angMom_b in and angMom_bx, angMom_by, angMom_bz = angMom_b in
let bxyz, xyz = let bxyz, xyz =
match angMom_b with match angMom_b with
| (_,_,1) -> angMom_bz, 2 | (_,0,0) -> angMom_bx, 0
| (_,1,_) -> angMom_by, 1 | (_,_,0) -> angMom_by, 1
| _ -> angMom_bx, 0 | (_,_,_) -> angMom_bz, 2
in in
if (bxyz < 1) then 0. else if (bxyz < 1) then 0. else
let ap, bm = let ap, bm =