10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-08-26 14:31:44 +02:00

Fixed state_average_weight.gz different from array

This commit is contained in:
Anthony Scemama 2018-02-15 12:00:45 +01:00
parent ee53802402
commit ab0eb1256b
2 changed files with 21 additions and 11 deletions

2
configure vendored
View File

@ -497,7 +497,7 @@ def create_ninja_and_rc(l_installed):
'export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)', 'export LIBRARY_PATH=$(qp_prepend_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)',
'export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)', 'export C_INCLUDE_PATH=$(qp_prepend_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)',
'', '',
'if [[ $SHELL == "bash" ]] ; then', 'if [[ $SHELL == "/bin/bash" ]] ; then',
' source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh', ' source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh',
'fi', 'fi',
'', '',

View File

@ -119,21 +119,31 @@ end = struct
;; ;;
let read_state_average_weight () = let read_state_average_weight () =
if not (Ezfio.has_determinants_state_average_weight ()) then
begin
let n_states = let n_states =
read_n_states () read_n_states ()
|> States_number.to_int |> States_number.to_int
in in
if not (Ezfio.has_determinants_state_average_weight ()) then
begin
let data = let data =
Array.init n_states (fun _ -> 1./.(float_of_int n_states)) Array.init n_states (fun _ -> 1./.(float_of_int n_states))
|> Array.map ~f:Positive_float.of_float |> Array.map ~f:Positive_float.of_float
in in
write_state_average_weight data; write_state_average_weight data
end; end;
let result =
Ezfio.get_determinants_state_average_weight () Ezfio.get_determinants_state_average_weight ()
|> Ezfio.flattened_ezfio |> Ezfio.flattened_ezfio
|> Array.map ~f:Positive_float.of_float |> Array.map ~f:Positive_float.of_float
in
if Array.length result = n_states then
result
else
let data =
Array.init n_states (fun _ -> 1./.(float_of_int n_states))
|> Array.map ~f:Positive_float.of_float
in
(write_state_average_weight data; data)
;; ;;
let read_expected_s2 () = let read_expected_s2 () =