10
0
mirror of https://github.com/LCPQ/quantum_package synced 2024-07-11 13:53:44 +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 of_rst r =
let r = Rst_string.to_string r let dets = Rst_string.to_string r
in in
(* Split into header and determinants data *) (* 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 in
let (header, dets) = let header =
(String.prefix r idx, String.suffix r ((String.length r)-idx-1) ) String.prefix dets idx
in in
(* Handle header *) (* Handle header *)
let header = r let header = header
|> String.split ~on:'\n' |> String.split ~on:'\n'
|> List.filter ~f:(fun line -> |> List.filter ~f:(fun line ->
if (line = "") then if (line = "") then
@ -364,7 +364,7 @@ psi_det = %s
let dets_stream = let dets_stream =
let ipos, jmax = let ipos, jmax =
ref (-1), String.length dets ref idx, String.length dets
in in
let next_line = let next_line =
Stream.from (fun _ -> Stream.from (fun _ ->