mirror of
https://github.com/LCPQ/quantum_package
synced 2025-01-03 10:05:57 +01:00
Overlap of multiple states
This commit is contained in:
parent
2e5752f8f5
commit
f448c37461
@ -16,7 +16,8 @@ let () =
|
|||||||
"Syntax : %s EZFIO1 EZFIO2" Sys.argv.(0)))
|
"Syntax : %s EZFIO1 EZFIO2" Sys.argv.(0)))
|
||||||
in
|
in
|
||||||
|
|
||||||
let fetch_wf filename =
|
let fetch_wf ~state filename =
|
||||||
|
(* State 0 is the ground state *)
|
||||||
Ezfio.set_file filename;
|
Ezfio.set_file filename;
|
||||||
let mo_tot_num =
|
let mo_tot_num =
|
||||||
Ezfio.get_mo_basis_mo_tot_num ()
|
Ezfio.get_mo_basis_mo_tot_num ()
|
||||||
@ -28,6 +29,9 @@ let () =
|
|||||||
let n_det =
|
let n_det =
|
||||||
Det_number.to_int d.Determinants_by_hand.n_det
|
Det_number.to_int d.Determinants_by_hand.n_det
|
||||||
in
|
in
|
||||||
|
let state_shift =
|
||||||
|
state*n_det
|
||||||
|
in
|
||||||
let keys =
|
let keys =
|
||||||
Array.map (Determinant.to_string ~mo_tot_num)
|
Array.map (Determinant.to_string ~mo_tot_num)
|
||||||
d.Determinants_by_hand.psi_det
|
d.Determinants_by_hand.psi_det
|
||||||
@ -40,7 +44,7 @@ let () =
|
|||||||
in
|
in
|
||||||
for i=0 to n_det-1
|
for i=0 to n_det-1
|
||||||
do
|
do
|
||||||
Hashtbl.add hash keys.(i) values.(i);
|
Hashtbl.add hash keys.(i) values.(state_shift+i);
|
||||||
done;
|
done;
|
||||||
hash
|
hash
|
||||||
in
|
in
|
||||||
@ -60,14 +64,30 @@ let () =
|
|||||||
result /. (sqrt (norm *. norm'))
|
result /. (sqrt (norm *. norm'))
|
||||||
in
|
in
|
||||||
|
|
||||||
let wf, wf' =
|
let n_st1 =
|
||||||
fetch_wf ezfio,
|
Ezfio.set_file ezfio;
|
||||||
fetch_wf ezfio'
|
Ezfio.get_determinants_n_states ()
|
||||||
|
and n_st2 =
|
||||||
|
Ezfio.set_file ezfio';
|
||||||
|
Ezfio.get_determinants_n_states ()
|
||||||
in
|
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 ()
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user