From f448c374614c310f3a3ffd83fbb550401a64f9e7 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 30 Nov 2017 18:01:27 +0100 Subject: [PATCH] Overlap of multiple states --- ocaml/qp_overlap_of_wf.ml | 42 +++++++++++++++++++++++++++++---------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/ocaml/qp_overlap_of_wf.ml b/ocaml/qp_overlap_of_wf.ml index deea0556..a1cf32a6 100644 --- a/ocaml/qp_overlap_of_wf.ml +++ b/ocaml/qp_overlap_of_wf.ml @@ -16,7 +16,8 @@ let () = "Syntax : %s EZFIO1 EZFIO2" Sys.argv.(0))) in - let fetch_wf filename = + let fetch_wf ~state filename = + (* State 0 is the ground state *) Ezfio.set_file filename; let mo_tot_num = Ezfio.get_mo_basis_mo_tot_num () @@ -28,6 +29,9 @@ let () = let n_det = Det_number.to_int d.Determinants_by_hand.n_det in + let state_shift = + state*n_det + in let keys = Array.map (Determinant.to_string ~mo_tot_num) d.Determinants_by_hand.psi_det @@ -40,7 +44,7 @@ let () = in for i=0 to n_det-1 do - Hashtbl.add hash keys.(i) values.(i); + Hashtbl.add hash keys.(i) values.(state_shift+i); done; hash in @@ -60,14 +64,30 @@ let () = result /. (sqrt (norm *. norm')) in - let wf, wf' = - fetch_wf ezfio, - fetch_wf ezfio' + let n_st1 = + Ezfio.set_file ezfio; + Ezfio.get_determinants_n_states () + and n_st2 = + Ezfio.set_file ezfio'; + Ezfio.get_determinants_n_states () in + Array.init n_st2 (fun i -> i) + |> Array.iter (fun state_j -> + Printf.printf "%d " (state_j+1); + let wf' = + fetch_wf ~state:state_j ezfio' + in + Array.init n_st1 (fun i -> i) + |> Array.iter (fun state_i -> + let wf = + fetch_wf ~state:state_i ezfio + in + let o = + overlap wf wf' + in + Printf.printf "%f %!" (abs_float o) + ); + Printf.printf "\n%!" + ) + - let o = - overlap wf wf' - in - print_float (abs_float o) ; - print_newline () -