From 90ccf82824b9077c6bfe899e9d339c2e85d9219e Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Fri, 31 Oct 2014 23:05:41 +0100 Subject: [PATCH] Print ao symmetries --- ocaml/Input_ao_basis.ml | 22 +++++++++++++++++++++- ocaml/test_input.ml | 2 +- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/ocaml/Input_ao_basis.ml b/ocaml/Input_ao_basis.ml index c0c20224..9754f3ec 100644 --- a/ocaml/Input_ao_basis.ml +++ b/ocaml/Input_ao_basis.ml @@ -142,6 +142,22 @@ end = struct ;; let to_rst b = + let print_sym = + let l = List.init (Array.length b.ao_power) ~f:( + fun i -> ( (i+1),b.ao_nucl.(i),b.ao_power.(i) ) ) in + let rec do_work count = function + | [] -> [] + | (i,n,x)::tail -> + if (count < 2) then + (Printf.sprintf " (%4d) %d:%-8s" i (Nucl_number.to_int n) (Symmetry.Xyz.to_string x)):: + (do_work (count+1) tail) + else + (Printf.sprintf " (%4d) %d:%-8s\n" i (Nucl_number.to_int n) (Symmetry.Xyz.to_string x)):: + (do_work 0 tail) + in do_work 0 l + |> String.concat + in + let short_basis = to_basis b in Printf.sprintf " Name of the AO basis :: @@ -152,12 +168,16 @@ Basis set :: %s +Symmetries :: + +%s + " b.ao_basis (Basis.to_string short_basis |> String.split ~on:'\n' |> List.map ~f:(fun x-> " "^x) |> String.concat ~sep:"\n" - ) + ) print_sym |> Rst_string.of_string ;; diff --git a/ocaml/test_input.ml b/ocaml/test_input.ml index 0c2bd5eb..ab663dfa 100644 --- a/ocaml/test_input.ml +++ b/ocaml/test_input.ml @@ -131,4 +131,4 @@ test_bielec_intergals ();; test_electrons(); *) -test_fci(); +test_ao();