10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-12-23 04:43:50 +01:00

Added read rst for Full-CI/Hartree-Fock.ml

This commit is contained in:
Anthony Scemama 2014-10-31 22:21:38 +01:00
parent a292070721
commit 39a8d4101f
2 changed files with 26 additions and 1 deletions

View File

@ -12,6 +12,7 @@ module Full_ci : 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_fci : Det_number_max.t;
@ -90,6 +91,23 @@ Compute E(PT2) at the end ::
(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

View File

@ -76,6 +76,13 @@ let test_fci () =
let b = Input.Full_ci.read ()
in
print_endline (Input.Full_ci.to_string b);
let rst = Input.Full_ci.to_rst b in
let new_b = Input.Full_ci.of_rst rst in
print_endline (Input.Full_ci.to_string b);
if (b = new_b) then
print_endline "OK"
else
print_endline "Failed in rst"
;;
let test_hf () =
@ -124,4 +131,4 @@ test_bielec_intergals ();;
test_electrons();
*)
test_hf();
test_fci();