10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-06-26 07:02:14 +02:00

Reduced memory in qp_edit

This commit is contained in:
Anthony Scemama 2016-02-19 23:53:23 +01:00
parent 32208d35f9
commit f71fa7ff6b

View File

@ -333,18 +333,18 @@ psi_det = %s
;;
let of_rst r =
let r = Rst_string.to_string r
let dets = Rst_string.to_string r
in
(* Split into header and determinants data *)
let idx = String.substr_index_exn r ~pos:0 ~pattern:"\nDeterminants"
let idx = String.substr_index_exn dets ~pos:0 ~pattern:"\nDeterminants"
in
let (header, dets) =
(String.prefix r idx, String.suffix r ((String.length r)-idx-1) )
let header =
String.prefix dets idx
in
(* Handle header *)
let header = r
let header = header
|> String.split ~on:'\n'
|> List.filter ~f:(fun line ->
if (line = "") then
@ -364,7 +364,7 @@ psi_det = %s
let dets_stream =
let ipos, jmax =
ref (-1), String.length dets
ref idx, String.length dets
in
let next_line =
Stream.from (fun _ ->