10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-15 18:43:40 +01:00
QCaml/Basis/General_basis.ml

39 lines
1.0 KiB
OCaml
Raw Normal View History

2018-01-18 00:21:05 +01:00
(** General basis set read from a file *)
type primitive = {
exponent: float ;
coefficient: float
}
type general_contracted_shell = Angular_momentum.t * (primitive array)
2018-01-19 03:14:06 +01:00
type t = Element.t * (general_contracted_shell array)
2018-01-18 00:21:05 +01:00
let string_of_primitive ?id prim =
match id with
| None -> (string_of_float prim.exponent)^" "^(string_of_float prim.coefficient)
| Some i -> (string_of_int i)^" "^(string_of_float prim.exponent)^" "^(string_of_float prim.coefficient)
let string_of_contracted_shell (angular_momentum, prim_array) =
let n =
Array.length prim_array
in
Printf.sprintf "%s %d\n%s"
(Angular_momentum.to_string angular_momentum) n
(Array.init n (fun i -> string_of_primitive ~id:(i+1) prim_array.(i))
|> Array.to_list
|> String.concat "\n")
let string_of_contracted_shell_array a =
Array.map string_of_contracted_shell a
|> Array.to_list
|> String.concat "\n"
let to_string (name, contracted_shell_array) =
Printf.sprintf "%s\n%s" name (string_of_contracted_shell_array contracted_shell_array)