9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-11-07 05:53:37 +01:00

Read only the n first atoms in xyz

This commit is contained in:
Anthony Scemama 2020-05-29 00:11:10 +02:00
parent 59b05ff39d
commit 2208d58c58
2 changed files with 14 additions and 13 deletions

View File

@ -13,11 +13,8 @@ dev:
bugfix: bugfix:
A fork of the *master* on which the bug fixes are made. A fork of the *master* on which the bug fixes are made.
dev-lcpq: dev:
Toulouse development branch Development branch
dev-lct:
Paris development branch
gh-pages: gh-pages:
This is an independent branch, containing only the web site of QP2. This is an independent branch, containing only the web site of QP2.

View File

@ -149,14 +149,18 @@ let of_xyz_file
let lines = let lines =
match Io_ext.input_lines filename with match Io_ext.input_lines filename with
| natoms :: title :: rest -> | natoms :: title :: rest ->
begin let natoms =
try try
if (int_of_string @@ String_ext.strip natoms) <= 0 then int_of_string @@ String_ext.strip natoms
raise XYZError with
with | _ -> raise XYZError
| _ -> raise XYZError in
end; if natoms <= 0 then
String.concat "\n" rest raise XYZError;
let a = Array.of_list rest in
Array.sub a 0 natoms
|> Array.to_list
|> String.concat "\n"
| _ -> raise XYZError | _ -> raise XYZError
in in
of_xyz_string ~charge:charge ~multiplicity:multiplicity of_xyz_string ~charge:charge ~multiplicity:multiplicity