diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 02a633a..1fb16b9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -47,14 +47,28 @@ jobs: echo "=== Check TREXIO file converted from GAMESS ===" trexio check-mos -n 50 trexio_gamess.h5 > mos-res grep "Norm of the error" < mos-res | grep -Eo "([0-9]+\.[0-9]*|\.?[0-9]+)([eE][+-][0-9]+)?" > error-res - python -c 'with open("error-res") as f: error = f.readline().strip(); assert float(error) < 1.0' + cat error-res + python -c 'with open("error-res") as f: error = f.readline().strip(); assert float(error) < 0.12' echo "=== Check TREXIO file converted from PySCF ===" - trexio check-mos -n 50 trexio_pyscf_h2o.h5 > mos-res + trexio check-mos -n 100 trexio_pyscf_h2o.h5 > mos-res grep "Norm of the error" < mos-res | grep -Eo "([0-9]+\.[0-9]*|\.?[0-9]+)([eE][+-][0-9]+)?" > error-res - python -c 'with open("error-res") as f: error = f.readline().strip(); assert float(error) < 1.0' + cat error-res + python -c 'with open("error-res") as f: error = f.readline().strip(); assert float(error) < 0.00018' echo "=== Check TREXIO file converted from ORCA ===" - trexio check-mos -n 50 trexio_orca_h2o.h5 > mos-res + trexio check-mos -n 100 trexio_orca_h2o.h5 > mos-res grep "Norm of the error" < mos-res | grep -Eo "([0-9]+\.[0-9]*|\.?[0-9]+)([eE][+-][0-9]+)?" > error-res - python -c 'with open("error-res") as f: error = f.readline().strip(); assert float(error) < 1.0' + cat error-res + python -c 'with open("error-res") as f: error = f.readline().strip(); assert float(error) < 0.08' # benchmark helper converters trexio convert-to -t molden -o trexio_molden.h5 trexio_gamess.h5 + echo "=== Check normalization in spherical file ===" + trexio check-mos -n 100 data/methane_sphe.hdf5 > mos-res + grep "Norm of the error" < mos-res | grep -Eo "([0-9]+\.[0-9]*|\.?[0-9]+)([eE][+-][0-9]+)?" > error-res + cat error-res + python -c 'with open("error-res") as f: error = f.readline().strip(); assert float(error) < 0.0017' + echo "=== Check normalization after transformation into cartesian file ===" + trexio convert-to -t cartesian data/methane_sphe.hdf5 -o methane_cart.hdf5 + trexio check-mos -n 100 methane_cart.hdf5 > mos-res + grep "Norm of the error" < mos-res | grep -Eo "([0-9]+\.[0-9]*|\.?[0-9]+)([eE][+-][0-9]+)?" > error-res + cat error-res + python -c 'with open("error-res") as f: error = f.readline().strip(); assert float(error) < 0.0017' diff --git a/data/methane_sphe.hdf5 b/data/methane_sphe.hdf5 new file mode 100644 index 0000000..c0bbbf4 Binary files /dev/null and b/data/methane_sphe.hdf5 differ diff --git a/src/trexio_tools/converters/convert_to.py b/src/trexio_tools/converters/convert_to.py index 51156a1..6c9b86c 100755 --- a/src/trexio_tools/converters/convert_to.py +++ b/src/trexio_tools/converters/convert_to.py @@ -515,53 +515,30 @@ def run_cart_phe(inp, filename, to_cartesian): # Update MOs if trexio.has_mo_coefficient(inp): X = trexio.read_mo_coefficient(inp) - for i in range(R.shape[1]): - if normalization[i] != 1.: - X[i,:] /= normalization[i] Y = X @ R.T trexio.write_mo_coefficient(out, Y) # Update 1e Integrals if trexio.has_ao_1e_int_overlap(inp): X = trexio.read_ao_1e_int_overlap(inp) - for i in range(R.shape[1]): - X[:,i] /= normalization[i] - for i in range(R.shape[1]): - X[i,:] /= normalization[i] Y = R_norm_inv @ X @ R_norm_inv.T trexio.write_ao_1e_int_overlap(out, Y) if trexio.has_ao_1e_int_kinetic(inp): X = trexio.read_ao_1e_int_kinetic(inp) - for i in range(R.shape[1]): - if normalization[i] != 1.: - X[:,i] /= normalization[i] - X[i,:] /= normalization[i] trexio.write_ao_1e_int_kinetic(out, R_norm_inv @ X @ R_norm_inv.T) if trexio.has_ao_1e_int_potential_n_e(inp): X = trexio.read_ao_1e_int_potential_n_e(inp) - for i in range(R.shape[1]): - if normalization[i] != 1.: - X[:,i] /= normalization[i] - X[i,:] /= normalization[i] trexio.write_ao_1e_int_potential_n_e(out, R_norm_inv @ X @ R_norm_inv.T) if trexio.has_ao_1e_int_ecp(inp): X = trexio.read_ao_1e_int_ecp(inp) - for i in range(R.shape[1]): - if normalization[i] != 1.: - X[:,i] /= normalization[i] - X[i,:] /= normalization[i] trexio.write_ao_1e_int_ecp(out, R_norm_inv @ X @ R_norm_inv.T) if trexio.has_ao_1e_int_core_hamiltonian(inp): X = trexio.read_ao_1e_int_core_hamiltonian(inp) - for i in range(R.shape[1]): - if normalization[i] != 1.: - X[:,i] /= normalization[i] - X[i,:] /= normalization[i] trexio.write_ao_1e_int_core_hamiltonian(out, R_norm_inv @ X @ R_norm_inv.T) # Remove 2e integrals: too expensive to transform diff --git a/src/trexio_tools/group_tools/check_basis.py b/src/trexio_tools/group_tools/check_basis.py index 69eed88..3322b6d 100755 --- a/src/trexio_tools/group_tools/check_basis.py +++ b/src/trexio_tools/group_tools/check_basis.py @@ -14,11 +14,6 @@ def run(trexio_file, n_points): the matrix stored in the file. """ - if not trexio.has_ao_1e_int_overlap(trexio_file): - raise Exception( - "One-electron overlap integrals are missing in the TREXIO file. Required for check-basis." - ) - trexio_filename = trexio_file.filename context = qmckl.context_create() qmckl.trexio_read(context, trexio_filename) @@ -56,7 +51,11 @@ def run(trexio_file, n_points): S = chi.T @ chi * dv print() - S_ex = trexio.read_ao_1e_int_overlap(trexio_file) + if trexio.has_ao_1e_int_overlap(trexio_file): + S_ex = trexio.read_ao_1e_int_overlap(trexio_file) + else: + S_ex = np.zeros((ao_num,ao_num)) + # This produces a lot of output for large molecules, maybe wrap up in ``if debug`` statement ? for i in range(ao_num):