10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-21 20:03:32 +01:00

MPI improved and 3-electron F12 optimized

This commit is contained in:
Anthony Scemama 2020-02-05 17:41:57 +01:00
parent 13fcc8e6fa
commit 6e6ef8df2d
4 changed files with 224 additions and 234 deletions

View File

@ -977,42 +977,37 @@ let make ~frozen_core ~simulation ~mo_basis ~aux_basis_filename () =
match s1, s2, s3 with
| Alfa, Alfa, Alfa
| Beta, Beta, Beta ->
sum mos_cabs (fun a ->
h_two i j a k s1 s2 *. f_two m a l n s3 s3
+. h_two i j a n s1 s2 *. f_two m a k l s3 s2
+. h_two i m a l s1 s3 *. f_two j a k n s2 s3
+. h_two j m a k s2 s3 *. f_two i a l n s1 s3
+. h_two j m a n s2 s3 *. f_two i a k l s1 s2
-. h_two i j a l s1 s2 *. f_two m a k n s3 s3
-. h_two i m a k s1 s3 *. f_two j a l n s2 s3
-. h_two i m a n s1 s3 *. f_two j a k l s2 s2
-. h_two j m a l s2 s3 *. f_two i a k n s1 s3 )
sum mos_cabs (fun a -> h_two a k i j s1 s2 *. f_two a m n l s3 s3)
+. sum mos_cabs (fun a -> h_two a n i j s1 s2 *. f_two a m l k s2 s3)
-. sum mos_cabs (fun a -> h_two a l i j s1 s2 *. f_two a m n k s3 s3)
+. sum mos_cabs (fun a -> h_two a l i m s1 s3 *. f_two a j n k s3 s2)
-. sum mos_cabs (fun a -> h_two a n i m s1 s3 *. f_two a j l k s2 s2)
-. sum mos_cabs (fun a -> h_two a k i m s1 s3 *. f_two a j n l s3 s2)
+. sum mos_cabs (fun a -> h_two a n j m s2 s3 *. f_two a i l k s2 s1)
+. sum mos_cabs (fun a -> h_two a k j m s2 s3 *. f_two a i n l s3 s1)
-. sum mos_cabs (fun a -> h_two a l j m s2 s3 *. f_two a i n k s3 s1)
| Alfa, Alfa, Beta
| Beta, Beta, Alfa ->
sum mos_cabs (fun a ->
h_two i j a l s1 s2 *. f_two a m k n s1 s3
+. h_two i m k a s1 s3 *. f_two j a l n s2 s3
+. h_two j m a n s2 s3 *. f_two i a k l s1 s2
+. h_two j m l a s2 s3 *. f_two i a k n s1 s3
-. h_two i j a k s1 s2 *. f_two a m l n s1 s3
-. h_two i m a n s1 s3 *. f_two j a k l s2 s2
-. h_two i m l a s1 s3 *. f_two j a k n s2 s3
-. h_two j m k a s2 s3 *. f_two i a l n s1 s3
)
sum mos_cabs (fun a -> h_two a l i j s1 s2 *. f_two a m k n s1 s3)
-. sum mos_cabs (fun a -> h_two a k i j s1 s2 *. f_two a m l n s1 s3)
+. sum mos_cabs (fun a -> h_two a l m j s3 s2 *. f_two a i n k s3 s1)
-. sum mos_cabs (fun a -> h_two a k m j s3 s2 *. f_two a i n l s3 s1)
+. sum mos_cabs (fun a -> h_two a k m i s3 s1 *. f_two a j n l s3 s2)
-. sum mos_cabs (fun a -> h_two a l m i s3 s1 *. f_two a j n k s3 s2)
+. sum mos_cabs (fun a -> h_two a n j m s2 s3 *. f_two a i l k s2 s1)
-. sum mos_cabs (fun a -> h_two a n i m s1 s3 *. f_two a j l k s2 s2)
| Alfa, Beta, Beta
| Beta, Alfa, Alfa ->
sum mos_cabs (fun a ->
h_two i j a l s1 s2 *. f_two a m k n s1 s3
+. h_two i m a n s1 s3 *. f_two a j k l s1 s2
+. h_two i m k a s1 s3 *. f_two j a l n s2 s3
+. h_two j m a n s2 s3 *. f_two i a k l s1 s2
-. h_two i j a n s1 s2 *. f_two a m k l s1 s2
-. h_two i j k a s1 s2 *. f_two m a l n s2 s3
-. h_two i m a l s1 s3 *. f_two a j k n s1 s3
-. h_two j m a l s2 s3 *. f_two i a k n s1 s3
)
sum mos_cabs (fun a -> h_two a l i j s1 s2 *. f_two a m k n s1 s3)
-. sum mos_cabs (fun a -> h_two a n i j s1 s2 *. f_two a m k l s1 s2)
+. sum mos_cabs (fun a -> h_two a n i m s1 s3 *. f_two a j k l s1 s2)
+. sum mos_cabs (fun a -> h_two a n j m s2 s3 *. f_two a i l k s2 s1)
-. sum mos_cabs (fun a -> h_two a l i m s1 s3 *. f_two a j k n s1 s3)
-. sum mos_cabs (fun a -> h_two a l j m s2 s3 *. f_two a i n k s3 s1)
+. sum mos_cabs (fun a -> h_two a k m i s3 s1 *. f_two a j n l s3 s2)
-. sum mos_cabs (fun a -> h_two a k j i s2 s1 *. f_two a m n l s3 s2)
| Beta, Alfa, Beta
| Alfa, Beta, Alfa -> assert false (*TODO *)
| Alfa, Beta, Alfa -> assert false
in
match phase with
| Phase.Pos -> result

View File

@ -127,14 +127,15 @@ module InterNode = struct
let rank =
if comm <> Mpi.comm_none then
Mpi.comm_rank c
else 0
if Mpi.comm_is_null comm then 0 else
Mpi.comm_rank comm
let master = rank = 0
let broadcast_generic broadcast x =
if Mpi.comm_rank <> Mpi.comm_none then
if Mpi.comm_is_null comm then
Lazy.force x
else
begin
let x =
if master then Some (Lazy.force x)
@ -143,18 +144,13 @@ module InterNode = struct
match broadcast x 0 comm with
| Some x -> x
| None -> assert false
else
Lazy.force x
end
let broadcast x = broadcast_generic Mpi.broadcast x
(* TODO : temporary single-node fix
let broadcast x = Lazy.force x
*)
let barrier () =
if comm <> Mpi.comm_none then
if Mpi.comm_is_null comm then () else
Mpi.barrier comm
else ()
let _ = barrier ()

View File

@ -2,7 +2,6 @@ let create ?(temp_dir="/dev/shm") data_type size_array =
let filename =
Parallel.Node.broadcast (lazy (Filename.temp_file ~temp_dir "4idx." ".tmp"))
in
Printf.printf "File:%s\n%!" filename;
if Parallel.Node.master then
begin

View File

@ -54,7 +54,7 @@ let () =
let guess =
match Command_line.get "guess" with
| None -> `Huckel
| None -> `Hcore
| Some filename ->
let s_guess = Simulation.of_filenames
~charge ~multiplicity ~nuclei:nuclei_file filename in