mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-19 04:22:21 +01:00
36 lines
1018 B
OCaml
36 lines
1018 B
OCaml
type primitive = {
|
|
exponent: float ;
|
|
coefficient: float
|
|
}
|
|
|
|
type contracted_shell = Angular_momentum.t * (primitive array)
|
|
|
|
type gaussian_basis_set = string * (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)
|
|
|