mirror of
https://github.com/LCPQ/quantum_package
synced 2024-12-23 04:43:50 +01:00
Input.Bielec_integrals reads rst
This commit is contained in:
parent
6716a996cd
commit
c84c7c3054
@ -16,6 +16,7 @@ module Bielec_integrals : 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 =
|
||||
{ read_ao_integrals : bool;
|
||||
@ -165,6 +166,21 @@ Direct calculation of integrals ::
|
||||
|> 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
|
||||
|
||||
|
||||
|
@ -15,6 +15,12 @@ let test_bielec_intergals () =
|
||||
let output = Input.Bielec_integrals.to_string b
|
||||
in
|
||||
print_endline output;
|
||||
let rst = Input.Bielec_integrals.to_rst b in
|
||||
let b2 = Input.Bielec_integrals.of_rst rst in
|
||||
if (b = b2) then
|
||||
print_endline "OK"
|
||||
else
|
||||
print_endline "rst failed";
|
||||
;;
|
||||
|
||||
let test_bitmasks () =
|
||||
@ -87,7 +93,6 @@ let test_nucl () =
|
||||
|
||||
(*
|
||||
test_ao ();;
|
||||
test_bielec_intergals ();;
|
||||
test_bitmasks ();
|
||||
test_cis ();
|
||||
test_cisd_sc2 ();
|
||||
@ -95,6 +100,7 @@ test_dets ();
|
||||
test_hf ();;
|
||||
test_mo ();;
|
||||
test_nucl ();
|
||||
test_bielec_intergals ();;
|
||||
*)
|
||||
test_nucl();;
|
||||
test_bielec_intergals ();;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user