9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-21 11:03:29 +01:00

Fixed qp_import_trexio.py

This commit is contained in:
Anthony Scemama 2024-12-18 17:01:31 +01:00
parent 31ddd20bf9
commit 88c49a03ce
3 changed files with 23 additions and 20 deletions

View File

@ -190,18 +190,21 @@ _qp_Complete()
;;
esac;;
set_file)
# Array to store directory names
dirs=""
# Caching the search results to reduce repeated find calls
if [[ -z "$QP_FILE_CACHE" || "$CACHE_DIR" != "$PWD" ]]; then
CACHE_DIR="$PWD"
QP_FILE_CACHE=$(find . -type f -name .version -exec dirname {} \; | sed 's/\/\.version$//')
fi
# Find directories containing "ezfio/.version" file recursively
for i in $(find . -name ezfio | sed 's/ezfio$/.version/')
do
dir_name=${i%/.version} # Remove the ".version" suffix
dir_name=${dir_name#./} # Remove the leading "./"
dirs+="$dir_name "
done
# Support for relative paths
prefix=$(dirname "${cur}")
if [[ "$prefix" != "." ]]; then
dirs=$(echo "$QP_FILE_CACHE" | grep "^$prefix")
else
dirs="$QP_FILE_CACHE"
fi
COMPREPLY=( $(compgen -W "$dirs" -- ${cur} ) )
COMPREPLY=( $(compgen -W "$dirs" -- "$cur") )
return 0
;;
plugins)

View File

@ -3,11 +3,11 @@
convert TREXIO file to EZFIO
Usage:
qp_import_trexio [-o EZFIO_DIR] FILE
qp_import_trexio [-o EZFIO_DIR] [-p] FILE
Options:
-o --output=EZFIO_DIR Produced directory
by default is FILE.ezfio
-o --output=EZFIO_DIR Produced directory
by default is FILE.ezfio
"""
@ -195,7 +195,7 @@ def write_ezfio(trexio_filename, filename):
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_ao_basis_primitives_normalized(True)
ezfio.set_basis_prim_coef(coefficient)
elif basis_type.lower() == "numerical":

View File

@ -272,9 +272,9 @@ subroutine export_trexio(update,full_path)
allocate(factor(shell_num))
! if (ao_normalized) then
! factor(1:shell_num) = shell_normalization_factor(1:shell_num)
factor(1:shell_num) = shell_normalization_factor(1:shell_num)
! else
factor(1:shell_num) = 1.d0
! factor(1:shell_num) = 1.d0
! endif
rc = trexio_write_basis_shell_factor(f(1), factor)
call trexio_assert(rc, TREXIO_SUCCESS)
@ -291,11 +291,11 @@ subroutine export_trexio(update,full_path)
call trexio_assert(rc, TREXIO_SUCCESS)
allocate(factor(prim_num))
if (primitives_normalized) then
! if (primitives_normalized) then
factor(1:prim_num) = prim_normalization_factor(1:prim_num)
else
factor(1:prim_num) = 1.d0
endif
! else
! factor(1:prim_num) = 1.d0
! endif
rc = trexio_write_basis_prim_factor(f(1), factor)
call trexio_assert(rc, TREXIO_SUCCESS)
deallocate(factor)