2014-10-17 22:25:45 +02:00
|
|
|
open Qptypes;;
|
|
|
|
open Qputils;;
|
|
|
|
open Core.Std;;
|
|
|
|
|
|
|
|
module Bielec_integrals : sig
|
2014-10-21 23:32:47 +02:00
|
|
|
type t =
|
|
|
|
{ read_ao_integrals : bool;
|
|
|
|
read_mo_integrals : bool;
|
|
|
|
write_ao_integrals : bool;
|
|
|
|
write_mo_integrals : bool;
|
2014-10-22 00:12:23 +02:00
|
|
|
threshold_ao : Threshold.t;
|
|
|
|
threshold_mo : Threshold.t;
|
2014-10-21 23:32:47 +02:00
|
|
|
direct : 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-11-03 22:33:32 +01:00
|
|
|
val write : t -> unit
|
2014-10-17 22:25:45 +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-17 22:25:45 +02:00
|
|
|
end = struct
|
|
|
|
type t =
|
|
|
|
{ read_ao_integrals : bool;
|
|
|
|
read_mo_integrals : bool;
|
|
|
|
write_ao_integrals : bool;
|
|
|
|
write_mo_integrals : bool;
|
2014-10-22 00:12:23 +02:00
|
|
|
threshold_ao : Threshold.t;
|
|
|
|
threshold_mo : Threshold.t;
|
2014-10-17 22:25:45 +02:00
|
|
|
direct : bool;
|
2014-10-25 21:24:21 +02:00
|
|
|
} with sexp
|
2014-10-17 22:25:45 +02:00
|
|
|
;;
|
|
|
|
|
|
|
|
let get_default = Qpackage.get_ezfio_default "bielec_integrals";;
|
|
|
|
|
|
|
|
let read_read_ao_integrals () =
|
|
|
|
if not (Ezfio.has_bielec_integrals_read_ao_integrals ()) then
|
|
|
|
get_default "read_ao_integrals"
|
|
|
|
|> Bool.of_string
|
|
|
|
|> Ezfio.set_bielec_integrals_read_ao_integrals
|
|
|
|
;
|
|
|
|
Ezfio.get_bielec_integrals_read_ao_integrals ()
|
|
|
|
;;
|
|
|
|
|
2014-11-03 22:33:32 +01:00
|
|
|
let write_read_ao_integrals =
|
|
|
|
Ezfio.set_bielec_integrals_read_ao_integrals
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
2014-10-17 22:25:45 +02:00
|
|
|
let read_read_mo_integrals () =
|
|
|
|
if not (Ezfio.has_bielec_integrals_read_mo_integrals ()) then
|
|
|
|
get_default "read_mo_integrals"
|
|
|
|
|> Bool.of_string
|
|
|
|
|> Ezfio.set_bielec_integrals_read_mo_integrals
|
|
|
|
;
|
|
|
|
Ezfio.get_bielec_integrals_read_mo_integrals ()
|
|
|
|
;;
|
|
|
|
|
2014-11-03 22:33:32 +01:00
|
|
|
let write_read_mo_integrals =
|
|
|
|
Ezfio.set_bielec_integrals_read_mo_integrals
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
2014-10-17 22:25:45 +02:00
|
|
|
let read_write_ao_integrals () =
|
|
|
|
if not (Ezfio.has_bielec_integrals_write_ao_integrals ()) then
|
|
|
|
get_default "write_ao_integrals"
|
|
|
|
|> Bool.of_string
|
|
|
|
|> Ezfio.set_bielec_integrals_write_ao_integrals
|
|
|
|
;
|
|
|
|
Ezfio.get_bielec_integrals_write_ao_integrals ()
|
|
|
|
;;
|
|
|
|
|
2014-11-03 22:33:32 +01:00
|
|
|
let write_write_ao_integrals =
|
|
|
|
Ezfio.set_bielec_integrals_write_ao_integrals
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
2014-10-17 22:25:45 +02:00
|
|
|
let read_write_mo_integrals () =
|
|
|
|
if not (Ezfio.has_bielec_integrals_write_mo_integrals ()) then
|
|
|
|
get_default "write_mo_integrals"
|
|
|
|
|> Bool.of_string
|
|
|
|
|> Ezfio.set_bielec_integrals_write_mo_integrals
|
|
|
|
;
|
|
|
|
Ezfio.get_bielec_integrals_write_mo_integrals ()
|
|
|
|
;;
|
|
|
|
|
2014-11-03 22:33:32 +01:00
|
|
|
let write_write_mo_integrals =
|
|
|
|
Ezfio.set_bielec_integrals_write_mo_integrals
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
2014-10-17 22:25:45 +02:00
|
|
|
let read_direct () =
|
|
|
|
if not (Ezfio.has_bielec_integrals_direct ()) then
|
|
|
|
get_default "direct"
|
|
|
|
|> Bool.of_string
|
|
|
|
|> Ezfio.set_bielec_integrals_direct
|
|
|
|
;
|
|
|
|
Ezfio.get_bielec_integrals_direct ()
|
|
|
|
;;
|
|
|
|
|
2014-11-03 22:33:32 +01:00
|
|
|
let write_direct =
|
|
|
|
Ezfio.set_bielec_integrals_direct
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
2014-10-17 22:25:45 +02:00
|
|
|
let read_threshold_ao () =
|
|
|
|
if not (Ezfio.has_bielec_integrals_threshold_ao ()) then
|
|
|
|
get_default "threshold_ao"
|
|
|
|
|> Float.of_string
|
|
|
|
|> Ezfio.set_bielec_integrals_threshold_ao
|
|
|
|
;
|
|
|
|
Ezfio.get_bielec_integrals_threshold_ao ()
|
2014-10-22 00:12:23 +02:00
|
|
|
|> Threshold.of_float
|
2014-10-17 22:25:45 +02:00
|
|
|
;;
|
|
|
|
|
2014-11-03 22:33:32 +01:00
|
|
|
let write_threshold_ao t =
|
|
|
|
Threshold.to_float t
|
|
|
|
|> Ezfio.set_bielec_integrals_threshold_ao
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
2014-10-17 22:25:45 +02:00
|
|
|
let read_threshold_mo () =
|
|
|
|
if not (Ezfio.has_bielec_integrals_threshold_mo ()) then
|
|
|
|
get_default "threshold_mo"
|
|
|
|
|> Float.of_string
|
|
|
|
|> Ezfio.set_bielec_integrals_threshold_mo
|
|
|
|
;
|
|
|
|
Ezfio.get_bielec_integrals_threshold_mo ()
|
2014-10-22 00:12:23 +02:00
|
|
|
|> Threshold.of_float
|
2014-10-17 22:25:45 +02:00
|
|
|
;;
|
|
|
|
|
2014-11-03 22:33:32 +01:00
|
|
|
let write_threshold_mo t =
|
|
|
|
Threshold.to_float t
|
|
|
|
|> Ezfio.set_bielec_integrals_threshold_mo
|
|
|
|
;;
|
|
|
|
|
|
|
|
|
2014-10-17 22:25:45 +02:00
|
|
|
let read ()=
|
|
|
|
let result =
|
|
|
|
{ read_ao_integrals = read_read_ao_integrals();
|
|
|
|
read_mo_integrals = read_read_mo_integrals () ;
|
|
|
|
write_ao_integrals = read_write_ao_integrals ();
|
|
|
|
write_mo_integrals = read_write_mo_integrals ();
|
|
|
|
threshold_ao = read_threshold_ao ();
|
|
|
|
threshold_mo = read_threshold_mo ();
|
|
|
|
direct = read_direct () ;
|
|
|
|
} in
|
|
|
|
if (result.read_ao_integrals &&
|
|
|
|
result.write_ao_integrals) then
|
|
|
|
failwith "Read and Write AO integrals are both true.";
|
|
|
|
if (result.read_mo_integrals &&
|
|
|
|
result.write_mo_integrals) then
|
|
|
|
failwith "Read and Write MO integrals are both true.";
|
2014-11-27 23:05:26 +01:00
|
|
|
Some result
|
2014-10-17 22:25:45 +02:00
|
|
|
;;
|
|
|
|
|
2014-11-03 22:33:32 +01:00
|
|
|
let write b =
|
|
|
|
if (b.read_ao_integrals &&
|
|
|
|
b.write_ao_integrals) then
|
|
|
|
failwith "Read and Write AO integrals are both true.";
|
|
|
|
if (b.read_mo_integrals &&
|
|
|
|
b.write_mo_integrals) then
|
|
|
|
failwith "Read and Write MO integrals are both true.";
|
|
|
|
write_read_ao_integrals b.read_ao_integrals;
|
|
|
|
write_read_mo_integrals b.read_mo_integrals;
|
|
|
|
write_write_ao_integrals b.write_ao_integrals ;
|
|
|
|
write_write_mo_integrals b.write_mo_integrals ;
|
|
|
|
write_threshold_ao b.threshold_ao;
|
|
|
|
write_threshold_mo b.threshold_mo;
|
|
|
|
write_direct b.direct;
|
|
|
|
;;
|
|
|
|
|
2014-10-17 22:25:45 +02:00
|
|
|
let to_string b =
|
2014-10-29 00:12:45 +01:00
|
|
|
Printf.sprintf "
|
2014-10-29 22:13:03 +01:00
|
|
|
read_ao_integrals = %s
|
|
|
|
read_mo_integrals = %s
|
|
|
|
write_ao_integrals = %s
|
|
|
|
write_mo_integrals = %s
|
|
|
|
threshold_ao = %s
|
|
|
|
threshold_mo = %s
|
|
|
|
direct = %s
|
|
|
|
"
|
|
|
|
(Bool.to_string b.read_ao_integrals)
|
|
|
|
(Bool.to_string b.read_mo_integrals)
|
|
|
|
(Bool.to_string b.write_ao_integrals)
|
|
|
|
(Bool.to_string b.write_mo_integrals)
|
|
|
|
(Threshold.to_string b.threshold_ao)
|
|
|
|
(Threshold.to_string b.threshold_mo)
|
|
|
|
(Bool.to_string b.direct)
|
|
|
|
;;
|
|
|
|
|
|
|
|
let to_rst b =
|
|
|
|
Printf.sprintf "
|
2014-10-29 00:12:45 +01:00
|
|
|
Read AO/MO integrals from disk ::
|
|
|
|
|
|
|
|
read_ao_integrals = %s
|
|
|
|
read_mo_integrals = %s
|
|
|
|
|
|
|
|
Write AO/MO integrals to disk ::
|
|
|
|
|
|
|
|
write_ao_integrals = %s
|
|
|
|
write_mo_integrals = %s
|
|
|
|
|
|
|
|
Thresholds on integrals ::
|
|
|
|
|
|
|
|
threshold_ao = %s
|
|
|
|
threshold_mo = %s
|
|
|
|
|
|
|
|
Direct calculation of integrals ::
|
|
|
|
|
|
|
|
direct = %s
|
|
|
|
|
2014-10-17 22:25:45 +02:00
|
|
|
"
|
|
|
|
(Bool.to_string b.read_ao_integrals)
|
|
|
|
(Bool.to_string b.read_mo_integrals)
|
|
|
|
(Bool.to_string b.write_ao_integrals)
|
|
|
|
(Bool.to_string b.write_mo_integrals)
|
2014-10-22 00:12:23 +02:00
|
|
|
(Threshold.to_string b.threshold_ao)
|
|
|
|
(Threshold.to_string b.threshold_mo)
|
2014-10-17 22:25:45 +02:00
|
|
|
(Bool.to_string b.direct)
|
2014-10-29 22:13:03 +01:00
|
|
|
|> Rst_string.of_string
|
2014-10-26 12:46:17 +01:00
|
|
|
;;
|
|
|
|
|
2014-11-12 17:17:44 +01:00
|
|
|
include Generic_input_of_rst;;
|
|
|
|
let of_rst = of_rst t_of_sexp;;
|
2014-10-31 19:23:44 +01:00
|
|
|
|
2014-10-17 22:25:45 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|