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">
- +program print_energy @@ -411,8 +411,8 @@ One needs to read from the TREXIO file:
integer :: i, j, k, l, m @@ -427,8 +427,8 @@ One needs to read from the TREXIO file:
call getarg(1, filename) @@ -444,8 +444,8 @@ f = trexio_open (filename, 'r', TREXIO_HDF5
rc = trexio_read_nucleus_repulsion(f, E_nn)
@@ -459,8 +459,8 @@ f = trexio_open (filename, 'r', TREXIO_HDF5
rc = trexio_read_mo_num(f, n)
@@ -474,8 +474,8 @@ f = trexio_open (filename, 'r', TREXIO_HDF5
allocate( D(n,n), h0(n,n) )
@@ -487,8 +487,8 @@ W(:,:,:,:) = 0.d0
rc = trexio_has_mo_1e_int_core_hamiltonian(f) @@ -520,8 +520,8 @@ rc = trexio_read_rdm_1e(f, D)
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.
rc = trexio_has_mo_2e_int_eri(f) @@ -587,8 +587,8 @@ icount = BUFSIZE
rc = trexio_has_rdm_2e(f) @@ -632,8 +632,8 @@ icount = bufsize
When the orbitals are real, we can use @@ -679,8 +679,8 @@ E = E + E_nn
deallocate( D, h0, G, W )
@@ -695,7 +695,7 @@ E = E + E_nn
stdint.h
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) )
All calls to TREXIO are thread-safe. @@ -561,10 +560,10 @@ TREXIO front end is modular, which simplifies implementation of new back ends.
trexio_exit_code
@@ -6082,8 +6061,8 @@ This section concerns API calls related to Slater determinants.
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
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
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
trexio_exit_code trexio_info(void); @@ -6816,8 +6795,8 @@ of the determinant and returns two list of orbitals each corresponding to a diff
interface
@@ -6858,8 +6837,8 @@ of the determinant and returns two list of orbitals each corresponding to a diff
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
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.
#define $GROUP$_GROUP_NAME "$group$" @@ -339,9 +339,16 @@ for the JavaScript code in this tag.
+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.
trexio_exit_code
@@ -459,8 +466,8 @@ for the JavaScript code in this tag.
trexio_exit_code
@@ -564,8 +571,8 @@ for the JavaScript code in this tag.
trexio_exit_code
@@ -699,8 +706,8 @@ for the JavaScript code in this tag.
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
trexio_exit_code
@@ -1102,8 +1109,8 @@ due to the fact that the sparse data will be written in chunks of user-defined s
trexio_exit_code
@@ -1230,8 +1237,8 @@ due to the fact that the sparse data will be written in chunks of user-defined s
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
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.
trexio_exit_code
@@ -1789,7 +1796,7 @@ Size specifies the number of data items (e.g. determinants) to process.
typedef struct $group$_s { @@ -366,9 +366,16 @@ The file is written when closed, or when the flush function is called.
+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.
trexio_exit_code
@@ -524,8 +531,8 @@ The file is written when closed, or when the flush function is called.
trexio_exit_code
@@ -547,8 +554,8 @@ The file is written when closed, or when the flush function is called.
$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$; - }
trexio_exit_code @@ -914,8 +844,8 @@ trexio_text_read_$group$ (trexio_text_t*
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; +} ++
trexio_exit_code
@@ -1026,8 +978,8 @@ Memory is allocated when reading. The following function frees memory.
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
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
trexio_exit_code
@@ -1300,8 +1252,8 @@ The group_dset
array is assumed allocated with the appropriate size
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.
trexio_exit_code
@@ -1604,8 +1555,8 @@ User provides indices and values of the sparse array as two separate variables.
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.
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.
-