2017-10-10 09:39:58 +02:00
|
|
|
open Core
|
2015-12-19 02:35:13 +01:00
|
|
|
|
|
|
|
let split_re =
|
|
|
|
Str.regexp " +"
|
|
|
|
|
|
|
|
|
|
|
|
let split s =
|
|
|
|
String.strip s
|
|
|
|
|> Str.split split_re
|
|
|
|
|
|
|
|
|
2016-01-18 20:17:37 +01:00
|
|
|
let set_ezfio_filename ezfio_filename =
|
|
|
|
let () =
|
|
|
|
if (not (Sys.file_exists_exn ezfio_filename)) then
|
|
|
|
failwith (ezfio_filename^" does not exist")
|
|
|
|
in
|
|
|
|
let () =
|
|
|
|
match (Sys.is_directory ezfio_filename) with
|
|
|
|
| `Yes -> Ezfio.set_file ezfio_filename ;
|
|
|
|
| _ -> failwith ("Error : "^ezfio_filename^" is not a directory")
|
|
|
|
in
|
|
|
|
let dir, result =
|
|
|
|
Filename.realpath ezfio_filename
|
|
|
|
|> Filename.split
|
|
|
|
in
|
|
|
|
Unix.chdir dir ;
|
|
|
|
Ezfio.set_file result
|
|
|
|
|
|
|
|
|
2015-12-19 02:35:13 +01:00
|
|
|
let ezfio_filename = lazy (
|
|
|
|
let f =
|
|
|
|
!Ezfio.ezfio_filename
|
|
|
|
in
|
|
|
|
let full_path =
|
2016-01-18 20:17:37 +01:00
|
|
|
match f with
|
|
|
|
| "EZFIO_File" ->
|
2015-12-19 02:35:13 +01:00
|
|
|
begin
|
|
|
|
if (Array.length Sys.argv = 1) then
|
|
|
|
failwith "Error : EZFIO directory not specified on the command line\n";
|
2016-01-18 20:17:37 +01:00
|
|
|
Sys.argv.(1)
|
2015-12-19 02:35:13 +01:00
|
|
|
end
|
2016-01-18 20:17:37 +01:00
|
|
|
| f -> f
|
2015-12-19 02:35:13 +01:00
|
|
|
in
|
2016-01-18 20:17:37 +01:00
|
|
|
set_ezfio_filename full_path;
|
|
|
|
!Ezfio.ezfio_filename
|
2015-12-19 02:35:13 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
let elec_num = lazy (
|
|
|
|
Ezfio.set_file (Lazy.force ezfio_filename);
|
|
|
|
Ezfio.get_electrons_elec_alpha_num () +
|
|
|
|
Ezfio.get_electrons_elec_beta_num ()
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
let walk_num = lazy (
|
|
|
|
Ezfio.set_file (Lazy.force ezfio_filename);
|
|
|
|
Ezfio.get_electrons_elec_walk_num ()
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
let warn msg =
|
|
|
|
Printf.printf "Warning : %s\n%!" msg
|
|
|
|
|
|
|
|
let () =
|
|
|
|
Random.self_init ()
|
|
|
|
|