9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-18 11:23:38 +01:00
qp2/ocaml/element_create_db.ml

27 lines
589 B
OCaml
Raw Normal View History

2019-01-25 11:39:31 +01:00
open Qptypes
open Element
let () =
let indices =
Array.init 78 (fun i -> i)
in
2019-03-13 13:02:29 +01:00
let out_channel =
open_out (Qpackage.root ^ "/data/list_element.txt")
in
Array.init 110 (fun i ->
let element =
try
Some (of_charge (Charge.of_int i))
with
| _ -> None
in
match element with
| None -> ""
| Some x -> Printf.sprintf "%3d %3s %s %f\n"
i (to_string x) (to_long_string x) (Positive_float.to_float @@ mass x )
2019-01-25 11:39:31 +01:00
)
2019-03-13 13:02:29 +01:00
|> Array.to_list
|> String.concat ""
|> Printf.fprintf out_channel "%s"
2019-01-25 11:39:31 +01:00