10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-11-06 22:23:39 +01:00

Added E_trial

This commit is contained in:
Anthony Scemama 2016-05-03 09:01:05 +02:00
parent 54f2bae5f6
commit b6b9a85cb2
7 changed files with 92 additions and 17 deletions

View File

@ -64,6 +64,7 @@ simulation
ci_threshold double precision ci_threshold double precision
md5_key character*(32) md5_key character*(32)
E_ref double precision E_ref double precision
E_trial double precision
srmc_projection_time real srmc_projection_time real
jastrow jastrow

View File

@ -490,6 +490,63 @@ end
module Trial_wf_energy : sig
type t = float
val doc : string
val read : unit -> t
val write : t -> unit
val to_float : t -> float
val of_float : float -> t
val to_string : t -> string
val of_string : string -> t
end = struct
type t = float
let doc = "Energy of the trial wave function (au)"
let of_float x =
if (x > 0.) then
failwith "Reference energy should not be positive.";
if (x <= -1_000_000.) then
failwith "Reference energy is too low.";
x
let to_float x = x
let read () =
let _ =
Lazy.force Qputils.ezfio_filename
in
if (not (Ezfio.has_simulation_e_trial ())) then
to_float 0.
|> Ezfio.set_simulation_e_trial;
Ezfio.get_simulation_e_trial ()
|> of_float
let write t =
let _ =
Lazy.force Qputils.ezfio_filename
in
to_float t
|> Ezfio.set_simulation_e_trial
let of_string x =
Float.of_string x
|> of_float
let to_string x =
to_float x
|> Float.to_string
end
module Ref_energy : sig module Ref_energy : sig
type t = float type t = float

View File

@ -24,6 +24,7 @@ type field =
| Method | Method
| Sampling | Sampling
| Ref_energy | Ref_energy
| Trial_wf_energy
| CI_threshold | CI_threshold
| Time_step | Time_step
| SRMC_projection_time | SRMC_projection_time
@ -62,6 +63,8 @@ let get field =
option_to_string Sampling.read Sampling.to_string Sampling.doc option_to_string Sampling.read Sampling.to_string Sampling.doc
| Ref_energy -> | Ref_energy ->
option_to_string Ref_energy.read Ref_energy.to_string Ref_energy.doc option_to_string Ref_energy.read Ref_energy.to_string Ref_energy.doc
| Trial_wf_energy ->
option_to_string Trial_wf_energy.read Trial_wf_energy.to_string Trial_wf_energy.doc
| CI_threshold -> | CI_threshold ->
option_to_string CI_threshold.read CI_threshold.to_string CI_threshold.doc option_to_string CI_threshold.read CI_threshold.to_string CI_threshold.doc
| Time_step -> | Time_step ->
@ -105,7 +108,7 @@ let write_input_in_ezfio ezfio_filename fields =
(** Run the edit command *) (** Run the edit command *)
let run ~c ?f ?t ?l ?m ?e ?s ?ts ?w ?wt ?n ?j ?p ?input ezfio_filename = let run ~c ?f ?t ?l ?m ?e ?et ?s ?ts ?w ?wt ?n ?j ?p ?input ezfio_filename =
let interactive = ref ( let interactive = ref (
if c then if c then
@ -131,6 +134,7 @@ let run ~c ?f ?t ?l ?m ?e ?s ?ts ?w ?wt ?n ?j ?p ?input ezfio_filename =
in in
handle_option Input.Ref_energy.(of_float , write) e; handle_option Input.Ref_energy.(of_float , write) e;
handle_option Input.Trial_wf_energy.(of_float , write) et;
handle_option Input.Jastrow_type.(of_string, write) j; handle_option Input.Jastrow_type.(of_string, write) j;
handle_option Input.Block_time.(of_int , write) l; handle_option Input.Block_time.(of_int , write) l;
handle_option Input.Method.(of_string, write) m; handle_option Input.Method.(of_string, write) m;
@ -153,6 +157,7 @@ let run ~c ?f ?t ?l ?m ?e ?s ?ts ?w ?wt ?n ?j ?p ?input ezfio_filename =
Time_step ; Time_step ;
SRMC_projection_time ; SRMC_projection_time ;
Ref_energy ; Ref_energy ;
Trial_wf_energy ;
Walk_num ; Walk_num ;
Walk_num_tot ; Walk_num_tot ;
Fitcusp_factor ; Fitcusp_factor ;
@ -225,6 +230,7 @@ let run ~c ?f ?t ?l ?m ?e ?s ?ts ?w ?wt ?n ?j ?p ?input ezfio_filename =
| Walk_num_tot -> Walk_num_tot.(of_string s |> write) | Walk_num_tot -> Walk_num_tot.(of_string s |> write)
| CI_threshold -> CI_threshold.(of_string s |> write) | CI_threshold -> CI_threshold.(of_string s |> write)
| Jastrow_type -> Jastrow_type.(of_string s |> write) | Jastrow_type -> Jastrow_type.(of_string s |> write)
| Trial_wf_energy -> Trial_wf_energy.(of_string s |> write)
| Properties -> Properties.(of_string s |> write) | Properties -> Properties.(of_string s |> write)
end end
with with
@ -281,6 +287,8 @@ let spec =
~doc:("method "^Input.Method.doc) ~doc:("method "^Input.Method.doc)
+> flag "e" (optional float) +> flag "e" (optional float)
~doc:("energy "^Input.Ref_energy.doc) ~doc:("energy "^Input.Ref_energy.doc)
+> flag "et" (optional float)
~doc:("energy "^Input.Trial_wf_energy.doc)
+> flag "s" (optional string) +> flag "s" (optional string)
~doc:("sampling "^Input.Sampling.doc) ~doc:("sampling "^Input.Sampling.doc)
+> flag "ts" (optional float) +> flag "ts" (optional float)
@ -307,8 +315,8 @@ let command =
Edit input data Edit input data
") ")
spec spec
(fun c f t l m e s ts w wt n j p ezfio_file input () -> (fun c f t l m e et s ts w wt n j p ezfio_file input () ->
run ~c ?f ?t ?l ?m ?e ?s ?ts ?w ?wt ?n ?j ?p ?input ezfio_file ) run ~c ?f ?t ?l ?m ?e ?et ?s ?ts ?w ?wt ?n ?j ?p ?input ezfio_file )

View File

@ -253,7 +253,7 @@ BEGIN_PROVIDER [ double precision, E_loc_zv ]
BEGIN_DOC BEGIN_DOC
! Zero-variance parameter on E_loc ! Zero-variance parameter on E_loc
END_DOC END_DOC
E_loc_zv = E_loc E_loc_zv = E_trial
END_PROVIDER END_PROVIDER

View File

@ -174,7 +174,7 @@ END_SHELL
if (calc_E_loc_zv) then if (calc_E_loc_zv) then
if (dabs(pdmc_weight(i_walk)*pop_weight_mult) > 1.d-6) then if (dabs(pdmc_weight(i_walk)*pop_weight_mult) > 1.d-6) then
E_loc_zv = E_loc + (E_ref-E_loc)/(pdmc_weight(i_walk)*pop_weight_mult) E_loc_zv = E_loc + (E_trial-E_loc)/(pdmc_weight(i_walk)*pop_weight_mult)
else else
E_loc_zv = 0.d0 E_loc_zv = 0.d0
endif endif

View File

@ -45,6 +45,7 @@ data = [ \
("simulation_http_server" , "character*(128)", "" ), ("simulation_http_server" , "character*(128)", "" ),
("simulation_md5_key" , "character*(32)" , "" ), ("simulation_md5_key" , "character*(32)" , "" ),
("simulation_e_ref" , "double precision" , "" ), ("simulation_e_ref" , "double precision" , "" ),
("simulation_e_trial" , "double precision" , "" ),
("simulation_do_run" , "logical " , "" ), ("simulation_do_run" , "logical " , "" ),
("pseudo_do_pseudo" , "logical " , "" ), ("pseudo_do_pseudo" , "logical " , "" ),

View File

@ -365,3 +365,11 @@ BEGIN_PROVIDER [ character*(32), md5_key ]
endif endif
END_PROVIDER END_PROVIDER
BEGIN_PROVIDER [ double precision, E_trial ]
implicit none
BEGIN_DOC
! Energy of the trial wave function
END_DOC
call get_simulation_e_trial(E_trial)
END_PROVIDER