mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-09-12 22:48:31 +02:00
26 lines
560 B
OCaml
26 lines
560 B
OCaml
type coordinates = ( (Element.t * (float array)) array)
|
|
|
|
let of_xyz_file ~filename =
|
|
let lexbuf =
|
|
let ic = open_in filename in
|
|
Lexing.from_channel ic
|
|
in
|
|
Xyz_parser.input Nuclei_lexer.read_all lexbuf
|
|
|
|
|
|
let of_zmt_file ~filename =
|
|
let ic = open_in filename in
|
|
let rec aux accu =
|
|
try
|
|
let line = input_line ic in
|
|
aux (line::accu)
|
|
with End_of_file ->
|
|
close_in ic;
|
|
List.rev accu
|
|
|> String.concat "\n"
|
|
in aux []
|
|
|> Zmatrix.of_string
|
|
|> Zmatrix.to_xyz
|
|
|> Array.map (fun (e,x,y,z) -> (e, [|x;y;z|]))
|
|
|