10
1
mirror of https://gitlab.com/scemama/qmcchem.git synced 2024-11-07 06:33:38 +01:00

Added Weight

This commit is contained in:
Anthony Scemama 2022-03-06 15:16:02 +01:00
parent 25ef42fa55
commit 9cd20a46e7
3 changed files with 17 additions and 6 deletions

View File

@ -183,10 +183,10 @@ def main():
if sum(x) == 0.: if sum(x) == 0.:
jast_a_up_dn = ezfio.jastrow_jast_a_up_dn jast_a_up_dn = ezfio.jastrow_jast_a_up_dn
x += jast_a_up_dn x += jast_a_up_dn
# opt = sp.optimize.minimize(f,x,method="Powell", opt = sp.optimize.minimize(f,x,method="Powell",
# options= {'disp':True, 'ftol':thresh,'xtol':0.02})
opt = sp.optimize.minimize(f,x,method="Nelder-Mead",
options= {'disp':True, 'ftol':thresh,'xtol':0.02}) options= {'disp':True, 'ftol':thresh,'xtol':0.02})
# opt = sp.optimize.minimize(f,x,method="Nelder-Mead",
# options= {'disp':True, 'ftol':thresh,'xtol':0.02})
print("x = "+str(opt)) print("x = "+str(opt))
sys.stdout.flush() sys.stdout.flush()
set_params_b(opt['x'][0]) set_params_b(opt['x'][0])

View File

@ -131,7 +131,7 @@ let display_histogram ~range property =
(** Display a summary of all the cmoputed quantities *) (** Display a summary of all the computed quantities *)
let display_summary ~range = let display_summary ~range =
let properties = let properties =
@ -152,12 +152,16 @@ let display_summary ~range =
Random_variable.of_raw_data ~range Property.Wall Random_variable.of_raw_data ~range Property.Wall
|> Random_variable.max_value_per_compute_node |> Random_variable.max_value_per_compute_node
|> Random_variable.sum |> Random_variable.sum
and total_weight =
Random_variable.of_raw_data ~range Property.E_loc
|> Random_variable.total_weight
in in
let speedup = let speedup =
cpu /. wall cpu /. wall
in in
Printf.printf "%20s : %10.2f x\n" "Speedup" speedup Printf.printf "%20s : %10.2f x\n" "Speedup" speedup ;
Printf.printf "%20s : %20.10e\n" "Total weight" total_weight

View File

@ -189,6 +189,13 @@ let sum { property ; data } =
in accu +. num in accu +. num
) 0. data ) 0. data
(** Compute sum of the weights *)
let total_weight { property ; data } =
List.fold_left (fun accu x ->
let num = (Weight.to_float x.Block.weight)
in accu +. num
) 0. data
(** Calculation of the average and error bar *) (** Calculation of the average and error bar *)