9
1
mirror of https://github.com/QuantumPackage/qp2.git synced 2024-12-22 11:33: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;; esac;;
set_file) set_file)
# Array to store directory names # Caching the search results to reduce repeated find calls
dirs="" 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 # Support for relative paths
for i in $(find . -name ezfio | sed 's/ezfio$/.version/') prefix=$(dirname "${cur}")
do if [[ "$prefix" != "." ]]; then
dir_name=${i%/.version} # Remove the ".version" suffix dirs=$(echo "$QP_FILE_CACHE" | grep "^$prefix")
dir_name=${dir_name#./} # Remove the leading "./" else
dirs+="$dir_name " dirs="$QP_FILE_CACHE"
done fi
COMPREPLY=( $(compgen -W "$dirs" -- ${cur} ) ) COMPREPLY=( $(compgen -W "$dirs" -- "$cur") )
return 0 return 0
;; ;;
plugins) plugins)

View File

@ -3,7 +3,7 @@
convert TREXIO file to EZFIO convert TREXIO file to EZFIO
Usage: Usage:
qp_import_trexio [-o EZFIO_DIR] FILE qp_import_trexio [-o EZFIO_DIR] [-p] FILE
Options: Options:
-o --output=EZFIO_DIR Produced directory -o --output=EZFIO_DIR Produced directory
@ -195,7 +195,7 @@ def write_ezfio(trexio_filename, filename):
prim_factor = trexio.read_basis_prim_factor(trexio_file) prim_factor = trexio.read_basis_prim_factor(trexio_file)
for i,p in enumerate(prim_factor): for i,p in enumerate(prim_factor):
coefficient[i] *= prim_factor[i] 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) ezfio.set_basis_prim_coef(coefficient)
elif basis_type.lower() == "numerical": elif basis_type.lower() == "numerical":

View File

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