From 3a7707ed86b061a831a261b5f5777682a4e3612c Mon Sep 17 00:00:00 2001 From: q-posev Date: Tue, 12 Apr 2022 00:44:53 +0200 Subject: [PATCH] Patch the generator --- tools/generator.py | 1 - tools/generator_tools.py | 7 ++++++- trex.org | 22 +++++++++++----------- 3 files changed, 17 insertions(+), 13 deletions(-) diff --git a/tools/generator.py b/tools/generator.py index 3562eb8..9904921 100644 --- a/tools/generator.py +++ b/tools/generator.py @@ -4,7 +4,6 @@ from generator_tools import * # --------------------- GET CONFIGURATION FROM THE TREX.JSON ---------------- # config_file = 'trex.json' trex_config = read_json(config_file) -trex_config.pop('determinant') # --------------------------------------------------------------------------- # # -------------------- GET ATTRIBUTES FROM THE CONFIGURATION ---------------- # diff --git a/tools/generator_tools.py b/tools/generator_tools.py index c58e5f4..e5bfd02 100644 --- a/tools/generator_tools.py +++ b/tools/generator_tools.py @@ -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_32 = '"' 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_16 += item_printf_16 group_dset_format_printf_32 += item_printf_32 @@ -644,11 +644,16 @@ def split_dset_dict_detailed (datasets: dict) -> tuple: dset_string_dict = {} dset_sparse_dict = {} for k,v in datasets.items(): + # create a temp dictionary tmp_dict = {} rank = len(v[1]) 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 is_sparse = False int_len_printf = {} diff --git a/trex.org b/trex.org index f57ac5c..10501eb 100644 --- a/trex.org +++ b/trex.org @@ -641,7 +641,7 @@ prim_factor = 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. @@ -650,8 +650,8 @@ prim_factor = (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, $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. #+NAME: determinant - | Variable | Type | Dimensions | Description | - |---------------+----------------+------------------------+--------------------------------------------------------| - | ~num~ | ~dim~ | | Number of determinants | - | ~list~ | ~int bitfield~ | ~(determinant.num, 2)~ | List of determinants as integer bit fields | - | ~coefficient~ | ~float~ | ~(determinant.num)~ | Coefficients of the determinants from the CI expansion | + | Variable | Type | Dimensions | Description | + |---------------+-----------------+------------------------+--------------------------------------------------------| + | ~num~ | ~dim~ | | Number of determinants | + | ~list~ | ~int special~ | ~(determinant.num, 2)~ | List of determinants as integer bit fields | + | ~coefficient~ | ~float special~ | ~(determinant.num)~ | Coefficients of the determinants from the CI expansion | #+CALL: json(data=determinant, title="determinant") @@ -671,9 +671,9 @@ prim_factor = :results: #+begin_src python :tangle trex.json "determinant": { - "num" : [ "dim" , [] ] - , "list" : [ "int binary", [ "2", "determinant.num" ] ] - , "coefficient" : [ "float" , [ "determinant.num" ] ] + "num" : [ "dim" , [] ] + , "list" : [ "int special" , [ "2", "determinant.num" ] ] + , "coefficient" : [ "float special", [ "determinant.num" ] ] } , #+end_src :end: