From ed6192f1b2c73976c11515368b40abbbbb6fdd37 Mon Sep 17 00:00:00 2001 From: q-posev <45995097+q-posev@users.noreply.github.com> Date: Thu, 19 May 2022 15:24:20 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20TREX-CoE?= =?UTF-8?q?/trexio@760d85612abe8e3c2d83887a2c5c16da54096828=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.html | 4 +- examples.html | 82 +++--- index.html | 4 +- templator_front.html | 597 +++++++++++++++++++++---------------------- templator_hdf5.html | 77 +++--- templator_text.html | 279 +++++++++----------- trex.html | 134 +++++----- 7 files changed, 557 insertions(+), 620 deletions(-) diff --git a/README.html b/README.html index 8e2bede..3889a1a 100644 --- a/README.html +++ b/README.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + TREXIO source code documentation @@ -347,7 +347,7 @@ and bug reports should be submitted at

Author: TREX-CoE

-

Created: 2022-05-18 Wed 09:56

+

Created: 2022-05-19 Thu 15:24

Validate

diff --git a/examples.html b/examples.html index 0b3ec5a..a37997f 100644 --- a/examples.html +++ b/examples.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Examples @@ -333,24 +333,24 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Accessing sparse quantities

+
+

1 Accessing sparse quantities

-
-

1.1 Fortran

+
+

1.1 Fortran

program print_energy
@@ -411,8 +411,8 @@ One needs to read from the TREXIO file:
 
-
-

1.1.1 Declare Temporary variables

+
+

1.1.1 Declare Temporary variables

integer                       :: i, j, k, l, m
@@ -427,8 +427,8 @@ One needs to read from the TREXIO file:
 
-
-

1.1.2 Obtain the name of the TREXIO file from the command line, and open it for reading

+
+

1.1.2 Obtain the name of the TREXIO file from the command line, and open it for reading

call getarg(1, filename)
@@ -444,8 +444,8 @@ f = trexio_open (filename, 'r', TREXIO_HDF5
 
-
-

1.1.3 Read the nuclear repulsion energy

+
+

1.1.3 Read the nuclear repulsion energy

rc = trexio_read_nucleus_repulsion(f, E_nn)
@@ -459,8 +459,8 @@ f = trexio_open (filename, 'r', TREXIO_HDF5
 
-
-

1.1.4 Read the number of molecular orbitals

+
+

1.1.4 Read the number of molecular orbitals

rc = trexio_read_mo_num(f, n)
@@ -474,8 +474,8 @@ f = trexio_open (filename, 'r', TREXIO_HDF5
 
-
-

1.1.5 Allocate memory

+
+

1.1.5 Allocate memory

allocate( D(n,n), h0(n,n) )
@@ -487,8 +487,8 @@ W(:,:,:,:) = 0.d0
 
-
-

1.1.6 Read one-electron quantities

+
+

1.1.6 Read one-electron quantities

rc = trexio_has_mo_1e_int_core_hamiltonian(f)
@@ -520,8 +520,8 @@ rc = trexio_read_rdm_1e(f, D)
 
-
-

1.1.7 Read two-electron quantities

+
+

1.1.7 Read two-electron quantities

Reading is done with OpenMP. Each thread reads its own buffer, and @@ -537,8 +537,8 @@ to be protected in the critical section when modified.

-
-
1.1.7.1 Electron repulsion integrals
+
+
1.1.7.1 Electron repulsion integrals
rc = trexio_has_mo_2e_int_eri(f)
@@ -587,8 +587,8 @@ icount = BUFSIZE
 
-
-
1.1.7.2 Reduced density matrix
+
+
1.1.7.2 Reduced density matrix
rc = trexio_has_rdm_2e(f)
@@ -632,8 +632,8 @@ icount = bufsize
 
-
-

1.1.8 Compute the energy

+
+

1.1.8 Compute the energy

When the orbitals are real, we can use @@ -679,8 +679,8 @@ E = E + E_nn

-
-

1.1.9 Terminate

+
+

1.1.9 Terminate

  deallocate( D, h0, G, W )
@@ -695,7 +695,7 @@ E = E + E_nn
 

Author: TREX-CoE

-

Created: 2022-05-18 Wed 09:56

+

Created: 2022-05-19 Thu 15:24

Validate

diff --git a/index.html b/index.html index 8e2bede..3889a1a 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + TREXIO source code documentation @@ -347,7 +347,7 @@ and bug reports should be submitted at

Author: TREX-CoE

-

Created: 2022-05-18 Wed 09:56

+

Created: 2022-05-19 Thu 15:24

Validate

diff --git a/templator_front.html b/templator_front.html index f525e22..b2ff570 100644 --- a/templator_front.html +++ b/templator_front.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + Front end API @@ -333,174 +333,173 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Coding conventions

+
+

1 Coding conventions

  • integer types will be defined using types given in stdint.h
  • @@ -515,8 +514,8 @@ for the JavaScript code in this tag.
-
-

1.1 Memory allocation

+
+

1.1 Memory allocation

Memory allocation of structures can be facilitated by using the @@ -527,7 +526,7 @@ For CALLOC, we allocate N+1 to avoid errors when N=0.

#define MALLOC(T) (T*) malloc (sizeof(T))
-#define CALLOC(N,T) (T*) calloc ( (N)+1 , sizeof(T) )     
+#define CALLOC(N,T) (T*) calloc ( (N)+1 , sizeof(T) )
 
@@ -552,8 +551,8 @@ The maximum string size for the filenames is 4096 characters.
-
-

2 Front end

+
+

2 Front end

All calls to TREXIO are thread-safe. @@ -561,10 +560,10 @@ TREXIO front end is modular, which simplifies implementation of new back ends.

-
-

2.1 Error handling

+
+

2.1 Error handling

- +
@@ -853,8 +852,8 @@ and the corresponding message are not propagated to the source code. -
-

2.1.1 Decoding errors

+
+

2.1.1 Decoding errors

The trexio_string_of_error converts an exit code into a string. The @@ -880,8 +879,8 @@ and the corresponding message are not propagated to the source code.

-
-
2.1.1.1 C source code
+
+
2.1.1.1 C source code
const char*
@@ -1016,8 +1015,8 @@ and the corresponding message are not propagated to the source code.
 
-
-
2.1.1.2 Fortran interface
+
+
2.1.1.2 Fortran interface
interface
@@ -1033,8 +1032,8 @@ and the corresponding message are not propagated to the source code.
 
-
-
2.1.1.3 Python interface
+
+
2.1.1.3 Python interface
class Error(Exception):
@@ -1067,8 +1066,8 @@ and the corresponding message are not propagated to the source code.
 
-
-

2.2 Back ends

+
+

2.2 Back ends

TREXIO has several back ends: @@ -1093,12 +1092,12 @@ lines that correspond to the TREXIO_JSON back end (not implemented

-Note: It is important to increment the value of TREXIO_INVALID_BACK_END when a new back end is added. Otherwise, it will not be available. +Note: It is important to increment the value of TREXIO_INVALID_BACK_END when a new back end is implemented. Otherwise, it will not be available.

-
-

2.2.1 C

+
+

2.2.1 C

typedef int32_t back_end_t;
@@ -1147,8 +1146,8 @@ This is useful due to the fact that HDF5 back end can be disabled at configure s
 
-
-

2.2.2 Fortran

+
+

2.2.2 Fortran

  integer(trexio_back_end_t), parameter :: TREXIO_HDF5 = 0
@@ -1189,8 +1188,8 @@ consistency, in version 2.2 it was renamed trexio_has_back_end.
 
-
-

2.2.3 Python

+
+

2.2.3 Python

# define TREXIO back ends
@@ -1205,8 +1204,8 @@ consistency, in version 2.2 it was renamed trexio_has_back_end.
 
-
-

2.3 Read/write behavior

+
+

2.3 Read/write behavior

Every time a reading function is called, the data is read from the @@ -1235,8 +1234,8 @@ concurrent programs, the behavior is not specified.

-
-

2.4 TREXIO file type

+
+

2.4 TREXIO file type

trexio_s is the the main type for TREXIO files, visible to the users @@ -1392,30 +1391,10 @@ to work with TREXIO files.

-
-

2.5 TODO (Remove) : Polymorphism of the file handle

+
+

2.5 File opening

-Polymorphism of the trexio_t type is handled by ensuring that the -corresponding types for all back ends can be safely casted to -trexio_t. This is done by making the back-end structs start with -struct trexio_s: -

- -
-
struct trexio_back_end_s {
-  trexio_t     parent ;
-  /* add below specific back-end data */
-}
-
-
-
-
- -
-

2.6 File opening

-
-

trexio_open creates a new TREXIO file or opens the existing one.

@@ -1469,9 +1448,9 @@ renaming the .txt data files.

-
-

2.6.1 C

-
+
+

2.5.1 C

+
trexio_t*
 trexio_open(const char* file_name, const char mode,
@@ -1787,9 +1766,9 @@ renaming the .txt data files.
 
-
-

2.6.2 Fortran

-
+
+

2.5.2 Fortran

+
interface
    integer(trexio_t) function trexio_open_c (filename, mode, back_end, rc_open) bind(C, name="trexio_open")
@@ -1806,9 +1785,9 @@ renaming the .txt data files.
 
-
-

2.6.3 Python

-
+
+

2.5.3 Python

+
def _open(file_name: str, mode: str, back_end: int):
     """Create TREXIO file or open existing one.
@@ -1855,9 +1834,9 @@ renaming the .txt data files.
 
-
-

2.6.4 Zero-based versus one-based arrays of indices

-
+
+

2.5.4 Zero-based versus one-based arrays of indices

+

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. @@ -1889,9 +1868,9 @@ know if we need to shift by 1 arrays of indices.

-
-

2.7 File closing

-
+
+

2.6 File closing

+

trexio_close closes an existing trexio_t file.

@@ -1907,9 +1886,9 @@ output:

-
-

2.7.1 C

-
+
+

2.6.1 C

+
trexio_exit_code
 trexio_close (trexio_t* file)
@@ -1993,9 +1972,9 @@ output:
 
-
-

2.7.2 Fortran

-
+
+

2.6.2 Fortran

+
interface
    integer(trexio_exit_code) function trexio_close (trex_file) bind(C)
@@ -2009,9 +1988,9 @@ output:
 
-
-

2.7.3 Python

-
+
+

2.6.3 Python

+
def _close(trexio_file):
     """Close TREXIO file.
@@ -2028,9 +2007,9 @@ output:
 
-
-

2.8 File existence

-
+
+

2.7 File existence

+

trexio_inquire check whether TREXIO file exists.

@@ -2066,9 +2045,9 @@ You can see examples of both functionalities in test_f.f90 (search

-
-

2.8.1 C

-
+
+

2.7.1 C

+
trexio_exit_code
 trexio_inquire (const char* file_name)
@@ -2097,9 +2076,9 @@ You can see examples of both functionalities in test_f.f90  (search
 
-
-

2.8.2 Fortran

-
+
+

2.7.2 Fortran

+

The function below is a C binding. The front end Fortran function for trexio_inquire can be found in the Fortran helper/wrapper functions. @@ -2118,9 +2097,9 @@ The front end Fortran function for trexio_inquire can be found in t

-
-

2.8.3 Python

-
+
+

2.7.3 Python

+
def _inquire(file_name: str) -> bool:
     """Check whether ~file_name~ TREXIO file exists.
@@ -2138,9 +2117,9 @@ The front end Fortran function for trexio_inquire can be found in t
 
-
-

2.9 File state

-
+
+

2.8 File state

+

trexio_set_state set an existing trexio_t file handle to a given state. trexio_get_state returns current sate of the trexio_t file handle. @@ -2158,9 +2137,9 @@ output:

-
-

2.9.1 C

-
+
+

2.8.1 C

+
trexio_exit_code
 trexio_set_state (trexio_t* file, const int32_t num)
@@ -2187,9 +2166,9 @@ output:
 
-
-

2.9.2 Fortran

-
+
+

2.8.2 Fortran

+
interface
    integer(trexio_exit_code) function trexio_set_state (trex_file, state) bind(C)
@@ -2213,9 +2192,9 @@ output:
 
-
-

2.9.3 Python

-
+
+

2.8.3 Python

+

See TREXIO File Python class.

@@ -2223,9 +2202,9 @@ See TREXIO File Python class.
-
-

2.10 Tasks to be done before closing

-
+
+

2.9 Tasks to be done before closing

+
trexio_exit_code
 trexio_pre_close (trexio_t* file)
@@ -2325,12 +2304,12 @@ See TREXIO File Python class.
 
-
-

3 Templates for front end

+
+

3 Templates for front end

-
-

3.1 Description

+
+

3.1 Description

Consider the following block of trex.json: @@ -2551,12 +2530,12 @@ value will result in TREXIO_INVALID_ARG_2 exit code.

-
-

3.2 Templates for front end has/read/write a single numerical attribute

+
+

3.2 Templates for front end has/read/write a single numerical attribute

-
-

3.2.1 Introduction

+
+

3.2.1 Introduction

This section concerns API calls related to numerical attributes, @@ -2627,8 +2606,8 @@ namely single value of int/float types.

-
-

3.2.2 C templates for front end

+
+

3.2.2 C templates for front end

The C templates that correspond to each of the abovementioned @@ -2642,12 +2621,12 @@ precision (see Table above).

-
-
3.2.2.1 Function declarations
+
+
3.2.2.1 Function declarations
-
-
3.2.2.2 Source code for double precision functions
+
+
3.2.2.2 Source code for double precision functions
trexio_exit_code
@@ -2711,8 +2690,8 @@ precision (see Table above).
 
-
-
3.2.2.3 Source code for single precision functions
+
+
3.2.2.3 Source code for single precision functions
trexio_exit_code
@@ -2788,8 +2767,8 @@ precision (see Table above).
 
-
-
3.2.2.4 Source code for default functions
+
+
3.2.2.4 Source code for default functions
trexio_exit_code
@@ -2844,8 +2823,8 @@ precision (see Table above).
 
-
-

3.2.3 Fortran templates for front end

+
+

3.2.3 Fortran templates for front end

The Fortran templates that provide an access to the C API calls from Fortran. @@ -2937,8 +2916,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

3.2.4 Python templates for front end

+
+

3.2.4 Python templates for front end

def write_$group_num$(trexio_file, num_w: $group_num_py_dtype$) -> None:
@@ -3011,12 +2990,12 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

3.3 Templates for front end has/read/write a dataset of numerical data

+
+

3.3 Templates for front end has/read/write a dataset of numerical data

-
-

3.3.1 Introduction

+
+

3.3.1 Introduction

This section concerns API calls related to datasets. @@ -3098,8 +3077,8 @@ This section concerns API calls related to datasets.

-
-

3.3.2 C templates for front end

+
+

3.3.2 C templates for front end

The C templates that correspond to each of the abovementioned functions can be found below. @@ -3110,12 +3089,12 @@ The basic (non-suffixed) API call on datasets deals with real(cdouble

-
-
3.3.2.1 Function declarations
+
+
3.3.2.1 Function declarations
-
-
3.3.2.2 Source code for double precision functions
+
+
3.3.2.2 Source code for double precision functions
trexio_exit_code
@@ -3278,8 +3257,8 @@ The basic (non-suffixed) API call on datasets deals with real(cdouble
 
-
-
3.3.2.3 Source code for single precision functions
+
+
3.3.2.3 Source code for single precision functions
trexio_exit_code
@@ -3430,11 +3409,11 @@ The basic (non-suffixed) API call on datasets deals with real(cdouble
 
-
-
3.3.2.4 Source code for memory-safe functions
+
+
3.3.2.4 Source code for memory-safe functions
-
trexio_exit_code rc;
+
trexio_exit_code rc;
 int64_t $group_dset_dim$ = 0;
 
 /* Error handling for this call is added by the generator */
@@ -3590,8 +3569,8 @@ rc = trexio_read_$group_dset_dim$_64(file, &($group_dset_dim$));
 
-
-
3.3.2.5 Source code for default functions
+
+
3.3.2.5 Source code for default functions
trexio_exit_code
@@ -3666,8 +3645,8 @@ rc = trexio_read_$group_dset_dim$_64(file, &($group_dset_dim$));
 
-
-

3.3.3 Fortran templates for front end

+
+

3.3.3 Fortran templates for front end

The Fortran templates that provide an access to the C API calls from Fortran. @@ -3759,8 +3738,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

3.3.4 Python templates for front end

+
+

3.3.4 Python templates for front end

def write_$group_dset$(trexio_file, dset_w) -> None:
@@ -3937,12 +3916,12 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

3.4 Templates for front end has/read/write a dataset of sparse data

+
+

3.4 Templates for front end has/read/write a dataset of sparse data

-
-

3.4.1 Introduction

+
+

3.4.1 Introduction

Sparse data structures are used typically for large tensors such as @@ -4103,16 +4082,16 @@ This section concerns API calls related to sparse data structures.

-
-

3.4.2 C templates for front end

+
+

3.4.2 C templates for front end

-
-
3.4.2.1 Function declarations
+
+
3.4.2.1 Function declarations
-
-
3.4.2.2 Source code for default functions
+
+
3.4.2.2 Source code for default functions
trexio_exit_code trexio_read_safe_$group_dset$(trexio_t* const file,
@@ -4388,8 +4367,8 @@ This section concerns API calls related to sparse data structures.
 
-
-

3.4.3 Fortran templates for front end

+
+

3.4.3 Fortran templates for front end

The Fortran templates that provide an access to the C API calls from Fortran. @@ -4490,8 +4469,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

3.4.4 Python templates for front end

+
+

3.4.4 Python templates for front end

def write_$group_dset$(trexio_file: File, offset_file: int, buffer_size: int, indices: list, values: list) -> None:
@@ -4703,12 +4682,12 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

3.5 Templates for front end has/read/write a dataset of strings

+
+

3.5 Templates for front end has/read/write a dataset of strings

-
-

3.5.1 Introduction

+
+

3.5.1 Introduction

This section concerns API calls related to datasets of strings. @@ -4748,8 +4727,8 @@ This section concerns API calls related to datasets of strings.

-
-

3.5.2 C templates for front end

+
+

3.5.2 C templates for front end

First parameter is the TREXIO file handle. Second parameter is the variable to be written/read @@ -4757,12 +4736,12 @@ to/from the TREXIO file (except for trexio_has_ functi

-
-
3.5.2.1 Function declarations
+
+
3.5.2.1 Function declarations
-
-
3.5.2.2 Source code for default functions
+
+
3.5.2.2 Source code for default functions
trexio_exit_code
@@ -5012,8 +4991,8 @@ to/from the TREXIO file (except for trexio_has_ functi
 
-
-

3.5.3 Fortran templates for front end

+
+

3.5.3 Fortran templates for front end

The Fortran templates that provide an access to the C API calls from Fortran. @@ -5112,8 +5091,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

3.5.4 Python templates for front end

+
+

3.5.4 Python templates for front end

def write_$group_dset$(trexio_file, dset_w: list) -> None:
@@ -5211,12 +5190,12 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

3.6 Templates for front end has/read/write a single string attribute

+
+

3.6 Templates for front end has/read/write a single string attribute

-
-

3.6.1 Introduction

+
+

3.6.1 Introduction

This section concerns API calls related to string attributes. @@ -5256,16 +5235,16 @@ This section concerns API calls related to string attributes.

-
-

3.6.2 C templates for front end

+
+

3.6.2 C templates for front end

-
-
3.6.2.1 Function declarations
+
+
3.6.2.1 Function declarations
-
-
3.6.2.2 Source code for default functions
+
+
3.6.2.2 Source code for default functions
trexio_exit_code
@@ -5369,8 +5348,8 @@ This section concerns API calls related to string attributes.
 
-
-

3.6.3 Fortran templates for front end

+
+

3.6.3 Fortran templates for front end

The Fortran templates that provide an access to the C API calls from Fortran. @@ -5450,8 +5429,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

3.6.4 Python templates for front end

+
+

3.6.4 Python templates for front end

def write_$group_str$(trexio_file, str_w: str) -> None:
@@ -5526,12 +5505,12 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

3.7 Templates for front end delete an entire group (UNSAFE MODE)

+
+

3.7 Templates for front end delete an entire group (UNSAFE MODE)

-
-

3.7.1 Introduction

+
+

3.7.1 Introduction

This section concerns API calls related to string attributes. @@ -5561,8 +5540,8 @@ This section concerns API calls related to string attributes.

-
-

3.7.2 C templates for front end

+
+

3.7.2 C templates for front end

trexio_exit_code
@@ -5597,8 +5576,8 @@ This section concerns API calls related to string attributes.
 
-
-

3.7.3 Fortran templates for front end

+
+

3.7.3 Fortran templates for front end

The Fortran templates that provide an access to the C API calls from Fortran. @@ -5618,8 +5597,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

3.7.4 Python templates for front end

+
+

3.7.4 Python templates for front end

def delete_$group$(trexio_file) -> None:
@@ -5644,8 +5623,8 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

4 Source code for the determinant part

+
+

4 Source code for the determinant part

Storage of the determinants is a particular case, @@ -5716,8 +5695,8 @@ This section concerns API calls related to Slater determinants.

-
-

4.0.1 C source code

+
+

4.0.1 C source code

trexio_exit_code
@@ -6082,8 +6061,8 @@ This section concerns API calls related to Slater determinants.
 
-
-

4.0.2 Fortran interface

+
+

4.0.2 Fortran interface

The Fortran templates that provide an access to the C API calls from Fortran. @@ -6240,8 +6219,8 @@ These templates are based on the use of iso_c_binding. Pointers hav

-
-

4.0.3 Python interface

+
+

4.0.3 Python interface

def write_determinant_list(trexio_file: File, offset_file: int, buffer_size: int, determinants: list) -> None:
@@ -6585,8 +6564,8 @@ These templates are based on the use of iso_c_binding. Pointers hav
 
-
-

5 General helper functions

+
+

5 General helper functions

This section contains general helper functions like trexio_info. @@ -6620,8 +6599,8 @@ of the determinant and returns two list of orbitals each corresponding to a diff

-
-

5.1 C

+
+

5.1 C

trexio_exit_code trexio_info(void);
@@ -6816,8 +6795,8 @@ of the determinant and returns two list of orbitals each corresponding to a diff
 
-
-

5.2 Fortran

+
+

5.2 Fortran

interface
@@ -6858,8 +6837,8 @@ of the determinant and returns two list of orbitals each corresponding to a diff
 
-
-

5.3 Python

+
+

5.3 Python

def info():
@@ -6897,7 +6876,7 @@ of the determinant and returns two list of orbitals each corresponding to a diff
     if len(orbital_list) < occ_num:
         raise Exception("Inconsistent size of the orbital_list.")
 
-    return orbital_list
+    return orbital_list[0:occ_num]
 
 
 def to_orbital_list_up_dn(n_int: int, determinant: list) -> tuple:
@@ -6935,8 +6914,8 @@ of the determinant and returns two list of orbitals each corresponding to a diff
 
-
-

6 Fortran helper/wrapper functions

+
+

6 Fortran helper/wrapper functions

The function below adapts the original C-based trexio_open for Fortran. @@ -7088,7 +7067,7 @@ two code are identical, i.e. if the assert statement pass.

Author: TREX-CoE

-

Created: 2022-05-18 Wed 09:56

+

Created: 2022-05-19 Thu 15:24

Validate

diff --git a/templator_hdf5.html b/templator_hdf5.html index 7a99f10..70cf3c7 100644 --- a/templator_hdf5.html +++ b/templator_hdf5.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + HDF5 back end @@ -311,23 +311,23 @@ for the JavaScript code in this tag.

Table of Contents

-
-

1 Template for HDF5 definitions

+
+

1 Template for HDF5 definitions

#define $GROUP$_GROUP_NAME          "$group$"
@@ -339,9 +339,16 @@ for the JavaScript code in this tag.
 
-
-

2 Template for HDF5 structures

+
+

2 Template for HDF5 structures

+

+Polymorphism of the trexio_t type is handled by ensuring that the +corresponding types for all back ends can be safely casted to +trexio_t. This is done by making the back-end structs start with +trexio_t parent attribute: +

+
typedef struct trexio_hdf5_s {
   trexio_t     parent ;
@@ -353,8 +360,8 @@ for the JavaScript code in this tag.
 
-
-

3 Template for HDF5 init/deinit

+
+

3 Template for HDF5 init/deinit

trexio_exit_code
@@ -459,8 +466,8 @@ for the JavaScript code in this tag.
 
-
-

4 Template for HDF5 has/read/write a numerical attribute

+
+

4 Template for HDF5 has/read/write a numerical attribute

trexio_exit_code
@@ -564,8 +571,8 @@ for the JavaScript code in this tag.
 
-
-

5 Template for HDF5 has/read/write a dataset of numerical data

+
+

5 Template for HDF5 has/read/write a dataset of numerical data

trexio_exit_code
@@ -699,8 +706,8 @@ for the JavaScript code in this tag.
 
-
-

6 Template for HDF5 has/read/write a dataset of sparse data

+
+

6 Template for HDF5 has/read/write a dataset of sparse data

Sparse data is stored using extensible datasets of HDF5. Extensibility is required @@ -903,8 +910,8 @@ due to the fact that the sparse data will be written in chunks of user-defined s

-
-

7 Template for HDF5 has/read/write a dataset of strings

+
+

7 Template for HDF5 has/read/write a dataset of strings

trexio_exit_code
@@ -1102,8 +1109,8 @@ due to the fact that the sparse data will be written in chunks of user-defined s
 
-
-

8 Template for HDF5 has/read/write a string attribute

+
+

8 Template for HDF5 has/read/write a string attribute

trexio_exit_code
@@ -1230,8 +1237,8 @@ due to the fact that the sparse data will be written in chunks of user-defined s
 
-
-

9 Template for HDF5 delete a group (UNSAFE mode)

+
+

9 Template for HDF5 delete a group (UNSAFE mode)

Note: in early versions of the HDF5 library (v < 1.10) unlinking an object was not working as expected @@ -1271,8 +1278,8 @@ Thus, any corrupted/lost file space will remain in the first file. The use of

-
-

10 Source code for the determinant part

+
+

10 Source code for the determinant part

Each array is stored in a separate HDF5 dataset due to the fact that determinant I/O has to be decoupled. @@ -1525,8 +1532,8 @@ Size specifies the number of data items (e.g. determinants) to process.

-
-

11 Helper functions

+
+

11 Helper functions

trexio_exit_code
@@ -1789,7 +1796,7 @@ Size specifies the number of data items (e.g. determinants) to process.
 

Author: TREX-CoE

-

Created: 2022-05-18 Wed 09:56

+

Created: 2022-05-19 Thu 15:24

Validate

diff --git a/templator_text.html b/templator_text.html index acdf922..c994ee1 100644 --- a/templator_text.html +++ b/templator_text.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + TEXT back end @@ -311,20 +311,20 @@ for the JavaScript code in this tag.

Table of Contents

@@ -346,8 +346,8 @@ directory. The file is written when closed, or when the flush function is called.

-
-

1 Template for group-related structures in text back end

+
+

1 Template for group-related structures in text back end

typedef struct $group$_s {
@@ -366,9 +366,16 @@ The file is written when closed, or when the flush function is called.
 
-
-

2 Template for general structure in text back end

+
+

2 Template for general structure in text back end

+

+Polymorphism of the trexio_t type is handled by ensuring that the +corresponding types for all back ends can be safely casted to +trexio_t. This is done by making the back-end structs start with +trexio_t parent attribute: +

+
typedef struct trexio_text_s {
   trexio_t   parent ;
@@ -380,8 +387,8 @@ The file is written when closed, or when the flush function is called.
 
-
-

3 Initialize function (constant part)

+
+

3 Initialize function (constant part)

trexio_exit_code
@@ -524,8 +531,8 @@ The file is written when closed, or when the flush function is called.
 
-
-

4 Deinitialize function (templated part)

+
+

4 Deinitialize function (templated part)

trexio_exit_code
@@ -547,8 +554,8 @@ The file is written when closed, or when the flush function is called.
 
-
-

5 Template for text read a group

+
+

5 Template for text read a group

$group$_t*
@@ -614,12 +621,7 @@ trexio_text_read_$group$ (trexio_text_t* "%u", &($group$->rank_$group_dset$));
         if (rc != 1) {
-          FREE(buffer);
-          fclose(f);
-          /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-          file->$group$ = $group$;
-          rc_free = trexio_text_free_$group$(file);
-          assert(rc_free == TREXIO_SUCCESS);
+          trexio_text_free_read_$group$(buffer, f, file, $group$);
           return NULL;
         }
 
@@ -630,24 +632,14 @@ trexio_text_read_$group$ (trexio_text_t* uint32_t j=0;
           rc = fscanf(f, "%1023s %u", buffer, &j);
           if ((rc != 2) || (strcmp(buffer, "dims_$group_dset$") != 0) || (j!=i)) {
-            FREE(buffer);
-            fclose(f);
-            /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-            file->$group$ = $group$;
-            rc_free = trexio_text_free_$group$(file);
-            assert(rc_free == TREXIO_SUCCESS);
+            trexio_text_free_read_$group$(buffer, f, file, $group$);
             return NULL;
           }
 
           rc = fscanf(f, "%" SCNu64 "\n", &($group$->dims_$group_dset$[i]));
           assert(!(rc != 1));
           if (rc != 1) {
-            FREE(buffer);
-            fclose(f);
-            /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-            file->$group$ = $group$;
-            rc_free = trexio_text_free_$group$(file);
-            assert(rc_free == TREXIO_SUCCESS);
+            trexio_text_free_read_$group$(buffer, f, file, $group$);
             return NULL;
           }
 
@@ -660,24 +652,14 @@ trexio_text_read_$group$ (trexio_text_t* Allocate arrays */
         $group$->$group_dset$ = CALLOC(size_$group_dset$, $group_dset_dtype$);
         if ($group$->$group_dset$ == NULL) {
-          FREE(buffer);
-          fclose(f);
-          /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-          file->$group$ = $group$;
-          rc_free = trexio_text_free_$group$(file);
-          assert(rc_free == TREXIO_SUCCESS);
+          trexio_text_free_read_$group$(buffer, f, file, $group$);
           return NULL;
         }
 
         for (uint64_t i=0 ; i<size_$group_dset$ ; ++i) {
           rc = fscanf(f, "%$group_dset_format_scanf$", &($group$->$group_dset$[i]));
           if (rc != 1) {
-            FREE(buffer);
-            fclose(f);
-            /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-            file->$group$ = $group$;
-            rc_free = trexio_text_free_$group$(file);
-            assert(rc_free == TREXIO_SUCCESS);
+            trexio_text_free_read_$group$(buffer, f, file, $group$);
             return NULL;
           }
         }
@@ -686,21 +668,16 @@ trexio_text_read_$group$ (trexio_text_t* START REPEAT GROUP_DSET_STR
       } else if (strcmp(buffer, "$group_dset$") == 0) {
 
-        if(size_$group_dset$ != 0) {
+        if (size_$group_dset$ != 0) {
           /* Allocate arrays */
           $group$->$group_dset$ = CALLOC(size_$group_dset$, $group_dset_dtype$);
           if ($group$->$group_dset$ == NULL) {
-            FREE(buffer);
-            fclose(f);
-            /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-            file->$group$ = $group$;
-            rc_free = trexio_text_free_$group$(file);
-            assert(rc_free == TREXIO_SUCCESS);
+            trexio_text_free_read_$group$(buffer, f, file, $group$);
             return NULL;
           }
 
           /* WARNING: this tmp array allows to avoid allocation of space for each element of array of string
-             BUT it's size has to be number_of_str*max_len_str where max_len_str is somewhat arbitrary, e.g. 32.
+           * BUT it's size has to be number_of_str*max_len_str where max_len_str is somewhat arbitrary, e.g. 32.
            */
           char* tmp_$group_dset$;
           tmp_$group_dset$ = CALLOC(size_$group_dset$*32, char);
@@ -709,16 +686,10 @@ trexio_text_read_$group$ (trexio_text_t* conventional fcanf with "%s" only return the string before the first space character
              * to read string with spaces use "%[^\n]" possible with space before or after, i.e. " %[^\n]"
-             * Q: depending on what ? */
+             */
             rc = fscanf(f, " %1023[^\n]", tmp_$group_dset$);
-            assert(!(rc != 1));
             if (rc != 1) {
-              FREE(buffer);
-              fclose(f);
-              /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-              file->$group$ = $group$;
-              rc_free = trexio_text_free_$group$(file);
-              assert(rc_free == TREXIO_SUCCESS);
+              trexio_text_free_read_$group$(buffer, f, file, $group$);
               return NULL;
             }
 
@@ -735,41 +706,25 @@ trexio_text_read_$group$ (trexio_text_t* additional parameter $group_num$_isSet is needed to suppress warning when fscanf into bool variable using %u or %d */
         rc = fscanf(f, "%u", &($group_num$_isSet));
         $group$->$group_num$_isSet = (bool) $group_num$_isSet;
-        assert(!(rc != 1));
         if (rc != 1) {
-          FREE(buffer);
-          fclose(f);
-          /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-          file->$group$ = $group$;
-          rc_free = trexio_text_free_$group$(file);
-          assert(rc_free == TREXIO_SUCCESS);
+          trexio_text_free_read_$group$(buffer, f, file, $group$);
           return NULL;
         }
 
         if ($group$->$group_num$_isSet == true) {
+
           rc = fscanf(f, "%1023s", buffer);
-          assert(!((rc != 1) || (strcmp(buffer, "$group_num$") != 0)));
           if ((rc != 1) || (strcmp(buffer, "$group_num$") != 0)) {
-            FREE(buffer);
-            fclose(f);
-            /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-            file->$group$ = $group$;
-            rc_free = trexio_text_free_$group$(file);
-            assert(rc_free == TREXIO_SUCCESS);
+            trexio_text_free_read_$group$(buffer, f, file, $group$);
             return NULL;
           }
 
           rc = fscanf(f, "%$group_num_format_scanf$", &($group$->$group_num$));
-          assert(!(rc != 1));
           if (rc != 1) {
-            FREE(buffer);
-            fclose(f);
-            /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-            file->$group$ = $group$;
-            rc_free = trexio_text_free_$group$(file);
-            assert(rc_free == TREXIO_SUCCESS);
+            trexio_text_free_read_$group$(buffer, f, file, $group$);
             return NULL;
           }
+
         }
 
       // END REPEAT GROUP_NUM
@@ -777,52 +732,28 @@ trexio_text_read_$group$ (trexio_text_t* else if (strcmp(buffer, "len_$group_str$") == 0) {
 
         rc = fscanf(f, "%" SCNu64 "", &($group$->len_$group_str$));
-        assert(!(rc != 1));
         if (rc != 1) {
-          FREE(buffer);
-          fclose(f);
-          /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-          file->$group$ = $group$;
-          rc_free = trexio_text_free_$group$(file);
-          assert(rc_free == TREXIO_SUCCESS);
+          trexio_text_free_read_$group$(buffer, f, file, $group$);
           return NULL;
         }
 
         rc = fscanf(f, "%1023s", buffer);
-        assert(!((rc != 1) || (strcmp(buffer, "$group_str$") != 0)));
         if ((rc != 1) || (strcmp(buffer, "$group_str$") != 0)) {
-          FREE(buffer);
-          fclose(f);
-          /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-          file->$group$ = $group$;
-          rc_free = trexio_text_free_$group$(file);
-          assert(rc_free == TREXIO_SUCCESS);
+          trexio_text_free_read_$group$(buffer, f, file, $group$);
           return NULL;
         }
 
         if ($group$->len_$group_str$ != 0) {
 
           $group$->$group_str$ = CALLOC($group$->len_$group_str$, char);
-          assert (!($group$->$group_str$ == NULL));
           if ($group$->$group_str$ == NULL) {
-            FREE(buffer);
-            fclose(f);
-            /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-            file->$group$ = $group$;
-            rc_free = trexio_text_free_$group$(file);
-            assert(rc_free == TREXIO_SUCCESS);
+            trexio_text_free_read_$group$(buffer, f, file, $group$);
             return NULL;
           }
 
           rc = fscanf(f, " %1023[^\n]", $group$->$group_str$);
-          assert(!(rc != 1));
           if (rc != 1) {
-            FREE(buffer);
-            fclose(f);
-            /* Set pointer to the struct so that the garbage collector can do the job on file handle */
-            file->$group$ = $group$;
-            rc_free = trexio_text_free_$group$(file);
-            assert(rc_free == TREXIO_SUCCESS);
+            trexio_text_free_read_$group$(buffer, f, file, $group$);
             return NULL;
           }
 
@@ -842,15 +773,14 @@ trexio_text_read_$group$ (trexio_text_t* return $group$;
-
 }
 
-
-

6 Template for text flush a group

+
+

6 Template for text flush a group

trexio_exit_code
@@ -914,8 +844,8 @@ trexio_text_read_$group$ (trexio_text_t* 
 
-
-

7 Template for text free memory

+
+

7 Template for text free memory

Memory is allocated when reading. The following function frees memory. @@ -942,7 +872,7 @@ Memory is allocated when reading. The following function frees memory. // START REPEAT GROUP_DSET_STR if ($group$->$group_dset$ != NULL) { - if($group$->rank_$group_dset$ != 0) FREE ($group$->$group_dset$[0]); + if ($group$->rank_$group_dset$ != 0) FREE ($group$->$group_dset$[0]); FREE ($group$->$group_dset$); } // END REPEAT GROUP_DSET_STR @@ -959,11 +889,33 @@ Memory is allocated when reading. The following function frees memory. }

+ +

+This function is called upon the non-successful exit from the trexio_text_read_group function. +

+ +
+
trexio_exit_code
+trexio_text_free_read_$group$ (char* buffer, FILE* txt_file, trexio_text_t* trexio_file, $group$_t* $group$)
+{
+  trexio_exit_code rc_free;
+
+  FREE(buffer);
+  fclose(txt_file);
+  /* Set pointer to the struct so that the garbage collector can do the job on file handle */
+  trexio_file->$group$ = $group$;
+  rc_free = trexio_text_free_$group$(trexio_file);
+  assert(rc_free == TREXIO_SUCCESS);
+
+  return TREXIO_SUCCESS;
+}
+
+
-
-

8 Template for has/read/write a numerical attribute

+
+

8 Template for has/read/write a numerical attribute

trexio_exit_code
@@ -1026,8 +978,8 @@ Memory is allocated when reading. The following function frees memory.
 
-
-

9 Template for has/read/write a dataset of numerical data

+
+

9 Template for has/read/write a dataset of numerical data

The group_dset array is assumed allocated with the appropriate size. @@ -1123,8 +1075,8 @@ The group_dset array is assumed allocated with the appropriate size

-
-

10 Template for has/read/write a dataset of strings

+
+

10 Template for has/read/write a dataset of strings

The group_dset array is assumed allocated with the appropriate size. @@ -1225,8 +1177,8 @@ The group_dset array is assumed allocated with the appropriate size

-
-

11 Template for has/read/write a string attribute

+
+

11 Template for has/read/write a string attribute

trexio_exit_code
@@ -1300,8 +1252,8 @@ The group_dset array is assumed allocated with the appropriate size
 
-
-

12 Template for has/read/write the dataset of sparse data

+
+

12 Template for has/read/write the dataset of sparse data

Each sparse array is stored in a separate .txt file due to the fact that sparse I/O has to be decoupled @@ -1340,8 +1292,7 @@ User provides indices and values of the sparse array as two separate variables. /* Open the file in "a" (append) mode to guarantee that no truncation happens upon consecutive writes */ FILE* f = fopen(file_full_path, "a"); - if(f == NULL) return TREXIO_FILE_ERROR; - + if (f == NULL) return TREXIO_FILE_ERROR; /* Specify the line length in order to offset properly. For example, for 4-index quantities the line_length is 69 because 10 per index + 4 spaces + 24 for floating point value + 1 for the new line char. @@ -1376,7 +1327,7 @@ User provides indices and values of the sparse array as two separate variables. rc = fprintf(f, format_str, $group_dset_sparse_indices_printf$, *(value_sparse + i)); - if(rc <= 0) { + if (rc <= 0) { fclose(f); return TREXIO_FAILURE; } @@ -1438,7 +1389,7 @@ User provides indices and values of the sparse array as two separate variables. /* Open the file in "r" (read) mode to guarantee that no truncation happens upon consecutive reads */ FILE* f = fopen(file_full_path, "r"); - if(f == NULL) return TREXIO_FILE_ERROR; + if (f == NULL) return TREXIO_FILE_ERROR; /* Specify the line length in order to offset properly. For example, for 4-index quantities the line_length is 69 because 10 per index + 4 spaces + 24 for floating point value + 1 for the new line char @@ -1464,7 +1415,7 @@ User provides indices and values of the sparse array as two separate variables. memset(buffer, 0, sizeof(buffer)); - if(fgets(buffer, 1023, f) == NULL){ + if (fgets(buffer, 1023, f) == NULL){ fclose(f); *eof_read_size = count; @@ -1475,7 +1426,7 @@ User provides indices and values of the sparse array as two separate variables. rc = sscanf(buffer, "$group_dset_format_scanf$", $group_dset_sparse_indices_scanf$, value_sparse + i); - if(rc <= 0) { + if (rc <= 0) { fclose(f); return TREXIO_FAILURE; } @@ -1486,7 +1437,7 @@ User provides indices and values of the sparse array as two separate variables. /* Close the TXT file */ rc = fclose(f); - if(rc != 0) return TREXIO_FILE_ERROR; + if (rc != 0) return TREXIO_FILE_ERROR; return TREXIO_SUCCESS; } @@ -1514,7 +1465,7 @@ User provides indices and values of the sparse array as two separate variables. /* Open the file in "r" (read) mode to guarantee that no truncation happens upon consecutive reads */ FILE* f = fopen(file_full_path, "r"); - if(f == NULL) return TREXIO_FILE_ERROR; + if (f == NULL) return TREXIO_FILE_ERROR; /* Read the data from the file and check the return code of fprintf to verify that > 0 bytes have been read or reached EOF */ @@ -1535,7 +1486,7 @@ User provides indices and values of the sparse array as two separate variables. /* Close the TXT file */ rc = fclose(f); - if(rc != 0) return TREXIO_FILE_ERROR; + if (rc != 0) return TREXIO_FILE_ERROR; /* Overwrite the value at the input address and return TREXIO_SUCCESS */ *size_max = size_accum; @@ -1575,8 +1526,8 @@ User provides indices and values of the sparse array as two separate variables.

-
-

13 Template for text delete a group (UNSAFE mode)

+
+

13 Template for text delete a group (UNSAFE mode)

trexio_exit_code
@@ -1604,8 +1555,8 @@ User provides indices and values of the sparse array as two separate variables.
 
-
-

14 Source code for the determinant part

+
+

14 Source code for the determinant part

Each array is stored in a separate .txt file due to the fact that determinant I/O has to be decoupled @@ -1639,7 +1590,7 @@ Size specifies the number of data items, e.g. determinants. /* Open the file in "r" (read) mode to guarantee that no truncation happens upon consecutive reads */ FILE* f = fopen(file_full_path, "r"); - if(f == NULL) return TREXIO_FILE_ERROR; + if (f == NULL) return TREXIO_FILE_ERROR; /* Specify the line length in order to offset properly. Each 64-bit integer takes at most 10 slots and requires one space, @@ -1667,7 +1618,7 @@ Size specifies the number of data items, e.g. determinants. accum = 0UL; memset(buffer, 0, buf_size); - if(fgets(buffer, buf_size-1, f) == NULL){ + if (fgets(buffer, buf_size-1, f) == NULL){ fclose(f); *eof_read_size = count; @@ -1680,7 +1631,7 @@ Size specifies the number of data items, e.g. determinants. */ for (uint32_t j=0; j < (uint32_t) dims[1]; ++j) { rc = sscanf(buffer+accum, "%10" SCNd64, list + dims[1]*i + j); - if(rc <= 0) { + if (rc <= 0) { fclose(f); return TREXIO_FAILURE; } @@ -1693,7 +1644,7 @@ Size specifies the number of data items, e.g. determinants. /* Close the TXT file */ rc = fclose(f); - if(rc != 0) return TREXIO_FILE_ERROR; + if (rc != 0) return TREXIO_FILE_ERROR; return TREXIO_SUCCESS; } @@ -1729,7 +1680,7 @@ Size specifies the number of data items, e.g. determinants. /* Open the file in "r" (read) mode to guarantee that no truncation happens upon consecutive reads */ FILE* f = fopen(file_full_path, "r"); - if(f == NULL) return TREXIO_FILE_ERROR; + if (f == NULL) return TREXIO_FILE_ERROR; /* Specify the line length in order to offset properly. Each double value 24 elements + one newline char. @@ -1750,7 +1701,7 @@ Size specifies the number of data items, e.g. determinants. for (uint64_t i=0UL; i < dims[0]; ++i) { memset(buffer, 0, buf_size); - if(fgets(buffer, buf_size-1, f) == NULL){ + if (fgets(buffer, buf_size-1, f) == NULL){ fclose(f); *eof_read_size = count; @@ -1759,7 +1710,7 @@ Size specifies the number of data items, e.g. determinants. } else { rc = sscanf(buffer, "%lf", coeff + i); - if(rc <= 0) { + if (rc <= 0) { fclose(f); return TREXIO_FAILURE; } @@ -1770,7 +1721,7 @@ Size specifies the number of data items, e.g. determinants. /* Close the TXT file */ rc = fclose(f); - if(rc != 0) return TREXIO_FILE_ERROR; + if (rc != 0) return TREXIO_FILE_ERROR; return TREXIO_SUCCESS; } @@ -1801,7 +1752,7 @@ Size specifies the number of data items, e.g. determinants. /* Open the file in "r" (read) mode to guarantee that no truncation happens upon consecutive reads */ FILE* f = fopen(file_full_path, "r"); - if(f == NULL) return TREXIO_FILE_ERROR; + if (f == NULL) return TREXIO_FILE_ERROR; /* Read the data from the file and check the return code of fprintf to verify that > 0 bytes have been read or reached EOF */ int rc; @@ -1821,7 +1772,7 @@ Size specifies the number of data items, e.g. determinants. /* Close the TXT file */ rc = fclose(f); - if(rc != 0) return TREXIO_FILE_ERROR; + if (rc != 0) return TREXIO_FILE_ERROR; /* Overwrite the value at the input address and return TREXIO_SUCCESS */ *size_max = size_accum; @@ -1852,7 +1803,7 @@ Size specifies the number of data items, e.g. determinants. /* Open the file in "a" (append) mode to guarantee that no truncation happens upon consecutive writes */ FILE* f = fopen(file_full_path, "a"); - if(f == NULL) return TREXIO_FILE_ERROR; + if (f == NULL) return TREXIO_FILE_ERROR; /* Write the data in the file and check the return code of fprintf to verify that > 0 bytes have been written */ int rc; @@ -1861,7 +1812,7 @@ Size specifies the number of data items, e.g. determinants. /* The loop below is needed to write a line with int bit fields for alpha and beta electrons */ for (uint32_t j=0; j < (uint32_t) dims[1]; ++j) { rc = fprintf(f, "%10" PRId64 " ", *(list + i*dims[1] + j)); - if(rc <= 0) { + if (rc <= 0) { fclose(f); return TREXIO_FAILURE; } @@ -1907,14 +1858,14 @@ Size specifies the number of data items, e.g. determinants. /* Open the file in "a" (append) mode to guarantee that no truncation happens upon consecutive writes */ FILE* f = fopen(file_full_path, "a"); - if(f == NULL) return TREXIO_FILE_ERROR; + if (f == NULL) return TREXIO_FILE_ERROR; /* Write the data in the file and check the return code of fprintf to verify that > 0 bytes have been written */ int rc; for (uint64_t i=0UL; i < dims[0]; ++i) { rc = fprintf(f, "%24.16e\n", *(coeff + i)); - if(rc <= 0) { + if (rc <= 0) { fclose(f); return TREXIO_FAILURE; } @@ -2009,7 +1960,7 @@ Size specifies the number of data items, e.g. determinants.

Author: TREX-CoE

-

Created: 2022-05-18 Wed 09:56

+

Created: 2022-05-19 Thu 15:24

Validate

diff --git a/trex.html b/trex.html index 2270815..b108519 100644 --- a/trex.html +++ b/trex.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> - + TREX Configuration file @@ -333,35 +333,35 @@ for the JavaScript code in this tag.

Table of Contents

@@ -411,8 +411,8 @@ the examples.

-
-

1 Metadata (metadata group)

+
+

1 Metadata (metadata group)

As we expect our files to be archived in open-data repositories, we @@ -422,7 +422,7 @@ which have participated to the creation of the file, a list of authors of the file, and a textual description.

- +
@@ -503,15 +503,15 @@ then the unsafe attribute value can be manually overwritten (in uns -
-

2 Electron (electron group)

+
+

2 Electron (electron group)

We consider wave functions expressed in the spin-free formalism, where the number of ↑ and ↓ electrons is fixed.

-
+
@@ -557,15 +557,15 @@ the number of ↑ and ↓ electrons is fixed. -
-

3 Nucleus (nucleus group)

+
+

3 Nucleus (nucleus group)

The nuclei are considered as fixed point charges. Coordinates are given in Cartesian \((x,y,z)\) format.

-
+
@@ -632,8 +632,8 @@ given in Cartesian \((x,y,z)\) format. -
-

4 Effective core potentials (ecp group)

+
+

4 Effective core potentials (ecp group)

An effective core potential (ECP) \(V_A^{\text{ECP}}\) replacing the @@ -666,7 +666,7 @@ The functions \(V_{A\ell}\) are parameterized as: See http://dx.doi.org/10.1063/1.4984046 or https://doi.org/10.1063/1.5121006 for more info.

-
+
@@ -768,8 +768,8 @@ If you encounter the aforementioned issue, please report it to our -

4.1 Example

+
+

4.1 Example

For example, consider H2 molecule with the following @@ -832,8 +832,8 @@ power = [

-
-

5 Basis set (basis group)

+
+

5 Basis set (basis group)

We consider here basis functions centered on nuclei. Hence, we enable @@ -886,7 +886,7 @@ If the the basis function is not considered normalized, \(\mathcal{N}_s=1\). All the basis set parameters are stored in one-dimensional arrays:

-
+
@@ -980,8 +980,8 @@ All the basis set parameters are stored in one-dimensional arrays:
-
-

5.1 Example

+
+

5.1 Example

For example, consider H2 with the following basis set (in GAMESS @@ -1059,8 +1059,8 @@ prim_factor =

-
-

6 Atomic orbitals (ao group)

+
+

6 Atomic orbitals (ao group)

Going from the atomic basis set to AOs implies a systematic @@ -1113,13 +1113,13 @@ shell, as in the GAMESS convention where

In such a case, one should set the normalization of the shell (in -the Basis set section) to \(\mathcal{N}_{z^2}\), which is the +the Basis set section) to \(\mathcal{N}_{z^2}\), which is the normalization factor of the atomic orbitals in spherical coordinates. The normalization factor of the \(xy\) function which should be introduced here should be \(\frac{\mathcal{N}_{xy}}{\mathcal{N}_{z^2}}\).

- +
@@ -1171,8 +1171,8 @@ introduced here should be \(\frac{\mathcal{N}_{xy}}{\mathcal{N}_{z^2}}\).
-
-

6.1 One-electron integrals (ao_1e_int group)

+
+

6.1 One-electron integrals (ao_1e_int group)

  • \[ \hat{V}_{\text{ne}} = \sum_{A=1}^{N_\text{nucl}} @@ -1189,7 +1189,7 @@ The one-electron integrals for a one-electron operator \(\hat{O}\) are over atomic orbitals.

    - +
    @@ -1249,8 +1249,8 @@ over atomic orbitals. -
    -

    6.2 Two-electron integrals (ao_2e_int group)

    +
    +

    6.2 Two-electron integrals (ao_2e_int group)

    The two-electron integrals for a two-electron operator \(\hat{O}\) are @@ -1271,7 +1271,7 @@ notation. \mathbf{r}_j \vert)}{\vert \mathbf{r}_i - \mathbf{r}_j \vert} \] : electron-electron long range potential -

    +
    @@ -1311,10 +1311,10 @@ notation. -
    -

    7 Molecular orbitals (mo group)

    +
    +

    7 Molecular orbitals (mo group)

    -
    +
    @@ -1380,8 +1380,8 @@ notation.
-
-

7.1 One-electron integrals (mo_1e_int group)

+
+

7.1 One-electron integrals (mo_1e_int group)

The operators as the same as those defined in the @@ -1389,7 +1389,7 @@ The operators as the same as those defined in the the basis of molecular orbitals.

- +
@@ -1449,8 +1449,8 @@ the basis of molecular orbitals. -
-

7.2 Two-electron integrals (mo_2e_int group)

+
+

7.2 Two-electron integrals (mo_2e_int group)

The operators as the same as those defined in the @@ -1458,7 +1458,7 @@ The operators as the same as those defined in the the basis of molecular orbitals.

-
+
@@ -1498,8 +1498,8 @@ the basis of molecular orbitals. -
-

8 Slater determinants (determinant group)

+
+

8 Slater determinants (determinant group)

The configuration interaction (CI) wave function \(\Psi\) @@ -1532,7 +1532,7 @@ where \(\alpha\) and \(\beta\) denote $↑$-spin and $↓$-spin electrons, \(n\uparrow\) and \(n\downarrow\) correspond to electron.up_num and electron.dn_num, respectively.

-
+
@@ -1578,8 +1578,8 @@ where \(\alpha\) and \(\beta\) denote $↑$-spin and $↓$-spin electrons, -
-

9 Excited states (state group)

+
+

9 Excited states (state group)

By default, the determinant group corresponds to the ground state. @@ -1588,7 +1588,7 @@ correspond to excited state wave functions for the same set of determinants. This is the goal of the present group

-
+
@@ -1627,8 +1627,8 @@ determinants. This is the goal of the present group -
-

10 Reduced density matrices (rdm group)

+
+

10 Reduced density matrices (rdm group)

The reduced density matrices are defined in the basis of molecular @@ -1681,7 +1681,7 @@ The total energy can be computed as: \]

-
+
@@ -1762,8 +1762,8 @@ The total energy can be computed as: -
-

11 Quantum Monte Carlo data (qmc group)

+
+

11 Quantum Monte Carlo data (qmc group)

In quantum Monte Carlo calculations, the wave function is evaluated @@ -1777,7 +1777,7 @@ By convention, the electron coordinates contain first all the electrons of $↑$-spin and then all the $↓$-spin.

-
+
@@ -1832,7 +1832,7 @@ of $↑$-spin and then all the $↓$-spin.

Author: TREX-CoE

-

Created: 2022-05-18 Wed 09:56

+

Created: 2022-05-19 Thu 15:24

Validate