Skip to content

Commit

Permalink
Fixed problems with trexio files coming from cp2k
Browse files Browse the repository at this point in the history
  • Loading branch information
scemama committed Nov 27, 2024
1 parent c35278c commit 7a0194d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 16 deletions.
13 changes: 8 additions & 5 deletions scripts/qp_import_trexio.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def write_ezfio(trexio_filename, filename):
ezfio.set_basis_shell_ang_mom(ang_mom)
ezfio.set_basis_basis_nucleus_index([ x+1 for x in nucl_index ])
ezfio.set_basis_prim_expo(exponent)
ezfio.set_basis_prim_coef(coefficient)

nucl_shell_num = []
prev = None
Expand Down Expand Up @@ -194,6 +193,10 @@ def write_ezfio(trexio_filename, filename):

shell_factor = trexio.read_basis_shell_factor(trexio_file)
prim_factor = trexio.read_basis_prim_factor(trexio_file)
for i,p in enumerate(prim_factor):
coefficient[i] *= prim_factor[i]
ezfio.set_ao_basis_primitives_normalized(False)
ezfio.set_basis_prim_coef(coefficient)

elif basis_type.lower() == "numerical":

Expand Down Expand Up @@ -245,7 +248,6 @@ def write_ezfio(trexio_filename, filename):
ezfio.set_basis_nucleus_shell_num(nucl_shell_num)

shell_factor = trexio.read_basis_shell_factor(trexio_file)
prim_factor = [1.]*prim_num
else:
raise TypeError

Expand Down Expand Up @@ -387,10 +389,11 @@ def write_ezfio(trexio_filename, filename):

# Renormalize MO coefs if needed
if trexio.has_ao_normalization(trexio_file_cart):
ezfio.set_ao_basis_ao_normalized(False)
norm = trexio.read_ao_normalization(trexio_file_cart)
for j in range(mo_num):
for i,f in enumerate(norm):
MoMatrix[i,j] *= f
# for j in range(mo_num):
# for i,f in enumerate(norm):
# MoMatrix[i,j] *= f
ezfio.set_mo_basis_mo_coef(MoMatrix)

mo_occ = [ 0. for i in range(mo_num) ]
Expand Down
22 changes: 11 additions & 11 deletions src/ao_basis/aos.irp.f
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@

do i=1,ao_num

! powA(1) = ao_power(i,1) + ao_power(i,2) + ao_power(i,3)
! powA(2) = 0
! powA(3) = 0
powA(1) = ao_power(i,1)
powA(2) = ao_power(i,2)
powA(3) = ao_power(i,3)
Expand All @@ -76,16 +73,19 @@
endif

! Normalization of the contracted basis functions
if (ao_normalized) then
norm = 0.d0
norm = 0.d0
do j=1,ao_prim_num(i)
do k=1,ao_prim_num(i)
call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz)
norm = norm+c*ao_coef_normalized(i,j)*ao_coef_normalized(i,k)
enddo
enddo
ao_coef_normalization_factor(i) = 1.d0/dsqrt(norm)

if (.not.ao_normalized) then
do j=1,ao_prim_num(i)
do k=1,ao_prim_num(i)
call overlap_gaussian_xyz(C_A,C_A,ao_expo(i,j),ao_expo(i,k),powA,powA,overlap_x,overlap_y,overlap_z,c,nz)
norm = norm+c*ao_coef_normalized(i,j)*ao_coef_normalized(i,k)
enddo
ao_coef_normalized(i,j) = ao_coef_normalized(i,j) * ao_coef_normalization_factor(i)
enddo
ao_coef_normalization_factor(i) = 1.d0/dsqrt(norm)
else
ao_coef_normalization_factor(i) = 1.d0
endif
enddo
Expand Down

0 comments on commit 7a0194d

Please sign in to comment.