1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2025-01-03 01:56:13 +01:00

Patch the generator

This commit is contained in:
q-posev 2022-04-12 00:44:53 +02:00
parent 738d8de5ca
commit 3a7707ed86
3 changed files with 17 additions and 13 deletions

View File

@ -4,7 +4,6 @@ from generator_tools import *
# --------------------- GET CONFIGURATION FROM THE TREX.JSON ---------------- # # --------------------- GET CONFIGURATION FROM THE TREX.JSON ---------------- #
config_file = 'trex.json' config_file = 'trex.json'
trex_config = read_json(config_file) trex_config = read_json(config_file)
trex_config.pop('determinant')
# --------------------------------------------------------------------------- # # --------------------------------------------------------------------------- #
# -------------------- GET ATTRIBUTES FROM THE CONFIGURATION ---------------- # # -------------------- GET ATTRIBUTES FROM THE CONFIGURATION ---------------- #

View File

@ -517,7 +517,7 @@ def get_dtype_dict (dtype: str, target: str, rank = None, int_len_printf = None)
group_dset_format_printf_16 = '"' group_dset_format_printf_16 = '"'
group_dset_format_printf_32 = '"' group_dset_format_printf_32 = '"'
group_dset_format_scanf = '' group_dset_format_scanf = ''
for i in range(rank): for _ in range(rank):
group_dset_format_printf_8 += item_printf_8 group_dset_format_printf_8 += item_printf_8
group_dset_format_printf_16 += item_printf_16 group_dset_format_printf_16 += item_printf_16
group_dset_format_printf_32 += item_printf_32 group_dset_format_printf_32 += item_printf_32
@ -644,11 +644,16 @@ def split_dset_dict_detailed (datasets: dict) -> tuple:
dset_string_dict = {} dset_string_dict = {}
dset_sparse_dict = {} dset_sparse_dict = {}
for k,v in datasets.items(): for k,v in datasets.items():
# create a temp dictionary # create a temp dictionary
tmp_dict = {} tmp_dict = {}
rank = len(v[1]) rank = len(v[1])
datatype = v[0] datatype = v[0]
# skip the data which has 'special' datatype (e.g. determinants for which the code is not templated)
if 'special' in datatype:
continue
# define whether the dset is sparse # define whether the dset is sparse
is_sparse = False is_sparse = False
int_len_printf = {} int_len_printf = {}

View File

@ -641,7 +641,7 @@ prim_factor =
can be expanded in the basis of Slater determinants $D_I$ as follows can be expanded in the basis of Slater determinants $D_I$ as follows
\[ \[
|\Psi> = \sum_I C_I |D_I> | \Psi> = \sum_I C_I | D_I>
\] \]
For relatively small expansions, a given determinant can be represented as a list of ~mo.num~ occupation numbers. For relatively small expansions, a given determinant can be represented as a list of ~mo.num~ occupation numbers.
@ -650,8 +650,8 @@ prim_factor =
(see ~int bitfield~ type in the table below). By default, the chemist notation is used, namely (see ~int bitfield~ type in the table below). By default, the chemist notation is used, namely
\[ \[
| D_I > = | \alpha_1 \alpha_2 \ldots \alpha_{n\uparrow} \beta_1 \beta_2 \ldots \beta_{n\downarrow} > | D_I > = | \alpha_1 \alpha_2 \ldots \alpha_{n\uparrow} \beta_1 \beta_2 \ldots \beta_{n\downarrow} >
\ \]
where $\alpha$ and $\beta$ denote $\uparrow$-spin and $\downarrow$-spin electrons, respectively, where $\alpha$ and $\beta$ denote $\uparrow$-spin and $\downarrow$-spin electrons, respectively,
$n\uparrow$ and $n\downarrow$ correspond to ~electron.up_num~ and ~electron.dn_num~, respectively. $n\uparrow$ and $n\downarrow$ correspond to ~electron.up_num~ and ~electron.dn_num~, respectively.
@ -659,11 +659,11 @@ prim_factor =
which is why the ~determinant.list~ attribute has a second dimension. which is why the ~determinant.list~ attribute has a second dimension.
#+NAME: determinant #+NAME: determinant
| Variable | Type | Dimensions | Description | | Variable | Type | Dimensions | Description |
|---------------+----------------+------------------------+--------------------------------------------------------| |---------------+-----------------+------------------------+--------------------------------------------------------|
| ~num~ | ~dim~ | | Number of determinants | | ~num~ | ~dim~ | | Number of determinants |
| ~list~ | ~int bitfield~ | ~(determinant.num, 2)~ | List of determinants as integer bit fields | | ~list~ | ~int special~ | ~(determinant.num, 2)~ | List of determinants as integer bit fields |
| ~coefficient~ | ~float~ | ~(determinant.num)~ | Coefficients of the determinants from the CI expansion | | ~coefficient~ | ~float special~ | ~(determinant.num)~ | Coefficients of the determinants from the CI expansion |
#+CALL: json(data=determinant, title="determinant") #+CALL: json(data=determinant, title="determinant")
@ -671,9 +671,9 @@ prim_factor =
:results: :results:
#+begin_src python :tangle trex.json #+begin_src python :tangle trex.json
"determinant": { "determinant": {
"num" : [ "dim" , [] ] "num" : [ "dim" , [] ]
, "list" : [ "int binary", [ "2", "determinant.num" ] ] , "list" : [ "int special" , [ "2", "determinant.num" ] ]
, "coefficient" : [ "float" , [ "determinant.num" ] ] , "coefficient" : [ "float special", [ "determinant.num" ] ]
} , } ,
#+end_src #+end_src
:end: :end: