mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-23 04:43:50 +01:00
Bug in psi_det N_det psi_coef
This commit is contained in:
parent
3f8f8da2ae
commit
82a285774c
@ -142,7 +142,7 @@ end = struct
|
||||
|
||||
let to_string b =
|
||||
let short_basis = to_basis b in
|
||||
Printf.sprintf "Basis name : %s\n\n%s" b.ao_basis
|
||||
Printf.sprintf "Basis name : %s\n\n%s\n" b.ao_basis
|
||||
(Basis.to_string short_basis)
|
||||
;;
|
||||
|
||||
|
@ -4,7 +4,7 @@ open Core.Std;;
|
||||
|
||||
module Cisd_sc2 : sig
|
||||
type t =
|
||||
{ n_det_max_cisd_sc2 : Det_number.t;
|
||||
{ n_det_max_cisd_sc2 : Det_number_max.t;
|
||||
pt2_max : PT2_energy.t;
|
||||
do_pt2_end : bool;
|
||||
} with sexp
|
||||
@ -13,7 +13,7 @@ module Cisd_sc2 : sig
|
||||
val to_string : t -> string
|
||||
end = struct
|
||||
type t =
|
||||
{ n_det_max_cisd_sc2 : Det_number.t;
|
||||
{ n_det_max_cisd_sc2 : Det_number_max.t;
|
||||
pt2_max : PT2_energy.t;
|
||||
do_pt2_end : bool;
|
||||
} with sexp
|
||||
@ -28,7 +28,7 @@ end = struct
|
||||
|> Ezfio.set_cisd_sc2_selected_n_det_max_cisd_sc2
|
||||
;
|
||||
Ezfio.get_cisd_sc2_selected_n_det_max_cisd_sc2 ()
|
||||
|> Det_number.of_int
|
||||
|> Det_number_max.of_int
|
||||
;;
|
||||
|
||||
|
||||
@ -61,12 +61,11 @@ end = struct
|
||||
;;
|
||||
|
||||
let to_string b =
|
||||
Printf.sprintf "
|
||||
n_det_max_cisd_sc2 = %s
|
||||
Printf.sprintf "n_det_max_cisd_sc2 = %s
|
||||
pt2_max = %s
|
||||
do_pt2_end = %s
|
||||
"
|
||||
(Det_number.to_string b.n_det_max_cisd_sc2)
|
||||
(Det_number_max.to_string b.n_det_max_cisd_sc2)
|
||||
(PT2_energy.to_string b.pt2_max)
|
||||
(Bool.to_string b.do_pt2_end)
|
||||
end
|
||||
|
@ -10,7 +10,7 @@ module Determinants : sig
|
||||
n_det : Det_number.t;
|
||||
n_states : States_number.t;
|
||||
n_states_diag : States_number.t;
|
||||
n_det_max_jacobi : Det_number.t;
|
||||
n_det_max_jacobi : Strictly_positive_int.t;
|
||||
threshold_generators : Threshold.t;
|
||||
threshold_selectors : Threshold.t;
|
||||
read_wf : bool;
|
||||
@ -30,7 +30,7 @@ end = struct
|
||||
n_det : Det_number.t;
|
||||
n_states : States_number.t;
|
||||
n_states_diag : States_number.t;
|
||||
n_det_max_jacobi : Det_number.t;
|
||||
n_det_max_jacobi : Strictly_positive_int.t;
|
||||
threshold_generators : Threshold.t;
|
||||
threshold_selectors : Threshold.t;
|
||||
read_wf : bool;
|
||||
@ -106,7 +106,7 @@ end = struct
|
||||
|> Ezfio.set_determinants_n_det_max_jacobi
|
||||
;
|
||||
Ezfio.get_determinants_n_det_max_jacobi ()
|
||||
|> Det_number.of_int
|
||||
|> Strictly_positive_int.of_int
|
||||
;;
|
||||
|
||||
let read_threshold_generators () =
|
||||
@ -234,6 +234,30 @@ end = struct
|
||||
;;
|
||||
|
||||
let to_string b =
|
||||
Printf.sprintf "read_wf = %s
|
||||
n_det = %s
|
||||
n_states = %s
|
||||
threshold_generators = %s
|
||||
threshold_selectors = %s
|
||||
n_det_max_jacobi = %s
|
||||
n_states_diag = %s
|
||||
s2_eig = %s
|
||||
expected_s2 = %s
|
||||
mo_label = \"%s\"
|
||||
"
|
||||
(b.read_wf |> Bool.to_string)
|
||||
(b.n_det |> Det_number.to_string)
|
||||
(b.n_states |> States_number.to_string)
|
||||
(b.threshold_generators |> Threshold.to_string)
|
||||
(b.threshold_selectors |> Threshold.to_string)
|
||||
(b.n_det_max_jacobi |> Strictly_positive_int.to_string)
|
||||
(b.n_states_diag |> States_number.to_string)
|
||||
(b.s2_eig |> Bool.to_string)
|
||||
(b.expected_s2 |> Positive_float.to_string)
|
||||
(b.mo_label |> Non_empty_string.to_string)
|
||||
;;
|
||||
|
||||
let debug b =
|
||||
Printf.sprintf "
|
||||
n_int = %s
|
||||
bit_kind = %s
|
||||
@ -256,7 +280,7 @@ psi_det = %s
|
||||
(b.n_det |> Det_number.to_string)
|
||||
(b.n_states |> States_number.to_string)
|
||||
(b.n_states_diag |> States_number.to_string)
|
||||
(b.n_det_max_jacobi |> Det_number.to_string)
|
||||
(b.n_det_max_jacobi |> Strictly_positive_int.to_string)
|
||||
(b.threshold_generators |> Threshold.to_string)
|
||||
(b.threshold_selectors |> Threshold.to_string)
|
||||
(b.read_wf |> Bool.to_string)
|
||||
@ -269,7 +293,6 @@ psi_det = %s
|
||||
Int64.to_string x )|> Array.to_list |>
|
||||
String.concat ~sep:", ") |> Array.to_list
|
||||
|> String.concat ~sep:" | ")
|
||||
;
|
||||
;;
|
||||
|
||||
end
|
||||
|
@ -47,14 +47,22 @@ end = struct
|
||||
;;
|
||||
|
||||
let to_string b =
|
||||
Printf.sprintf "
|
||||
elec_alpha_num = %s
|
||||
Printf.sprintf "elec_alpha_num = %s
|
||||
elec_beta_num = %s
|
||||
"
|
||||
(Elec_alpha_number.to_string b.elec_alpha_num)
|
||||
(Elec_beta_number.to_string b.elec_beta_num)
|
||||
;;
|
||||
|
||||
let debug b =
|
||||
Printf.sprintf "elec_alpha_num = %s
|
||||
elec_beta_num = %s
|
||||
elec_num = %s
|
||||
"
|
||||
(Elec_alpha_number.to_string b.elec_alpha_num)
|
||||
(Elec_beta_number.to_string b.elec_beta_num)
|
||||
(Elec_number.to_string b.elec_num)
|
||||
;;
|
||||
end
|
||||
|
||||
|
||||
|
@ -4,7 +4,7 @@ open Core.Std;;
|
||||
|
||||
module Full_ci : sig
|
||||
type t =
|
||||
{ n_det_max_fci : Det_number.t;
|
||||
{ n_det_max_fci : Det_number_max.t;
|
||||
pt2_max : PT2_energy.t;
|
||||
do_pt2_end : bool;
|
||||
} with sexp
|
||||
@ -13,7 +13,7 @@ module Full_ci : sig
|
||||
val to_string : t -> string
|
||||
end = struct
|
||||
type t =
|
||||
{ n_det_max_fci : Det_number.t;
|
||||
{ n_det_max_fci : Det_number_max.t;
|
||||
pt2_max : PT2_energy.t;
|
||||
do_pt2_end : bool;
|
||||
} with sexp
|
||||
@ -28,7 +28,7 @@ end = struct
|
||||
|> Ezfio.set_full_ci_n_det_max_fci
|
||||
;
|
||||
Ezfio.get_full_ci_n_det_max_fci ()
|
||||
|> Det_number.of_int
|
||||
|> Det_number_max.of_int
|
||||
;;
|
||||
|
||||
let read_pt2_max () =
|
||||
@ -59,12 +59,11 @@ end = struct
|
||||
;;
|
||||
|
||||
let to_string b =
|
||||
Printf.sprintf "
|
||||
n_det_max_fci = %s
|
||||
Printf.sprintf "n_det_max_fci = %s
|
||||
pt2_max = %s
|
||||
do_pt2_end = %s
|
||||
"
|
||||
(Det_number.to_string b.n_det_max_fci)
|
||||
(Det_number_max.to_string b.n_det_max_fci)
|
||||
(PT2_energy.to_string b.pt2_max)
|
||||
(Bool.to_string b.do_pt2_end)
|
||||
end
|
||||
|
@ -46,8 +46,7 @@ end = struct
|
||||
;;
|
||||
|
||||
let to_string b =
|
||||
Printf.sprintf "
|
||||
n_it_scf_max = %s
|
||||
Printf.sprintf "n_it_scf_max = %s
|
||||
thresh_scf = %s
|
||||
"
|
||||
(Strictly_positive_int.to_string b.n_it_scf_max)
|
||||
|
@ -72,6 +72,16 @@ end = struct
|
||||
let to_string b =
|
||||
Printf.sprintf "
|
||||
mo_label = %s
|
||||
mo_tot_num = %s
|
||||
"
|
||||
(Non_empty_string.to_string b.mo_label)
|
||||
(MO_number.to_string b.mo_tot_num)
|
||||
|
||||
;;
|
||||
|
||||
let debug b =
|
||||
Printf.sprintf "
|
||||
mo_label = %s
|
||||
mo_tot_num = \"%s\"
|
||||
mo_occ = %s
|
||||
mo_coef = %s
|
||||
@ -82,6 +92,7 @@ mo_coef = %s
|
||||
~f:(Positive_float.to_string) |> String.concat ~sep:", " )
|
||||
(b.mo_coef |> Array.to_list |> List.map
|
||||
~f:(MO_coef.to_string) |> String.concat ~sep:", " )
|
||||
;;
|
||||
|
||||
end
|
||||
|
||||
|
@ -15,11 +15,23 @@ let instructions filename = Printf.sprintf
|
||||
type keyword =
|
||||
| Ao_basis
|
||||
| Bielec_integrals
|
||||
| Cisd_sc2
|
||||
| Determinants
|
||||
| Electrons
|
||||
| Full_ci
|
||||
| Hartree_fock
|
||||
| Mo_basis
|
||||
;;
|
||||
|
||||
let keyword_to_string = function
|
||||
| Ao_basis -> "AO basis"
|
||||
| Bielec_integrals -> "Two electron integrals"
|
||||
| Cisd_sc2 -> "CISD (SC)^2"
|
||||
| Determinants -> "Determinants"
|
||||
| Electrons -> "Electrons"
|
||||
| Full_ci -> "Selected Full-CI"
|
||||
| Hartree_fock -> "Hartree-Fock"
|
||||
| Mo_basis -> "MO basis"
|
||||
;;
|
||||
|
||||
let make_header kw =
|
||||
@ -28,15 +40,37 @@ let make_header kw =
|
||||
"\n\n# "^s^"\n"^"# "^(String.init l ~f:(fun _ -> '='))^"\n\n"
|
||||
;;
|
||||
|
||||
let get_bielec () =
|
||||
(make_header Bielec_integrals)^
|
||||
(Input.Bielec_integrals.(to_string (read ())))
|
||||
let get s =
|
||||
let header = (make_header s)
|
||||
in header^(match s with
|
||||
| Bielec_integrals ->
|
||||
Input.Bielec_integrals.(to_string (read ()))
|
||||
| Ao_basis ->
|
||||
Input.Ao_basis.(to_string (read ()))
|
||||
| Cisd_sc2 ->
|
||||
Input.Cisd_sc2.(to_string (read ()))
|
||||
| Determinants ->
|
||||
Input.Determinants.(to_string (read ()))
|
||||
| Electrons ->
|
||||
Input.Electrons.(to_string (read ()))
|
||||
| Full_ci ->
|
||||
Input.Full_ci.(to_string (read ()))
|
||||
| Hartree_fock ->
|
||||
Input.Hartree_fock.(to_string (read ()))
|
||||
| Mo_basis ->
|
||||
Input.Mo_basis.(to_string (read ()))
|
||||
)
|
||||
;;
|
||||
|
||||
let get_ao_basis () =
|
||||
(make_header Ao_basis)^
|
||||
(Input.Ao_basis.(to_string (read ())))
|
||||
(*
|
||||
let create_temp_file ezfio_filename fields =
|
||||
In_channel.with_file filename ~f:(func out_channel ->
|
||||
(instructions ezfio_filename) :: (List.map ~f:get fields)
|
||||
|> String.concat output
|
||||
|> print_string
|
||||
)
|
||||
;;
|
||||
*)
|
||||
|
||||
let run ezfio_filename =
|
||||
|
||||
@ -46,11 +80,18 @@ let run ezfio_filename =
|
||||
|
||||
Ezfio.set_file ezfio_filename;
|
||||
|
||||
let output = [
|
||||
(instructions ezfio_filename) ;
|
||||
(get_ao_basis ()) ;
|
||||
(get_bielec ())
|
||||
] in
|
||||
let output = (instructions ezfio_filename) :: (
|
||||
List.map ~f:get [
|
||||
Electrons ;
|
||||
Ao_basis ;
|
||||
Mo_basis ;
|
||||
Bielec_integrals ;
|
||||
Cisd_sc2 ;
|
||||
Determinants ;
|
||||
Full_ci ;
|
||||
Hartree_fock ;
|
||||
])
|
||||
in
|
||||
String.concat output
|
||||
|> print_string
|
||||
;;
|
||||
|
@ -68,8 +68,13 @@ let input_data = "
|
||||
assert (x > 0) ;
|
||||
if (x > 100000000) then
|
||||
warning \"More than 100 million determinants\";
|
||||
if (Ezfio.has_determinants_det_num ()) then
|
||||
assert (x <= (Ezfio.get_determinants_det_num ()));
|
||||
if (Ezfio.has_determinants_n_det ()) then
|
||||
assert (x <= (Ezfio.get_determinants_n_det ()));
|
||||
|
||||
* Det_number_max : int
|
||||
assert (x > 0) ;
|
||||
if (x > 100000000) then
|
||||
warning \"More than 100 million determinants\";
|
||||
|
||||
* States_number : int
|
||||
assert (x > 0) ;
|
||||
|
@ -136,7 +136,6 @@ subroutine copy_H_apply_buffer_to_wf
|
||||
do j=0,nproc-1
|
||||
N_det = N_det + H_apply_buffer(j)%N_det
|
||||
enddo
|
||||
SOFT_TOUCH N_det
|
||||
|
||||
if (psi_det_size < N_det) then
|
||||
psi_det_size = N_det
|
||||
@ -180,6 +179,7 @@ subroutine copy_H_apply_buffer_to_wf
|
||||
H_apply_buffer(j)%N_det = 0
|
||||
!$OMP END PARALLEL
|
||||
call normalize(psi_coef,N_det)
|
||||
SOFT_TOUCH N_det psi_det psi_coef
|
||||
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user