diff --git a/ocaml/Input.ml b/ocaml/Input.ml index e771289f..ccdc3efa 100644 --- a/ocaml/Input.ml +++ b/ocaml/Input.ml @@ -6,5 +6,6 @@ open Core.Std;; include Input_ao_basis;; include Input_bi_integrals;; include Input_bitmasks;; +include Input_cis;; diff --git a/ocaml/Input_cis.ml b/ocaml/Input_cis.ml new file mode 100644 index 00000000..ee3ee72c --- /dev/null +++ b/ocaml/Input_cis.ml @@ -0,0 +1,105 @@ +open Qptypes;; +open Qputils;; +open Core.Std;; + +module Cis_dressed : sig + type t + val read : unit -> t + val to_string : t -> string +end = struct + 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; + } + ;; + + let get_default = Qpackage.get_ezfio_default "cis_dressed";; + + let read_n_state_cis () = + if not (Ezfio.has_cis_dressed_n_state_cis ()) then + get_default "n_state_cis" + |> Int.of_string + |> Ezfio.set_cis_dressed_n_state_cis + ; + Ezfio.get_cis_dressed_n_state_cis () + |> Strictly_positive_int.of_int + ;; + + let read_n_core_cis () = + if not (Ezfio.has_cis_dressed_n_core_cis ()) then + get_default "n_core_cis" + |> Int.of_string + |> Ezfio.set_cis_dressed_n_core_cis + ; + Ezfio.get_cis_dressed_n_core_cis () + |> Positive_int.of_int + ;; + + let read_n_act_cis () = + if not (Ezfio.has_cis_dressed_n_act_cis ()) then + Ezfio.get_mo_basis_mo_tot_num () + |> Ezfio.set_cis_dressed_n_act_cis + ; + Ezfio.get_cis_dressed_n_act_cis () + |> Positive_int.of_int + ;; + + let read_mp2_dressing () = + if not (Ezfio.has_cis_dressed_mp2_dressing ()) then + get_default "mp2_dressing" + |> Bool.of_string + |> Ezfio.set_cis_dressed_mp2_dressing + ; + Ezfio.get_cis_dressed_mp2_dressing () + ;; + + let read_standard_doubles () = + if not (Ezfio.has_cis_dressed_standard_doubles ()) then + get_default "standard_doubles" + |> Bool.of_string + |> Ezfio.set_cis_dressed_standard_doubles + ; + Ezfio.get_cis_dressed_standard_doubles () + ;; + + let read_en_2_2 () = + if not (Ezfio.has_cis_dressed_en_2_2 ()) then + get_default "en_2_2" + |> Bool.of_string + |> Ezfio.set_cis_dressed_en_2_2 + ; + Ezfio.get_cis_dressed_en_2_2 () + ;; + + let read () = + { n_state_cis = read_n_state_cis (); + n_core_cis = read_n_core_cis (); + n_act_cis = read_n_act_cis (); + mp2_dressing = read_mp2_dressing (); + standard_doubles = read_standard_doubles (); + en_2_2 = read_en_2_2 (); + } + ;; + + let to_string b = + Printf.sprintf " +n_state_cis = %s +n_core_cis = %s +n_act_cis = %s +mp2_dressing = %s +standard_doubles = %s +en_2_2 = %s +" + (Strictly_positive_int.to_string b.n_state_cis) + (Positive_int.to_string b.n_core_cis) + (Positive_int.to_string b.n_act_cis) + (Bool.to_string b.mp2_dressing) + (Bool.to_string b.standard_doubles) + (Bool.to_string b.en_2_2) +end + + diff --git a/ocaml/test_input.ml b/ocaml/test_input.ml index 2a654023..6deefb40 100644 --- a/ocaml/test_input.ml +++ b/ocaml/test_input.ml @@ -19,4 +19,11 @@ let test_bitmasks () = print_endline (Input.Bitmasks.to_string b); ;; -test_bitmasks ();; +let test_cis () = + Ezfio.set_file "F2.ezfio" ; + let b = Input.Cis_dressed.read () + in + print_endline (Input.Cis_dressed.to_string b); +;; + +test_cis ();;