10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-11-04 21:24:02 +01:00
quantum_package/ocaml/Input_cis.ml

157 lines
3.7 KiB
OCaml
Raw Normal View History

2014-10-18 23:18:54 +02:00
open Qptypes;;
open Qputils;;
open Core.Std;;
module Cis_dressed : sig
2014-10-21 23:32:47 +02:00
type t =
2014-10-22 00:12:23 +02:00
{ n_state_cis : States_number.t;
2014-10-21 23:32:47 +02:00
n_core_cis : Positive_int.t;
n_act_cis : Positive_int.t;
mp2_dressing : bool;
standard_doubles : bool;
en_2_2 : bool;
2014-10-25 21:24:21 +02:00
} with sexp
2014-10-21 23:32:47 +02:00
;;
2014-11-27 23:05:26 +01:00
val read : unit -> t option
2014-10-18 23:18:54 +02:00
val to_string : t -> string
2014-10-29 22:13:03 +01:00
val to_rst : t -> Rst_string.t
2014-11-12 17:17:44 +01:00
val of_rst : Rst_string.t -> t option
2014-10-18 23:18:54 +02:00
end = struct
type t =
2014-10-22 00:12:23 +02:00
{ n_state_cis : States_number.t;
2014-10-18 23:18:54 +02:00
n_core_cis : Positive_int.t;
n_act_cis : Positive_int.t;
mp2_dressing : bool;
standard_doubles : bool;
en_2_2 : bool;
2014-10-25 21:24:21 +02:00
} with sexp
2014-10-18 23:18:54 +02:00
;;
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 ()
2014-10-22 00:12:23 +02:00
|> States_number.of_int
2014-10-18 23:18:54 +02:00
;;
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 () =
2014-11-27 23:05:26 +01:00
Some
2014-10-18 23:18:54 +02:00
{ 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 "
2014-10-29 22:13:03 +01:00
n_state_cis = %s
n_core_cis = %s
n_act_cis = %s
mp2_dressing = %s
standard_doubles = %s
en_2_2 = %s
"
(States_number.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)
;;
let to_rst b =
Printf.sprintf "
2014-10-29 00:12:45 +01:00
Number of states ::
n_state_cis = %s
Core and active MOs ::
n_core_cis = %s
n_act_cis = %s
Dress with MP2 perturbation ::
mp2_dressing = %s
Use standard double-excitations ::
standard_doubles = %s
Epstein-Nesbet 2x2 diagonalization ::
en_2_2 = %s
2014-10-18 23:18:54 +02:00
"
2014-10-22 00:12:23 +02:00
(States_number.to_string b.n_state_cis)
2014-10-18 23:18:54 +02:00
(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)
2014-10-29 22:13:03 +01:00
|> Rst_string.of_string
;;
2014-11-12 17:17:44 +01:00
include Generic_input_of_rst;;
let of_rst = of_rst t_of_sexp;;
2014-10-18 23:18:54 +02:00
end