diff --git a/org/qmckl_trexio.org b/org/qmckl_trexio.org index e4c2eec..f6f152e 100644 --- a/org/qmckl_trexio.org +++ b/org/qmckl_trexio.org @@ -414,7 +414,7 @@ qmckl_trexio_read_ao_X(qmckl_context context, trexio_t* const file) } #+end_src -*** Nucleus_shell_num array +*** Number of shells per nucleus #+begin_src c :tangle (eval c) { @@ -450,6 +450,259 @@ qmckl_trexio_read_ao_X(qmckl_context context, trexio_t* const file) } #+end_src +*** Angular momentum + + #+begin_src c :tangle (eval c) + { + qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero; + mem_info.size = shell_num * sizeof(int32_t); + + int32_t* shell_ang_mom = (int32_t*) qmckl_malloc(context, mem_info); + + if (shell_ang_mom == NULL) { + return qmckl_failwith( context, + QMCKL_ALLOCATION_FAILED, + "qmckl_trexio_read_basis_shell_ang_mom_X", + NULL); + } + + assert (shell_ang_mom != NULL); + + rcio = trexio_read_basis_shell_ang_mom_32(file, shell_ang_mom); + if (rcio != TREXIO_SUCCESS) { + return qmckl_failwith( context, + QMCKL_FAILURE, + "trexio_read_basis_shell_ang_mom", + trexio_string_of_error(rcio)); + } + + rc = qmckl_set_ao_basis_shell_ang_mom(context, shell_ang_mom); + + qmckl_free(context, shell_ang_mom); + shell_ang_mom = NULL; + + if (rc != QMCKL_SUCCESS) + return rc; + } + #+end_src + +*** Number of primitives per shell + + #+begin_src c :tangle (eval c) + { + qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero; + mem_info.size = shell_num * sizeof(int64_t); + + int64_t* shell_prim_num = (int64_t*) qmckl_malloc(context, mem_info); + + if (shell_prim_num == NULL) { + return qmckl_failwith( context, + QMCKL_ALLOCATION_FAILED, + "qmckl_trexio_read_basis_shell_prim_num_X", + NULL); + } + + assert (shell_prim_num != NULL); + + rcio = trexio_read_basis_shell_prim_num_64(file, shell_prim_num); + if (rcio != TREXIO_SUCCESS) { + return qmckl_failwith( context, + QMCKL_FAILURE, + "trexio_read_basis_shell_prim_num", + trexio_string_of_error(rcio)); + } + + rc = qmckl_set_ao_basis_shell_prim_num(context, shell_prim_num); + + qmckl_free(context, shell_prim_num); + shell_prim_num = NULL; + + if (rc != QMCKL_SUCCESS) + return rc; + } + #+end_src + +*** Indices of the primitives + + #+begin_src c :tangle (eval c) + { + qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero; + mem_info.size = shell_num * sizeof(int64_t); + + int64_t* shell_prim_index = (int64_t*) qmckl_malloc(context, mem_info); + + if (shell_prim_index == NULL) { + return qmckl_failwith( context, + QMCKL_ALLOCATION_FAILED, + "qmckl_trexio_read_basis_shell_prim_index_X", + NULL); + } + + assert (shell_prim_index != NULL); + + rcio = trexio_read_basis_shell_prim_index_64(file, shell_prim_index); + if (rcio != TREXIO_SUCCESS) { + return qmckl_failwith( context, + QMCKL_FAILURE, + "trexio_read_basis_shell_prim_index", + trexio_string_of_error(rcio)); + } + + rc = qmckl_set_ao_basis_shell_prim_index(context, shell_prim_index); + + qmckl_free(context, shell_prim_index); + shell_prim_index = NULL; + + if (rc != QMCKL_SUCCESS) + return rc; + } + #+end_src + +*** Normalization of the shells + + #+begin_src c :tangle (eval c) + { + qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero; + mem_info.size = shell_num * sizeof(double); + + double* shell_factor = (double*) qmckl_malloc(context, mem_info); + + if (shell_factor == NULL) { + return qmckl_failwith( context, + QMCKL_ALLOCATION_FAILED, + "qmckl_trexio_read_basis_shell_factor_X", + NULL); + } + + assert (shell_factor != NULL); + + rcio = trexio_read_basis_shell_factor_64(file, shell_factor); + if (rcio != TREXIO_SUCCESS) { + return qmckl_failwith( context, + QMCKL_FAILURE, + "trexio_read_basis_shell_factor", + trexio_string_of_error(rcio)); + } + + rc = qmckl_set_ao_basis_shell_factor(context, shell_factor); + + qmckl_free(context, shell_factor); + shell_factor = NULL; + + if (rc != QMCKL_SUCCESS) + return rc; + } + #+end_src + +*** Exponents + + #+begin_src c :tangle (eval c) + { + qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero; + mem_info.size = prim_num * sizeof(double); + + double* exponent = (double*) qmckl_malloc(context, mem_info); + + if (exponent == NULL) { + return qmckl_failwith( context, + QMCKL_ALLOCATION_FAILED, + "qmckl_trexio_read_basis_exponent_X", + NULL); + } + + assert (exponent != NULL); + + rcio = trexio_read_basis_exponent_64(file, exponent); + if (rcio != TREXIO_SUCCESS) { + return qmckl_failwith( context, + QMCKL_FAILURE, + "trexio_read_basis_exponent", + trexio_string_of_error(rcio)); + } + + rc = qmckl_set_ao_basis_exponent(context, exponent); + + qmckl_free(context, exponent); + exponent = NULL; + + if (rc != QMCKL_SUCCESS) + return rc; + } + #+end_src + +*** Coefficients + + #+begin_src c :tangle (eval c) + { + qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero; + mem_info.size = prim_num * sizeof(double); + + double* coefficient = (double*) qmckl_malloc(context, mem_info); + + if (coefficient == NULL) { + return qmckl_failwith( context, + QMCKL_ALLOCATION_FAILED, + "qmckl_trexio_read_basis_coefficient_X", + NULL); + } + + assert (coefficient != NULL); + + rcio = trexio_read_basis_coefficient_64(file, coefficient); + if (rcio != TREXIO_SUCCESS) { + return qmckl_failwith( context, + QMCKL_FAILURE, + "trexio_read_basis_coefficient", + trexio_string_of_error(rcio)); + } + + rc = qmckl_set_ao_basis_coefficient(context, coefficient); + + qmckl_free(context, coefficient); + coefficient = NULL; + + if (rc != QMCKL_SUCCESS) + return rc; + } + #+end_src + +*** Normalization of the primitivies + + #+begin_src c :tangle (eval c) + { + qmckl_memory_info_struct mem_info = qmckl_memory_info_struct_zero; + mem_info.size = prim_num * sizeof(double); + + double* prim_factor = (double*) qmckl_malloc(context, mem_info); + + if (prim_factor == NULL) { + return qmckl_failwith( context, + QMCKL_ALLOCATION_FAILED, + "qmckl_trexio_read_basis_prim_factor_X", + NULL); + } + + assert (prim_factor != NULL); + + rcio = trexio_read_basis_prim_factor_64(file, prim_factor); + if (rcio != TREXIO_SUCCESS) { + return qmckl_failwith( context, + QMCKL_FAILURE, + "trexio_read_basis_prim_factor", + trexio_string_of_error(rcio)); + } + + rc = qmckl_set_ao_basis_prim_factor(context, prim_factor); + + qmckl_free(context, prim_factor); + prim_factor = NULL; + + if (rc != QMCKL_SUCCESS) + return rc; + } + #+end_src + +*** End #+begin_src c :tangle (eval c) @@ -600,7 +853,7 @@ coord = NULL; #+end_src *** Atomic basis - + #+begin_src c :tangle (eval c_test) printf("Atomic basis\n"); @@ -626,6 +879,8 @@ assert (rc == QMCKL_SUCCESS); for (int i=0 ; i