10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-07 22:53:41 +01:00

F12 amplitudes programmed

This commit is contained in:
Anthony Scemama 2019-03-21 16:44:24 +01:00
parent 7633f01746
commit a181c0ff7b
3 changed files with 18 additions and 32 deletions

View File

@ -410,14 +410,13 @@ let make ?(n_states=1) det_space =
let second_order_sum { det_space ; m_H ; m_S2 ; eigensystem ; n_states } let second_order_sum { det_space ; m_H ; m_S2 ; eigensystem ; n_states }
list_holes list_particles i_o1_alfa alfa_o2_i w_alfa = list_holes list_particles i_o1_alfa alfa_o2_i w_alfa psi0 =
let list_holes = Array.of_list list_holes let list_holes = Array.of_list list_holes
and list_particles = Array.of_list list_particles and list_particles = Array.of_list list_particles
in in
let psi0 = let psi0 =
let psi0, _ = Parallel.broadcast eigensystem in
let stream = let stream =
Ds.determinant_stream det_space Ds.determinant_stream det_space
@ -600,7 +599,7 @@ let second_order_sum { det_space ; m_H ; m_S2 ; eigensystem ; n_states }
let pt2_en ci = let pt2_en ci =
let mo_basis = Ds.mo_basis ci.det_space in let mo_basis = Ds.mo_basis ci.det_space in
let _psi0, e0 = Parallel.broadcast ci.eigensystem in let psi0, e0 = Parallel.broadcast ci.eigensystem in
let i_o1_alfa = h_ij mo_basis in let i_o1_alfa = h_ij mo_basis in
@ -658,7 +657,7 @@ let pt2_en ci =
in in
second_order_sum ci list_holes list_particles second_order_sum ci list_holes list_particles
i_o1_alfa i_o1_alfa w_alfa i_o1_alfa i_o1_alfa w_alfa psi0
|> List.fold_left (+.) 0. |> List.fold_left (+.) 0.
@ -688,8 +687,9 @@ let pt2_mp ci =
[ MOClass.active_mos mo_class ; MOClass.virtual_mos mo_class ] [ MOClass.active_mos mo_class ; MOClass.virtual_mos mo_class ]
in in
let psi0, _ = Parallel.broadcast ci.eigensystem in
second_order_sum ci list_holes list_particles second_order_sum ci list_holes list_particles
i_o1_alfa i_o1_alfa w_alfa i_o1_alfa i_o1_alfa w_alfa psi0
|> List.fold_left (+.) 0. |> List.fold_left (+.) 0.
@ -708,8 +708,9 @@ let variance ci =
[ MOClass.active_mos mo_class ; MOClass.virtual_mos mo_class ] [ MOClass.active_mos mo_class ; MOClass.virtual_mos mo_class ]
in in
let psi0, _ = Parallel.broadcast ci.eigensystem in
second_order_sum ci list_holes list_particles second_order_sum ci list_holes list_particles
i_o1_alfa i_o1_alfa w_alfa i_o1_alfa i_o1_alfa w_alfa psi0
|> List.fold_left (+.) 0. |> List.fold_left (+.) 0.

View File

@ -47,7 +47,7 @@ let f_ij mo_basis ki kj =
|> List.hd |> List.hd
let dressing_vector ci = let dressing_vector ci f12_amplitudes =
let mo_basis = DeterminantSpace.mo_basis ci.CI.det_space in let mo_basis = DeterminantSpace.mo_basis ci.CI.det_space in
@ -58,28 +58,13 @@ let dressing_vector ci =
let mo_class = CI.mo_class ci in let mo_class = CI.mo_class ci in
let internal_term =
let list_holes = List.concat
[ MOClass.inactive_mos mo_class ; MOClass.active_mos mo_class ]
and list_particles = List.concat
[ MOClass.active_mos mo_class ; MOClass.virtual_mos mo_class ]
in
CI.second_order_sum ci list_holes list_particles
i_o1_alfa alfa_o2_i w_alfa
|> Vec.of_list
in
let external_term =
let list_holes = List.concat let list_holes = List.concat
[ MOClass.inactive_mos mo_class ; MOClass.active_mos mo_class ] [ MOClass.inactive_mos mo_class ; MOClass.active_mos mo_class ]
and list_particles = MOClass.auxiliary_mos mo_class and list_particles = MOClass.auxiliary_mos mo_class
in in
CI.second_order_sum ci list_holes list_particles CI.second_order_sum ci list_holes list_particles
i_o1_alfa alfa_o2_i w_alfa i_o1_alfa alfa_o2_i w_alfa f12_amplitudes
|> Vec.of_list |> Vec.of_list
in
Vec.sub external_term internal_term

View File

@ -580,15 +580,15 @@ let test_case () =
let a = m1 and b = m2_s in let a = m1 and b = m2_s in
let x = ax_eq_b a b in let x = ax_eq_b a b in
Alcotest.(check (float 1.e-10)) "dense dense 2" 0. (norm_diff (mm a x) b); Alcotest.(check (float 1.e-10)) "dense sparse 2" 0. (norm_diff (mm a x) b);
let a = m1_s and b = m2 in let a = m1_s and b = m2 in
let x = ax_eq_b a b in let x = ax_eq_b a b in
Alcotest.(check (float 1.e-10)) "dense dense 2" 0. (norm_diff (mm a x) b); Alcotest.(check (float 1.e-10)) "sparse dense 3" 0. (norm_diff (mm a x) b);
let a = m1_s and b = m2_s in let a = m1_s and b = m2_s in
let x = ax_eq_b a b in let x = ax_eq_b a b in
Alcotest.(check (float 1.e-10)) "dense dense 2" 0. (norm_diff (mm a x) b); Alcotest.(check (float 1.e-10)) "sparse sparse 4" 0. (norm_diff (mm a x) b);
in in
[ [