10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-21 12:42:13 +02:00
quantum_package/ocaml/test_input.ml

178 lines
3.9 KiB
OCaml
Raw Normal View History

2014-10-29 22:13:03 +01:00
open Qptypes;;
2014-10-17 22:25:45 +02:00
let test_ao () =
2014-10-17 15:07:07 +02:00
Ezfio.set_file "F2.ezfio" ;
2014-11-27 23:05:26 +01:00
let b = match Input.Ao_basis.read () with
| Some x -> x
| None -> assert false
2014-10-17 15:07:07 +02:00
in
print_endline (Input.Ao_basis.to_string b);
2014-10-29 22:13:03 +01:00
print_endline (Input.Ao_basis.to_rst b |> Rst_string.to_string);
2014-10-17 15:07:07 +02:00
;;
2014-10-17 22:25:45 +02:00
let test_bielec_intergals () =
Ezfio.set_file "F2.ezfio" ;
2014-11-27 23:05:26 +01:00
let b = match Input.Bielec_integrals.read () with
| Some x -> x
| None -> assert false
2014-10-17 22:25:45 +02:00
in
2014-10-26 12:46:17 +01:00
let output = Input.Bielec_integrals.to_string b
in
print_endline output;
2014-10-31 19:23:44 +01:00
let rst = Input.Bielec_integrals.to_rst b in
2014-11-12 21:58:13 +01:00
let b2 = match Input.Bielec_integrals.of_rst rst with
| Some x -> x
| None -> assert false
in
2014-10-31 19:23:44 +01:00
if (b = b2) then
print_endline "OK"
else
print_endline "rst failed";
2014-10-17 22:25:45 +02:00
;;
2014-10-18 00:10:25 +02:00
let test_bitmasks () =
Ezfio.set_file "F2.ezfio" ;
2014-11-27 23:05:26 +01:00
let b = match Input.Bitmasks.read () with
| Some x -> x
| None -> assert false
2014-10-18 00:10:25 +02:00
in
print_endline (Input.Bitmasks.to_string b);
;;
2014-10-18 23:18:54 +02:00
2014-10-20 12:19:12 +02:00
let test_dets () =
Ezfio.set_file "F2.ezfio" ;
2014-11-27 23:05:26 +01:00
let b = match Input.Determinants.read () with
| Some x -> x
| None -> assert false
2014-10-20 12:19:12 +02:00
in
2014-11-03 15:37:02 +01:00
print_endline (Input.Determinants.to_rst b |> Rst_string.to_string ) ;
print_endline (Input.Determinants.sexp_of_t b |> Sexplib.Sexp.to_string ) ;
2014-11-12 21:58:13 +01:00
let rst = Input.Determinants.to_rst b in
let b2 = match Input.Determinants.of_rst rst with
| Some x -> x
| None -> assert false
in
2014-11-03 15:37:02 +01:00
if (b2 = b) then
print_endline "OK"
else
print_endline "Failed"
2014-10-20 12:19:12 +02:00
;;
2014-10-21 22:18:57 +02:00
let test_cisd_sc2 () =
Ezfio.set_file "F2.ezfio" ;
let b = match Input.Cisd_sc2_selected.read () with
2014-11-27 23:05:26 +01:00
| Some x -> x
| None -> assert false
2014-10-21 22:18:57 +02:00
in
print_endline (Input.Cisd_sc2_selected.to_string b);
let rst = Input.Cisd_sc2_selected.to_rst b in
let b2 = match Input.Cisd_sc2_selected.of_rst rst with
2014-11-12 21:58:13 +01:00
| Some x -> x
| None -> assert false
in
2014-10-31 19:26:27 +01:00
if (b = b2) then
print_endline "OK"
else
print_endline "rst failed";
2014-10-21 22:18:57 +02:00
;;
2014-10-21 23:23:37 +02:00
let test_electrons () =
Ezfio.set_file "F2.ezfio" ;
2014-11-27 23:05:26 +01:00
let b = match Input.Electrons.read () with
| Some x -> x
| None -> assert false
2014-10-21 23:23:37 +02:00
in
print_endline (Input.Electrons.to_string b);
2014-10-31 19:33:29 +01:00
let rst = Input.Electrons.to_rst b in
2014-11-12 21:58:13 +01:00
let b2 = match Input.Electrons.of_rst rst with
| Some x -> x
| None -> assert false
in
if (b = b2) then
2014-10-31 19:33:29 +01:00
print_endline "OK"
else
print_endline "Failed in rst"
2014-10-21 23:23:37 +02:00
;;
2014-10-21 23:32:47 +02:00
let test_fci () =
Ezfio.set_file "F2.ezfio" ;
2014-11-27 23:05:26 +01:00
let b = match Input.Full_ci.read () with
| Some x -> x
| None -> assert false
2014-10-21 23:32:47 +02:00
in
print_endline (Input.Full_ci.to_string b);
let rst = Input.Full_ci.to_rst b in
2014-11-12 21:58:13 +01:00
let b2 = match Input.Full_ci.of_rst rst with
| Some x -> x
| None -> assert false
in
print_endline (Input.Full_ci.to_string b);
2014-11-12 21:58:13 +01:00
if (b = b2) then
print_endline "OK"
else
print_endline "Failed in rst"
2014-10-21 23:32:47 +02:00
;;
2014-10-22 00:12:23 +02:00
let test_hf () =
Ezfio.set_file "F2.ezfio" ;
2014-11-27 23:05:26 +01:00
let b = match Input.Hartree_fock.read () with
| Some x -> x
| None -> assert false
2014-10-22 00:12:23 +02:00
in
print_endline (Input.Hartree_fock.to_string b);
2014-10-31 22:19:39 +01:00
let rst = Input.Hartree_fock.to_rst b in
2014-11-12 21:58:13 +01:00
let b2 = match Input.Hartree_fock.of_rst rst with
| Some x -> x
| None -> assert false
in
2014-10-31 22:19:39 +01:00
print_endline (Input.Hartree_fock.to_string b);
2014-11-12 21:58:13 +01:00
if (b = b2) then
2014-10-31 22:19:39 +01:00
print_endline "OK"
else
print_endline "Failed in rst"
2014-10-22 00:12:23 +02:00
;;
2014-10-24 00:25:15 +02:00
let test_mo () =
Ezfio.set_file "F2.ezfio" ;
2014-11-27 23:05:26 +01:00
let b = match Input.Mo_basis.read () with
| Some x -> x
| None -> assert false
2014-10-24 00:25:15 +02:00
in
2014-10-29 22:16:40 +01:00
print_endline (Input.Mo_basis.to_string b);
2014-10-24 00:25:15 +02:00
;;
2014-10-24 00:42:07 +02:00
let test_nucl () =
Ezfio.set_file "F2.ezfio" ;
2014-11-27 23:05:26 +01:00
let b = match Input.Nuclei.read () with
| Some x -> x
| None -> assert false
in
2014-10-29 22:16:40 +01:00
let rst = Input.Nuclei.to_rst b in
2014-11-12 21:58:13 +01:00
let b2 = match Input.Nuclei.of_rst rst with
| Some x -> x
| None -> assert false
in
2014-10-29 22:13:03 +01:00
print_endline (Input.Nuclei.to_string b);
2014-11-12 21:58:13 +01:00
if (b = b2) then
2014-10-29 22:16:40 +01:00
print_endline "OK"
else
print_endline "Failed in rst"
2014-10-29 22:13:03 +01:00
;;
2014-10-22 00:12:23 +02:00
(*
test_ao ();;
test_bitmasks ();
test_cis ();
test_cisd_sc2 ();
2014-10-26 12:46:17 +01:00
test_dets ();
test_hf ();;
2014-10-24 00:25:15 +02:00
test_mo ();;
2014-10-24 00:42:07 +02:00
test_nucl ();
2014-10-31 19:23:44 +01:00
test_bielec_intergals ();;
2014-10-31 19:33:29 +01:00
test_electrons();
2014-10-25 21:24:21 +02:00
*)
2014-11-03 15:37:02 +01:00
test_dets ();
2014-10-25 21:24:21 +02:00