mirror of
https://github.com/QuantumPackage/qp2.git
synced 2024-12-22 20:34:58 +01:00
Read only the n first atoms in xyz
This commit is contained in:
parent
59b05ff39d
commit
2208d58c58
@ -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.
|
||||||
|
@ -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
|
||||||
end;
|
in
|
||||||
String.concat "\n" rest
|
if natoms <= 0 then
|
||||||
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user