From ede29e42846ee4bd138244ba45611e6efd55b227 Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 21 Oct 2014 23:32:47 +0200 Subject: [PATCH] Added Input_full_ci.ml --- ocaml/Input.ml | 1 + ocaml/Input_ao_basis.ml | 12 ++++++- ocaml/Input_bi_integrals.ml | 11 +++++- ocaml/Input_bitmasks.ml | 12 ++++--- ocaml/Input_cis.ml | 10 +++++- ocaml/Input_cisd_sc2.ml | 7 +++- ocaml/Input_determinants.ml | 18 +++++++++- ocaml/Input_full_ci.ml | 72 +++++++++++++++++++++++++++++++++++++ ocaml/test_input.ml | 9 ++++- 9 files changed, 141 insertions(+), 11 deletions(-) create mode 100644 ocaml/Input_full_ci.ml diff --git a/ocaml/Input.ml b/ocaml/Input.ml index a8980459..a861e3ec 100644 --- a/ocaml/Input.ml +++ b/ocaml/Input.ml @@ -10,5 +10,6 @@ include Input_cis;; include Input_cisd_sc2;; include Input_determinants;; include Input_electrons;; +include Input_full_ci;; diff --git a/ocaml/Input_ao_basis.ml b/ocaml/Input_ao_basis.ml index 5f527d53..8bf2a303 100644 --- a/ocaml/Input_ao_basis.ml +++ b/ocaml/Input_ao_basis.ml @@ -3,7 +3,17 @@ open Qputils;; open Core.Std;; module Ao_basis : sig - type t + type t = + { ao_basis : string ; + ao_num : AO_number.t ; + ao_prim_num : Strictly_positive_int.t array; + ao_prim_num_max : Strictly_positive_int.t; + ao_nucl : Nucl_number.t array; + ao_power : Symmetry.Xyz.t array; + ao_coef : float array; + ao_expo : Positive_float.t array; + } + ;; val read : unit -> t val to_string : t -> string end = struct diff --git a/ocaml/Input_bi_integrals.ml b/ocaml/Input_bi_integrals.ml index 0bbdd111..e040ce5f 100644 --- a/ocaml/Input_bi_integrals.ml +++ b/ocaml/Input_bi_integrals.ml @@ -3,7 +3,16 @@ open Qputils;; open Core.Std;; module Bielec_integrals : sig - type t + type t = + { read_ao_integrals : bool; + read_mo_integrals : bool; + write_ao_integrals : bool; + write_mo_integrals : bool; + threshold_ao : Positive_float.t; + threshold_mo : Positive_float.t; + direct : bool; + } + ;; val read : unit -> t val to_string : t -> string end = struct diff --git a/ocaml/Input_bitmasks.ml b/ocaml/Input_bitmasks.ml index a4862432..9e60b67e 100644 --- a/ocaml/Input_bitmasks.ml +++ b/ocaml/Input_bitmasks.ml @@ -3,7 +3,13 @@ open Qputils;; open Core.Std;; module Bitmasks : sig - type t + type t = + { n_int : N_int_number.t; + bit_kind : Bit_kind.t; + n_mask_gen : Strictly_positive_int.t; + generators : int64 array; + } + ;; val read : unit -> t val to_string : t -> string end = struct @@ -12,10 +18,6 @@ end = struct bit_kind : Bit_kind.t; n_mask_gen : Strictly_positive_int.t; generators : int64 array; - (* - n_mask_ref : Strictly_positive_int.t; - reference : int64 array; - *) } ;; diff --git a/ocaml/Input_cis.ml b/ocaml/Input_cis.ml index ee3ee72c..3ee0e93b 100644 --- a/ocaml/Input_cis.ml +++ b/ocaml/Input_cis.ml @@ -3,7 +3,15 @@ open Qputils;; open Core.Std;; module Cis_dressed : sig - type t + type t = + { n_state_cis : Strictly_positive_int.t; + n_core_cis : Positive_int.t; + n_act_cis : Positive_int.t; + mp2_dressing : bool; + standard_doubles : bool; + en_2_2 : bool; + } + ;; val read : unit -> t val to_string : t -> string end = struct diff --git a/ocaml/Input_cisd_sc2.ml b/ocaml/Input_cisd_sc2.ml index 15890620..a976e683 100644 --- a/ocaml/Input_cisd_sc2.ml +++ b/ocaml/Input_cisd_sc2.ml @@ -3,7 +3,12 @@ open Qputils;; open Core.Std;; module Cisd_sc2 : sig - type t + type t = + { n_det_max_cisd_sc2 : Strictly_positive_int.t; + pt2_max : Positive_float.t; + do_pt2_end : bool; + } + ;; val read : unit -> t val to_string : t -> string end = struct diff --git a/ocaml/Input_determinants.ml b/ocaml/Input_determinants.ml index a3f21ca7..7a2e1ddf 100644 --- a/ocaml/Input_determinants.ml +++ b/ocaml/Input_determinants.ml @@ -3,7 +3,23 @@ open Qputils;; open Core.Std;; module Determinants : sig - type t + type t = + { n_int : N_int_number.t; + bit_kind : Bit_kind.t; + mo_label : Non_empty_string.t; + n_det : Det_number.t; + n_states : States_number.t; + n_states_diag : States_number.t; + n_det_max_jacobi : Det_number.t; + threshold_generators : Positive_float.t; + threshold_selectors : Positive_float.t; + read_wf : bool; + expected_s2 : Positive_float.t; + s2_eig : bool; + psi_coef : Det_coef.t array; + psi_det : Determinant.t array; + } + ;; val read : unit -> t val to_string : t -> string end = struct diff --git a/ocaml/Input_full_ci.ml b/ocaml/Input_full_ci.ml new file mode 100644 index 00000000..64de6498 --- /dev/null +++ b/ocaml/Input_full_ci.ml @@ -0,0 +1,72 @@ +open Qptypes;; +open Qputils;; +open Core.Std;; + +module Full_ci : sig + type t = + { n_det_max_fci : Strictly_positive_int.t; + pt2_max : Positive_float.t; + do_pt2_end : bool; + } + ;; + val read : unit -> t + val to_string : t -> string +end = struct + type t = + { n_det_max_fci : Strictly_positive_int.t; + pt2_max : Positive_float.t; + do_pt2_end : bool; + } + ;; + + let get_default = Qpackage.get_ezfio_default "full_ci";; + + let read_n_det_max_fci () = + if not (Ezfio.has_full_ci_n_det_max_fci ()) then + get_default "n_det_max_fci" + |> Int.of_string + |> Ezfio.set_full_ci_n_det_max_fci + ; + Ezfio.get_full_ci_n_det_max_fci () + |> Strictly_positive_int.of_int + ;; + + let read_pt2_max () = + if not (Ezfio.has_full_ci_pt2_max ()) then + get_default "pt2_max" + |> Float.of_string + |> Ezfio.set_full_ci_pt2_max + ; + Ezfio.get_full_ci_pt2_max () + |> Positive_float.of_float + ;; + + let read_do_pt2_end () = + if not (Ezfio.has_full_ci_do_pt2_end ()) then + get_default "do_pt2_end" + |> Bool.of_string + |> Ezfio.set_full_ci_do_pt2_end + ; + Ezfio.get_full_ci_do_pt2_end () + ;; + + + let read () = + { n_det_max_fci = read_n_det_max_fci (); + pt2_max = read_pt2_max (); + do_pt2_end = read_do_pt2_end (); + } + ;; + + let to_string b = + Printf.sprintf " +n_det_max_fci = %s +pt2_max = %s +do_pt2_end = %s +" + (Strictly_positive_int.to_string b.n_det_max_fci) + (Positive_float.to_string b.pt2_max) + (Bool.to_string b.do_pt2_end) +end + + diff --git a/ocaml/test_input.ml b/ocaml/test_input.ml index bd17a1b3..4b7d135e 100644 --- a/ocaml/test_input.ml +++ b/ocaml/test_input.ml @@ -47,4 +47,11 @@ let test_electrons () = print_endline (Input.Electrons.to_string b); ;; -test_electrons();; +let test_fci () = + Ezfio.set_file "F2.ezfio" ; + let b = Input.Full_ci.read () + in + print_endline (Input.Full_ci.to_string b); +;; + +test_fci();;