From a4b2bea36fd8cbd9262018289c64ef9897048c51 Mon Sep 17 00:00:00 2001 From: joguenzl Date: Mon, 17 Mar 2025 15:50:45 +0100 Subject: [PATCH 1/3] Further basis spoofing for NAO import --- scripts/qp_import_trexio.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/qp_import_trexio.py b/scripts/qp_import_trexio.py index 23f48eef..9f2df06b 100755 --- a/scripts/qp_import_trexio.py +++ b/scripts/qp_import_trexio.py @@ -209,6 +209,7 @@ def write_ezfio(trexio_filename, filename): nucl_index = trexio.read_basis_nucleus_index(trexio_file) exponent = [1.]*prim_num coefficient = [1.]*prim_num + prim_factor = [1.]*prim_num shell_index = [i for i in range(shell_num)] ao_shell = trexio.read_ao_shell(trexio_file) @@ -220,6 +221,9 @@ def write_ezfio(trexio_filename, filename): 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) + ezfio.set_basis_prim_normalization_factor(prim_factor) + ezfio.set_basis_primitives_normalized(True) + ezfio.set_basis_ao_normalized(False) nucl_shell_num = [] prev = None @@ -283,7 +287,7 @@ def write_ezfio(trexio_filename, filename): ezfio.set_ao_basis_ao_num(ao_num) - if cartesian and basis_type.lower() == "gaussian" and shell_num > 0: + if cartesian and basis_type.lower() in ["gaussian", "numerical"] and shell_num > 0: ao_shell = trexio.read_ao_shell(trexio_file_cart) at = [ nucl_index[i]+1 for i in ao_shell ] ezfio.set_ao_basis_ao_nucl(at) From 2c737621702765c45d87da56ef8fea5e5cf5a3d6 Mon Sep 17 00:00:00 2001 From: joguenzl Date: Mon, 17 Mar 2025 16:46:12 +0100 Subject: [PATCH 2/3] Allow import of core_hamiltonian if kinetic and nuclear matrices are not provided --- src/trexio/import_trexio_integrals.irp.f | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/src/trexio/import_trexio_integrals.irp.f b/src/trexio/import_trexio_integrals.irp.f index d85a0283..17da55a3 100644 --- a/src/trexio/import_trexio_integrals.irp.f +++ b/src/trexio/import_trexio_integrals.irp.f @@ -119,6 +119,28 @@ subroutine run(f) call ezfio_set_ao_one_e_ints_io_ao_integrals_n_e('Read') endif + ! Some codes only provide ao_1e_int_core_hamiltonian rather than + ! kinetic and nuclear potentials separately, so we need tneed to work + ! around that. This is needed for non-GTO basis sets since some QP + ! functions will try to calculate these matrices from the nonexisting + ! GTO basis if they are not set. + if (trexio_has_ao_1e_int_core_hamiltonian(f) == TREXIO_SUCCESS .and. & + trexio_has_ao_1e_int_potential_n_e(f) /= TREXIO_SUCCESS .and. & + trexio_has_ao_1e_int_kinetic(f) /= TREXIO_SUCCESS) then + rc = trexio_read_ao_1e_int_core_hamiltonian(f, A) + if (rc /= TREXIO_SUCCESS) then + print *, irp_here + print *, 'Error reading AO core Hamiltonian.' + call trexio_assert(rc, TREXIO_SUCCESS) + stop -1 + endif + call ezfio_set_ao_one_e_ints_ao_integrals_n_e(A) + call ezfio_set_ao_one_e_ints_io_ao_integrals_n_e('Read') + A=0.d0 + call ezfio_set_ao_one_e_ints_ao_integrals_kinetic(A) + call ezfio_set_ao_one_e_ints_io_ao_integrals_kinetic('Read') + endif + deallocate(A,B) ! AO 2e integrals From 120a94e3b50386bea2616b155af672c5aa5fd4a6 Mon Sep 17 00:00:00 2001 From: joguenzl Date: Mon, 17 Mar 2025 17:55:36 +0100 Subject: [PATCH 3/3] Fix type --- src/trexio/import_trexio_integrals.irp.f | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/trexio/import_trexio_integrals.irp.f b/src/trexio/import_trexio_integrals.irp.f index 17da55a3..0fda2ff0 100644 --- a/src/trexio/import_trexio_integrals.irp.f +++ b/src/trexio/import_trexio_integrals.irp.f @@ -120,7 +120,7 @@ subroutine run(f) endif ! Some codes only provide ao_1e_int_core_hamiltonian rather than - ! kinetic and nuclear potentials separately, so we need tneed to work + ! kinetic and nuclear potentials separately, so we need to work ! around that. This is needed for non-GTO basis sets since some QP ! functions will try to calculate these matrices from the nonexisting ! GTO basis if they are not set.