mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-12-21 20:03:32 +01:00
MPI improved and 3-electron F12 optimized
This commit is contained in:
parent
13fcc8e6fa
commit
6e6ef8df2d
437
MOBasis/HF12.ml
437
MOBasis/HF12.ml
@ -259,10 +259,10 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
|
|||||||
let two_e_ints = MOBasis.two_e_ints aux_basis in
|
let two_e_ints = MOBasis.two_e_ints aux_basis in
|
||||||
let h2 i j k l (s:Spin.t) (s':Spin.t) =
|
let h2 i j k l (s:Spin.t) (s':Spin.t) =
|
||||||
if s' <> s then
|
if s' <> s then
|
||||||
ERI.get_phys two_e_ints i j k l
|
ERI.get_phys two_e_ints i j k l
|
||||||
else
|
else
|
||||||
(ERI.get_phys two_e_ints i j k l) -.
|
(ERI.get_phys two_e_ints i j k l) -.
|
||||||
(ERI.get_phys two_e_ints i j l k)
|
(ERI.get_phys two_e_ints i j l k)
|
||||||
in
|
in
|
||||||
h2
|
h2
|
||||||
in
|
in
|
||||||
@ -271,12 +271,12 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
|
|||||||
let f12_ints = MOBasis.f12_ints aux_basis in
|
let f12_ints = MOBasis.f12_ints aux_basis in
|
||||||
let f2 i j k l (s:Spin.t) (s':Spin.t) =
|
let f2 i j k l (s:Spin.t) (s':Spin.t) =
|
||||||
if s' <> s then
|
if s' <> s then
|
||||||
0.375 *. F12.get_phys f12_ints i j k l +.
|
0.375 *. F12.get_phys f12_ints i j k l +.
|
||||||
0.125 *. F12.get_phys f12_ints i j l k
|
0.125 *. F12.get_phys f12_ints i j l k
|
||||||
else
|
else
|
||||||
0.25 *. (
|
0.25 *. (
|
||||||
(F12.get_phys f12_ints i j k l) -.
|
(F12.get_phys f12_ints i j k l) -.
|
||||||
(F12.get_phys f12_ints i j l k) )
|
(F12.get_phys f12_ints i j l k) )
|
||||||
in
|
in
|
||||||
f2
|
f2
|
||||||
in
|
in
|
||||||
@ -289,55 +289,55 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
|
|||||||
if Parallel.master then Printf.printf "Computing m_0111_1H_1F\n" ;
|
if Parallel.master then Printf.printf "Computing m_0111_1H_1F\n" ;
|
||||||
let m_0111_1H_1F =
|
let m_0111_1H_1F =
|
||||||
Vec.init mo_num (fun i ->
|
Vec.init mo_num (fun i ->
|
||||||
sum mos_cabs (fun a ->
|
sum mos_cabs (fun a ->
|
||||||
h_one a i Spin.Alfa *. f_one a i Spin.Alfa ))
|
h_one a i Spin.Alfa *. f_one a i Spin.Alfa ))
|
||||||
in
|
in
|
||||||
|
|
||||||
if Parallel.master then Printf.printf "Computing m_0111_1H_2Fa\n" ;
|
if Parallel.master then Printf.printf "Computing m_0111_1H_2Fa\n" ;
|
||||||
let m_0111_1H_2Fa, m_0111_2Ha_2Fa =
|
let m_0111_1H_2Fa, m_0111_2Ha_2Fa =
|
||||||
|
|
||||||
let m_0122_Haa =
|
let m_0122_Haa =
|
||||||
array_3_init mo_num mo_num mo_num (fun i j k ->
|
array_3_init mo_num mo_num mo_num (fun i j k ->
|
||||||
sum mos_cabs (fun a ->
|
sum mos_cabs (fun a ->
|
||||||
h_two a k i j Spin.Alfa Spin.Alfa *. f_two a k i j Spin.Alfa Spin.Alfa
|
h_two a k i j Spin.Alfa Spin.Alfa *. f_two a k i j Spin.Alfa Spin.Alfa
|
||||||
) )
|
) )
|
||||||
in
|
in
|
||||||
|
|
||||||
let m_0111_1H_2Fa =
|
let m_0111_1H_2Fa =
|
||||||
Mat.init_cols mo_num mo_num (fun i j ->
|
Mat.init_cols mo_num mo_num (fun i j ->
|
||||||
sum mos_cabs (fun a ->
|
sum mos_cabs (fun a ->
|
||||||
h_one a i Spin.Alfa *. f_two a j i j Spin.Alfa Spin.Alfa +.
|
h_one a i Spin.Alfa *. f_two a j i j Spin.Alfa Spin.Alfa +.
|
||||||
h_two a j i j Spin.Alfa Spin.Alfa *. f_one a i Spin.Alfa
|
h_two a j i j Spin.Alfa Spin.Alfa *. f_one a i Spin.Alfa
|
||||||
) +.
|
) +.
|
||||||
if i < j then 0. else
|
if i < j then 0. else
|
||||||
begin
|
begin
|
||||||
sum mos_cabs (fun a ->
|
sum mos_cabs (fun a ->
|
||||||
sum mos_cabs (fun b -> if b >= a then 0. else
|
sum mos_cabs (fun b -> if b >= a then 0. else
|
||||||
h_two i j a b Spin.Alfa Spin.Alfa *. f_two a b i j Spin.Alfa Spin.Alfa
|
h_two i j a b Spin.Alfa Spin.Alfa *. f_two a b i j Spin.Alfa Spin.Alfa
|
||||||
)
|
)
|
||||||
) +.
|
) +.
|
||||||
sum mos_in (fun k -> m_0122_Haa.{i,j,k})
|
sum mos_in (fun k -> m_0122_Haa.{i,j,k})
|
||||||
end
|
end
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
|
|
||||||
let m_0111_2Ha_2Fa =
|
let m_0111_2Ha_2Fa =
|
||||||
array_3_init mo_num mo_num mo_num (fun i j k ->
|
array_3_init mo_num mo_num mo_num (fun i j k ->
|
||||||
sum mos_cabs (fun a ->
|
sum mos_cabs (fun a ->
|
||||||
h_two a j i j Spin.Alfa Spin.Alfa *.
|
h_two a j i j Spin.Alfa Spin.Alfa *.
|
||||||
f_two a k i k Spin.Alfa Spin.Alfa
|
f_two a k i k Spin.Alfa Spin.Alfa
|
||||||
) -. if i < j then 0. else m_0122_Haa.{i,j,k}
|
) -. if i < j then 0. else m_0122_Haa.{i,j,k}
|
||||||
)
|
)
|
||||||
in m_0111_1H_2Fa, m_0111_2Ha_2Fa
|
in m_0111_1H_2Fa, m_0111_2Ha_2Fa
|
||||||
in
|
in
|
||||||
|
|
||||||
if Parallel.master then Printf.printf "Computing m_0111_1H_2Fb\n" ;
|
if Parallel.master then Printf.printf "Computing m_0111_1H_2Fb\n" ;
|
||||||
let m_0111_1H_2Fb, m_0111_2Hb_2Fb =
|
let m_0111_1H_2Fb, m_0111_2Hb_2Fb =
|
||||||
let m_0122_Hab =
|
let m_0122_Hab =
|
||||||
array_3_init mo_num mo_num mo_num (fun i j k ->
|
array_3_init mo_num mo_num mo_num (fun i j k ->
|
||||||
sum mos_cabs (fun a ->
|
sum mos_cabs (fun a ->
|
||||||
h_two a k i j Spin.Alfa Spin.Beta *. f_two a k i j Spin.Alfa Spin.Beta
|
h_two a k i j Spin.Alfa Spin.Beta *. f_two a k i j Spin.Alfa Spin.Beta
|
||||||
) )
|
) )
|
||||||
in
|
in
|
||||||
|
|
||||||
let m_0111_1H_2Fb =
|
let m_0111_1H_2Fb =
|
||||||
@ -374,8 +374,8 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
|
|||||||
let m_0111_2Ha_2Fb =
|
let m_0111_2Ha_2Fb =
|
||||||
array_3_init mo_num mo_num mo_num (fun i j k ->
|
array_3_init mo_num mo_num mo_num (fun i j k ->
|
||||||
sum mos_cabs (fun a ->
|
sum mos_cabs (fun a ->
|
||||||
h_two a j i j Spin.Alfa Spin.Alfa *.
|
h_two a j i j Spin.Alfa Spin.Alfa *.
|
||||||
f_two a k i k Spin.Alfa Spin.Beta
|
f_two a k i k Spin.Alfa Spin.Beta
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
@ -387,57 +387,57 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
|
|||||||
|
|
||||||
(* Alpha *)
|
(* Alpha *)
|
||||||
let a =
|
let a =
|
||||||
sum mos_i (fun i -> m_0111_1H_1F.{i})
|
sum mos_i (fun i -> m_0111_1H_1F.{i})
|
||||||
in
|
in
|
||||||
|
|
||||||
let b =
|
let b =
|
||||||
if same then a else
|
if same then a else
|
||||||
sum mos_i' (fun i -> m_0111_1H_1F.{i})
|
sum mos_i' (fun i -> m_0111_1H_1F.{i})
|
||||||
in
|
in
|
||||||
|
|
||||||
let aa =
|
let aa =
|
||||||
sum mos_i (fun j ->
|
sum mos_i (fun j ->
|
||||||
sum mos_i (fun i -> m_0111_1H_2Fa.{i,j} ))
|
sum mos_i (fun i -> m_0111_1H_2Fa.{i,j} ))
|
||||||
in
|
in
|
||||||
|
|
||||||
let bb =
|
let bb =
|
||||||
if same then aa else
|
if same then aa else
|
||||||
sum mos_i' (fun j ->
|
sum mos_i' (fun j ->
|
||||||
sum mos_i' (fun i -> m_0111_1H_2Fa.{i,j} ))
|
sum mos_i' (fun i -> m_0111_1H_2Fa.{i,j} ))
|
||||||
in
|
in
|
||||||
|
|
||||||
let ab =
|
let ab =
|
||||||
sum mos_i' (fun j ->
|
sum mos_i' (fun j ->
|
||||||
sum mos_i (fun i -> m_0111_1H_2Fb.{i,j} ))
|
sum mos_i (fun i -> m_0111_1H_2Fb.{i,j} ))
|
||||||
in
|
in
|
||||||
|
|
||||||
let aaa =
|
let aaa =
|
||||||
sum mos_i (fun k ->
|
sum mos_i (fun k ->
|
||||||
sum mos_i (fun j ->
|
sum mos_i (fun j ->
|
||||||
sum mos_i (fun i -> m_0111_2Ha_2Fa.{i,j,k} )))
|
sum mos_i (fun i -> m_0111_2Ha_2Fa.{i,j,k} )))
|
||||||
in
|
in
|
||||||
|
|
||||||
let bbb =
|
let bbb =
|
||||||
if same then aaa else
|
if same then aaa else
|
||||||
sum mos_i' (fun k ->
|
sum mos_i' (fun k ->
|
||||||
sum mos_i' (fun j ->
|
sum mos_i' (fun j ->
|
||||||
sum mos_i' (fun i -> m_0111_2Ha_2Fa.{i,j,k} )))
|
sum mos_i' (fun i -> m_0111_2Ha_2Fa.{i,j,k} )))
|
||||||
in
|
in
|
||||||
|
|
||||||
let baa =
|
let baa =
|
||||||
sum mos_i' (fun k ->
|
sum mos_i' (fun k ->
|
||||||
sum mos_i (fun j ->
|
sum mos_i (fun j ->
|
||||||
sum mos_i (fun i ->
|
sum mos_i (fun i ->
|
||||||
m_0111_2Ha_2Fb.{i,j,k} +. m_0111_2Hb_2Fb.{i,j,k}
|
m_0111_2Ha_2Fb.{i,j,k} +. m_0111_2Hb_2Fb.{i,j,k}
|
||||||
)))
|
)))
|
||||||
in
|
in
|
||||||
|
|
||||||
let bba =
|
let bba =
|
||||||
sum mos_i (fun k ->
|
sum mos_i (fun k ->
|
||||||
sum mos_i' (fun j ->
|
sum mos_i' (fun j ->
|
||||||
sum mos_i' (fun i ->
|
sum mos_i' (fun i ->
|
||||||
m_0111_2Ha_2Fb.{i,j,k} +. m_0111_2Hb_2Fb.{j,i,k}
|
m_0111_2Ha_2Fb.{i,j,k} +. m_0111_2Hb_2Fb.{j,i,k}
|
||||||
)))
|
)))
|
||||||
in
|
in
|
||||||
|
|
||||||
a +. b +. aa +. bb +. ab +. aaa +. baa +. bba +. bbb
|
a +. b +. aa +. bb +. ab +. aaa +. baa +. bba +. bbb
|
||||||
@ -446,7 +446,7 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
|
|||||||
if Parallel.master then Printf.printf "Computing m_1111_1H_1F\n" ;
|
if Parallel.master then Printf.printf "Computing m_1111_1H_1F\n" ;
|
||||||
let m_1111_1H_1F =
|
let m_1111_1H_1F =
|
||||||
Mat.init_cols mo_num mo_num (fun i k ->
|
Mat.init_cols mo_num mo_num (fun i k ->
|
||||||
sum mos_cabs (fun a -> h_one a i Spin.Alfa *. f_one a k Spin.Alfa ))
|
sum mos_cabs (fun a -> h_one a i Spin.Alfa *. f_one a k Spin.Alfa ))
|
||||||
in
|
in
|
||||||
|
|
||||||
if Parallel.master then Printf.printf "Computing m_1111_2Ha_2Fa\n" ;
|
if Parallel.master then Printf.printf "Computing m_1111_2Ha_2Fa\n" ;
|
||||||
@ -586,7 +586,7 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
|
|||||||
array_4_init mo_num mo_num mo_num mo_num (fun l j i k ->
|
array_4_init mo_num mo_num mo_num mo_num (fun l j i k ->
|
||||||
sum mos_cabs (fun a ->
|
sum mos_cabs (fun a ->
|
||||||
h_two a l i j Spin.Alfa Spin.Beta *.
|
h_two a l i j Spin.Alfa Spin.Beta *.
|
||||||
f_two a l k j Spin.Alfa Spin.Beta
|
f_two a l k j Spin.Alfa Spin.Beta
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
@ -632,77 +632,77 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
|
|||||||
|
|
||||||
let f_1 ki kj =
|
let f_1 ki kj =
|
||||||
let i, k, s, phase =
|
let i, k, s, phase =
|
||||||
match Excitation.of_det ki kj with
|
match Excitation.of_det ki kj with
|
||||||
| Excitation.(Single (phase, { hole ; particle ; spin })) ->
|
| Excitation.(Single (phase, { hole ; particle ; spin })) ->
|
||||||
hole, particle, spin, phase
|
hole, particle, spin, phase
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
|
|
||||||
let mos_novirt, mos_novirt' =
|
let mos_novirt, mos_novirt' =
|
||||||
let alfa =
|
let alfa =
|
||||||
let i = Spindeterminant.bitstring @@ Determinant.alfa ki in
|
let i = Spindeterminant.bitstring @@ Determinant.alfa ki in
|
||||||
let j = Spindeterminant.bitstring @@ Determinant.alfa kj in
|
let j = Spindeterminant.bitstring @@ Determinant.alfa kj in
|
||||||
Bitstring.to_list (Bitstring.logor i j)
|
Bitstring.to_list (Bitstring.logor i j)
|
||||||
in
|
in
|
||||||
let beta =
|
let beta =
|
||||||
let i = Spindeterminant.bitstring @@ Determinant.beta ki in
|
let i = Spindeterminant.bitstring @@ Determinant.beta ki in
|
||||||
let j = Spindeterminant.bitstring @@ Determinant.beta kj in
|
let j = Spindeterminant.bitstring @@ Determinant.beta kj in
|
||||||
Bitstring.to_list (Bitstring.logor i j)
|
Bitstring.to_list (Bitstring.logor i j)
|
||||||
in
|
in
|
||||||
match s with
|
match s with
|
||||||
| Spin.Alfa -> alfa, beta
|
| Spin.Alfa -> alfa, beta
|
||||||
| Spin.Beta -> beta, alfa
|
| Spin.Beta -> beta, alfa
|
||||||
in
|
in
|
||||||
|
|
||||||
let mos_ij, mos_ij' =
|
let mos_ij, mos_ij' =
|
||||||
let alfa =
|
let alfa =
|
||||||
let i = Spindeterminant.bitstring @@ Determinant.alfa ki in
|
let i = Spindeterminant.bitstring @@ Determinant.alfa ki in
|
||||||
let j = Spindeterminant.bitstring @@ Determinant.alfa kj in
|
let j = Spindeterminant.bitstring @@ Determinant.alfa kj in
|
||||||
Bitstring.to_list (Bitstring.logand i j)
|
Bitstring.to_list (Bitstring.logand i j)
|
||||||
in
|
in
|
||||||
let beta =
|
let beta =
|
||||||
let i = Spindeterminant.bitstring @@ Determinant.beta ki in
|
let i = Spindeterminant.bitstring @@ Determinant.beta ki in
|
||||||
let j = Spindeterminant.bitstring @@ Determinant.beta kj in
|
let j = Spindeterminant.bitstring @@ Determinant.beta kj in
|
||||||
Bitstring.to_list (Bitstring.logand i j)
|
Bitstring.to_list (Bitstring.logand i j)
|
||||||
in
|
in
|
||||||
match s with
|
match s with
|
||||||
| Spin.Alfa -> alfa, beta
|
| Spin.Alfa -> alfa, beta
|
||||||
| Spin.Beta -> beta, alfa
|
| Spin.Beta -> beta, alfa
|
||||||
in
|
in
|
||||||
|
|
||||||
let mos_i, mos_i' =
|
let mos_i, mos_i' =
|
||||||
match s with
|
match s with
|
||||||
| Spin.Alfa -> mos_a ki, mos_b ki
|
| Spin.Alfa -> mos_a ki, mos_b ki
|
||||||
| Spin.Beta -> mos_b ki, mos_a ki
|
| Spin.Beta -> mos_b ki, mos_a ki
|
||||||
in
|
in
|
||||||
|
|
||||||
let mos_j, mos_j' =
|
let mos_j, mos_j' =
|
||||||
match s with
|
match s with
|
||||||
| Spin.Alfa -> mos_a kj, mos_b kj
|
| Spin.Alfa -> mos_a kj, mos_b kj
|
||||||
| Spin.Beta -> mos_b kj, mos_a kj
|
| Spin.Beta -> mos_b kj, mos_a kj
|
||||||
in
|
in
|
||||||
|
|
||||||
let result =
|
let result =
|
||||||
m_1111_1H_1F.{i,k} +.
|
m_1111_1H_1F.{i,k} +.
|
||||||
sum mos_ij (fun j ->
|
sum mos_ij (fun j ->
|
||||||
m_1111_1H_2Fa.{j,i,k}
|
m_1111_1H_2Fa.{j,i,k}
|
||||||
+. sum mos_i (fun l -> m_1111_2Ha_2Fa.{l,j,i,k})
|
+. sum mos_i (fun l -> m_1111_2Ha_2Fa.{l,j,i,k})
|
||||||
+. sum mos_i' (fun l -> m_1111_2Ha_2Fb.{l,j,i,k})
|
+. sum mos_i' (fun l -> m_1111_2Ha_2Fb.{l,j,i,k})
|
||||||
+. sum mos_j (fun l -> m_1121_2Ha_2Fa.{l,j,i,k})
|
+. sum mos_j (fun l -> m_1121_2Ha_2Fa.{l,j,i,k})
|
||||||
+. sum mos_j' (fun l -> m_1121_2Ha_2Fb.{l,j,i,k})
|
+. sum mos_j' (fun l -> m_1121_2Ha_2Fb.{l,j,i,k})
|
||||||
-. sum mos_novirt (fun l -> m_1122_va.{l,j,i,k})
|
-. sum mos_novirt (fun l -> m_1122_va.{l,j,i,k})
|
||||||
-. sum mos_ij (fun l -> m_1122_oa.{l,j,i,k} )
|
-. sum mos_ij (fun l -> m_1122_oa.{l,j,i,k} )
|
||||||
) +.
|
) +.
|
||||||
sum mos_ij' (fun j ->
|
sum mos_ij' (fun j ->
|
||||||
m_1111_1H_2Fb.{j,i,k}
|
m_1111_1H_2Fb.{j,i,k}
|
||||||
+. sum mos_i (fun l -> m_1111_2Hb_2Fa.{l,j,i,k})
|
+. sum mos_i (fun l -> m_1111_2Hb_2Fa.{l,j,i,k})
|
||||||
+. sum mos_i' (fun l -> m_1111_2Hb_2Fb.{l,j,i,k})
|
+. sum mos_i' (fun l -> m_1111_2Hb_2Fb.{l,j,i,k})
|
||||||
+. sum mos_j (fun l -> m_1121_2Hb_2Fb.{l,j,i,k})
|
+. sum mos_j (fun l -> m_1121_2Hb_2Fb.{l,j,i,k})
|
||||||
+. sum mos_j' (fun l -> m_1121_2Hb_2Fa.{l,j,i,k})
|
+. sum mos_j' (fun l -> m_1121_2Hb_2Fa.{l,j,i,k})
|
||||||
-. sum mos_novirt (fun l -> m_1122_v2.{l,j,i,k})
|
-. sum mos_novirt (fun l -> m_1122_v2.{l,j,i,k})
|
||||||
-. sum mos_novirt' (fun l -> m_1122_v3.{l,j,i,k})
|
-. sum mos_novirt' (fun l -> m_1122_v3.{l,j,i,k})
|
||||||
-. sum mos_ij (fun l -> m_1122_o.{l,j,i,k})
|
-. sum mos_ij (fun l -> m_1122_o.{l,j,i,k})
|
||||||
)
|
)
|
||||||
in
|
in
|
||||||
match phase with
|
match phase with
|
||||||
| Phase.Pos -> result
|
| Phase.Pos -> result
|
||||||
@ -884,75 +884,75 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
|
|||||||
|
|
||||||
let f_2 ki kj =
|
let f_2 ki kj =
|
||||||
let i, j, k, l, s, s', phase =
|
let i, j, k, l, s, s', phase =
|
||||||
match Excitation.of_det ki kj with
|
match Excitation.of_det ki kj with
|
||||||
| Excitation.(Double (phase, { hole ; particle ; spin }, {hole=hole' ; particle=particle' ; spin=spin' })) ->
|
| Excitation.(Double (phase, { hole ; particle ; spin }, {hole=hole' ; particle=particle' ; spin=spin' })) ->
|
||||||
hole, hole', particle, particle', spin, spin', phase
|
hole, hole', particle, particle', spin, spin', phase
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
let mos_i, mos_i' =
|
let mos_i, mos_i' =
|
||||||
match s with
|
match s with
|
||||||
| Spin.Alfa -> mos_a ki, mos_b ki
|
| Spin.Alfa -> mos_a ki, mos_b ki
|
||||||
| Spin.Beta -> mos_b ki, mos_a ki
|
| Spin.Beta -> mos_b ki, mos_a ki
|
||||||
in
|
in
|
||||||
|
|
||||||
let mos_j, mos_j' =
|
let mos_j, mos_j' =
|
||||||
match s with
|
match s with
|
||||||
| Spin.Alfa -> mos_a kj, mos_b kj
|
| Spin.Alfa -> mos_a kj, mos_b kj
|
||||||
| Spin.Beta -> mos_b kj, mos_a kj
|
| Spin.Beta -> mos_b kj, mos_a kj
|
||||||
in
|
in
|
||||||
|
|
||||||
let mos_ij, mos_ij' =
|
let mos_ij, mos_ij' =
|
||||||
let alfa =
|
let alfa =
|
||||||
let i = Spindeterminant.bitstring @@ Determinant.alfa ki in
|
let i = Spindeterminant.bitstring @@ Determinant.alfa ki in
|
||||||
let j = Spindeterminant.bitstring @@ Determinant.alfa kj in
|
let j = Spindeterminant.bitstring @@ Determinant.alfa kj in
|
||||||
Bitstring.to_list (Bitstring.logand i j)
|
Bitstring.to_list (Bitstring.logand i j)
|
||||||
in
|
in
|
||||||
let beta =
|
let beta =
|
||||||
let i = Spindeterminant.bitstring @@ Determinant.beta ki in
|
let i = Spindeterminant.bitstring @@ Determinant.beta ki in
|
||||||
let j = Spindeterminant.bitstring @@ Determinant.beta kj in
|
let j = Spindeterminant.bitstring @@ Determinant.beta kj in
|
||||||
Bitstring.to_list (Bitstring.logand i j)
|
Bitstring.to_list (Bitstring.logand i j)
|
||||||
in
|
in
|
||||||
match s with
|
match s with
|
||||||
| Spin.Alfa -> alfa, beta
|
| Spin.Alfa -> alfa, beta
|
||||||
| Spin.Beta -> beta, alfa
|
| Spin.Beta -> beta, alfa
|
||||||
in
|
in
|
||||||
|
|
||||||
let mos_novirt, mos_novirt' =
|
let mos_novirt, mos_novirt' =
|
||||||
let alfa =
|
let alfa =
|
||||||
let i = Spindeterminant.bitstring @@ Determinant.alfa ki in
|
let i = Spindeterminant.bitstring @@ Determinant.alfa ki in
|
||||||
let j = Spindeterminant.bitstring @@ Determinant.alfa kj in
|
let j = Spindeterminant.bitstring @@ Determinant.alfa kj in
|
||||||
Bitstring.to_list (Bitstring.logor i j)
|
Bitstring.to_list (Bitstring.logor i j)
|
||||||
in
|
in
|
||||||
let beta =
|
let beta =
|
||||||
let i = Spindeterminant.bitstring @@ Determinant.beta ki in
|
let i = Spindeterminant.bitstring @@ Determinant.beta ki in
|
||||||
let j = Spindeterminant.bitstring @@ Determinant.beta kj in
|
let j = Spindeterminant.bitstring @@ Determinant.beta kj in
|
||||||
Bitstring.to_list (Bitstring.logor i j)
|
Bitstring.to_list (Bitstring.logor i j)
|
||||||
in
|
in
|
||||||
match s with
|
match s with
|
||||||
| Spin.Alfa -> alfa, beta
|
| Spin.Alfa -> alfa, beta
|
||||||
| Spin.Beta -> beta, alfa
|
| Spin.Beta -> beta, alfa
|
||||||
in
|
in
|
||||||
|
|
||||||
let result =
|
let result =
|
||||||
if s = s' then
|
if s = s' then
|
||||||
m_2112_1H_2Fa.{i,j,k,l} +.
|
m_2112_1H_2Fa.{i,j,k,l} +.
|
||||||
sum mos_i (fun n -> m_2112_2Ha_2Fa.{n,i,j,k,l} ) +.
|
sum mos_i (fun n -> m_2112_2Ha_2Fa.{n,i,j,k,l} ) +.
|
||||||
sum mos_i' (fun n -> m_2112_2Hb_2Fa.{n,i,j,k,l} ) +.
|
sum mos_i' (fun n -> m_2112_2Hb_2Fa.{n,i,j,k,l} ) +.
|
||||||
sum mos_j (fun n -> m_2121_2Ha_2Fa.{n,i,j,k,l} ) +.
|
sum mos_j (fun n -> m_2121_2Ha_2Fa.{n,i,j,k,l} ) +.
|
||||||
sum mos_j' (fun n -> m_2121_2Ha_2Fb.{n,i,j,k,l} ) +.
|
sum mos_j' (fun n -> m_2121_2Ha_2Fb.{n,i,j,k,l} ) +.
|
||||||
sum mos_ij (fun n -> m_2122_2Ha_2Fa_ij.{n,i,j,k,l} ) +.
|
sum mos_ij (fun n -> m_2122_2Ha_2Fa_ij.{n,i,j,k,l} ) +.
|
||||||
sum mos_ij' (fun n -> m_2122_2Ha_2Fa_ij2.{n,i,j,k,l} ) +.
|
sum mos_ij' (fun n -> m_2122_2Ha_2Fa_ij2.{n,i,j,k,l} ) +.
|
||||||
sum mos_novirt (fun n -> m_2122_2Ha_2Fa_nv.{n,i,j,k,l} )
|
sum mos_novirt (fun n -> m_2122_2Ha_2Fa_nv.{n,i,j,k,l} )
|
||||||
else
|
else
|
||||||
m_2112_1H_2Fb.{i,j,k,l} +.
|
m_2112_1H_2Fb.{i,j,k,l} +.
|
||||||
sum mos_i (fun n -> m_2112_2Ha_2Fb.{n,i,j,k,l} ) +.
|
sum mos_i (fun n -> m_2112_2Ha_2Fb.{n,i,j,k,l} ) +.
|
||||||
sum mos_i' (fun n -> m_2112_2Ha_2Fb.{n,j,i,l,k} ) +.
|
sum mos_i' (fun n -> m_2112_2Ha_2Fb.{n,j,i,l,k} ) +.
|
||||||
sum mos_j (fun n -> m_2121_2Hb_2Fa.{n,i,j,k,l} ) +.
|
sum mos_j (fun n -> m_2121_2Hb_2Fa.{n,i,j,k,l} ) +.
|
||||||
sum mos_j' (fun n -> m_2121_2Hb_2Fa.{n,j,i,l,k} ) +.
|
sum mos_j' (fun n -> m_2121_2Hb_2Fa.{n,j,i,l,k} ) +.
|
||||||
sum mos_novirt'(fun n -> m_2122_2Hb_2Fb_nv.{n,i,j,k,l} ) +.
|
sum mos_novirt'(fun n -> m_2122_2Hb_2Fb_nv.{n,i,j,k,l} ) +.
|
||||||
sum mos_novirt (fun n -> m_2122_2Hb_2Fb_nv2.{n,i,j,k,l} )+.
|
sum mos_novirt (fun n -> m_2122_2Hb_2Fb_nv2.{n,i,j,k,l} )+.
|
||||||
sum mos_ij (fun n -> m_2122_2Hb_2Fb_ij.{n,i,j,k,l} ) +.
|
sum mos_ij (fun n -> m_2122_2Hb_2Fb_ij.{n,i,j,k,l} ) +.
|
||||||
sum mos_ij' (fun n -> m_2122_2Hb_2Fb_ij2.{n,i,j,k,l} )
|
sum mos_ij' (fun n -> m_2122_2Hb_2Fb_ij2.{n,i,j,k,l} )
|
||||||
in
|
in
|
||||||
|
|
||||||
match phase with
|
match phase with
|
||||||
@ -963,56 +963,51 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
|
|||||||
|
|
||||||
let f_3 ki kj =
|
let f_3 ki kj =
|
||||||
let i, j, m, k, l, n, s1, s2, s3, phase =
|
let i, j, m, k, l, n, s1, s2, s3, phase =
|
||||||
match Excitation.of_det ki kj with
|
match Excitation.of_det ki kj with
|
||||||
| Excitation.(Triple (phase,
|
| Excitation.(Triple (phase,
|
||||||
{ hole=h1 ; particle=p1 ; spin=s1 },
|
{ hole=h1 ; particle=p1 ; spin=s1 },
|
||||||
{ hole=h2 ; particle=p2 ; spin=s2 },
|
{ hole=h2 ; particle=p2 ; spin=s2 },
|
||||||
{ hole=h3 ; particle=p3 ; spin=s3 }) ) ->
|
{ hole=h3 ; particle=p3 ; spin=s3 }) ) ->
|
||||||
h1, h2, h3, p1, p2, p3, s1, s2, s3, phase
|
h1, h2, h3, p1, p2, p3, s1, s2, s3, phase
|
||||||
| _ -> assert false
|
| _ -> assert false
|
||||||
in
|
in
|
||||||
|
|
||||||
let result =
|
let result =
|
||||||
let open Spin in
|
let open Spin in
|
||||||
match s1, s2, s3 with
|
match s1, s2, s3 with
|
||||||
| Alfa, Alfa, Alfa
|
| Alfa, Alfa, Alfa
|
||||||
| Beta, Beta, Beta ->
|
| Beta, Beta, Beta ->
|
||||||
sum mos_cabs (fun a ->
|
sum mos_cabs (fun a -> h_two a k i j s1 s2 *. f_two a m n l s3 s3)
|
||||||
h_two i j a k s1 s2 *. f_two m a l n s3 s3
|
+. sum mos_cabs (fun a -> h_two a n i j s1 s2 *. f_two a m l k s2 s3)
|
||||||
+. h_two i j a n s1 s2 *. f_two m a k l s3 s2
|
-. sum mos_cabs (fun a -> h_two a l i j s1 s2 *. f_two a m n k s3 s3)
|
||||||
+. h_two i m a l s1 s3 *. f_two j a k n s2 s3
|
+. sum mos_cabs (fun a -> h_two a l i m s1 s3 *. f_two a j n k s3 s2)
|
||||||
+. h_two j m a k s2 s3 *. f_two i a l n s1 s3
|
-. sum mos_cabs (fun a -> h_two a n i m s1 s3 *. f_two a j l k s2 s2)
|
||||||
+. h_two j m a n s2 s3 *. f_two i a k l s1 s2
|
-. sum mos_cabs (fun a -> h_two a k i m s1 s3 *. f_two a j n l s3 s2)
|
||||||
-. h_two i j a l s1 s2 *. f_two m a k n s3 s3
|
+. sum mos_cabs (fun a -> h_two a n j m s2 s3 *. f_two a i l k s2 s1)
|
||||||
-. h_two i m a k s1 s3 *. f_two j a l n s2 s3
|
+. sum mos_cabs (fun a -> h_two a k j m s2 s3 *. f_two a i n l s3 s1)
|
||||||
-. h_two i m a n s1 s3 *. f_two j a k l s2 s2
|
-. sum mos_cabs (fun a -> h_two a l j m s2 s3 *. f_two a i n k s3 s1)
|
||||||
-. h_two j m a l s2 s3 *. f_two i a k n s1 s3 )
|
| Alfa, Alfa, Beta
|
||||||
| Alfa, Alfa, Beta
|
| Beta, Beta, Alfa ->
|
||||||
| Beta, Beta, Alfa ->
|
sum mos_cabs (fun a -> h_two a l i j s1 s2 *. f_two a m k n s1 s3)
|
||||||
sum mos_cabs (fun a ->
|
-. sum mos_cabs (fun a -> h_two a k i j s1 s2 *. f_two a m l n s1 s3)
|
||||||
h_two i j a l s1 s2 *. f_two a m k n s1 s3
|
+. sum mos_cabs (fun a -> h_two a l m j s3 s2 *. f_two a i n k s3 s1)
|
||||||
+. h_two i m k a s1 s3 *. f_two j a l n s2 s3
|
-. sum mos_cabs (fun a -> h_two a k m j s3 s2 *. f_two a i n l s3 s1)
|
||||||
+. h_two j m a n s2 s3 *. f_two i a k l s1 s2
|
+. sum mos_cabs (fun a -> h_two a k m i s3 s1 *. f_two a j n l s3 s2)
|
||||||
+. h_two j m l a s2 s3 *. f_two i a k n s1 s3
|
-. sum mos_cabs (fun a -> h_two a l m i s3 s1 *. f_two a j n k s3 s2)
|
||||||
-. h_two i j a k s1 s2 *. f_two a m l n s1 s3
|
+. sum mos_cabs (fun a -> h_two a n j m s2 s3 *. f_two a i l k s2 s1)
|
||||||
-. h_two i m a n s1 s3 *. f_two j a k l s2 s2
|
-. sum mos_cabs (fun a -> h_two a n i m s1 s3 *. f_two a j l k s2 s2)
|
||||||
-. h_two i m l a s1 s3 *. f_two j a k n s2 s3
|
| Alfa, Beta, Beta
|
||||||
-. h_two j m k a s2 s3 *. f_two i a l n s1 s3
|
| Beta, Alfa, Alfa ->
|
||||||
)
|
sum mos_cabs (fun a -> h_two a l i j s1 s2 *. f_two a m k n s1 s3)
|
||||||
| Alfa, Beta, Beta
|
-. sum mos_cabs (fun a -> h_two a n i j s1 s2 *. f_two a m k l s1 s2)
|
||||||
| Beta, Alfa, Alfa ->
|
+. sum mos_cabs (fun a -> h_two a n i m s1 s3 *. f_two a j k l s1 s2)
|
||||||
sum mos_cabs (fun a ->
|
+. sum mos_cabs (fun a -> h_two a n j m s2 s3 *. f_two a i l k s2 s1)
|
||||||
h_two i j a l s1 s2 *. f_two a m k n s1 s3
|
-. sum mos_cabs (fun a -> h_two a l i m s1 s3 *. f_two a j k n s1 s3)
|
||||||
+. h_two i m a n s1 s3 *. f_two a j k l s1 s2
|
-. sum mos_cabs (fun a -> h_two a l j m s2 s3 *. f_two a i n k s3 s1)
|
||||||
+. h_two i m k a s1 s3 *. f_two j a l n s2 s3
|
+. sum mos_cabs (fun a -> h_two a k m i s3 s1 *. f_two a j n l s3 s2)
|
||||||
+. h_two j m a n s2 s3 *. f_two i a k l s1 s2
|
-. sum mos_cabs (fun a -> h_two a k j i s2 s1 *. f_two a m n l s3 s2)
|
||||||
-. h_two i j a n s1 s2 *. f_two a m k l s1 s2
|
| Beta, Alfa, Beta
|
||||||
-. h_two i j k a s1 s2 *. f_two m a l n s2 s3
|
| Alfa, Beta, Alfa -> assert false
|
||||||
-. h_two i m a l s1 s3 *. f_two a j k n s1 s3
|
|
||||||
-. h_two j m a l s2 s3 *. f_two i a k n s1 s3
|
|
||||||
)
|
|
||||||
| Beta, Alfa, Beta
|
|
||||||
| Alfa, Beta, Alfa -> assert false (*TODO *)
|
|
||||||
in
|
in
|
||||||
match phase with
|
match phase with
|
||||||
| Phase.Pos -> result
|
| Phase.Pos -> result
|
||||||
|
@ -127,14 +127,15 @@ module InterNode = struct
|
|||||||
|
|
||||||
|
|
||||||
let rank =
|
let rank =
|
||||||
if comm <> Mpi.comm_none then
|
if Mpi.comm_is_null comm then 0 else
|
||||||
Mpi.comm_rank c
|
Mpi.comm_rank comm
|
||||||
else 0
|
|
||||||
|
|
||||||
let master = rank = 0
|
let master = rank = 0
|
||||||
|
|
||||||
let broadcast_generic broadcast x =
|
let broadcast_generic broadcast x =
|
||||||
if Mpi.comm_rank <> Mpi.comm_none then
|
if Mpi.comm_is_null comm then
|
||||||
|
Lazy.force x
|
||||||
|
else
|
||||||
begin
|
begin
|
||||||
let x =
|
let x =
|
||||||
if master then Some (Lazy.force x)
|
if master then Some (Lazy.force x)
|
||||||
@ -143,18 +144,13 @@ module InterNode = struct
|
|||||||
match broadcast x 0 comm with
|
match broadcast x 0 comm with
|
||||||
| Some x -> x
|
| Some x -> x
|
||||||
| None -> assert false
|
| None -> assert false
|
||||||
else
|
end
|
||||||
Lazy.force x
|
|
||||||
|
|
||||||
let broadcast x = broadcast_generic Mpi.broadcast x
|
let broadcast x = broadcast_generic Mpi.broadcast x
|
||||||
(* TODO : temporary single-node fix
|
|
||||||
let broadcast x = Lazy.force x
|
|
||||||
*)
|
|
||||||
|
|
||||||
let barrier () =
|
let barrier () =
|
||||||
if comm <> Mpi.comm_none then
|
if Mpi.comm_is_null comm then () else
|
||||||
Mpi.barrier comm
|
Mpi.barrier comm
|
||||||
else ()
|
|
||||||
|
|
||||||
let _ = barrier ()
|
let _ = barrier ()
|
||||||
|
|
||||||
|
@ -2,7 +2,6 @@ let create ?(temp_dir="/dev/shm") data_type size_array =
|
|||||||
let filename =
|
let filename =
|
||||||
Parallel.Node.broadcast (lazy (Filename.temp_file ~temp_dir "4idx." ".tmp"))
|
Parallel.Node.broadcast (lazy (Filename.temp_file ~temp_dir "4idx." ".tmp"))
|
||||||
in
|
in
|
||||||
Printf.printf "File:%s\n%!" filename;
|
|
||||||
|
|
||||||
if Parallel.Node.master then
|
if Parallel.Node.master then
|
||||||
begin
|
begin
|
||||||
|
@ -54,7 +54,7 @@ let () =
|
|||||||
|
|
||||||
let guess =
|
let guess =
|
||||||
match Command_line.get "guess" with
|
match Command_line.get "guess" with
|
||||||
| None -> `Huckel
|
| None -> `Hcore
|
||||||
| Some filename ->
|
| Some filename ->
|
||||||
let s_guess = Simulation.of_filenames
|
let s_guess = Simulation.of_filenames
|
||||||
~charge ~multiplicity ~nuclei:nuclei_file filename in
|
~charge ~multiplicity ~nuclei:nuclei_file filename in
|
||||||
|
Loading…
Reference in New Issue
Block a user