From 13eee57e6789fd3de7047ee90fb826213a5b896d Mon Sep 17 00:00:00 2001 From: Anthony Scemama Date: Tue, 7 Dec 2021 19:30:32 +0100 Subject: [PATCH] Update for TREXIOv2 --- bin/qp_convert_output_to_ezfio | 26 +++++++++++++++----------- config/ifort_2021_avx.cfg | 2 +- config/ifort_2021_avx_mpi.cfg | 2 +- config/ifort_2021_sse4.cfg | 2 +- config/ifort_2021_sse4_mpi.cfg | 2 +- config/ifort_2021_xHost.cfg | 2 +- ocaml/qp_create_ezfio.ml | 30 ++++++++++++++---------------- src/basis/EZFIO.cfg | 10 +++++----- src/basis/basis.irp.f | 9 ++++++--- 9 files changed, 45 insertions(+), 40 deletions(-) diff --git a/bin/qp_convert_output_to_ezfio b/bin/qp_convert_output_to_ezfio index 1c7394fc..9412b090 100755 --- a/bin/qp_convert_output_to_ezfio +++ b/bin/qp_convert_output_to_ezfio @@ -195,48 +195,52 @@ def write_ezfio(res, filename): # P a r s i n g # # ~#~#~#~#~#~#~ # + inucl = {} + for i, a in enumerate(res.geometry): + inucl[a.coord] = i + nbasis = 0 - nucl_center = [] + nucl_index = [] curr_center = -1 nucl_shell_num = [] ang_mom = [] nshell = 0 - shell_prim_index = [1] + nshell_tot = 0 + shell_index = [] shell_prim_num = [] for b in res.basis: s = b.sym if str.count(s, "y") + str.count(s, "x") == 0: - c = b.center + c = inucl[b.center] nshell += 1 + nshell_tot += 1 if c != curr_center: curr_center = c - nucl_center.append(nbasis+1) nucl_shell_num.append(nshell) nshell = 0 nbasis += 1 + nucl_index.append(c+1) coefficient += b.coef[:len(b.prim)] exponent += [p.expo for p in b.prim] ang_mom.append(str.count(s, "z")) - shell_prim_index.append(len(exponent)+1) shell_prim_num.append(len(b.prim)) - - nucl_shell_num.append(nshell+1) - nucl_shell_num = nucl_shell_num[1:] + shell_index += [nshell_tot+1] * len(b.prim) # ~#~#~#~#~ # # W r i t e # # ~#~#~#~#~ # ezfio.set_basis_basis("Read from ResultsFile") - ezfio.set_basis_basis_nucleus_index(nucl_center) - ezfio.set_basis_prim_num(len(coefficient)) ezfio.set_basis_shell_num(len(ang_mom)) + ezfio.set_basis_basis_nucleus_index(nucl_index) + ezfio.set_basis_prim_num(len(coefficient)) + ezfio.set_basis_nucleus_shell_num(nucl_shell_num) ezfio.set_basis_prim_coef(coefficient) ezfio.set_basis_prim_expo(exponent) ezfio.set_basis_shell_ang_mom(ang_mom) ezfio.set_basis_shell_prim_num(shell_prim_num) - ezfio.set_basis_shell_prim_index(shell_prim_index) + ezfio.set_basis_shell_index(shell_index) print("OK") diff --git a/config/ifort_2021_avx.cfg b/config/ifort_2021_avx.cfg index 6f657052..8fadda67 100644 --- a/config/ifort_2021_avx.cfg +++ b/config/ifort_2021_avx.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL diff --git a/config/ifort_2021_avx_mpi.cfg b/config/ifort_2021_avx_mpi.cfg index c991a4a9..b6b74b73 100644 --- a/config/ifort_2021_avx_mpi.cfg +++ b/config/ifort_2021_avx_mpi.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : mpiifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL diff --git a/config/ifort_2021_sse4.cfg b/config/ifort_2021_sse4.cfg index a6299665..269023da 100644 --- a/config/ifort_2021_sse4.cfg +++ b/config/ifort_2021_sse4.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DINTEL diff --git a/config/ifort_2021_sse4_mpi.cfg b/config/ifort_2021_sse4_mpi.cfg index 6ae56d2a..41df87bc 100644 --- a/config/ifort_2021_sse4_mpi.cfg +++ b/config/ifort_2021_sse4_mpi.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : mpiifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL diff --git a/config/ifort_2021_xHost.cfg b/config/ifort_2021_xHost.cfg index 1e76a69d..05c271f3 100644 --- a/config/ifort_2021_xHost.cfg +++ b/config/ifort_2021_xHost.cfg @@ -7,7 +7,7 @@ # [COMMON] FC : ifort -fpic -LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps +LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps IRPF90 : irpf90 IRPF90_FLAGS : --ninja --align=64 -DINTEL diff --git a/ocaml/qp_create_ezfio.ml b/ocaml/qp_create_ezfio.ml index a4865e2b..e51dd0ef 100644 --- a/ocaml/qp_create_ezfio.ml +++ b/ocaml/qp_create_ezfio.ml @@ -585,12 +585,18 @@ let run ?o b au c d m p cart xyz_file = let shell_prim_num = list_map List.length lc in - let shell_prim_idx = + Printf.printf "Coucou\n%!"; + let shell_idx = + Printf.printf "Coucou\n%!"; + let rec make_list n accu = function + | 0 -> accu + | i -> make_list n (n :: accu) (i-1) + in let rec aux count accu = function | [] -> List.rev accu | l::rest -> - let newcount = count+(List.length l) in - aux newcount (count::accu) rest + let new_l = make_list count accu (List.length l) in + aux (count+1) new_l rest in aux 1 [] lc in @@ -602,20 +608,12 @@ let run ?o b au c d m p cart xyz_file = ~rank:1 ~dim:[| shell_num |] ~data:shell_prim_num); Ezfio.set_basis_shell_ang_mom (Ezfio.ezfio_array_of_list ~rank:1 ~dim:[| shell_num |] ~data:ang_mom ) ; - Ezfio.set_basis_shell_prim_index (Ezfio.ezfio_array_of_list - ~rank:1 ~dim:[| shell_num |] ~data:shell_prim_idx) ; + Ezfio.set_basis_shell_index (Ezfio.ezfio_array_of_list + ~rank:1 ~dim:[| prim_num |] ~data:shell_idx) ; Ezfio.set_basis_basis_nucleus_index (Ezfio.ezfio_array_of_list - ~rank:1 ~dim:[| nucl_num |] - ~data:( - list_map (fun (_,n) -> Nucl_number.to_int n) basis - |> List.fold_left (fun accu i -> - match accu with - | [] -> [] - | (h,j) :: rest -> if j == i then ((h+1,j)::rest) else ((h+1,i)::(h+1,j)::rest) - ) [(0,0)] - |> List.rev - |> List.map fst - )) ; + ~rank:1 ~dim:[| shell_num |] + ~data:( list_map (fun (_,n) -> Nucl_number.to_int n) basis) + ) ; Ezfio.set_basis_nucleus_shell_num(Ezfio.ezfio_array_of_list ~rank:1 ~dim:[| nucl_num |] ~data:( diff --git a/src/basis/EZFIO.cfg b/src/basis/EZFIO.cfg index a6df8e7a..a6864418 100644 --- a/src/basis/EZFIO.cfg +++ b/src/basis/EZFIO.cfg @@ -37,16 +37,16 @@ doc: Number of primitives in a shell size: (basis.shell_num) interface: ezfio, provider -[shell_prim_index] +[shell_index] type: integer -doc: Index of the first primitive of the shell -size: (basis.shell_num) +doc: Index of the shell for each primitive +size: (basis.prim_num) interface: ezfio, provider [basis_nucleus_index] type: integer -doc: Index of the nucleus on which the shell is centered -size: (nuclei.nucl_num) +doc: Nucleus on which the shell is centered +size: (basis.shell_num) interface: ezfio, provider [prim_normalization_factor] diff --git a/src/basis/basis.irp.f b/src/basis/basis.irp.f index 6a406e28..b750d75a 100644 --- a/src/basis/basis.irp.f +++ b/src/basis/basis.irp.f @@ -30,8 +30,10 @@ BEGIN_PROVIDER [ double precision, shell_normalization_factor , (shell_num) ] powA(3) = 0 norm = 0.d0 - do k=shell_prim_index(i),shell_prim_index(i)+shell_prim_num(i)-1 - do j=shell_prim_index(i),shell_prim_index(i)+shell_prim_num(i)-1 + do k=1, prim_num + if (shell_index(k) /= i) cycle + do j=1, prim_num + if (shell_index(j) /= i) cycle call overlap_gaussian_xyz(C_A,C_A,prim_expo(j),prim_expo(k), & powA,powA,overlap_x,overlap_y,overlap_z,c,nz) norm = norm+c*prim_coef(j)*prim_coef(k) * prim_normalization_factor(j) * prim_normalization_factor(k) @@ -91,7 +93,8 @@ BEGIN_PROVIDER [ double precision, prim_normalization_factor , (prim_num) ] powA(2) = 0 powA(3) = 0 - do k=shell_prim_index(i),shell_prim_index(i)+shell_prim_num(i)-1 + do k=1, prim_num + if (shell_index(k) /= i) cycle call overlap_gaussian_xyz(C_A,C_A,prim_expo(k),prim_expo(k), & powA,powA,overlap_x,overlap_y,overlap_z,norm,nz) prim_normalization_factor(k) = 1.d0/dsqrt(norm)