1
0
mirror of https://gitlab.com/scemama/qp_plugins_scemama.git synced 2024-12-22 12:23:37 +01:00

Fix trexio->QP converter

This commit is contained in:
Anthony Scemama 2022-12-05 17:44:07 +01:00
parent ec1a0e8af4
commit d8b80f4b55
4 changed files with 52 additions and 25 deletions

View File

@ -24,7 +24,8 @@ subroutine run
double precision, allocatable :: A(:,:)
double precision, allocatable :: V(:)
integer , allocatable :: Vi(:,:)
double precision, allocatable :: s
double precision :: s
PROVIDE ao_num
f = trexio_open(trexio_filename, 'r', TREXIO_AUTO, rc)
if (f == 0_8) then
@ -37,8 +38,9 @@ subroutine run
if (trexio_has_nucleus_repulsion(f) == TREXIO_SUCCESS) then
rc = trexio_read_nucleus_repulsion(f, s)
call trexio_assert(rc, TREXIO_SUCCESS)
if (rc /= TREXIO_SUCCESS) then
print *, irp_here
print *, irp_here, rc
print *, 'Error reading nuclear repulsion'
stop -1
endif
@ -100,6 +102,7 @@ subroutine run
! AO 2e integrals
! ---------------
PROVIDE ao_integrals_map
allocate(buffer_i(ao_num**3), buffer_values(ao_num**3))
allocate(Vi(4,ao_num**3), V(ao_num**3))
@ -107,7 +110,7 @@ subroutine run
integer*8 :: offset, icount
offset = 0_8
icount = 0_8
icount = size(V)
rc = TREXIO_SUCCESS
do while (icount == size(V))
rc = trexio_read_ao_2e_int_eri(f, offset, icount, Vi, V)

View File

@ -10,4 +10,14 @@ fi
pkg-config --libs trexio > LIB
scripts_list="qp_import_trexio.py"
# Destroy ONLY the symbolic link for the scripts to be used in the
# ${QP_ROOT}/scripts/ directory.
for i in $scripts_list
do
find ${QP_ROOT}/scripts/$i -type l -delete
done
# Create symlink in scripts
ln --symbolic ${PWD}/qp_import_trexio.py $QP_ROOT/scripts

View File

@ -68,21 +68,13 @@ def write_ezfio(trexio_filename, filename):
trexio_file = trexio.File(trexio_filename,mode='r',back_end=trexio.TREXIO_HDF5)
basis_type = trexio.read_basis_type(trexio_file)
if basis_type.lower() != "gaussian":
raise TypeError
# if basis_type.lower() != "gaussian":
# raise TypeError
ezfio.set_file(filename)
ezfio.set_trexio_trexio_file(trexio_filename)
print("Electrons\t...\t", end=' ')
num_alpha = trexio.read_electron_up_num(trexio_file)
num_beta = trexio.read_electron_dn_num(trexio_file)
ezfio.set_electrons_elec_alpha_num(num_alpha)
ezfio.set_electrons_elec_beta_num(num_beta)
print("OK")
print("Nuclei\t\t...\t", end=' ')
@ -106,6 +98,23 @@ def write_ezfio(trexio_filename, filename):
print("OK")
print("Electrons\t...\t", end=' ')
try:
num_beta = trexio.read_electron_dn_num(trexio_file)
except:
num_beta = sum(charge)//2
try:
num_alpha = trexio.read_electron_up_num(trexio_file)
except:
num_alpha = sum(charge) - num_beta
ezfio.set_electrons_elec_alpha_num(num_alpha)
ezfio.set_electrons_elec_beta_num(num_beta)
print("OK")
print("Basis\t\t...\t", end=' ')
ezfio.set_basis_basis("Read from TREXIO")
@ -229,6 +238,7 @@ def write_ezfio(trexio_filename, filename):
coef.append(coefficient[j])
expo.append(exponent[j])
ezfio.set_ao_basis_ao_prim_num_max(prim_num_max)
ezfio.set_ao_basis_ao_coef(coef)
ezfio.set_ao_basis_ao_expo(expo)
ezfio.set_ao_basis_ao_basis("Read from TREXIO")
@ -265,17 +275,21 @@ def write_ezfio(trexio_filename, filename):
except trexio.Error:
pass
MoMatrix = trexio.read_mo_coefficient(trexio_file)
try:
mo_num = trexio.read_mo_num(trexio_file)
ezfio.set_mo_basis_mo_num(mo_num)
MoMatrix = trexio.read_mo_coefficient(trexio_file)
ezfio.set_mo_basis_mo_coef(MoMatrix)
mo_occ = [ 0. for i in range(mo_num) ]
for i in range(num_alpha):
mo_occ[i] += 1.
for i in range(num_beta):
mo_occ[i] += 1.
ezfio.set_mo_basis_mo_occ(mo_occ)
except:
pass
print("OK")

View File

@ -8,7 +8,7 @@ then
exit -1
fi
scripts_list="qp_import_trexio.py "
scripts_list="qp_import_trexio.py"
# Destroy ONLY the symbolic link for the scripts to be used in the
# ${QP_ROOT}/scripts/ directory.