1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-07-22 18:57:39 +02:00

Merge branch 'master' into add-strings

This commit is contained in:
q-posev 2021-06-15 11:49:42 +02:00
commit ac45a937af
7 changed files with 250 additions and 175 deletions

View File

@ -5,9 +5,10 @@ TREX library fo efficient I/O.
## Minimal requirements (for users):
- Autoconf
- C compiler (gcc/icc/clang)
- Fortran compiler (gfortran/ifort/flang)
- Autotools (autoconf, automake, libtool)
- C compiler (gcc/icc/clang)
- Fortran compiler (gfortran/ifort)
- HDF5 library (>= 1.8)
## Installation procedure from the tarball (for users):
@ -26,9 +27,8 @@ TREX library fo efficient I/O.
## Additional requirements (for developers):
- Automake
- python3 (>=3.6)
- Emacs (>=26.0)
- python3 (>= 3.6)
- Emacs (>= 26.0)
## Installation procedure from the GitHub repo clone (for developers):
@ -36,7 +36,7 @@ TREX library fo efficient I/O.
1. `git clone https://github.com/TREX-CoE/trexio.git`
2. `cd trexio`
3. `./autogen.sh`
4. `./configure`
4. `TREXIO_DEVEL=1 ./configure`
5. `make`
6. `make check`
7. `sudo make install`

View File

@ -55,7 +55,7 @@ AC_PROG_LN_S
## ---------
# Checks for basic header files.
AC_CHECK_HEADERS([fcntl.h inttypes.h stdint.h stdlib.h string.h unistd.h])
AC_CHECK_HEADERS([fcntl.h inttypes.h stdint.h stdbool.h stdlib.h string.h unistd.h])
### HDF5

View File

@ -52,11 +52,12 @@ typedef int32_t trexio_exit_code;
#include <pthread.h>
#include <assert.h>
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include "trexio.h"
#include "trexio_s.h"
#include "trexio_private.h"
#include "trexio_s.h"
#include "trexio_text.h"
#include "trexio_hdf5.h"
/*
@ -73,6 +74,7 @@ typedef int32_t trexio_exit_code;
#include "trexio.h"
#include <pthread.h>
#include <assert.h>
#include <stdbool.h>
#+end_src
* Coding conventions
@ -429,11 +431,12 @@ typedef struct trexio_s trexio_t;
#+begin_src c :tangle prefix_s_front.h
struct trexio_s {
char* file_name;
char file_name[TREXIO_MAX_FILENAME_LENGTH];
pthread_mutex_t thread_lock;
back_end_t back_end;
char mode;
char padding[7]; /* Ensures the proper alignment of back ends */
bool one_based;
char padding[6]; /* Ensures the proper alignment of back ends */
};
#+end_src
** Polymorphism of the file handle
@ -466,11 +469,13 @@ struct trexio_back_end_s {
output:
~trexio_t~ file handle
Note: the ~file_name~ in TEXT back end actually corresponds to the name of the folder where ~.txt~
data files are stored. The actual name of each ~.txt~ file corresponds to the group name provided in
~trex.config~ (e.g. ~nucleus.txt~ for nuclei-related data).
These names are populated by the generator.py (i.e. they are hard-coded), which is why the user
should tend to avoid renaming the ~.txt~ data files.
Note: the ~file_name~ in TEXT back end actually corresponds to the
name of the directory where ~.txt~ data files are stored. The
actual name of each ~.txt~ file corresponds to the group name
provided in ~trex.config~ (e.g. ~nucleus.txt~ for nuclei-related
data). These names are populated by the generator.py (i.e. they
are hard-coded), which is why the user should tend to avoid
renaming the ~.txt~ data files.
#+begin_src c :tangle prefix_front.h :exports none
trexio_t* trexio_open(const char* file_name, const char mode, const back_end_t back_end);
@ -517,16 +522,15 @@ trexio_open(const char* file_name, const char mode,
/* Data for the parent type */
result->file_name = CALLOC(TREXIO_MAX_FILENAME_LENGTH, char);
strncpy(result->file_name, file_name, TREXIO_MAX_FILENAME_LENGTH);
if (result->file_name[TREXIO_MAX_FILENAME_LENGTH-1] != '\0') {
free(result->file_name);
free(result);
return NULL;
}
result->back_end = back_end;
result->mode = mode;
result->one_based = false; // Need to be flipped in Fortran interface
int irc = pthread_mutex_init ( &(result->thread_lock), NULL);
assert (irc == 0);
@ -553,7 +557,6 @@ trexio_open(const char* file_name, const char mode,
}
if (rc != TREXIO_SUCCESS) {
free(result->file_name);
free(result);
return NULL;
}
@ -579,7 +582,6 @@ trexio_open(const char* file_name, const char mode,
}
if (rc != TREXIO_SUCCESS) {
free(result->file_name);
free(result);
return NULL;
}
@ -599,7 +601,35 @@ interface
end function trexio_open_c
end interface
#+end_src
Because arrays are zero-based in Fortran, we need to set a flag to
know if we need to shift by 1 arrays of indices.
#+begin_src c :tangle prefix_front.h :exports none
trexio_exit_code trexio_set_one_based(trexio_t* file);
#+end_src
#+begin_src c :tangle prefix_front.c
trexio_exit_code trexio_set_one_based(trexio_t* file)
{
if (file == NULL)
return TREXIO_FILE_ERROR;
file->one_based = true;
return TREXIO_SUCCESS;
}
#+end_src
#+begin_src f90 :tangle prefix_fortran.f90
interface
integer function trexio_set_one_based(trex_file) bind(C)
use, intrinsic :: iso_c_binding
integer(8), intent(in), value :: trex_file
end function trexio_set_one_based
end interface
#+end_src
** File closing
~trexio_close~ closes an existing ~trexio_t~ file.
@ -643,7 +673,6 @@ trexio_close (trexio_t* file)
}
if (rc != TREXIO_SUCCESS) {
FREE(file->file_name);
FREE(file);
return rc;
}
@ -670,8 +699,6 @@ trexio_close (trexio_t* file)
/* Terminate front end */
FREE(file->file_name);
int irc = pthread_mutex_destroy( &(file->thread_lock) );
free(file);
@ -1081,6 +1108,7 @@ trexio_read_$group_dset$_64 (trexio_t* const file, $group_dset_dtype_double$* co
/* Error handling for this call is added by the generator */
rc = trexio_read_$group_dset_dim$_64(file, &($group_dset_dim$));
if (rc != TREXIO_SUCCESS) return rc;
if ($group_dset_dim$ == 0L) return TREXIO_INVALID_NUM;
@ -1089,22 +1117,36 @@ trexio_read_$group_dset$_64 (trexio_t* const file, $group_dset_dtype_double$* co
assert(file->back_end < TREXIO_INVALID_BACK_END);
rc = TREXIO_FAILURE;
switch (file->back_end) {
case TREXIO_TEXT:
return trexio_text_read_$group_dset$(file, $group_dset$, rank, dims);
rc = trexio_text_read_$group_dset$(file, $group_dset$, rank, dims);
break;
case TREXIO_HDF5:
return trexio_hdf5_read_$group_dset$(file, $group_dset$, rank, dims);
rc = trexio_hdf5_read_$group_dset$(file, $group_dset$, rank, dims);
break;
/*
case TREXIO_JSON:
return trexio_json_read_$group_dset$(file, $group_dset$, rank, dims);
rc = trexio_json_read_$group_dset$(file, $group_dset$, rank, dims);
break;
,*/
}
return TREXIO_FAILURE;
if (rc != TREXIO_SUCCESS) return rc;
/* Handle index type */
if ($is_index$) {
uint64_t dim_size = 1;
for (uint32_t i=0; i<rank; ++i){
dim_size *= dims[i];
}
for (uint64_t i=0; i<dim_size; ++i){
$group_dset$[i] += ($group_dset_dtype_single$) 1;
}
}
return TREXIO_SUCCESS;
}
#+end_src
@ -1122,30 +1164,56 @@ trexio_write_$group_dset$_64 (trexio_t* const file, const $group_dset_dtype_doub
/* Error handling for this call is added by the generator */
rc = trexio_read_$group_dset_dim$_64(file, &($group_dset_dim$));
if (rc != TREXIO_SUCCESS) return rc;
if ($group_dset_dim$ == 0L) return TREXIO_INVALID_NUM;
uint32_t rank = $group_dset_rank$;
uint64_t dims[$group_dset_rank$] = {$group_dset_dim_list$};
$group_dset_dtype_double$* $group_dset$_p = $group_dset$;
/* Handle index type */
if ($is_index$) {
uint64_t dim_size = 1;
for (uint32_t i=0; i<rank; ++i){
dim_size *= dims[i];
}
$group_dset$_p = CALLOC(dim_size, $group_dset_dtype_double$);
if ($group_dset$_p == NULL) return TREXIO_ALLOCATION_FAILED;
for (uint64_t i=0; i<dim_size; ++i){
$group_dset$_p[i] = $group_dset$_p[i] - ($group_dset_dtype_single$) 1;
}
}
assert(file->back_end < TREXIO_INVALID_BACK_END);
rc = TREXIO_FAILURE;
switch (file->back_end) {
case TREXIO_TEXT:
return trexio_text_write_$group_dset$(file, $group_dset$, rank, dims);
rc = trexio_text_write_$group_dset$(file, $group_dset$_p, rank, dims);
break;
case TREXIO_HDF5:
return trexio_hdf5_write_$group_dset$(file, $group_dset$, rank, dims);
rc = trexio_hdf5_write_$group_dset$(file, $group_dset$_p, rank, dims);
break;
/*
case TREXIO_JSON:
return trexio_json_write_$group_dset$(file, $group_dset$, rank, dims);
rc = trexio_json_write_$group_dset$(file, $group_dset$_p, rank, dims);
break;
,*/
}
return TREXIO_FAILURE;
/* Handle index type */
if ($is_index$) {
FREE($group_dset$_p);
}
return rc;
}
#+end_src
@ -1169,7 +1237,7 @@ trexio_read_$group_dset$_32 (trexio_t* const file, $group_dset_dtype_single$* co
uint64_t dims[$group_dset_rank$] = {$group_dset_dim_list$};
uint64_t dim_size = 1;
for (unsigned int i=0; i<rank; ++i){
for (uint32_t i=0; i<rank; ++i){
dim_size *= dims[i];
}
@ -1201,8 +1269,14 @@ trexio_read_$group_dset$_32 (trexio_t* const file, $group_dset_dtype_single$* co
return rc;
}
for (uint64_t i=0; i<dim_size; ++i){
$group_dset$[i] = ($group_dset_dtype_single$) $group_dset$_64[i];
if ($is_index$) {
for (uint64_t i=0; i<dim_size; ++i){
$group_dset$[i] = ($group_dset_dtype_single$) $group_dset$_64[i] + ($group_dset_dtype_single$) 1;
}
} else {
for (uint64_t i=0; i<dim_size; ++i){
$group_dset$[i] = ($group_dset_dtype_single$) $group_dset$_64[i];
}
}
FREE($group_dset$_64);
@ -1231,7 +1305,7 @@ trexio_write_$group_dset$_32 (trexio_t* const file, const $group_dset_dtype_sing
uint64_t dims[$group_dset_rank$] = {$group_dset_dim_list$};
uint64_t dim_size = 1;
for (unsigned int i=0; i<rank; ++i){
for (uint32_t i=0; i<rank; ++i){
dim_size *= dims[i];
}
@ -1239,8 +1313,14 @@ trexio_write_$group_dset$_32 (trexio_t* const file, const $group_dset_dtype_sing
if ($group_dset$_64 == NULL) return TREXIO_ALLOCATION_FAILED;
/* A type conversion from single precision to double reqired since back end only accepts 64-bit data */
for (uint64_t i=0; i<dim_size; ++i){
$group_dset$_64[i] = ($group_dset_dtype_double$) $group_dset$[i];
if ($is_index$) {
for (uint64_t i=0; i<dim_size; ++i){
$group_dset$_64[i] = ($group_dset_dtype_double$) $group_dset$[i] - ($group_dset_dtype_double$) 1;
}
} else {
for (uint64_t i=0; i<dim_size; ++i){
$group_dset$_64[i] = ($group_dset_dtype_double$) $group_dset$[i];
}
}
assert(file->back_end < TREXIO_INVALID_BACK_END);
@ -2032,13 +2112,22 @@ contains
integer(8) function trexio_open (filename, mode, backend)
use, intrinsic :: iso_c_binding, only : c_null_char
implicit none
character(len=*), intent(in) :: filename
character, intent(in), value :: mode
character(len=*), intent(in) :: filename
character, intent(in), value :: mode
integer(trexio_backend), intent(in), value :: backend
character(len=len_trim(filename)+1) :: filename_c
integer :: rc
filename_c = trim(filename) // c_null_char
trexio_open = trexio_open_c(filename_c, mode, backend)
if (trexio_open == 0_8) then
return
endif
rc = trexio_set_one_based(trexio_open)
if (rc /= TREXIO_SUCCESS) then
rc = trexio_close(trexio_open)
trexio_open = 0_8
endif
end function trexio_open
#+end_src

View File

@ -35,6 +35,8 @@ subroutine test_write(file_name, back_end)
integer :: rc = 1
integer :: num
integer :: basis_nucleus_index(12)
double precision :: charge(12)
double precision :: coord(3,12)
@ -58,6 +60,8 @@ subroutine test_write(file_name, back_end)
0.00000000d0, 2.47304151d0 , 0.00000000d0 /), &
shape(coord) )
basis_nucleus_index = (/ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 /)
label = [character(len=8) :: 'C', 'Na','C', 'C 66', 'C','C', 'H 99', 'Ru', 'H', 'H', 'H', 'H' ]
sym_str = 'B3U with some comments'
@ -89,6 +93,11 @@ subroutine test_write(file_name, back_end)
deallocate(sym_str)
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE POINT GROUP')
rc = trexio_write_basis_nucleus_index(trex_file, basis_nucleus_index)
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS WRITE INDEX')
rc = trexio_has_nucleus_num(trex_file)
call trexio_assert(rc, TREXIO_SUCCESS, 'SUCCESS HAS 1')
@ -119,6 +128,7 @@ subroutine test_read(file_name, back_end)
integer :: rc = 1
integer :: num, num_read
integer :: basis_nucleus_index(12)
double precision :: charge(12)
double precision :: coord(3,12)
@ -177,6 +187,16 @@ subroutine test_read(file_name, back_end)
endif
rc = trexio_read_basis_nucleus_index(trex_file, basis_nucleus_index)
call trexio_assert(rc, TREXIO_SUCCESS)
if (basis_nucleus_index(12) == 12) then
write(*,*) 'SUCCESS READ INDEX'
else
print *, 'FAILURE INDEX CHECK'
call exit(-1)
endif
rc = trexio_read_nucleus_point_group(trex_file, sym_str, 10)
call trexio_assert(rc, TREXIO_SUCCESS)
if (sym_str(1:3) == 'B3U') then
@ -186,6 +206,7 @@ subroutine test_read(file_name, back_end)
call exit(-1)
endif
rc = trexio_close(trex_file)
call trexio_assert(rc, TREXIO_SUCCESS)

View File

@ -100,7 +100,7 @@ def recursive_populate_file(fname: str, paths: dict, detailed_source: dict) -> N
fname_new = join('populated',f'pop_{fname}')
templ_path = get_template_path(fname, paths)
triggers = ['group_dset_dtype', 'group_dset_h5_dtype', 'default_prec',
triggers = ['group_dset_dtype', 'group_dset_h5_dtype', 'default_prec', 'is_index',
'group_dset_f_dtype_default', 'group_dset_f_dtype_double', 'group_dset_f_dtype_single',
'group_dset_dtype_default', 'group_dset_dtype_double', 'group_dset_dtype_single',
'group_dset_rank', 'group_dset_dim_list', 'group_dset_f_dims',
@ -542,7 +542,7 @@ def split_dset_dict_detailed (datasets: dict) -> tuple:
default_prec = '64'
group_dset_std_dtype_out = '24.16e'
group_dset_std_dtype_in = 'lf'
elif v[0] == 'int':
elif v[0] in ['int', 'index']:
datatype = 'int64_t'
group_dset_h5_dtype = 'native_int64'
group_dset_f_dtype_default= 'integer(4)'
@ -564,6 +564,11 @@ def split_dset_dict_detailed (datasets: dict) -> tuple:
# add the dset name for templates
tmp_dict['group_dset'] = k
# add flag to detect index types
if 'index' == v[0]:
tmp_dict['is_index'] = 'file->one_based'
else:
tmp_dict['is_index'] = 'false'
# add the datatypes for templates
tmp_dict['dtype'] = datatype
tmp_dict['group_dset_dtype'] = datatype

104
trex.json
View File

@ -1,104 +0,0 @@
{
"metadata": {
"code_num" : [ "int", [] ]
, "code" : [ "str", [ "metadata.code_num" ] ]
, "author_num" : [ "int", [] ]
, "author" : [ "str", [ "metadata.author_num" ] ]
, "description" : [ "str", [] ]
} ,
"electron": {
"up_num" : [ "int", [] ]
, "dn_num" : [ "int", [] ]
} ,
"nucleus": {
"num" : [ "int" , [] ]
, "charge" : [ "float", [ "nucleus.num" ] ]
, "coord" : [ "float", [ "nucleus.num", "3" ] ]
, "label" : [ "str" , [ "nucleus.num" ] ]
, "point_group" : [ "str" , [] ]
} ,
"ecp": {
"lmax_plus_1" : [ "int" , [ "nucleus.num" ] ]
, "z_core" : [ "float", [ "nucleus.num" ] ]
, "local_n" : [ "int" , [ "nucleus.num" ] ]
, "local_num_n_max" : [ "int" , [] ]
, "local_exponent" : [ "float", [ "nucleus.num", "ecp.local_num_n_max" ] ]
, "local_coef" : [ "float", [ "nucleus.num", "ecp.local_num_n_max" ] ]
, "local_power" : [ "int" , [ "nucleus.num", "ecp.local_num_n_max" ] ]
, "non_local_n" : [ "int" , [ "nucleus.num" ] ]
, "non_local_num_n_max" : [ "int" , [] ]
, "non_local_exponent" : [ "float", [ "nucleus.num", "ecp.non_local_num_n_max" ] ]
, "non_local_coef" : [ "float", [ "nucleus.num", "ecp.non_local_num_n_max" ] ]
, "non_local_power" : [ "int" , [ "nucleus.num", "ecp.non_local_num_n_max" ] ]
} ,
"basis": {
"type" : [ "str" , [] ]
, "shell_num" : [ "int" , [] ]
, "shell_center" : [ "int" , [ "basis.shell_num" ] ]
, "shell_ang_mom" : [ "int" , [ "basis.shell_num" ] ]
, "shell_prim_num" : [ "int" , [ "basis.shell_num" ] ]
, "shell_factor" : [ "float", [ "basis.shell_num" ] ]
, "prim_index" : [ "int" , [ "basis.shell_num" ] ]
, "prim_num" : [ "int" , [] ]
, "exponent" : [ "float", [ "basis.prim_num" ] ]
, "coefficient" : [ "float", [ "basis.prim_num" ] ]
, "prim_factor" : [ "float", [ "basis.prim_num" ] ]
} ,
"ao": {
"cartesian" : [ "int" , [] ]
, "num" : [ "int" , [] ]
, "shell" : [ "int" , [ "ao.num" ] ]
, "normalization" : [ "float", [ "ao.num" ] ]
} ,
"ao_1e_int": {
"overlap" : [ "float", [ "ao.num", "ao.num" ] ]
, "kinetic" : [ "float", [ "ao.num", "ao.num" ] ]
, "potential_n_e" : [ "float", [ "ao.num", "ao.num" ] ]
, "ecp_local" : [ "float", [ "ao.num", "ao.num" ] ]
, "ecp_non_local" : [ "float", [ "ao.num", "ao.num" ] ]
, "core_hamiltonian" : [ "float", [ "ao.num", "ao.num" ] ]
} ,
"ao_2e_int": {
"eri" : [ "float sparse", [ "ao.num", "ao.num", "ao.num", "ao.num" ] ]
, "eri_lr" : [ "float sparse", [ "ao.num", "ao.num", "ao.num", "ao.num" ] ]
} ,
"mo": {
"type" : [ "str" , [] ]
, "num" : [ "int" , [] ]
, "coefficient" : [ "float", [ "mo.num", "ao.num" ] ]
, "class" : [ "str" , [ "mo.num" ] ]
, "symmetry" : [ "str" , [ "mo.num" ] ]
, "occupation" : [ "float", [ "mo.num" ] ]
} ,
"mo_1e_int": {
"overlap" : [ "float", [ "mo.num", "mo.num" ] ]
, "kinetic" : [ "float", [ "mo.num", "mo.num" ] ]
, "potential_n_e" : [ "float", [ "mo.num", "mo.num" ] ]
, "ecp_local" : [ "float", [ "mo.num", "mo.num" ] ]
, "ecp_non_local" : [ "float", [ "mo.num", "mo.num" ] ]
, "core_hamiltonian" : [ "float", [ "mo.num", "mo.num" ] ]
} ,
"mo_2e_int": {
"eri" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
, "eri_lr" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
} ,
"rdm": {
"one_e" : [ "float" , [ "mo.num", "mo.num" ] ]
, "one_e_up" : [ "float" , [ "mo.num", "mo.num" ] ]
, "one_e_dn" : [ "float" , [ "mo.num", "mo.num" ] ]
, "two_e" : [ "float sparse", [ "mo.num", "mo.num", "mo.num", "mo.num" ] ]
}
}

120
trex.org
View File

@ -7,6 +7,10 @@ column-major order (as in Fortran), and the ordering of the dimensions
is reversed in the produces JSON configuration file as the library is
written in C.
In Fortran, the arrays are 1-based and in most other languages the
arrays are 0-base. Hence, we introduce the ~index~ type which is an
1-based ~int~ in the Fortran interface and 0-based otherwise.
#+begin_src python :tangle trex.json
{
#+end_src
@ -158,8 +162,8 @@ written in C.
* Basis set
We consider here basis functions centered on nuclei. Hence, we enable
the possibility to define \emph{dummy atoms} to place basis functions
in random positions.
the possibility to define /dummy atoms/ to place basis functions in
random positions.
The atomic basis set is defined as a list of shells. Each shell $s$ is
centered on a center $A$, possesses a given angular momentum $l$ and a
@ -185,25 +189,28 @@ written in C.
Some codes assume that the contraction coefficients are for a linear
combination of /normalized/ primitives. This implies that a normalization
constant for the primitive $ks$ needs to be computed and stored. If
this normalization factor is not required, set $f_{ks}$ to one.
this normalization factor is not required, $f_{ks}=1$.
Some codes assume that the basis function are normalized. This
implies the computation of an extra normalization factor, $\mathcal{N}_s$.
If the the basis function is not normalized, set $\mathcal{N}_s=1$.
If the the basis function is not considered normalized, $\mathcal{N}_s=1$.
All the basis set parameters are stored in one-dimensional arrays:
#+NAME: basis
| ~type~ | ~str~ | | Type of basis set: "Gaussian" or "Slater" |
| ~shell_num~ | ~int~ | | Total Number of shells |
| ~shell_center~ | ~int~ | ~(basis.shell_num)~ | Nucleus on which the shell is centered ($A$) |
| ~shell_ang_mom~ | ~int~ | ~(basis.shell_num)~ | Angular momentum ~0:S, 1:P, 2:D, ...~ |
| ~shell_prim_num~ | ~int~ | ~(basis.shell_num)~ | Number of primitives in the shell ($N_{\text{prim}}$) |
| ~shell_factor~ | ~float~ | ~(basis.shell_num)~ | Normalization factor of the shell ($\mathcal{N}_s$) |
| ~prim_index~ | ~int~ | ~(basis.shell_num)~ | Index of the first primitive in the complete list |
| ~prim_num~ | ~int~ | | Total number of primitives |
| ~exponent~ | ~float~ | ~(basis.prim_num)~ | Exponents of the primitives ($\gamma_{ks}) |
| ~coefficient~ | ~float~ | ~(basis.prim_num)~ | Coefficients of the primitives ($a_{ks}$) |
| ~prim_factor~ | ~float~ | ~(basis.prim_num)~ | Normalization coefficients for the primitives ($f_{ks}$) |
| ~type~ | ~str~ | | Type of basis set: "Gaussian" or "Slater" |
| ~num~ | ~int~ | | Total Number of shells |
| ~prim_num~ | ~int~ | | Total number of primitives |
| ~nucleus_index~ | ~index~ | ~(nucleus.num)~ | Index of the first shell of each nucleus ($A$) |
| ~nucleus_shell_num~ | ~int~ | ~(nucleus.num)~ | Number of shells for each nucleus |
| ~shell_ang_mom~ | ~int~ | ~(basis.num)~ | Angular momentum ~0:S, 1:P, 2:D, ...~ |
| ~shell_prim_num~ | ~int~ | ~(basis.num)~ | Number of primitives in the shell ($N_{\text{prim}}$) |
| ~shell_factor~ | ~float~ | ~(basis.num)~ | Normalization factor of the shell ($\mathcal{N}_s$) |
| ~shell_prim_index~ | ~index~ | ~(basis.num)~ | Index of the first primitive in the complete list |
| ~exponent~ | ~float~ | ~(basis.prim_num)~ | Exponents of the primitives ($\gamma_{ks}) |
| ~coefficient~ | ~float~ | ~(basis.prim_num)~ | Coefficients of the primitives ($a_{ks}$) |
| ~prim_factor~ | ~float~ | ~(basis.prim_num)~ | Normalization coefficients for the primitives ($f_{ks}$) |
#+CALL: json(data=basis, title="basis")
@ -211,21 +218,78 @@ written in C.
:results:
#+begin_src python :tangle trex.json
"basis": {
"type" : [ "str" , [] ]
, "shell_num" : [ "int" , [] ]
, "shell_center" : [ "int" , [ "basis.shell_num" ] ]
, "shell_ang_mom" : [ "int" , [ "basis.shell_num" ] ]
, "shell_prim_num" : [ "int" , [ "basis.shell_num" ] ]
, "shell_factor" : [ "float", [ "basis.shell_num" ] ]
, "prim_index" : [ "int" , [ "basis.shell_num" ] ]
, "prim_num" : [ "int" , [] ]
, "exponent" : [ "float", [ "basis.prim_num" ] ]
, "coefficient" : [ "float", [ "basis.prim_num" ] ]
, "prim_factor" : [ "float", [ "basis.prim_num" ] ]
"type" : [ "str" , [] ]
, "num" : [ "int" , [] ]
, "prim_num" : [ "int" , [] ]
, "nucleus_index" : [ "index" , [ "nucleus.num" ] ]
, "nucleus_shell_num" : [ "int" , [ "nucleus.num" ] ]
, "shell_ang_mom" : [ "int" , [ "basis.num" ] ]
, "shell_prim_num" : [ "int" , [ "basis.num" ] ]
, "shell_factor" : [ "float", [ "basis.num" ] ]
, "shell_prim_index" : [ "index" , [ "basis.num" ] ]
, "exponent" : [ "float", [ "basis.prim_num" ] ]
, "coefficient" : [ "float", [ "basis.prim_num" ] ]
, "prim_factor" : [ "float", [ "basis.prim_num" ] ]
} ,
#+end_src
:end:
For example, consider H_2 with the following basis set (in GAMESS
format), where both the AOs and primitives are considered normalized:
#+BEGIN_EXAMPLE
HYDROGEN
S 5
1 3.387000E+01 6.068000E-03
2 5.095000E+00 4.530800E-02
3 1.159000E+00 2.028220E-01
4 3.258000E-01 5.039030E-01
5 1.027000E-01 3.834210E-01
S 1
1 3.258000E-01 1.000000E+00
S 1
1 1.027000E-01 1.000000E+00
P 1
1 1.407000E+00 1.000000E+00
P 1
1 3.880000E-01 1.000000E+00
D 1
1 1.057000E+00 1.0000000
#+END_EXAMPLE
we have:
#+BEGIN_EXAMPLE
type = "Gaussian"
num = 12
prim_num = 20
nucleus_index = [0 , 6]
shell_ang_mom = [0 , 0 , 0 , 1 , 1 , 2 , 0 , 0 , 0 , 1 , 1 , 2 ]
shell_prim_num = [5 , 1 , 1 , 1 , 1 , 1 , 5 , 1 , 1 , 1 , 1 , 1 ]
shell_prim_index = [0 , 5 , 6 , 7 , 8 , 9 , 10, 15, 16, 17, 18, 19]
shell_factor = [1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]
exponent =
[ 33.87, 5.095, 1.159, 0.3258, 0.1027, 0.3258, 0.1027, 1.407,
0.388, 1.057, 33.87, 5.095, 1.159, 0.3258, 0.1027, 0.3258, 0.1027, 1.407,
0.388, 1.057]
coefficient =
[ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421, 1.0, 1.0,
1.0, 1.0, 1.0, 0.006068, 0.045308, 0.202822, 0.503903, 0.383421, 1.0, 1.0,
1.0, 1.0, 1.0]
prim_factor =
[ 1.0006253235944540e+01, 2.4169531573445120e+00, 7.9610924849766440e-01
3.0734305383061117e-01, 1.2929684417481876e-01, 3.0734305383061117e-01,
1.2929684417481876e-01, 2.1842769845268308e+00, 4.3649547399719840e-01,
1.8135965626177861e+00, 1.0006253235944540e+01, 2.4169531573445120e+00,
7.9610924849766440e-01, 3.0734305383061117e-01, 1.2929684417481876e-01,
3.0734305383061117e-01, 1.2929684417481876e-01, 2.1842769845268308e+00,
4.3649547399719840e-01, 1.8135965626177861e+00 ]
#+END_EXAMPLE
* Atomic orbitals
Going from the atomic basis set to AOs implies a systematic
@ -273,7 +337,7 @@ written in C.
#+NAME: ao
| ~cartesian~ | ~int~ | | ~1~: true, ~0~: false |
| ~num~ | ~int~ | | Total number of atomic orbitals |
| ~shell~ | ~int~ | ~(ao.num)~ | basis set shell for each AO |
| ~shell~ | ~index~ | ~(ao.num)~ | basis set shell for each AO |
| ~normalization~ | ~float~ | ~(ao.num)~ | Normalization factors |
#+CALL: json(data=ao, title="ao")
@ -284,7 +348,7 @@ written in C.
"ao": {
"cartesian" : [ "int" , [] ]
, "num" : [ "int" , [] ]
, "shell" : [ "int" , [ "ao.num" ] ]
, "shell" : [ "index", [ "ao.num" ] ]
, "normalization" : [ "float", [ "ao.num" ] ]
} ,
#+end_src