10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-18 12:03:40 +01:00

Add Multipole.to_file

This commit is contained in:
Pierre-Francois Loos 2020-10-12 08:57:00 +02:00
parent 62eacf4146
commit fa3a407253
3 changed files with 20 additions and 1 deletions

View File

@ -27,7 +27,6 @@ in quantum chemistry.")
(depends
(ocaml (>= 4.10))
(dune (>= 1.10))
str
lacaml
getopt
zarith

View File

@ -222,3 +222,19 @@ let of_basis basis =
Array.iter Matrix.detri_inplace result;
result
let to_file ~filename eni_array =
let n = Matrix.dim1 eni_array in
let eni_array = Matrix.to_bigarray_inplace eni_array in
let oc = open_out filename in
for j=1 to n do
for i=1 to j do
let value = eni_array.{i,j} in
if (value <> 0.) then
Printf.fprintf oc " %5d %5d %20.15f\n" i j value;
done;
done;
close_out oc

View File

@ -60,3 +60,7 @@ val matrix_z4 : t -> (Basis.t, Basis.t) Matrix.t
(** {% $$ \langle \chi_i | z^4 | \chi_j \rangle $$ %} *)
val of_basis : Basis.t -> t
val to_file : filename:string -> (Basis.t, Basis.t) Matrix.t -> unit
(** Write a matrix to a file *)