10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-09-27 12:00:56 +02:00
quantum_package/ocaml/element_create_db.ml

28 lines
678 B
OCaml
Raw Normal View History

2017-12-19 09:59:46 +01:00
open Core
open Qptypes
open Element
let () =
2019-01-14 15:20:51 +01:00
let indices =
2017-12-19 09:59:46 +01:00
Array.init 78 (fun i -> i)
in
Out_channel.with_file (Qpackage.root ^ "/data/list_element.txt")
~f:(fun out_channel ->
2019-01-14 15:20:51 +01:00
Array.init 110 ~f:(fun i ->
2017-12-19 09:59:46 +01:00
let element =
2019-01-14 15:20:51 +01:00
try
2017-12-19 09:59:46 +01:00
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 )
)
|> Array.to_list
2019-01-14 15:20:51 +01:00
|> String.concat ~sep:""
|> Out_channel.output_string out_channel
2017-12-19 09:59:46 +01:00
)
2019-01-14 15:20:51 +01:00