mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-18 20:12:26 +01:00
41 lines
1.1 KiB
OCaml
41 lines
1.1 KiB
OCaml
|
(** General basis set read from a file *)
|
||
|
type primitive = {
|
||
|
exponent: float ;
|
||
|
coefficient: float
|
||
|
}
|
||
|
|
||
|
type general_contracted_shell = AngularMomentum.t * (primitive array)
|
||
|
|
||
|
type t = Element.t * (general_contracted_shell array)
|
||
|
|
||
|
|
||
|
module Am = AngularMomentum
|
||
|
|
||
|
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"
|
||
|
(Am.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)
|
||
|
|
||
|
|