mirror of
https://github.com/LCPQ/quantum_package
synced 2025-01-03 10:05:57 +01:00
State-average weights and Zsh fix
This commit is contained in:
parent
37c07671da
commit
49d85cf27c
16
configure
vendored
16
configure
vendored
@ -480,24 +480,24 @@ def create_ninja_and_rc(l_installed):
|
||||
'export QP_PYTHON={0}'.format(":".join(l_python)), "",
|
||||
'export IRPF90={0}'.format(path_irpf90.replace(QP_ROOT,"${QP_ROOT}")),
|
||||
'export NINJA={0}'.format(path_ninja.replace(QP_ROOT,"${QP_ROOT}")),
|
||||
'qp_append_export () {',
|
||||
' #Append path $2:${!1}. Add the semicolon only if ${!1} is defined',
|
||||
' echo ${2}${!1:+:${!1}}',
|
||||
'function qp_append_export () {',
|
||||
' #Append path $2:${!1}. Add the semicolon only if ${!1} is defined',
|
||||
' eval "value_1=\"\${$1}\""',
|
||||
' echo ${2}${value_1:+:${value_1}}',
|
||||
'}',
|
||||
'export PYTHONPATH=$(qp_append_export "PYTHONPATH" "${QP_EZFIO}/Python":"${QP_PYTHON}")',
|
||||
'export PATH=$(qp_append_export "PATH" "${QP_PYTHON}":"${QP_ROOT}"/bin:"${QP_ROOT}"/ocaml)',
|
||||
'export LD_LIBRARY_PATH=$(qp_append_export "LD_LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)',
|
||||
'export LIBRARY_PATH=$(qp_append_export "LIBRARY_PATH" "${QP_ROOT}"/lib:"${QP_ROOT}"/lib64)',
|
||||
'export C_INCLUDE_PATH=$(qp_append_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)'
|
||||
'export C_INCLUDE_PATH=$(qp_append_export "C_INCLUDE_PATH" "${QP_ROOT}"/include)',
|
||||
'',
|
||||
'source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh',
|
||||
'if [[ $SHELL == "bash" ]] ; then',
|
||||
' source ${QP_ROOT}/install/EZFIO/Bash/ezfio.sh',
|
||||
'fi',
|
||||
'',
|
||||
'# Choose the correct network interface',
|
||||
'# export QP_NIC=ib0',
|
||||
'# export QP_NIC=eth0',
|
||||
'',
|
||||
'# Choose how to start MPI processes',
|
||||
'# export QP_MPIRUN="mpirun"',
|
||||
''
|
||||
]
|
||||
|
||||
|
@ -11,6 +11,7 @@ module Determinants_by_hand : sig
|
||||
expected_s2 : Positive_float.t;
|
||||
psi_coef : Det_coef.t array;
|
||||
psi_det : Determinant.t array;
|
||||
state_average_weight : Positive_float.t array;
|
||||
} [@@deriving sexp]
|
||||
val read : unit -> t
|
||||
val read_maybe : unit -> t option
|
||||
@ -30,6 +31,7 @@ end = struct
|
||||
expected_s2 : Positive_float.t;
|
||||
psi_coef : Det_coef.t array;
|
||||
psi_det : Determinant.t array;
|
||||
state_average_weight : Positive_float.t array;
|
||||
} [@@deriving sexp]
|
||||
;;
|
||||
|
||||
@ -82,7 +84,6 @@ end = struct
|
||||
|> Ezfio.set_determinants_n_det
|
||||
;;
|
||||
|
||||
|
||||
let read_n_states () =
|
||||
if not (Ezfio.has_determinants_n_states ()) then
|
||||
Ezfio.set_determinants_n_states 1
|
||||
@ -96,6 +97,36 @@ end = struct
|
||||
|> Ezfio.set_determinants_n_states
|
||||
;;
|
||||
|
||||
let write_state_average_weight data =
|
||||
let n_states =
|
||||
read_n_states ()
|
||||
|> States_number.to_int
|
||||
in
|
||||
let data =
|
||||
Array.map ~f:Positive_float.to_float data
|
||||
|> Array.to_list
|
||||
in
|
||||
Ezfio.ezfio_array_of_list ~rank:1 ~dim:[| n_states |] ~data
|
||||
|> Ezfio.set_determinants_state_average_weight
|
||||
;;
|
||||
|
||||
let read_state_average_weight () =
|
||||
if not (Ezfio.has_determinants_state_average_weight ()) then
|
||||
begin
|
||||
let n_states =
|
||||
read_n_states ()
|
||||
|> States_number.to_int
|
||||
in
|
||||
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;
|
||||
end;
|
||||
Ezfio.get_determinants_state_average_weight ()
|
||||
|> Ezfio.flattened_ezfio
|
||||
|> Array.map ~f:Positive_float.of_float
|
||||
;;
|
||||
|
||||
let read_expected_s2 () =
|
||||
if not (Ezfio.has_determinants_expected_s2 ()) then
|
||||
@ -205,6 +236,7 @@ end = struct
|
||||
psi_coef = read_psi_coef () ;
|
||||
psi_det = read_psi_det () ;
|
||||
n_states = read_n_states () ;
|
||||
state_average_weight = read_state_average_weight () ;
|
||||
}
|
||||
else
|
||||
failwith "No molecular orbitals, so no determinants"
|
||||
@ -228,6 +260,7 @@ end = struct
|
||||
psi_coef ;
|
||||
psi_det ;
|
||||
n_states ;
|
||||
state_average_weight ;
|
||||
} =
|
||||
write_n_int n_int ;
|
||||
write_bit_kind bit_kind;
|
||||
@ -236,6 +269,7 @@ end = struct
|
||||
write_expected_s2 expected_s2;
|
||||
write_psi_coef ~n_det:n_det ~n_states:n_states psi_coef ;
|
||||
write_psi_det ~n_int:n_int ~n_det:n_det psi_det;
|
||||
write_state_average_weight state_average_weight;
|
||||
;;
|
||||
|
||||
|
||||
@ -288,12 +322,17 @@ Number of determinants ::
|
||||
|
||||
n_det = %s
|
||||
|
||||
State average weights ::
|
||||
|
||||
state_average_weight = (%s)
|
||||
|
||||
Determinants ::
|
||||
|
||||
%s
|
||||
"
|
||||
(b.expected_s2 |> Positive_float.to_string)
|
||||
(b.n_det |> Det_number.to_string)
|
||||
(b.state_average_weight |> Array.to_list |> List.map ~f:Positive_float.to_string |> String.concat ~sep:"\t")
|
||||
det_text
|
||||
|> Rst_string.of_string
|
||||
;;
|
||||
@ -307,6 +346,7 @@ bit_kind = %s
|
||||
n_det = %s
|
||||
n_states = %s
|
||||
expected_s2 = %s
|
||||
state_average_weight = %s
|
||||
psi_coef = %s
|
||||
psi_det = %s
|
||||
"
|
||||
@ -315,6 +355,7 @@ psi_det = %s
|
||||
(b.n_det |> Det_number.to_string)
|
||||
(b.n_states |> States_number.to_string)
|
||||
(b.expected_s2 |> Positive_float.to_string)
|
||||
(b.state_average_weight |> Array.to_list |> List.map ~f:Positive_float.to_string |> String.concat ~sep:",")
|
||||
(b.psi_coef |> Array.to_list |> List.map ~f:Det_coef.to_string
|
||||
|> String.concat ~sep:", ")
|
||||
(b.psi_det |> Array.to_list |> List.map ~f:(Determinant.to_string
|
||||
|
Loading…
Reference in New Issue
Block a user