mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-06 22:23:42 +01:00
TRR and Gc
This commit is contained in:
parent
4b527c6356
commit
90481d296b
@ -20,7 +20,6 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
=
|
=
|
||||||
|
|
||||||
(* Swap electrons 1 and 2 so that the max angular momentum is on 1 *)
|
(* Swap electrons 1 and 2 so that the max angular momentum is on 1 *)
|
||||||
(*
|
|
||||||
if angMom_a.tot + angMom_b.tot < angMom_c.tot + angMom_d.tot then
|
if angMom_a.tot + angMom_b.tot < angMom_c.tot + angMom_d.tot then
|
||||||
hvrr_two_e (angMom_c, angMom_d, angMom_a, angMom_b)
|
hvrr_two_e (angMom_c, angMom_d, angMom_a, angMom_b)
|
||||||
zero_m_array
|
zero_m_array
|
||||||
@ -31,7 +30,6 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
map_1d map_2d
|
map_1d map_2d
|
||||||
|
|
||||||
else
|
else
|
||||||
*)
|
|
||||||
|
|
||||||
let maxm = angMom_a.tot + angMom_b.tot + angMom_c.tot + angMom_d.tot in
|
let maxm = angMom_a.tot + angMom_b.tot + angMom_c.tot + angMom_d.tot in
|
||||||
let maxsze = maxm+1 in
|
let maxsze = maxm+1 in
|
||||||
@ -51,7 +49,7 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
match angMom_a.tot with
|
match angMom_a.tot with
|
||||||
| 0 -> zero_m_array
|
| 0 -> zero_m_array
|
||||||
| _ ->
|
| _ ->
|
||||||
let key = Zkey.of_powers (Zkey.Three angMom_a) in
|
let key = Zkey.of_powers_three angMom_a in
|
||||||
|
|
||||||
try Zmap.find map_1d key with
|
try Zmap.find map_1d key with
|
||||||
| Not_found ->
|
| Not_found ->
|
||||||
@ -93,11 +91,11 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
|
|
||||||
and vrr angMom_a angMom_c =
|
and vrr angMom_a angMom_c =
|
||||||
|
|
||||||
match (angMom_a.tot, angMom_c.tot) with
|
match angMom_a.tot, angMom_c.tot with
|
||||||
| (i,0) -> if (i>0) then vrr0 angMom_a
|
| (i,0) -> if (i>0) then vrr0 angMom_a
|
||||||
else zero_m_array
|
else zero_m_array
|
||||||
| (_,_) ->
|
| (_,_) ->
|
||||||
let key = Zkey.of_powers (Zkey.Six (angMom_a, angMom_c)) in
|
let key = Zkey.of_powers_six angMom_a angMom_c in
|
||||||
|
|
||||||
try Zmap.find map_2d key with
|
try Zmap.find map_2d key with
|
||||||
| Not_found ->
|
| Not_found ->
|
||||||
@ -114,15 +112,19 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
expo_inv_q *. (Coordinate.get xyz center_pq)
|
expo_inv_q *. (Coordinate.get xyz center_pq)
|
||||||
in
|
in
|
||||||
let result = Array.make maxsze 0. in
|
let result = Array.make maxsze 0. in
|
||||||
if ( (abs_float f1 > cutoff) || (abs_float f2 > cutoff) ) then
|
if axyz > 0 then
|
||||||
begin
|
begin
|
||||||
let v1 =
|
let am = Powers.decr xyz angMom_a in
|
||||||
vrr angMom_a cm
|
let f5 =
|
||||||
|
(float_of_int axyz) *. expo_inv_p *. expo_inv_q *. 0.5
|
||||||
in
|
in
|
||||||
for m=0 to maxm-1 do
|
if (abs_float f5 > cutoff) then
|
||||||
result.(m) <- f1 *. v1.(m) -. f2 *. v1.(m+1) ;
|
let v5 =
|
||||||
done;
|
vrr am cm
|
||||||
result.(maxm) <- f1 *. v1.(maxm) ;
|
in
|
||||||
|
for m=0 to maxm-1 do
|
||||||
|
result.(m) <- result.(m) -. f5 *. v5.(m+1)
|
||||||
|
done
|
||||||
end;
|
end;
|
||||||
if cmxyz > 0 then
|
if cmxyz > 0 then
|
||||||
begin
|
begin
|
||||||
@ -143,38 +145,31 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
result.(maxm) <- result.(maxm) +. f3 *. v3.(maxm)
|
result.(maxm) <- result.(maxm) +. f3 *. v3.(maxm)
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
if axyz > 0 then
|
if ( (abs_float f1 > cutoff) || (abs_float f2 > cutoff) ) then
|
||||||
begin
|
begin
|
||||||
let am = Powers.decr xyz angMom_a in
|
let v1 =
|
||||||
let f5 =
|
vrr angMom_a cm
|
||||||
(float_of_int axyz) *. expo_inv_p *. expo_inv_q *. 0.5
|
|
||||||
in
|
in
|
||||||
if (abs_float f5 > cutoff) then
|
for m=0 to maxm-1 do
|
||||||
let v5 =
|
result.(m) <- result.(m) +. f1 *. v1.(m) -. f2 *. v1.(m+1) ;
|
||||||
vrr am cm
|
done;
|
||||||
in
|
result.(maxm) <- result.(maxm) +. f1 *. v1.(maxm) ;
|
||||||
for m=0 to maxm-1 do
|
|
||||||
result.(m) <- result.(m) -. f5 *. v5.(m+1)
|
|
||||||
done
|
|
||||||
end;
|
end;
|
||||||
result
|
result
|
||||||
in Zmap.add map_2d key result;
|
in Zmap.add map_2d key result;
|
||||||
result
|
result
|
||||||
|
|
||||||
|
|
||||||
(*
|
|
||||||
and trr angMom_a angMom_c =
|
and trr angMom_a angMom_c =
|
||||||
|
|
||||||
match (angMom_a.tot, angMom_c.tot) with
|
match (angMom_a.tot, angMom_c.tot) with
|
||||||
| (i,0) -> if (i>0) then (vrr0 angMom_a).(0)
|
| (i,0) -> if (i>0) then (vrr0 angMom_a).(0)
|
||||||
else zero_m_array.(0)
|
else zero_m_array.(0)
|
||||||
| (_,_) ->
|
| (_,_) ->
|
||||||
(*
|
let key = Zkey.of_powers_six angMom_a angMom_c in
|
||||||
let key = Zkey.of_powers (Zkey.Six (angMom_a, angMom_c)) in
|
|
||||||
|
|
||||||
try Zmap.find map_2d key with
|
try (Zmap.find map_2d key).(0) with
|
||||||
| Not_found ->
|
| Not_found ->
|
||||||
*)
|
|
||||||
let result =
|
let result =
|
||||||
let xyz = get_xyz angMom_c in
|
let xyz = get_xyz angMom_c in
|
||||||
let axyz = Powers.get xyz angMom_a in
|
let axyz = Powers.get xyz angMom_a in
|
||||||
@ -186,19 +181,8 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
Coordinate.get xyz center_qc +. expo_inv_q_over_p *.
|
Coordinate.get xyz center_qc +. expo_inv_q_over_p *.
|
||||||
(Coordinate.get xyz center_pa)
|
(Coordinate.get xyz center_pa)
|
||||||
in
|
in
|
||||||
let result =
|
let result = 0. in
|
||||||
if abs_float f < cutoff then 0. else
|
|
||||||
let v1 = trr angMom_a cm in
|
|
||||||
f *. v1
|
|
||||||
in
|
|
||||||
let result =
|
|
||||||
if axyz < 1 then result else
|
|
||||||
let f = 0.5 *. (float_of_int axyz) *. expo_inv_q in
|
|
||||||
if abs_float f < cutoff then result else
|
|
||||||
let am = Powers.decr xyz angMom_a in
|
|
||||||
let v2 = trr am cm in
|
|
||||||
result +. f *. v2
|
|
||||||
in
|
|
||||||
let result =
|
let result =
|
||||||
if cmxyz < 1 then result else
|
if cmxyz < 1 then result else
|
||||||
let f = 0.5 *. (float_of_int cmxyz) *. expo_inv_q in
|
let f = 0.5 *. (float_of_int cmxyz) *. expo_inv_q in
|
||||||
@ -207,6 +191,11 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
let v3 = trr angMom_a cmm in
|
let v3 = trr angMom_a cmm in
|
||||||
result +. f *. v3
|
result +. f *. v3
|
||||||
in
|
in
|
||||||
|
let result =
|
||||||
|
if abs_float f < cutoff then result else
|
||||||
|
let v1 = trr angMom_a cm in
|
||||||
|
result +. f *. v1
|
||||||
|
in
|
||||||
let result =
|
let result =
|
||||||
if cmxyz < 0 then result else
|
if cmxyz < 0 then result else
|
||||||
let f = -. expo_inv_q_over_p in
|
let f = -. expo_inv_q_over_p in
|
||||||
@ -214,23 +203,31 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
let v4 = trr ap cm in
|
let v4 = trr ap cm in
|
||||||
result +. v4 *. f
|
result +. v4 *. f
|
||||||
in
|
in
|
||||||
|
let result =
|
||||||
|
if axyz < 1 then result else
|
||||||
|
let f = 0.5 *. (float_of_int axyz) *. expo_inv_q in
|
||||||
|
if abs_float f < cutoff then result else
|
||||||
|
let am = Powers.decr xyz angMom_a in
|
||||||
|
let v2 = trr am cm in
|
||||||
|
result +. f *. v2
|
||||||
|
in
|
||||||
result
|
result
|
||||||
in
|
in
|
||||||
(*
|
Zmap.add map_2d key [|result|];
|
||||||
Zmap.add map_2d key result;
|
|
||||||
*)
|
|
||||||
result
|
result
|
||||||
*)
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
in
|
||||||
|
|
||||||
|
let vrr a c =
|
||||||
|
if maxm < 40 then (vrr a c).(0) else trr a c
|
||||||
|
in
|
||||||
|
|
||||||
|
|
||||||
(** Horizontal recurrence relations *)
|
(** Horizontal recurrence relations *)
|
||||||
and hrr0 angMom_a angMom_b angMom_c =
|
let rec hrr0 angMom_a angMom_b angMom_c =
|
||||||
|
|
||||||
match angMom_b.tot with
|
match angMom_b.tot with
|
||||||
| 1 ->
|
| 1 ->
|
||||||
@ -238,13 +235,10 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
let ap = Powers.incr xyz angMom_a in
|
let ap = Powers.incr xyz angMom_a in
|
||||||
let v1 = vrr ap angMom_c in
|
let v1 = vrr ap angMom_c in
|
||||||
let f2 = Coordinate.get xyz center_ab in
|
let f2 = Coordinate.get xyz center_ab in
|
||||||
if (abs_float f2 < cutoff) then v1.(0) else
|
if (abs_float f2 < cutoff) then v1 else
|
||||||
let v2 = vrr angMom_a angMom_c in
|
let v2 = vrr angMom_a angMom_c in
|
||||||
v1.(0) +. f2 *. v2.(0)
|
v1 +. f2 *. v2
|
||||||
| 0 -> (vrr angMom_a angMom_c).(0)
|
|
||||||
(*
|
|
||||||
| 0 -> trr angMom_a angMom_c
|
| 0 -> trr angMom_a angMom_c
|
||||||
*)
|
|
||||||
| _ ->
|
| _ ->
|
||||||
let xyz = get_xyz angMom_b in
|
let xyz = get_xyz angMom_b in
|
||||||
let bxyz = Powers.get xyz angMom_b in
|
let bxyz = Powers.get xyz angMom_b in
|
||||||
@ -264,10 +258,7 @@ let rec hvrr_two_e (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
match (angMom_b.tot, angMom_d.tot) with
|
match (angMom_b.tot, angMom_d.tot) with
|
||||||
| (_,0) ->
|
| (_,0) ->
|
||||||
if (angMom_b.tot = 0) then
|
if (angMom_b.tot = 0) then
|
||||||
(vrr angMom_a angMom_c).(0)
|
vrr angMom_a angMom_c
|
||||||
(*
|
|
||||||
trr angMom_a angMom_c
|
|
||||||
*)
|
|
||||||
else
|
else
|
||||||
hrr0 angMom_a angMom_b angMom_c
|
hrr0 angMom_a angMom_b angMom_c
|
||||||
| (_,_) ->
|
| (_,_) ->
|
||||||
|
@ -22,6 +22,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
(expo_b, expo_d)
|
(expo_b, expo_d)
|
||||||
(expo_inv_p, expo_inv_q)
|
(expo_inv_p, expo_inv_q)
|
||||||
(center_ab, center_cd, center_pq)
|
(center_ab, center_cd, center_pq)
|
||||||
|
(center_pa, center_qc)
|
||||||
map_1d map_2d np nq
|
map_1d map_2d np nq
|
||||||
=
|
=
|
||||||
|
|
||||||
@ -37,7 +38,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
match angMom_a.tot with
|
match angMom_a.tot with
|
||||||
| 0 -> zero_m_array.(m)
|
| 0 -> zero_m_array.(m)
|
||||||
| _ ->
|
| _ ->
|
||||||
let key = Zkey.of_powers (Zkey.Three angMom_a)
|
let key = Zkey.of_powers_three angMom_a
|
||||||
in
|
in
|
||||||
|
|
||||||
try Zmap.find map_1d.(m) key with
|
try Zmap.find map_1d.(m) key with
|
||||||
@ -103,8 +104,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
| (i,0) -> Some (vrr0_v m angMom_a)
|
| (i,0) -> Some (vrr0_v m angMom_a)
|
||||||
| (_,_) ->
|
| (_,_) ->
|
||||||
|
|
||||||
let key = Zkey.of_powers (Zkey.Six (angMom_a, angMom_c))
|
let key = Zkey.of_powers_six angMom_a angMom_c in
|
||||||
in
|
|
||||||
|
|
||||||
try Zmap.find map_2d.(m) key with
|
try Zmap.find map_2d.(m) key with
|
||||||
| Not_found ->
|
| Not_found ->
|
||||||
@ -163,8 +163,7 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
done;
|
done;
|
||||||
Some f2
|
Some f2
|
||||||
end
|
end
|
||||||
else
|
else None
|
||||||
None
|
|
||||||
in
|
in
|
||||||
|
|
||||||
let p1 =
|
let p1 =
|
||||||
@ -330,65 +329,184 @@ let hvrr_two_e_vector (angMom_a, angMom_b, angMom_c, angMom_d)
|
|||||||
result
|
result
|
||||||
|
|
||||||
|
|
||||||
|
and trr_v angMom_a angMom_c =
|
||||||
|
|
||||||
|
match (angMom_a.tot, angMom_c.tot) with
|
||||||
|
| (i,0) -> Some (vrr0_v 0 angMom_a)
|
||||||
|
| (_,_) ->
|
||||||
|
|
||||||
|
let key = Zkey.of_powers_six angMom_a angMom_c in
|
||||||
|
|
||||||
|
try Zmap.find map_2d.(0) key with
|
||||||
|
| Not_found ->
|
||||||
|
let result =
|
||||||
|
let xyz = get_xyz angMom_c in
|
||||||
|
let axyz = Powers.get xyz angMom_a in
|
||||||
|
let cm = Powers.decr xyz angMom_c in
|
||||||
|
let cmxyz = Powers.get xyz cm in
|
||||||
|
let expo_inv_q_over_p =
|
||||||
|
Array.mapi (fun l expo_inv_p_l ->
|
||||||
|
let expo_p_l = 1./.expo_inv_p_l in
|
||||||
|
Array.mapi (fun k expo_inv_q_k ->
|
||||||
|
expo_inv_q_k *. expo_p_l) expo_inv_q ) expo_inv_p
|
||||||
|
in
|
||||||
|
let result = None in
|
||||||
|
|
||||||
|
let result =
|
||||||
|
if cmxyz < 1 then result else
|
||||||
|
let f = 0.5 *. (float_of_int cmxyz) in
|
||||||
|
if abs_float f < cutoff then result else
|
||||||
|
begin
|
||||||
|
let cmm = Powers.decr xyz cm in
|
||||||
|
match result, trr_v angMom_a cmm with
|
||||||
|
| None, None -> None
|
||||||
|
| Some result, None -> Some result
|
||||||
|
| None, Some v3 ->
|
||||||
|
Some (Array.init np (fun l ->
|
||||||
|
let v3_l = v3.(l) in
|
||||||
|
Array.mapi (fun k v3_lk ->
|
||||||
|
expo_inv_q.(k) *. f *. v3_lk) v3_l
|
||||||
|
) )
|
||||||
|
| Some result, Some v3 ->
|
||||||
|
(Array.iteri (fun l v3_l ->
|
||||||
|
let result_l = result.(l) in
|
||||||
|
Array.iteri (fun k v3_lk ->
|
||||||
|
result_l.(k) <- result_l.(k) +.
|
||||||
|
expo_inv_q.(k) *. f *. v3_lk) v3_l
|
||||||
|
) v3 ; Some result)
|
||||||
|
end
|
||||||
|
in
|
||||||
|
let result =
|
||||||
|
match result, trr_v angMom_a cm with
|
||||||
|
| None, None -> None
|
||||||
|
| Some result, None -> Some result
|
||||||
|
| None, Some v1 ->
|
||||||
|
Some (Array.init np (fun l ->
|
||||||
|
let v1_l = v1.(l)
|
||||||
|
and cpa = (center_pa xyz).(l)
|
||||||
|
and expo_inv_q_over_p_l = expo_inv_q_over_p.(l)
|
||||||
|
in
|
||||||
|
Array.mapi (fun k v1_lk ->
|
||||||
|
let cqc = (center_qc xyz).(k) in
|
||||||
|
(cqc +. expo_inv_q_over_p_l.(k) *. cpa) *. v1_lk
|
||||||
|
) v1_l
|
||||||
|
) )
|
||||||
|
| Some result, Some v1 ->
|
||||||
|
(Array.iteri (fun l v1_l ->
|
||||||
|
let cpa = (center_pa xyz).(l)
|
||||||
|
and result_l = result.(l)
|
||||||
|
and expo_inv_q_over_p_l = expo_inv_q_over_p.(l)
|
||||||
|
in
|
||||||
|
Array.iteri (fun k v1_lk ->
|
||||||
|
let cqc = (center_qc xyz).(k) in
|
||||||
|
result_l.(k) <- result_l.(k) +.
|
||||||
|
(cqc +. expo_inv_q_over_p_l.(k) *. cpa) *. v1_lk
|
||||||
|
) v1_l
|
||||||
|
) v1 ; Some result)
|
||||||
|
in
|
||||||
|
let result =
|
||||||
|
if cmxyz < 0 then result else
|
||||||
|
begin
|
||||||
|
let ap = Powers.incr xyz angMom_a in
|
||||||
|
match result, trr_v ap cm with
|
||||||
|
| None, None -> None
|
||||||
|
| Some result, None -> Some result
|
||||||
|
| None, Some v4 ->
|
||||||
|
Some (Array.init np (fun l ->
|
||||||
|
let v4_l = v4.(l) in
|
||||||
|
let expo_inv_q_over_p_l = expo_inv_q_over_p.(l) in
|
||||||
|
Array.mapi (fun k v4_lk ->
|
||||||
|
-. expo_inv_q_over_p_l.(k) *. v4_lk) v4_l
|
||||||
|
) )
|
||||||
|
| Some result, Some v4 ->
|
||||||
|
(Array.iteri (fun l v4_l ->
|
||||||
|
let result_l = result.(l) in
|
||||||
|
Array.iteri (fun k v4_lk ->
|
||||||
|
let expo_inv_q_over_p_l = expo_inv_q_over_p.(l) in
|
||||||
|
result_l.(k) <- result_l.(k)
|
||||||
|
-. expo_inv_q_over_p_l.(k) *. v4_lk) v4_l
|
||||||
|
) v4 ; Some result)
|
||||||
|
end
|
||||||
|
in
|
||||||
|
let result =
|
||||||
|
if axyz < 1 then result else
|
||||||
|
let f = 0.5 *. (float_of_int axyz) in
|
||||||
|
if abs_float f < cutoff then result else
|
||||||
|
begin
|
||||||
|
let am = Powers.decr xyz angMom_a in
|
||||||
|
match result, trr_v am cm with
|
||||||
|
| None, None -> None
|
||||||
|
| Some result, None -> Some result
|
||||||
|
| None, Some v2 ->
|
||||||
|
Some (Array.init np (fun l ->
|
||||||
|
let v2_l = v2.(l) in
|
||||||
|
Array.mapi (fun k v2_lk ->
|
||||||
|
expo_inv_q.(k) *. f *. v2_lk) v2_l
|
||||||
|
) )
|
||||||
|
| Some result, Some v2 ->
|
||||||
|
(Array.iteri (fun l v2_l ->
|
||||||
|
let result_l = result.(l) in
|
||||||
|
Array.iteri (fun k v2_lk ->
|
||||||
|
result_l.(k) <- result_l.(k) +.
|
||||||
|
expo_inv_q.(k) *. f *. v2_lk) v2_l
|
||||||
|
) v2; Some result)
|
||||||
|
end
|
||||||
|
in result
|
||||||
|
in
|
||||||
|
Zmap.add map_2d.(0) key result;
|
||||||
|
result
|
||||||
|
in
|
||||||
|
|
||||||
|
let sum matrix =
|
||||||
|
Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
||||||
|
in
|
||||||
|
|
||||||
|
let vrr_v a b =
|
||||||
|
let v =
|
||||||
|
if Array.length zero_m_array < 20 then vrr_v 0 a b
|
||||||
|
else trr_v a b
|
||||||
|
in
|
||||||
|
match v with
|
||||||
|
| None -> 0.
|
||||||
|
| Some matrix -> sum matrix
|
||||||
|
in
|
||||||
|
|
||||||
|
|
||||||
(** Horizontal recurrence relations *)
|
(** Horizontal recurrence relations *)
|
||||||
and hrr0_v angMom_a angMom_b angMom_c =
|
let rec hrr0_v angMom_a angMom_b angMom_c =
|
||||||
|
|
||||||
match angMom_b.tot with
|
match angMom_b.tot with
|
||||||
| 0 ->
|
| 0 ->
|
||||||
begin
|
begin
|
||||||
match (angMom_a.tot, angMom_c.tot) with
|
match (angMom_a.tot, angMom_c.tot) with
|
||||||
| (0,0) -> Array.fold_left (fun accu c ->
|
| (0,0) -> sum zero_m_array.(0)
|
||||||
accu +. Array.fold_left (+.) 0. c) 0. zero_m_array.(0)
|
| (_,_) -> vrr_v angMom_a angMom_c
|
||||||
| (_,_) ->
|
|
||||||
begin
|
|
||||||
match vrr_v 0 angMom_a angMom_c with
|
|
||||||
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
|
||||||
| None -> 0.
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
| 1 ->
|
| 1 ->
|
||||||
let xyz = get_xyz angMom_b in
|
let xyz = get_xyz angMom_b in
|
||||||
let ap = Powers.incr xyz angMom_a in
|
let ap = Powers.incr xyz angMom_a in
|
||||||
let f = Coordinate.get xyz center_ab in
|
let f = Coordinate.get xyz center_ab in
|
||||||
let v1 =
|
let v1 = vrr_v ap angMom_c in
|
||||||
match vrr_v 0 ap angMom_c with
|
|
||||||
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
|
||||||
| None -> 0.
|
|
||||||
in
|
|
||||||
if (abs_float f < cutoff) then v1 else
|
if (abs_float f < cutoff) then v1 else
|
||||||
let v2 =
|
let v2 = vrr_v angMom_a angMom_c in
|
||||||
match vrr_v 0 angMom_a angMom_c with
|
v1 +. v2 *. f
|
||||||
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
|
||||||
| None -> 0.
|
|
||||||
in
|
|
||||||
v1 +. v2 *. f
|
|
||||||
| _ ->
|
| _ ->
|
||||||
let xyz = get_xyz angMom_b in
|
let xyz = get_xyz angMom_b in
|
||||||
let bxyz = Powers.get xyz angMom_b in
|
let bxyz = Powers.get xyz angMom_b in
|
||||||
if (bxyz < 0) then 0. else
|
if (bxyz < 0) then 0. else
|
||||||
let ap = Powers.incr xyz angMom_a in
|
let ap = Powers.incr xyz angMom_a in
|
||||||
let bm = Powers.decr xyz angMom_b in
|
let bm = Powers.decr xyz angMom_b in
|
||||||
let h1 =
|
let h1 = hrr0_v ap bm angMom_c in
|
||||||
hrr0_v ap bm angMom_c
|
let f = Coordinate.get xyz center_ab in
|
||||||
in
|
if abs_float f < cutoff then h1 else
|
||||||
let f = Coordinate.get xyz center_ab in
|
let h2 = hrr0_v angMom_a bm angMom_c in
|
||||||
if abs_float f < cutoff then h1 else
|
h1 +. h2 *. f
|
||||||
let h2 =
|
|
||||||
hrr0_v angMom_a bm angMom_c
|
|
||||||
in
|
|
||||||
h1 +. h2 *. f
|
|
||||||
|
|
||||||
and hrr_v angMom_a angMom_b angMom_c angMom_d =
|
and hrr_v angMom_a angMom_b angMom_c angMom_d =
|
||||||
|
|
||||||
match (angMom_b.tot, angMom_d.tot) with
|
match (angMom_b.tot, angMom_d.tot) with
|
||||||
| (_,0) -> if angMom_b.tot = 0 then
|
| (_,0) -> if angMom_b.tot = 0 then
|
||||||
begin
|
vrr_v angMom_a angMom_c
|
||||||
match vrr_v 0 angMom_a angMom_c with
|
|
||||||
| Some matrix -> Array.fold_left (fun accu c -> accu +. Array.fold_left (+.) 0. c) 0. matrix
|
|
||||||
| None -> 0.
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
hrr0_v angMom_a angMom_b angMom_c
|
hrr0_v angMom_a angMom_b angMom_c
|
||||||
| (_,_) ->
|
| (_,_) ->
|
||||||
@ -568,8 +686,7 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
match xyz with
|
match xyz with
|
||||||
| 0 -> Coordinate.get X cpq;
|
| 0 -> Coordinate.get X cpq;
|
||||||
| 1 -> Coordinate.get Y cpq;
|
| 1 -> Coordinate.get Y cpq;
|
||||||
| 2 -> Coordinate.get Z cpq;
|
| _ -> Coordinate.get Z cpq;
|
||||||
| _ -> assert false
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
@ -578,6 +695,44 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
| Y -> result.(1)
|
| Y -> result.(1)
|
||||||
| Z -> result.(2)
|
| Z -> result.(2)
|
||||||
in
|
in
|
||||||
|
let center_pa =
|
||||||
|
let result =
|
||||||
|
Array.init 3 (fun xyz ->
|
||||||
|
Array.init np (fun ab ->
|
||||||
|
let shell_ab = sp.(ab) in
|
||||||
|
let cpa =
|
||||||
|
shell_ab.ShellPair.center |- Contracted_shell.center shell_a
|
||||||
|
in
|
||||||
|
match xyz with
|
||||||
|
| 0 -> Coordinate.get X cpa;
|
||||||
|
| 1 -> Coordinate.get Y cpa;
|
||||||
|
| _ -> Coordinate.get Z cpa;
|
||||||
|
)
|
||||||
|
)
|
||||||
|
in function
|
||||||
|
| X -> result.(0)
|
||||||
|
| Y -> result.(1)
|
||||||
|
| Z -> result.(2)
|
||||||
|
in
|
||||||
|
let center_qc =
|
||||||
|
let result =
|
||||||
|
Array.init 3 (fun xyz ->
|
||||||
|
Array.init nq (fun cd ->
|
||||||
|
let shell_cd = sq.(cd) in
|
||||||
|
let cqc =
|
||||||
|
shell_cd.ShellPair.center |- Contracted_shell.center shell_c
|
||||||
|
in
|
||||||
|
match xyz with
|
||||||
|
| 0 -> Coordinate.get X cqc;
|
||||||
|
| 1 -> Coordinate.get Y cqc;
|
||||||
|
| _ -> Coordinate.get Z cqc;
|
||||||
|
)
|
||||||
|
)
|
||||||
|
in function
|
||||||
|
| X -> result.(0)
|
||||||
|
| Y -> result.(1)
|
||||||
|
| Z -> result.(2)
|
||||||
|
in
|
||||||
let zero_m_array =
|
let zero_m_array =
|
||||||
let result =
|
let result =
|
||||||
Array.init (maxm+1) (fun _ ->
|
Array.init (maxm+1) (fun _ ->
|
||||||
@ -648,8 +803,8 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
if (np+nq> 24) then
|
if (np+nq> 24) then
|
||||||
(
|
(
|
||||||
let schwartz_p =
|
let schwartz_p =
|
||||||
let key = Zkey.of_powers (Zkey.Twelve
|
let key = Zkey.of_powers_twelve
|
||||||
(angMom_a, angMom_b, angMom_a, angMom_b) )
|
angMom_a angMom_b angMom_a angMom_b
|
||||||
in
|
in
|
||||||
match schwartz_p with
|
match schwartz_p with
|
||||||
| None -> 1.
|
| None -> 1.
|
||||||
@ -657,8 +812,8 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
in
|
in
|
||||||
if schwartz_p < cutoff then raise NullQuartet;
|
if schwartz_p < cutoff then raise NullQuartet;
|
||||||
let schwartz_q =
|
let schwartz_q =
|
||||||
let key = Zkey.of_powers (Zkey.Twelve
|
let key = Zkey.of_powers_twelve
|
||||||
(angMom_c, angMom_d, angMom_c, angMom_d) )
|
angMom_c angMom_d angMom_c angMom_d
|
||||||
in
|
in
|
||||||
match schwartz_q with
|
match schwartz_q with
|
||||||
| None -> 1.
|
| None -> 1.
|
||||||
@ -673,7 +828,8 @@ let contracted_class_shell_pairs ~zero_m ?schwartz_p ?schwartz_q shell_p shell_q
|
|||||||
(expo_b, expo_d)
|
(expo_b, expo_d)
|
||||||
(expo_inv_p, expo_inv_q)
|
(expo_inv_p, expo_inv_q)
|
||||||
(shell_p.ContractedShellPair.center_ab,
|
(shell_p.ContractedShellPair.center_ab,
|
||||||
shell_q.ContractedShellPair.center_ab, center_pq)
|
shell_q.ContractedShellPair.center_ab, center_pq)
|
||||||
|
(center_pa, center_qc)
|
||||||
map_1d map_2d np nq
|
map_1d map_2d np nq
|
||||||
in
|
in
|
||||||
contracted_class.(i) <- contracted_class.(i) +. integral *. norm.(i)
|
contracted_class.(i) <- contracted_class.(i) +. integral *. norm.(i)
|
||||||
|
@ -47,6 +47,22 @@ type kind =
|
|||||||
| Nine of (Powers.t * Powers.t * Powers.t)
|
| Nine of (Powers.t * Powers.t * Powers.t)
|
||||||
| Twelve of (Powers.t * Powers.t * Powers.t * Powers.t)
|
| Twelve of (Powers.t * Powers.t * Powers.t * Powers.t)
|
||||||
|
|
||||||
|
let of_powers_three { x=a ; y=b ; z=c ; _ } = of_int a <+ b <+ c
|
||||||
|
|
||||||
|
let of_powers_six { x=a ; y=b ; z=c ; _ } { x=d ; y=e ; z=f ; _ } =
|
||||||
|
of_int a << b << c << d << e << f
|
||||||
|
|
||||||
|
let of_powers_twelve { x=a ; y=b ; z=c ; _ } { x=d ; y=e ; z=f ; _ }
|
||||||
|
{ x=g ; y=h ; z=i ; _ } { x=j ; y=k ; z=l ; _ } =
|
||||||
|
of_int a << b << c << d << e << f
|
||||||
|
<| g << h << i << j << k << l
|
||||||
|
|
||||||
|
let of_powers_nine { x=a ; y=b ; z=c ; _ } { x=d ; y=e ; z=f ; _ }
|
||||||
|
{ x=g ; y=h ; z=i ; _ } =
|
||||||
|
of_int a << b << c << d << e << f
|
||||||
|
<| g << h << i
|
||||||
|
|
||||||
|
|
||||||
let of_powers a =
|
let of_powers a =
|
||||||
match a with
|
match a with
|
||||||
| Three { x=a ; y=b ; z=c ; _ } -> of_int a <+ b <+ c
|
| Three { x=a ; y=b ; z=c ; _ } -> of_int a <+ b <+ c
|
||||||
|
@ -13,10 +13,8 @@ let speclist = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
let run ~out =
|
let run ~out =
|
||||||
(*
|
|
||||||
let gc = Gc.get () in
|
let gc = Gc.get () in
|
||||||
Gc.set { gc with minor_heap_size=(262144 / 16) };
|
Gc.set { gc with space_overhead = 1000 };
|
||||||
*)
|
|
||||||
let out_file =
|
let out_file =
|
||||||
match out with
|
match out with
|
||||||
| None -> raise (Invalid_argument "Output file should be specified with -o")
|
| None -> raise (Invalid_argument "Output file should be specified with -o")
|
||||||
|
Loading…
Reference in New Issue
Block a user