Fixed parser

This commit is contained in:
Anthony Scemama 2020-02-06 11:10:18 +01:00
parent daa408fc9c
commit cd3304aef8
5 changed files with 17 additions and 17 deletions

View File

@ -24,7 +24,7 @@ let read_shell ic =
try
let line = input_line ic in
if String.trim line = "$END" then raise End_of_file;
Scanf.sscanf line "%c %d " (fun shell n -> shell, n)
Scanf.sscanf line " %c %d " (fun shell n -> shell, n)
with
| End_of_file -> raise No_shell
| Scanf.Scan_failure m -> raise (Malformed_shell m)
@ -34,7 +34,7 @@ let read_shell ic =
| 0 -> []
| i -> let contraction =
let line = (input_line ic) in
try Scanf.sscanf line "%_d %f %f "
try Scanf.sscanf line " %_d %f %f "
(fun exponent coefficient -> { exponent ; coefficient })
with _ -> raise (Malformed_shell (Printf.sprintf
"Expected %d %c contractions, error at contraction %d:\n%s"

View File

@ -611,6 +611,11 @@ let make ?(n_states=1) ?(algo=`Direct) det_space =
let mo_basis = Ds.mo_basis det_space in
(* While in a sequential region, initiate the parallel
4-idx transformation to avoid nested parallel jobs
*)
ignore @@ MOBasis.two_e_ints mo_basis;
let e_shift =
let d0 =
Ds.determinant_stream det_space
@ -621,11 +626,6 @@ let make ?(n_states=1) ?(algo=`Direct) det_space =
let m_H =
(* While in a sequential region, initiate the parallel
4-idx transformation to avoid nested parallel jobs
*)
ignore @@ MOBasis.two_e_ints mo_basis;
let f =
match Ds.determinants det_space with
| Ds.Arbitrary _ -> create_matrix_arbitrary
@ -666,7 +666,7 @@ let make ?(n_states=1) ?(algo=`Direct) det_space =
in
let matrix_prod psi =
let result =
Matrix.parallel_mm ~transa:`T psi m_H
Matrix.mm ~transa:`T psi m_H
|> Matrix.transpose
in
Parallel.broadcast (lazy result)

View File

@ -70,6 +70,7 @@ let sum l f = List.fold_left (fun accu i -> accu +. f i) 0. l
let make ~simulation ?(threshold=1.e-12) ~frozen_core ~mo_basis ~aux_basis_filename ?(state=1) () =
let det_space =
DeterminantSpace.fci_of_mo_basis mo_basis ~frozen_core
in

View File

@ -216,9 +216,11 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
let aux_num = MOBasis.size aux_basis in
(* Fire calculation of F12 and ERI *)
ignore @@ MOBasis.f12_ints aux_basis ;
ignore @@ MOBasis.two_e_ints aux_basis ;
(* While in a sequential region, initiate the parallel
4-idx transformation to avoid nested parallel jobs
*)
ignore @@ MOBasis.two_e_ints aux_basis;
ignore @@ MOBasis.f12_ints aux_basis;
(* Compute the <ij|QHF|kl> integrals *)
if Parallel.master then Printf.eprintf "Computing HF12 integrals\n%!";

View File

@ -391,16 +391,14 @@ let to_list data =
let broadcast t =
Parallel.InterNode.broadcast (lazy t)
(*
let size =
Parallel.broadcast (lazy t.size)
Parallel.InterNode.broadcast (lazy t.size)
in
let bufsize = size * size * size in
let stream = to_stream t in
let rec iterate () =
let buffer =
Parallel.broadcast (lazy (
Parallel.InterNode.broadcast (lazy (
if Stream.peek stream = None then None else
Some (Array.init bufsize (fun _ ->
try Some (Stream.next stream)
@ -412,7 +410,7 @@ let broadcast t =
| None -> ()
| Some buffer ->
begin
if not Parallel.master then
if not Parallel.InterNode.master then
Array.iter (fun x ->
match x with
| Some {i_r1 ; j_r2 ; k_r1 ; l_r2 ; value} ->
@ -422,7 +420,6 @@ let broadcast t =
end
in iterate ();
t
*)