10
0
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-06-19 03:37:08 +02:00

Update for TREXIOv2

This commit is contained in:
Anthony Scemama 2021-12-07 19:30:32 +01:00
parent 3b3f7a7de9
commit 13eee57e67
9 changed files with 45 additions and 40 deletions

View File

@ -195,48 +195,52 @@ def write_ezfio(res, filename):
# P a r s i n g # # P a r s i n g #
# ~#~#~#~#~#~#~ # # ~#~#~#~#~#~#~ #
inucl = {}
for i, a in enumerate(res.geometry):
inucl[a.coord] = i
nbasis = 0 nbasis = 0
nucl_center = [] nucl_index = []
curr_center = -1 curr_center = -1
nucl_shell_num = [] nucl_shell_num = []
ang_mom = [] ang_mom = []
nshell = 0 nshell = 0
shell_prim_index = [1] nshell_tot = 0
shell_index = []
shell_prim_num = [] shell_prim_num = []
for b in res.basis: for b in res.basis:
s = b.sym s = b.sym
if str.count(s, "y") + str.count(s, "x") == 0: if str.count(s, "y") + str.count(s, "x") == 0:
c = b.center c = inucl[b.center]
nshell += 1 nshell += 1
nshell_tot += 1
if c != curr_center: if c != curr_center:
curr_center = c curr_center = c
nucl_center.append(nbasis+1)
nucl_shell_num.append(nshell) nucl_shell_num.append(nshell)
nshell = 0 nshell = 0
nbasis += 1 nbasis += 1
nucl_index.append(c+1)
coefficient += b.coef[:len(b.prim)] coefficient += b.coef[:len(b.prim)]
exponent += [p.expo for p in b.prim] exponent += [p.expo for p in b.prim]
ang_mom.append(str.count(s, "z")) ang_mom.append(str.count(s, "z"))
shell_prim_index.append(len(exponent)+1)
shell_prim_num.append(len(b.prim)) shell_prim_num.append(len(b.prim))
shell_index += [nshell_tot+1] * len(b.prim)
nucl_shell_num.append(nshell+1)
nucl_shell_num = nucl_shell_num[1:]
# ~#~#~#~#~ # # ~#~#~#~#~ #
# W r i t e # # W r i t e #
# ~#~#~#~#~ # # ~#~#~#~#~ #
ezfio.set_basis_basis("Read from ResultsFile") 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_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_nucleus_shell_num(nucl_shell_num)
ezfio.set_basis_prim_coef(coefficient) ezfio.set_basis_prim_coef(coefficient)
ezfio.set_basis_prim_expo(exponent) ezfio.set_basis_prim_expo(exponent)
ezfio.set_basis_shell_ang_mom(ang_mom) ezfio.set_basis_shell_ang_mom(ang_mom)
ezfio.set_basis_shell_prim_num(shell_prim_num) 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") print("OK")

View File

@ -7,7 +7,7 @@
# #
[COMMON] [COMMON]
FC : ifort -fpic FC : ifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90 IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DINTEL IRPF90_FLAGS : --ninja --align=32 -DINTEL

View File

@ -7,7 +7,7 @@
# #
[COMMON] [COMMON]
FC : mpiifort -fpic FC : mpiifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90 IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL

View File

@ -7,7 +7,7 @@
# #
[COMMON] [COMMON]
FC : ifort -fpic FC : ifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90 IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DINTEL IRPF90_FLAGS : --ninja --align=32 -DINTEL

View File

@ -7,7 +7,7 @@
# #
[COMMON] [COMMON]
FC : mpiifort -fpic FC : mpiifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90 IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL IRPF90_FLAGS : --ninja --align=32 -DMPI -DINTEL

View File

@ -7,7 +7,7 @@
# #
[COMMON] [COMMON]
FC : ifort -fpic FC : ifort -fpic
LAPACK_LIB : -mkl=parallel -lirc -lsvml -limf -lipps LAPACK_LIB : -qmkl=parallel -lirc -lsvml -limf -lipps
IRPF90 : irpf90 IRPF90 : irpf90
IRPF90_FLAGS : --ninja --align=64 -DINTEL IRPF90_FLAGS : --ninja --align=64 -DINTEL

View File

@ -585,12 +585,18 @@ let run ?o b au c d m p cart xyz_file =
let shell_prim_num = let shell_prim_num =
list_map List.length lc list_map List.length lc
in 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 let rec aux count accu = function
| [] -> List.rev accu | [] -> List.rev accu
| l::rest -> | l::rest ->
let newcount = count+(List.length l) in let new_l = make_list count accu (List.length l) in
aux newcount (count::accu) rest aux (count+1) new_l rest
in in
aux 1 [] lc aux 1 [] lc
in 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); ~rank:1 ~dim:[| shell_num |] ~data:shell_prim_num);
Ezfio.set_basis_shell_ang_mom (Ezfio.ezfio_array_of_list Ezfio.set_basis_shell_ang_mom (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| shell_num |] ~data:ang_mom ) ; ~rank:1 ~dim:[| shell_num |] ~data:ang_mom ) ;
Ezfio.set_basis_shell_prim_index (Ezfio.ezfio_array_of_list Ezfio.set_basis_shell_index (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| shell_num |] ~data:shell_prim_idx) ; ~rank:1 ~dim:[| prim_num |] ~data:shell_idx) ;
Ezfio.set_basis_basis_nucleus_index (Ezfio.ezfio_array_of_list Ezfio.set_basis_basis_nucleus_index (Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| nucl_num |] ~rank:1 ~dim:[| shell_num |]
~data:( ~data:( list_map (fun (_,n) -> Nucl_number.to_int n) basis)
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
)) ;
Ezfio.set_basis_nucleus_shell_num(Ezfio.ezfio_array_of_list Ezfio.set_basis_nucleus_shell_num(Ezfio.ezfio_array_of_list
~rank:1 ~dim:[| nucl_num |] ~rank:1 ~dim:[| nucl_num |]
~data:( ~data:(

View File

@ -37,16 +37,16 @@ doc: Number of primitives in a shell
size: (basis.shell_num) size: (basis.shell_num)
interface: ezfio, provider interface: ezfio, provider
[shell_prim_index] [shell_index]
type: integer type: integer
doc: Index of the first primitive of the shell doc: Index of the shell for each primitive
size: (basis.shell_num) size: (basis.prim_num)
interface: ezfio, provider interface: ezfio, provider
[basis_nucleus_index] [basis_nucleus_index]
type: integer type: integer
doc: Index of the nucleus on which the shell is centered doc: Nucleus on which the shell is centered
size: (nuclei.nucl_num) size: (basis.shell_num)
interface: ezfio, provider interface: ezfio, provider
[prim_normalization_factor] [prim_normalization_factor]

View File

@ -30,8 +30,10 @@ BEGIN_PROVIDER [ double precision, shell_normalization_factor , (shell_num) ]
powA(3) = 0 powA(3) = 0
norm = 0.d0 norm = 0.d0
do k=shell_prim_index(i),shell_prim_index(i)+shell_prim_num(i)-1 do k=1, prim_num
do j=shell_prim_index(i),shell_prim_index(i)+shell_prim_num(i)-1 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), & call overlap_gaussian_xyz(C_A,C_A,prim_expo(j),prim_expo(k), &
powA,powA,overlap_x,overlap_y,overlap_z,c,nz) 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) 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(2) = 0
powA(3) = 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), & call overlap_gaussian_xyz(C_A,C_A,prim_expo(k),prim_expo(k), &
powA,powA,overlap_x,overlap_y,overlap_z,norm,nz) powA,powA,overlap_x,overlap_y,overlap_z,norm,nz)
prim_normalization_factor(k) = 1.d0/dsqrt(norm) prim_normalization_factor(k) = 1.d0/dsqrt(norm)