mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-23 12:56:14 +01:00
Merge branch 'master' of github.com:scemama/quantum_package
This commit is contained in:
commit
c8f676166b
@ -1,6 +1,12 @@
|
|||||||
|
(**
|
||||||
|
* Computes the overlap <Psi_0 | Psi_1> where both Psi_0 and Psi_1 are truncated in the set
|
||||||
|
* of common determinants and normalized
|
||||||
|
*)
|
||||||
|
|
||||||
open Input_determinants_by_hand
|
open Input_determinants_by_hand
|
||||||
open Qptypes
|
open Qptypes
|
||||||
|
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
let ezfio, ezfio' =
|
let ezfio, ezfio' =
|
||||||
try
|
try
|
||||||
@ -40,26 +46,16 @@ let () =
|
|||||||
in
|
in
|
||||||
|
|
||||||
let overlap wf wf' =
|
let overlap wf wf' =
|
||||||
let norm =
|
let result, norm, norm' =
|
||||||
Hashtbl.fold (fun k c norm ->
|
Hashtbl.fold (fun k c (accu,norm,norm') ->
|
||||||
norm +. c *. c ) wf 0.
|
let (c',c) =
|
||||||
and norm' =
|
try (Hashtbl.find wf' k, c)
|
||||||
Hashtbl.fold (fun k c norm ->
|
with Not_found -> (0.,0.)
|
||||||
norm +. c *. c ) wf' 0.
|
|
||||||
in
|
in
|
||||||
let get_result wf wf' =
|
(accu +. c *. c' ,
|
||||||
Hashtbl.fold (fun k c accu ->
|
norm +. c *. c ,
|
||||||
let c' =
|
norm'+. c'*. c' )
|
||||||
try Hashtbl.find wf' k
|
) wf (0.,0.,0.)
|
||||||
with Not_found -> 0.
|
|
||||||
in
|
|
||||||
accu +. c *. c' ) wf 0.
|
|
||||||
in
|
|
||||||
let result =
|
|
||||||
if Hashtbl.length wf < Hashtbl.length wf' then
|
|
||||||
get_result wf wf'
|
|
||||||
else
|
|
||||||
get_result wf' wf
|
|
||||||
in
|
in
|
||||||
result /. (sqrt (norm *. norm'))
|
result /. (sqrt (norm *. norm'))
|
||||||
in
|
in
|
||||||
|
Loading…
Reference in New Issue
Block a user