mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-22 20:35:19 +01:00
Input_cisd_sc2 reads rst
This commit is contained in:
parent
c84c7c3054
commit
dc29b0144c
@ -12,6 +12,7 @@ module Cisd_sc2 : sig
|
||||
val read : unit -> t
|
||||
val to_string : t -> string
|
||||
val to_rst : t -> Rst_string.t
|
||||
val of_rst : Rst_string.t -> t
|
||||
end = struct
|
||||
type t =
|
||||
{ n_det_max_cisd_sc2 : Det_number_max.t;
|
||||
@ -91,6 +92,24 @@ Compute E(PT2) at the end ::
|
||||
(PT2_energy.to_string b.pt2_max)
|
||||
(Bool.to_string b.do_pt2_end)
|
||||
|> Rst_string.of_string
|
||||
;;
|
||||
|
||||
let of_rst s =
|
||||
let s = Rst_string.to_string s
|
||||
|> String.split ~on:'\n'
|
||||
|> List.filter ~f:(fun line ->
|
||||
String.contains line '=')
|
||||
|> List.map ~f:(fun line ->
|
||||
"("^(
|
||||
String.tr line ~target:'=' ~replacement:' '
|
||||
)^")" )
|
||||
|> String.concat
|
||||
in
|
||||
Sexp.of_string ("("^s^")")
|
||||
|> t_of_sexp
|
||||
;;
|
||||
|
||||
|
||||
|
||||
end
|
||||
|
||||
|
@ -49,6 +49,13 @@ let test_cisd_sc2 () =
|
||||
let b = Input.Cisd_sc2.read ()
|
||||
in
|
||||
print_endline (Input.Cisd_sc2.to_string b);
|
||||
let rst = Input.Cisd_sc2.to_rst b in
|
||||
let b2 = Input.Cisd_sc2.of_rst rst in
|
||||
if (b = b2) then
|
||||
print_endline "OK"
|
||||
else
|
||||
print_endline "rst failed";
|
||||
|
||||
;;
|
||||
|
||||
let test_electrons () =
|
||||
@ -102,5 +109,5 @@ test_mo ();;
|
||||
test_nucl ();
|
||||
test_bielec_intergals ();;
|
||||
*)
|
||||
test_bielec_intergals ();;
|
||||
|
||||
test_cisd_sc2 ();
|
||||
|
Loading…
Reference in New Issue
Block a user