mirror of
https://gitlab.com/scemama/qmcchem.git
synced 2024-11-07 06:33:38 +01:00
Random init of Walkers accelerated in OCaml
This commit is contained in:
parent
55d51c3666
commit
8dfdf8a2b3
@ -192,6 +192,7 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
and ez =
|
and ez =
|
||||||
Ezfio.get_electrons_elec_coord_pool ()
|
Ezfio.get_electrons_elec_coord_pool ()
|
||||||
|> Ezfio.flattened_ezfio
|
|> Ezfio.flattened_ezfio
|
||||||
|
|> Array.map ~f:Float.to_string
|
||||||
in
|
in
|
||||||
try
|
try
|
||||||
Array.init walk_num_tot ~f:(fun i ->
|
Array.init walk_num_tot ~f:(fun i ->
|
||||||
@ -231,6 +232,7 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
Array.map walkers_array ~f:Array.to_list
|
Array.map walkers_array ~f:Array.to_list
|
||||||
|> Array.to_list
|
|> Array.to_list
|
||||||
|> List.concat
|
|> List.concat
|
||||||
|
|> List.map ~f:Float.of_string
|
||||||
in
|
in
|
||||||
Ezfio.set_electrons_elec_coord_pool (Ezfio.ezfio_array_of_list
|
Ezfio.set_electrons_elec_coord_pool (Ezfio.ezfio_array_of_list
|
||||||
~rank:3 ~dim:[| elec_num+1 ; 3 ; walk_num_tot |] ~data:walkers_list);
|
~rank:3 ~dim:[| elec_num+1 ; 3 ; walk_num_tot |] ~data:walkers_list);
|
||||||
@ -536,14 +538,14 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
let random_int =
|
let random_int =
|
||||||
Random.int (Strictly_positive_int.to_int n_walks)
|
Random.int (Strictly_positive_int.to_int n_walks)
|
||||||
in
|
in
|
||||||
(Array.to_list (walkers_array.(random_int)) ) :: (walkers accu (n-1))
|
let new_accu =
|
||||||
|
walkers_array.(random_int) :: accu
|
||||||
|
in
|
||||||
|
walkers new_accu (n-1)
|
||||||
in
|
in
|
||||||
walkers [] (Strictly_positive_int.to_int n_walks)
|
walkers [] (Strictly_positive_int.to_int n_walks)
|
||||||
|> List.concat
|
|> Array.concat
|
||||||
|> List.map ~f:(fun x-> Printf.sprintf "%20.14f" x)
|
|> Array.to_list
|
||||||
(*
|
|
||||||
|> List.map ~f:Float.to_string
|
|
||||||
*)
|
|
||||||
in
|
in
|
||||||
|
|
||||||
let start_main_thread =
|
let start_main_thread =
|
||||||
@ -727,7 +729,8 @@ let run ?(daemon=true) ezfio_filename =
|
|||||||
recv_log log_msg ;
|
recv_log log_msg ;
|
||||||
for i=0 to ((Array.length w)-1)
|
for i=0 to ((Array.length w)-1)
|
||||||
do
|
do
|
||||||
Array.replace walkers_array (!last_walker) (fun _ -> w.(i));
|
Array.replace walkers_array (!last_walker) (fun _ -> Array.map
|
||||||
|
~f:Float.to_string w.(i));
|
||||||
increment_last_walker ();
|
increment_last_walker ();
|
||||||
done;
|
done;
|
||||||
let wall =
|
let wall =
|
||||||
|
Loading…
Reference in New Issue
Block a user