10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-22 12:23:31 +01:00

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 try
let line = input_line ic in let line = input_line ic in
if String.trim line = "$END" then raise End_of_file; 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 with
| End_of_file -> raise No_shell | End_of_file -> raise No_shell
| Scanf.Scan_failure m -> raise (Malformed_shell m) | Scanf.Scan_failure m -> raise (Malformed_shell m)
@ -34,7 +34,7 @@ let read_shell ic =
| 0 -> [] | 0 -> []
| i -> let contraction = | i -> let contraction =
let line = (input_line ic) in 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 }) (fun exponent coefficient -> { exponent ; coefficient })
with _ -> raise (Malformed_shell (Printf.sprintf with _ -> raise (Malformed_shell (Printf.sprintf
"Expected %d %c contractions, error at contraction %d:\n%s" "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 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 e_shift =
let d0 = let d0 =
Ds.determinant_stream det_space Ds.determinant_stream det_space
@ -621,11 +626,6 @@ let make ?(n_states=1) ?(algo=`Direct) det_space =
let m_H = 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 = let f =
match Ds.determinants det_space with match Ds.determinants det_space with
| Ds.Arbitrary _ -> create_matrix_arbitrary | Ds.Arbitrary _ -> create_matrix_arbitrary
@ -666,7 +666,7 @@ let make ?(n_states=1) ?(algo=`Direct) det_space =
in in
let matrix_prod psi = let matrix_prod psi =
let result = let result =
Matrix.parallel_mm ~transa:`T psi m_H Matrix.mm ~transa:`T psi m_H
|> Matrix.transpose |> Matrix.transpose
in in
Parallel.broadcast (lazy result) 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 make ~simulation ?(threshold=1.e-12) ~frozen_core ~mo_basis ~aux_basis_filename ?(state=1) () =
let det_space = let det_space =
DeterminantSpace.fci_of_mo_basis mo_basis ~frozen_core DeterminantSpace.fci_of_mo_basis mo_basis ~frozen_core
in 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 let aux_num = MOBasis.size aux_basis in
(* Fire calculation of F12 and ERI *) (* While in a sequential region, initiate the parallel
ignore @@ MOBasis.f12_ints aux_basis ; 4-idx transformation to avoid nested parallel jobs
ignore @@ MOBasis.two_e_ints aux_basis ; *)
ignore @@ MOBasis.two_e_ints aux_basis;
ignore @@ MOBasis.f12_ints aux_basis;
(* Compute the <ij|QHF|kl> integrals *) (* Compute the <ij|QHF|kl> integrals *)
if Parallel.master then Printf.eprintf "Computing HF12 integrals\n%!"; if Parallel.master then Printf.eprintf "Computing HF12 integrals\n%!";

View File

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