mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-15 10:33:39 +01:00
39 lines
1.0 KiB
OCaml
39 lines
1.0 KiB
OCaml
(** General basis set read from a file *)
|
|
type primitive = {
|
|
exponent: float ;
|
|
coefficient: float
|
|
}
|
|
|
|
type general_contracted_shell = Angular_momentum.t * (primitive array)
|
|
|
|
type t = Element.t * (general_contracted_shell array)
|
|
|
|
|
|
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)
|
|
|
|
|