TREXIO I/O library
Table of Contents
- 1. Local functions
- 1.1. Open file
- 1.2. Electron
- 1.3. Nucleus
- 1.4. Basis set and AOs
- 1.4.1. Basis set type
- 1.4.2. Number of shells
- 1.4.3. Number of primitives
- 1.4.4. Number of atomic orbitals
- 1.4.5. Nucleusindex array
- 1.4.6. Number of shells per nucleus
- 1.4.7. r power
- 1.4.8. Angular momentum
- 1.4.9. Number of primitives per shell
- 1.4.10. Indices of the primitives
- 1.4.11. Normalization of the shells
- 1.4.12. Exponents
- 1.4.13. Coefficients
- 1.4.14. Normalization of the primitivies
- 1.4.15. AO Normalization
- 1.5. Molecular orbitals
- 1.6. TODO ECP
- 2. Read everything
- 3. Test
1. Local functions
Functions defined in this section are all local (internal to this module):
they should not be exposed in the public API. To identify them clearly,
we append _X to their name, indicating their private status.
Users are not able to call these functions directly. Since they are only
called from within this module where the context validity has already been
checked, the context parameter can't be NULL. Therefore, we verify this
precondition with an assert statement rather than returning an error code.
In the functions defined in this section, we use the following local variable naming conventions:
rc: the return code for QMCkl functionsrcio: the return code for TREXIO library functions.
1.1. Open file
We first define a helper function to open a TREXIO file by attempting
multiple backends. It tries to use the TEXT backend first, and if that fails,
attempts the HDF5 backend. If both strategies fail, a NULL pointer is
returned. This flexible approach allows the function to handle TREXIO files
in either format without requiring the user to specify which format is used.
open only once the file and call multiple small functions to read
groups of data by passing the trexio_t handle.
1.2. Electron
In this section we read all the data into the electron data structure. We read the number of up-spin and down-spin electrons.
1.3. Nucleus
In this section we read the number of nuclei, the molecular geometry and nuclear charges.
1.3.1. Number of nuclei
1.3.2. Nuclear charges
1.3.3. Nuclear coordinates
Now, we read the molecular geometry. It is stored in normal format
in the TREXIO file ('N'), so it will be automatically transposed internally.
1.4. Basis set and AOs
In this section we read the atomic basis set and atomic orbitals.
1.4.1. Basis set type
1.4.2. Number of shells
1.4.3. Number of primitives
1.4.4. Number of atomic orbitals
1.4.5. Nucleusindex array
1.4.6. Number of shells per nucleus
1.4.7. r power
{
qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero;
/* Allocate array for data */
mem_info.size = shell_num * sizeof(int32_t);
int32_t* r_power = (int32_t*) qmckl_malloc(context, mem_info);
if (r_power == NULL) {
return qmckl_failwith( context,
QMCKL_ALLOCATION_FAILED,
"qmckl_trexio_read_basis_r_power",
NULL);
}
assert (r_power != NULL);
/* Read data */
rcio = trexio_read_safe_basis_r_power_32(file, r_power, shell_num);
if (rcio != TREXIO_SUCCESS) {
for (int i=0 ; i<shell_num ; ++i) {
r_power[i] = 0;
}
}
/* Store data */
rc = qmckl_set_ao_basis_r_power(context, r_power, shell_num);
qmckl_free(context, r_power);
r_power = NULL;
if (rc != QMCKL_SUCCESS)
return rc;
}
1.4.8. Angular momentum
1.4.9. Number of primitives per shell
1.4.10. Indices of the primitives
1.4.11. Normalization of the shells
1.4.12. Exponents
1.4.13. Coefficients
1.4.14. Normalization of the primitivies
1.4.15. AO Normalization
1.5. Molecular orbitals
In this section we read the MO coefficients.
1.5.1. Number of MOs
1.5.2. MO coefficients
1.6. TODO ECP
2. Read everything
qmckl_exit_code qmckl_trexio_read(const qmckl_context context, const char* file_name, const int64_t size_max);