From cd3304aef8e09d21cb2260bc8a08793efb42b00f Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Thu, 6 Feb 2020 11:10:18 +0100 Subject: [PATCH] Fixed parser --- Basis/GeneralBasis.ml | 4 ++-- CI/CI.ml | 12 ++++++------ CI/F12CI.ml | 1 + MOBasis/HF12.ml | 8 +++++--- Utils/FourIdxStorage.ml | 9 +++------ 5 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Basis/GeneralBasis.ml b/Basis/GeneralBasis.ml index c979870..4b8dcde 100644 --- a/Basis/GeneralBasis.ml +++ b/Basis/GeneralBasis.ml @@ -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" diff --git a/CI/CI.ml b/CI/CI.ml index 14034f3..5ac3280 100644 --- a/CI/CI.ml +++ b/CI/CI.ml @@ -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) diff --git a/CI/F12CI.ml b/CI/F12CI.ml index c1cf903..38a247d 100644 --- a/CI/F12CI.ml +++ b/CI/F12CI.ml @@ -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 diff --git a/MOBasis/HF12.ml b/MOBasis/HF12.ml index 4fcd438..2786c0e 100644 --- a/MOBasis/HF12.ml +++ b/MOBasis/HF12.ml @@ -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 integrals *) if Parallel.master then Printf.eprintf "Computing HF12 integrals\n%!"; diff --git a/Utils/FourIdxStorage.ml b/Utils/FourIdxStorage.ml index 63f043f..d2dc3de 100644 --- a/Utils/FourIdxStorage.ml +++ b/Utils/FourIdxStorage.ml @@ -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 -*)