1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2025-03-04 14:20:19 +01:00

Deploying to gh-pages from @ TREX-CoE/trexio@65269c6e69 🚀

This commit is contained in:
q-posev 2022-10-06 13:35:54 +00:00
parent 0ae83950cd
commit 906f7368c4
7 changed files with 1488 additions and 1360 deletions

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2022-10-04 Tue 15:30 -->
<!-- 2022-10-06 Thu 13:35 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>TREXIO source code documentation</title>
@ -347,7 +347,7 @@ and bug reports should be submitted at
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2022-10-04 Tue 15:30</p>
<p class="date">Created: 2022-10-06 Thu 13:35</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2022-10-04 Tue 15:30 -->
<!-- 2022-10-06 Thu 13:35 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Examples</title>
@ -333,31 +333,31 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org42c7818">1. Accessing sparse quantities (integrals)</a>
<li><a href="#org59d1e48">1. Accessing sparse quantities (integrals)</a>
<ul>
<li><a href="#org1417273">1.1. Fortran</a>
<li><a href="#org7730943">1.1. Fortran</a>
<ul>
<li><a href="#org6104921">1.1.1. Declare Temporary variables</a></li>
<li><a href="#org0df0850">1.1.2. Obtain the name of the TREXIO file from the command line, and open it for reading</a></li>
<li><a href="#org619ac0c">1.1.3. Read the nuclear repulsion energy</a></li>
<li><a href="#org69319d5">1.1.4. Read the number of molecular orbitals</a></li>
<li><a href="#orga63b271">1.1.5. Allocate memory</a></li>
<li><a href="#orgf917f8a">1.1.6. Read one-electron quantities</a></li>
<li><a href="#org5a2eff4">1.1.7. Read two-electron quantities</a>
<li><a href="#org7aa71a5">1.1.1. Declare Temporary variables</a></li>
<li><a href="#org2876687">1.1.2. Obtain the name of the TREXIO file from the command line, and open it for reading</a></li>
<li><a href="#org76ecf7f">1.1.3. Read the nuclear repulsion energy</a></li>
<li><a href="#org5d1651f">1.1.4. Read the number of molecular orbitals</a></li>
<li><a href="#org4dc7a33">1.1.5. Allocate memory</a></li>
<li><a href="#org603fe9d">1.1.6. Read one-electron quantities</a></li>
<li><a href="#orge091f5d">1.1.7. Read two-electron quantities</a>
<ul>
<li><a href="#orgacd65fb">1.1.7.1. Electron repulsion integrals</a></li>
<li><a href="#org0445f9e">1.1.7.2. Reduced density matrix</a></li>
<li><a href="#org48e5b8a">1.1.7.1. Electron repulsion integrals</a></li>
<li><a href="#org75da222">1.1.7.2. Reduced density matrix</a></li>
</ul>
</li>
<li><a href="#org1b2bcd8">1.1.8. Compute the energy</a></li>
<li><a href="#orgf7d2f17">1.1.9. Terminate</a></li>
<li><a href="#orgd6ddd82">1.1.8. Compute the energy</a></li>
<li><a href="#orgd5fecc9">1.1.9. Terminate</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org8088931">2. Reading determinants</a>
<li><a href="#org551626c">2. Reading determinants</a>
<ul>
<li><a href="#orgff97007">2.1. Fortran</a></li>
<li><a href="#org3806827">2.1. Fortran</a></li>
</ul>
</li>
</ul>
@ -365,12 +365,12 @@ for the JavaScript code in this tag.
</div>
<div id="outline-container-org42c7818" class="outline-2">
<h2 id="org42c7818"><span class="section-number-2">1</span> Accessing sparse quantities (integrals)</h2>
<div id="outline-container-org59d1e48" class="outline-2">
<h2 id="org59d1e48"><span class="section-number-2">1</span> Accessing sparse quantities (integrals)</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org1417273" class="outline-3">
<h3 id="org1417273"><span class="section-number-3">1.1</span> Fortran</h3>
<div id="outline-container-org7730943" class="outline-3">
<h3 id="org7730943"><span class="section-number-3">1.1</span> Fortran</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">program</span> <span style="color: #0000ff;">print_energy</span>
@ -416,8 +416,8 @@ One needs to read from the TREXIO file:
</div>
</div>
<div id="outline-container-org6104921" class="outline-4">
<h4 id="org6104921"><span class="section-number-4">1.1.1</span> Declare Temporary variables</h4>
<div id="outline-container-org7aa71a5" class="outline-4">
<h4 id="org7aa71a5"><span class="section-number-4">1.1.1</span> Declare Temporary variables</h4>
<div class="outline-text-4" id="text-1-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> i, j, k, l, m</span>
@ -432,8 +432,8 @@ One needs to read from the TREXIO file:
</div>
</div>
<div id="outline-container-org0df0850" class="outline-4">
<h4 id="org0df0850"><span class="section-number-4">1.1.2</span> Obtain the name of the TREXIO file from the command line, and open it for reading</h4>
<div id="outline-container-org2876687" class="outline-4">
<h4 id="org2876687"><span class="section-number-4">1.1.2</span> Obtain the name of the TREXIO file from the command line, and open it for reading</h4>
<div class="outline-text-4" id="text-1-1-2">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">call</span> <span style="color: #0000ff;">getarg</span>(1, filename)
@ -449,8 +449,8 @@ f = trexio_open (filename, <span style="color: #8b2252;">'r'</span>, TREXIO_HDF5
</div>
</div>
<div id="outline-container-org619ac0c" class="outline-4">
<h4 id="org619ac0c"><span class="section-number-4">1.1.3</span> Read the nuclear repulsion energy</h4>
<div id="outline-container-org76ecf7f" class="outline-4">
<h4 id="org76ecf7f"><span class="section-number-4">1.1.3</span> Read the nuclear repulsion energy</h4>
<div class="outline-text-4" id="text-1-1-3">
<div class="org-src-container">
<pre class="src src-f90">rc = trexio_read_nucleus_repulsion(f, E_nn)
@ -464,8 +464,8 @@ f = trexio_open (filename, <span style="color: #8b2252;">'r'</span>, TREXIO_HDF5
</div>
</div>
<div id="outline-container-org69319d5" class="outline-4">
<h4 id="org69319d5"><span class="section-number-4">1.1.4</span> Read the number of molecular orbitals</h4>
<div id="outline-container-org5d1651f" class="outline-4">
<h4 id="org5d1651f"><span class="section-number-4">1.1.4</span> Read the number of molecular orbitals</h4>
<div class="outline-text-4" id="text-1-1-4">
<div class="org-src-container">
<pre class="src src-f90">rc = trexio_read_mo_num(f, n)
@ -479,8 +479,8 @@ f = trexio_open (filename, <span style="color: #8b2252;">'r'</span>, TREXIO_HDF5
</div>
</div>
<div id="outline-container-orga63b271" class="outline-4">
<h4 id="orga63b271"><span class="section-number-4">1.1.5</span> Allocate memory</h4>
<div id="outline-container-org4dc7a33" class="outline-4">
<h4 id="org4dc7a33"><span class="section-number-4">1.1.5</span> Allocate memory</h4>
<div class="outline-text-4" id="text-1-1-5">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">allocate</span>( D(n,n), h0(n,n) )
@ -492,8 +492,8 @@ W(:,:,:,:) = 0.d0
</div>
</div>
<div id="outline-container-orgf917f8a" class="outline-4">
<h4 id="orgf917f8a"><span class="section-number-4">1.1.6</span> Read one-electron quantities</h4>
<div id="outline-container-org603fe9d" class="outline-4">
<h4 id="org603fe9d"><span class="section-number-4">1.1.6</span> Read one-electron quantities</h4>
<div class="outline-text-4" id="text-1-1-6">
<div class="org-src-container">
<pre class="src src-f90">rc = trexio_has_mo_1e_int_core_hamiltonian(f)
@ -525,8 +525,8 @@ rc = trexio_read_rdm_1e(f, D)
</div>
</div>
<div id="outline-container-org5a2eff4" class="outline-4">
<h4 id="org5a2eff4"><span class="section-number-4">1.1.7</span> Read two-electron quantities</h4>
<div id="outline-container-orge091f5d" class="outline-4">
<h4 id="orge091f5d"><span class="section-number-4">1.1.7</span> Read two-electron quantities</h4>
<div class="outline-text-4" id="text-1-1-7">
<p>
Reading is done with OpenMP. Each thread reads its own buffer, and
@ -542,8 +542,8 @@ to be protected in the critical section when modified.
</p>
</div>
<div id="outline-container-orgacd65fb" class="outline-5">
<h5 id="orgacd65fb"><span class="section-number-5">1.1.7.1</span> Electron repulsion integrals</h5>
<div id="outline-container-org48e5b8a" class="outline-5">
<h5 id="org48e5b8a"><span class="section-number-5">1.1.7.1</span> Electron repulsion integrals</h5>
<div class="outline-text-5" id="text-1-1-7-1">
<div class="org-src-container">
<pre class="src src-f90">rc = trexio_has_mo_2e_int_eri(f)
@ -592,8 +592,8 @@ icount = BUFSIZE
</div>
</div>
<div id="outline-container-org0445f9e" class="outline-5">
<h5 id="org0445f9e"><span class="section-number-5">1.1.7.2</span> Reduced density matrix</h5>
<div id="outline-container-org75da222" class="outline-5">
<h5 id="org75da222"><span class="section-number-5">1.1.7.2</span> Reduced density matrix</h5>
<div class="outline-text-5" id="text-1-1-7-2">
<div class="org-src-container">
<pre class="src src-f90">rc = trexio_has_rdm_2e(f)
@ -637,8 +637,8 @@ icount = bufsize
</div>
</div>
<div id="outline-container-org1b2bcd8" class="outline-4">
<h4 id="org1b2bcd8"><span class="section-number-4">1.1.8</span> Compute the energy</h4>
<div id="outline-container-orgd6ddd82" class="outline-4">
<h4 id="orgd6ddd82"><span class="section-number-4">1.1.8</span> Compute the energy</h4>
<div class="outline-text-4" id="text-1-1-8">
<p>
When the orbitals are real, we can use
@ -684,8 +684,8 @@ E = E + E_nn
</div>
</div>
<div id="outline-container-orgf7d2f17" class="outline-4">
<h4 id="orgf7d2f17"><span class="section-number-4">1.1.9</span> Terminate</h4>
<div id="outline-container-orgd5fecc9" class="outline-4">
<h4 id="orgd5fecc9"><span class="section-number-4">1.1.9</span> Terminate</h4>
<div class="outline-text-4" id="text-1-1-9">
<div class="org-src-container">
<pre class="src src-f90"> <span style="color: #a020f0;">deallocate</span>( D, h0, G, W )
@ -699,12 +699,12 @@ E = E + E_nn
</div>
<div id="outline-container-org8088931" class="outline-2">
<h2 id="org8088931"><span class="section-number-2">2</span> Reading determinants</h2>
<div id="outline-container-org551626c" class="outline-2">
<h2 id="org551626c"><span class="section-number-2">2</span> Reading determinants</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-orgff97007" class="outline-3">
<h3 id="orgff97007"><span class="section-number-3">2.1</span> Fortran</h3>
<div id="outline-container-org3806827" class="outline-3">
<h3 id="org3806827"><span class="section-number-3">2.1</span> Fortran</h3>
<div class="outline-text-3" id="text-2-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">program</span> <span style="color: #0000ff;">test</span>
@ -783,7 +783,7 @@ end
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2022-10-04 Tue 15:30</p>
<p class="date">Created: 2022-10-06 Thu 13:35</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2022-10-04 Tue 15:30 -->
<!-- 2022-10-06 Thu 13:35 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>TREXIO source code documentation</title>
@ -347,7 +347,7 @@ and bug reports should be submitted at
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2022-10-04 Tue 15:30</p>
<p class="date">Created: 2022-10-06 Thu 13:35</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2022-10-04 Tue 15:30 -->
<!-- 2022-10-06 Thu 13:35 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>HDF5 back end</title>
@ -311,24 +311,25 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org1e1f226">1. Template for HDF5 definitions</a></li>
<li><a href="#orgb00a10b">2. Template for HDF5 structures</a></li>
<li><a href="#org1f5ce89">3. Template for HDF5 init/deinit</a></li>
<li><a href="#org6e34dc9">4. Template for HDF5 has a group</a></li>
<li><a href="#orgacb9979">5. Template for HDF5 has/read/write a numerical attribute</a></li>
<li><a href="#org5cf4476">6. Template for HDF5 has/read/write a dataset of numerical data</a></li>
<li><a href="#orgbf16202">7. Template for HDF5 has/read/write a dataset of sparse data</a></li>
<li><a href="#org0c72410">8. Template for HDF5 has/read/write a dataset of strings</a></li>
<li><a href="#org01fd1b8">9. Template for HDF5 has/read/write a string attribute</a></li>
<li><a href="#org0a14af1">10. Template for HDF5 delete a group (UNSAFE mode)</a></li>
<li><a href="#org6cff039">11. Source code for the determinant part</a></li>
<li><a href="#orgdb62ea5">12. Helper functions</a></li>
<li><a href="#org246ffdc">1. Template for HDF5 definitions</a></li>
<li><a href="#org8317b02">2. Template for HDF5 structures</a></li>
<li><a href="#org460ee6c">3. Template for HDF5 init/deinit</a></li>
<li><a href="#org355e79b">4. Template for HDF5 has a group</a></li>
<li><a href="#org0d92dcf">5. Template for HDF5 has/read/write a numerical attribute</a></li>
<li><a href="#orgc550ebf">6. Template for HDF5 has/read/write a dataset of numerical data</a></li>
<li><a href="#org84f42be">7. Template for HDF5 has/read/write a dataset of sparse data</a></li>
<li><a href="#org3d27d6c">8. Template for HDF5 has/read/write a dataset of buffered vectors</a></li>
<li><a href="#orgf8e608d">9. Template for HDF5 has/read/write a dataset of strings</a></li>
<li><a href="#org4422d26">10. Template for HDF5 has/read/write a string attribute</a></li>
<li><a href="#orge759da6">11. Template for HDF5 delete a group (UNSAFE mode)</a></li>
<li><a href="#org98c9a70">12. Source code for the determinant part</a></li>
<li><a href="#org8bc4db2">13. Helper functions</a></li>
</ul>
</div>
</div>
<div id="outline-container-org1e1f226" class="outline-2">
<h2 id="org1e1f226"><span class="section-number-2">1</span> Template for HDF5 definitions</h2>
<div id="outline-container-org246ffdc" class="outline-2">
<h2 id="org246ffdc"><span class="section-number-2">1</span> Template for HDF5 definitions</h2>
<div class="outline-text-2" id="text-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #483d8b;">#define</span> $GROUP$_GROUP_NAME <span style="color: #8b2252;">"$group$"</span>
@ -340,8 +341,8 @@ for the JavaScript code in this tag.
</div>
</div>
<div id="outline-container-orgb00a10b" class="outline-2">
<h2 id="orgb00a10b"><span class="section-number-2">2</span> Template for HDF5 structures</h2>
<div id="outline-container-org8317b02" class="outline-2">
<h2 id="org8317b02"><span class="section-number-2">2</span> Template for HDF5 structures</h2>
<div class="outline-text-2" id="text-2">
<p>
Polymorphism of the <code>trexio_t</code> type is handled by ensuring that the
@ -361,8 +362,8 @@ corresponding types for all back ends can be safely casted to
</div>
</div>
<div id="outline-container-org1f5ce89" class="outline-2">
<h2 id="org1f5ce89"><span class="section-number-2">3</span> Template for HDF5 init/deinit</h2>
<div id="outline-container-org460ee6c" class="outline-2">
<h2 id="org460ee6c"><span class="section-number-2">3</span> Template for HDF5 init/deinit</h2>
<div class="outline-text-2" id="text-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -482,8 +483,8 @@ corresponding types for all back ends can be safely casted to
</div>
</div>
<div id="outline-container-org6e34dc9" class="outline-2">
<h2 id="org6e34dc9"><span class="section-number-2">4</span> Template for HDF5 has a group</h2>
<div id="outline-container-org355e79b" class="outline-2">
<h2 id="org355e79b"><span class="section-number-2">4</span> Template for HDF5 has a group</h2>
<div class="outline-text-2" id="text-4">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -513,8 +514,8 @@ corresponding types for all back ends can be safely casted to
</div>
</div>
<div id="outline-container-orgacb9979" class="outline-2">
<h2 id="orgacb9979"><span class="section-number-2">5</span> Template for HDF5 has/read/write a numerical attribute</h2>
<div id="outline-container-org0d92dcf" class="outline-2">
<h2 id="org0d92dcf"><span class="section-number-2">5</span> Template for HDF5 has/read/write a numerical attribute</h2>
<div class="outline-text-2" id="text-5">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -618,8 +619,8 @@ corresponding types for all back ends can be safely casted to
</div>
</div>
<div id="outline-container-org5cf4476" class="outline-2">
<h2 id="org5cf4476"><span class="section-number-2">6</span> Template for HDF5 has/read/write a dataset of numerical data</h2>
<div id="outline-container-orgc550ebf" class="outline-2">
<h2 id="orgc550ebf"><span class="section-number-2">6</span> Template for HDF5 has/read/write a dataset of numerical data</h2>
<div class="outline-text-2" id="text-6">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -753,8 +754,8 @@ corresponding types for all back ends can be safely casted to
</div>
</div>
<div id="outline-container-orgbf16202" class="outline-2">
<h2 id="orgbf16202"><span class="section-number-2">7</span> Template for HDF5 has/read/write a dataset of sparse data</h2>
<div id="outline-container-org84f42be" class="outline-2">
<h2 id="org84f42be"><span class="section-number-2">7</span> Template for HDF5 has/read/write a dataset of sparse data</h2>
<div class="outline-text-2" id="text-7">
<p>
Sparse data is stored using extensible datasets of HDF5. Extensibility is required
@ -957,9 +958,145 @@ due to the fact that the sparse data will be written in chunks of user-defined s
</div>
</div>
<div id="outline-container-org0c72410" class="outline-2">
<h2 id="org0c72410"><span class="section-number-2">8</span> Template for HDF5 has/read/write a dataset of strings</h2>
<div id="outline-container-org3d27d6c" class="outline-2">
<h2 id="org3d27d6c"><span class="section-number-2">8</span> Template for HDF5 has/read/write a dataset of buffered vectors</h2>
<div class="outline-text-2" id="text-8">
<p>
Chunked I/O in HDF5 for <code>buffered</code> data.
</p>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_hdf5_read_$group_dset$</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">offset_file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">rank</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint64_t</span>* <span style="color: #a0522d;">dims</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">eof_read_size</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">dset</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (eof_read_size == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_5;
<span style="color: #a020f0;">if</span> (dset == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_6;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">dset_name</span>[256] = <span style="color: #8b2252;">"$group_dset$"</span>;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">trexio_hdf5_t</span>* <span style="color: #a0522d;">f</span> = (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">trexio_hdf5_t</span>*) file;
<span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">offset</span>[1] = {(<span style="color: #228b22;">hsize_t</span>) offset_file};
<span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">count</span>[1] = {(<span style="color: #228b22;">hsize_t</span>) dims[0]};
/* <span style="color: #b22222;">Attempt to read values (if EOF -&gt; eof_read_size is modified with the number of elements read and return code is TREXIO_END)</span>
<span style="color: #b22222;"> 0 argument below is requires to skip internal treatment specific to sparse indices (i.e. their de-compression).</span>*/
<span style="color: #a020f0;">return</span> trexio_hdf5_open_read_dset_sparse(f-&gt;$group$_group, dset_name, 1, offset, count, eof_read_size, 0, dset);
}
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_hdf5_write_$group_dset$</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">offset_file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">rank</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint64_t</span>* <span style="color: #a0522d;">dims</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">dset</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (dset == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_5;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">dset_name</span>[256] = <span style="color: #8b2252;">"$group_dset$"</span>;
<span style="color: #228b22;">trexio_hdf5_t</span>* <span style="color: #a0522d;">f</span> = (<span style="color: #228b22;">trexio_hdf5_t</span>*) file;
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dtype</span> = H5T_NATIVE_DOUBLE;
/* <span style="color: #b22222;">Arrays of chunk dims that will be used for chunking the dataset </span>*/
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">chunk_dims</span>[1] = {(<span style="color: #228b22;">hsize_t</span>) dims[0]};
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #a0522d;">rc_write</span> = TREXIO_FAILURE;
/* <span style="color: #b22222;">NOTE: chunk size is set upon creation of the HDF5 dataset and cannot be changed ! </span>*/
<span style="color: #a020f0;">if</span> ( H5LTfind_dataset(f-&gt;$group$_group, dset_name) != 1 ) {
/* <span style="color: #b22222;">If the file does not exist -&gt; create it and write </span>*/
/* <span style="color: #b22222;">Create chunked dataset with dtype datatype and write indices into it </span>*/
rc_write = trexio_hdf5_create_write_dset_sparse(f-&gt;$group$_group, dset_name, dtype, chunk_dims, dset);
<span style="color: #a020f0;">if</span> (rc_write != TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> rc_write;
} <span style="color: #a020f0;">else</span> {
/* <span style="color: #b22222;">If the file exists -&gt; open it and write </span>*/
<span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">offset_data</span>[1] = {(<span style="color: #228b22;">hsize_t</span>) offset_file};
/* <span style="color: #b22222;">Create chunked dataset with dtype datatype and write indices into it </span>*/
rc_write = trexio_hdf5_open_write_dset_sparse(f-&gt;$group$_group, dset_name, dtype, chunk_dims, offset_data, dset);
<span style="color: #a020f0;">if</span> (rc_write != TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> rc_write;
}
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
<span style="color: #228b22;">trexio_exit_code</span>
<span style="color: #0000ff;">trexio_hdf5_read_$group_dset$_size</span> (<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>, <span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">size_max</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (size_max == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_2;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">dset_name</span>[256] = <span style="color: #8b2252;">"$group_dset$"</span>;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">trexio_hdf5_t</span>* <span style="color: #a0522d;">f</span> = (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">trexio_hdf5_t</span>*) file;
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dset_id</span> = H5Dopen(f-&gt;$group$_group, dset_name, H5P_DEFAULT);
<span style="color: #a020f0;">if</span> (dset_id &lt;= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">fspace_id</span> = H5Dget_space(dset_id);
<span style="color: #a020f0;">if</span> (fspace_id &lt; 0) {
H5Dclose(dset_id);
<span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
}
// <span style="color: #b22222;">allocate space for the dimensions to be read</span>
<span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">ddims</span>[1] = {0};
// <span style="color: #b22222;">get the rank and dimensions of the dataset</span>
H5Sget_simple_extent_dims(fspace_id, ddims, <span style="color: #008b8b;">NULL</span>);
H5Dclose(dset_id);
H5Sclose(fspace_id);
*size_max = (<span style="color: #228b22;">int64_t</span>) ddims[0];
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_hdf5_has_$group_dset$</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #228b22;">trexio_hdf5_t</span>* <span style="color: #a0522d;">f</span> = (<span style="color: #228b22;">trexio_hdf5_t</span>*) file;
<span style="color: #a020f0;">if</span> (f-&gt;$group$_group == (<span style="color: #228b22;">hsize_t</span>) 0) <span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">dset_name</span>[256] = <span style="color: #8b2252;">"$group_dset$"</span>;
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5LTfind_dataset(f-&gt;$group$_group, dset_name);
/* <span style="color: #b22222;">H5LTfind_dataset returns 1 if dataset exists, 0 otherwise </span>*/
<span style="color: #a020f0;">if</span> (status == 1){
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
} <span style="color: #a020f0;">else</span> <span style="color: #a020f0;">if</span> (status == 0) {
<span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
} <span style="color: #a020f0;">else</span> {
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
}
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf8e608d" class="outline-2">
<h2 id="orgf8e608d"><span class="section-number-2">9</span> Template for HDF5 has/read/write a dataset of strings</h2>
<div class="outline-text-2" id="text-9">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
<span style="color: #0000ff;">trexio_hdf5_read_$group_dset$</span> (<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>, <span style="color: #228b22;">char</span>* <span style="color: #a020f0;">const</span> $group_dset$, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">rank</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint64_t</span>* <span style="color: #a0522d;">dims</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">max_str_len</span>)
@ -1156,9 +1293,9 @@ due to the fact that the sparse data will be written in chunks of user-defined s
</div>
</div>
<div id="outline-container-org01fd1b8" class="outline-2">
<h2 id="org01fd1b8"><span class="section-number-2">9</span> Template for HDF5 has/read/write a string attribute</h2>
<div class="outline-text-2" id="text-9">
<div id="outline-container-org4422d26" class="outline-2">
<h2 id="org4422d26"><span class="section-number-2">10</span> Template for HDF5 has/read/write a string attribute</h2>
<div class="outline-text-2" id="text-10">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
<span style="color: #0000ff;">trexio_hdf5_read_$group_str$</span> (<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>, <span style="color: #228b22;">char</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">str</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">max_str_len</span>)
@ -1284,9 +1421,9 @@ due to the fact that the sparse data will be written in chunks of user-defined s
</div>
</div>
</div>
<div id="outline-container-org0a14af1" class="outline-2">
<h2 id="org0a14af1"><span class="section-number-2">10</span> Template for HDF5 delete a group (UNSAFE mode)</h2>
<div class="outline-text-2" id="text-10">
<div id="outline-container-orge759da6" class="outline-2">
<h2 id="orge759da6"><span class="section-number-2">11</span> Template for HDF5 delete a group (UNSAFE mode)</h2>
<div class="outline-text-2" id="text-11">
<p>
<b><b>Note:</b></b> in early versions of the HDF5 library (v &lt; 1.10) unlinking an object was not working as expected
and the associated memory was not necessarily freed (see <a href="https://stackoverflow.com/questions/1124994/removing-data-from-a-hdf5-file">this StackOverflow discussion</a> for example).
@ -1325,9 +1462,9 @@ Thus, any corrupted/lost file space will remain in the first file. The use of <c
</div>
</div>
<div id="outline-container-org6cff039" class="outline-2">
<h2 id="org6cff039"><span class="section-number-2">11</span> Source code for the determinant part</h2>
<div class="outline-text-2" id="text-11">
<div id="outline-container-org98c9a70" class="outline-2">
<h2 id="org98c9a70"><span class="section-number-2">12</span> Source code for the determinant part</h2>
<div class="outline-text-2" id="text-12">
<p>
Each array is stored in a separate HDF5 dataset due to the fact that determinant I/O has to be decoupled.
Chunks are used to read/write the data to prevent memory overflow. Chunks have a given <code>int64_t dims[0]*dims[1]</code>.
@ -1357,37 +1494,6 @@ Size specifies the number of data items (e.g. determinants) to process.
<span style="color: #b22222;"> 0 argument below is requires to skip internal treatment specific to sparse indices (i.e. their de-compression).</span>*/
<span style="color: #a020f0;">return</span> trexio_hdf5_open_read_dset_sparse(f-&gt;determinant_group, dset_det_name, (<span style="color: #228b22;">uint32_t</span>) dims[1], offset, count, eof_read_size, 0, list);
}
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_hdf5_read_determinant_coefficient</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">offset_file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">rank</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint64_t</span>* <span style="color: #a0522d;">dims</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">eof_read_size</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">coeff</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (eof_read_size == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_5;
<span style="color: #a020f0;">if</span> (coeff == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_6;
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">dset_coeff_name</span>[128];
memset(dset_coeff_name, 0, <span style="color: #a020f0;">sizeof</span>(dset_coeff_name));
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">trexio_state</span> = file-&gt;state;
<span style="color: #a020f0;">if</span> (trexio_state != 0) {
sprintf(dset_coeff_name, <span style="color: #8b2252;">"determinant_coefficient_state_%"</span> PRId32, trexio_state);
} <span style="color: #a020f0;">else</span> {
strncpy(dset_coeff_name, <span style="color: #8b2252;">"determinant_coefficient"</span>, 24);
}
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">trexio_hdf5_t</span>* <span style="color: #a0522d;">f</span> = (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">trexio_hdf5_t</span>*) file;
<span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">offset</span>[1] = {(<span style="color: #228b22;">hsize_t</span>) offset_file};
<span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">count</span>[1] = {(<span style="color: #228b22;">hsize_t</span>) dims[0]};
/* <span style="color: #b22222;">Attempt to read determinants (if EOF -&gt; eof_read_size is modified with the number of elements read and return code is TREXIO_END)</span>
<span style="color: #b22222;"> 0 argument below is requires to skip internal treatment specific to sparse indices (i.e. their de-compression).</span>*/
<span style="color: #a020f0;">return</span> trexio_hdf5_open_read_dset_sparse(f-&gt;determinant_group, dset_coeff_name, 1, offset, count, eof_read_size, 0, coeff);
}
</pre>
</div>
@ -1434,97 +1540,6 @@ Size specifies the number of data items (e.g. determinants) to process.
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_hdf5_write_determinant_coefficient</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">offset_file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">rank</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint64_t</span>* <span style="color: #a0522d;">dims</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coeff</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (coeff == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_5;
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">dset_coeff_name</span>[128];
memset(dset_coeff_name, 0, <span style="color: #a020f0;">sizeof</span>(dset_coeff_name));
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">trexio_state</span> = file-&gt;state;
<span style="color: #a020f0;">if</span> (trexio_state != 0) {
sprintf(dset_coeff_name, <span style="color: #8b2252;">"determinant_coefficient_state_%"</span> PRId32, trexio_state);
} <span style="color: #a020f0;">else</span> {
strncpy(dset_coeff_name, <span style="color: #8b2252;">"determinant_coefficient"</span>, 24);
}
<span style="color: #228b22;">trexio_hdf5_t</span>* <span style="color: #a0522d;">f</span> = (<span style="color: #228b22;">trexio_hdf5_t</span>*) file;
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">det_dtype</span> = H5T_NATIVE_DOUBLE;
/* <span style="color: #b22222;">Arrays of chunk dims that will be used for chunking the dataset </span>*/
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">chunk_dims</span>[1] = {(<span style="color: #228b22;">hsize_t</span>) dims[0]};
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #a0522d;">rc_write</span> = TREXIO_FAILURE;
/* <span style="color: #b22222;">NOTE: chunk size is set upon creation of the HDF5 dataset and cannot be changed ! </span>*/
<span style="color: #a020f0;">if</span> ( H5LTfind_dataset(f-&gt;determinant_group, dset_coeff_name) != 1 ) {
/* <span style="color: #b22222;">If the file does not exist -&gt; create it and write </span>*/
/* <span style="color: #b22222;">Create chunked dataset with det_dtype datatype and write indices into it </span>*/
rc_write = trexio_hdf5_create_write_dset_sparse(f-&gt;determinant_group, dset_coeff_name, det_dtype, chunk_dims, coeff);
<span style="color: #a020f0;">if</span> (rc_write != TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> rc_write;
} <span style="color: #a020f0;">else</span> {
/* <span style="color: #b22222;">If the file exists -&gt; open it and write </span>*/
<span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">offset_data</span>[1] = {(<span style="color: #228b22;">hsize_t</span>) offset_file};
/* <span style="color: #b22222;">Create chunked dataset with det_dtype datatype and write indices into it </span>*/
rc_write = trexio_hdf5_open_write_dset_sparse(f-&gt;determinant_group, dset_coeff_name, det_dtype, chunk_dims, offset_data, coeff);
<span style="color: #a020f0;">if</span> (rc_write != TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> rc_write;
}
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
<span style="color: #228b22;">trexio_exit_code</span>
<span style="color: #0000ff;">trexio_hdf5_read_determinant_coefficient_size</span> (<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>, <span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">size_max</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (size_max == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_2;
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">dset_coeff_name</span>[128];
memset(dset_coeff_name, 0, <span style="color: #a020f0;">sizeof</span>(dset_coeff_name));
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">trexio_state</span> = file-&gt;state;
<span style="color: #a020f0;">if</span> (trexio_state != 0) {
sprintf(dset_coeff_name, <span style="color: #8b2252;">"determinant_coefficient_state_%"</span> PRId32, trexio_state);
} <span style="color: #a020f0;">else</span> {
strncpy(dset_coeff_name, <span style="color: #8b2252;">"determinant_coefficient"</span>, 24);
}
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">trexio_hdf5_t</span>* <span style="color: #a0522d;">f</span> = (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">trexio_hdf5_t</span>*) file;
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dset_id</span> = H5Dopen(f-&gt;determinant_group, dset_coeff_name, H5P_DEFAULT);
<span style="color: #a020f0;">if</span> (dset_id &lt;= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">fspace_id</span> = H5Dget_space(dset_id);
<span style="color: #a020f0;">if</span> (fspace_id &lt; 0) {
H5Dclose(dset_id);
<span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
}
// <span style="color: #b22222;">allocate space for the dimensions to be read</span>
<span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">ddims</span>[1] = {0};
// <span style="color: #b22222;">get the rank and dimensions of the dataset</span>
H5Sget_simple_extent_dims(fspace_id, ddims, <span style="color: #008b8b;">NULL</span>);
H5Dclose(dset_id);
H5Sclose(fspace_id);
*size_max = (<span style="color: #228b22;">int64_t</span>) ddims[0];
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
</pre>
</div>
@ -1546,42 +1561,14 @@ Size specifies the number of data items (e.g. determinants) to process.
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
}
}
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_hdf5_has_determinant_coefficient</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #228b22;">trexio_hdf5_t</span>* <span style="color: #a0522d;">f</span> = (<span style="color: #228b22;">trexio_hdf5_t</span>*) file;
<span style="color: #a020f0;">if</span> (f-&gt;determinant_group == (<span style="color: #228b22;">hsize_t</span>) 0) <span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">dset_coeff_name</span>[128];
memset(dset_coeff_name, 0, <span style="color: #a020f0;">sizeof</span>(dset_coeff_name));
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">trexio_state</span> = file-&gt;state;
<span style="color: #a020f0;">if</span> (trexio_state != 0) {
sprintf(dset_coeff_name, <span style="color: #8b2252;">"determinant_coefficient_state_%"</span> PRId32, trexio_state);
} <span style="color: #a020f0;">else</span> {
strncpy(dset_coeff_name, <span style="color: #8b2252;">"determinant_coefficient"</span>, 24);
}
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5LTfind_dataset(f-&gt;determinant_group, dset_coeff_name);
/* <span style="color: #b22222;">H5LTfind_dataset returns 1 if dataset exists, 0 otherwise </span>*/
<span style="color: #a020f0;">if</span> (status == 1){
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
} <span style="color: #a020f0;">else</span> <span style="color: #a020f0;">if</span> (status == 0) {
<span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
} <span style="color: #a020f0;">else</span> {
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
}
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgdb62ea5" class="outline-2">
<h2 id="orgdb62ea5"><span class="section-number-2">12</span> Helper functions</h2>
<div class="outline-text-2" id="text-12">
<div id="outline-container-org8bc4db2" class="outline-2">
<h2 id="org8bc4db2"><span class="section-number-2">13</span> Helper functions</h2>
<div class="outline-text-2" id="text-13">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
<span style="color: #0000ff;">trexio_hdf5_create_write_dset_sparse</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">group_id</span>,
@ -1843,7 +1830,7 @@ Size specifies the number of data items (e.g. determinants) to process.
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2022-10-04 Tue 15:30</p>
<p class="date">Created: 2022-10-06 Thu 13:35</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2022-10-04 Tue 15:30 -->
<!-- 2022-10-06 Thu 13:35 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>TEXT back end</title>
@ -311,22 +311,23 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org9d62113">1. Template for group-related structures in text back end</a></li>
<li><a href="#orgb74cc83">2. Template for general structure in text back end</a></li>
<li><a href="#org789af86">3. Initialize function (constant part)</a></li>
<li><a href="#org39c9237">4. Deinitialize function (templated part)</a></li>
<li><a href="#org023e4a5">5. Flush function (templated part)</a></li>
<li><a href="#orgc580483">6. Template for text read a group</a></li>
<li><a href="#orgc8936b4">7. Template for text has a group</a></li>
<li><a href="#org4f6762c">8. Template for text flush a group</a></li>
<li><a href="#org086a039">9. Template for text free memory</a></li>
<li><a href="#orge565e65">10. Template for has/read/write a numerical attribute</a></li>
<li><a href="#orga0d282a">11. Template for has/read/write a dataset of numerical data</a></li>
<li><a href="#org31593bd">12. Template for has/read/write a dataset of strings</a></li>
<li><a href="#orgb84cebd">13. Template for has/read/write a string attribute</a></li>
<li><a href="#org9bca428">14. Template for has/read/write the dataset of sparse data</a></li>
<li><a href="#orgb8dbd9a">15. Template for text delete a group (UNSAFE mode)</a></li>
<li><a href="#orgeb697cc">16. Source code for the determinant part</a></li>
<li><a href="#org78bd9f1">1. Template for group-related structures in text back end</a></li>
<li><a href="#orgd8c09cf">2. Template for general structure in text back end</a></li>
<li><a href="#org44fd165">3. Initialize function (constant part)</a></li>
<li><a href="#org214c263">4. Deinitialize function (templated part)</a></li>
<li><a href="#org436e771">5. Flush function (templated part)</a></li>
<li><a href="#orgb7d31b8">6. Template for text read a group</a></li>
<li><a href="#org79f1647">7. Template for text has a group</a></li>
<li><a href="#org219178b">8. Template for text flush a group</a></li>
<li><a href="#orgf2232d0">9. Template for text free memory</a></li>
<li><a href="#org7034821">10. Template for has/read/write a numerical attribute</a></li>
<li><a href="#org8a2f19d">11. Template for has/read/write a dataset of numerical data</a></li>
<li><a href="#org4cd23dc">12. Template for has/read/write a dataset of strings</a></li>
<li><a href="#orge0f79f8">13. Template for has/read/write a string attribute</a></li>
<li><a href="#orgf66c25c">14. Template for has/read/write the dataset of sparse data</a></li>
<li><a href="#orgad47a68">15. Template for has/read/write a buffered vector</a></li>
<li><a href="#org21b9574">16. Template for text delete a group (UNSAFE mode)</a></li>
<li><a href="#orgf02d803">17. Source code for the determinant part</a></li>
</ul>
</div>
</div>
@ -348,8 +349,8 @@ directory.
The file is written when closed, or when the flush function is called.
</p>
<div id="outline-container-org9d62113" class="outline-2">
<h2 id="org9d62113"><span class="section-number-2">1</span> Template for group-related structures in text back end</h2>
<div id="outline-container-org78bd9f1" class="outline-2">
<h2 id="org78bd9f1"><span class="section-number-2">1</span> Template for group-related structures in text back end</h2>
<div class="outline-text-2" id="text-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> $group$_s {
@ -368,8 +369,8 @@ The file is written when closed, or when the flush function is called.
</div>
</div>
<div id="outline-container-orgb74cc83" class="outline-2">
<h2 id="orgb74cc83"><span class="section-number-2">2</span> Template for general structure in text back end</h2>
<div id="outline-container-orgd8c09cf" class="outline-2">
<h2 id="orgd8c09cf"><span class="section-number-2">2</span> Template for general structure in text back end</h2>
<div class="outline-text-2" id="text-2">
<p>
Polymorphism of the <code>trexio_t</code> type is handled by ensuring that the
@ -389,8 +390,8 @@ corresponding types for all back ends can be safely casted to
</div>
</div>
<div id="outline-container-org789af86" class="outline-2">
<h2 id="org789af86"><span class="section-number-2">3</span> Initialize function (constant part)</h2>
<div id="outline-container-org44fd165" class="outline-2">
<h2 id="org44fd165"><span class="section-number-2">3</span> Initialize function (constant part)</h2>
<div class="outline-text-2" id="text-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">bool</span>
@ -557,8 +558,8 @@ corresponding types for all back ends can be safely casted to
</div>
</div>
<div id="outline-container-org39c9237" class="outline-2">
<h2 id="org39c9237"><span class="section-number-2">4</span> Deinitialize function (templated part)</h2>
<div id="outline-container-org214c263" class="outline-2">
<h2 id="org214c263"><span class="section-number-2">4</span> Deinitialize function (templated part)</h2>
<div class="outline-text-2" id="text-4">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -580,8 +581,8 @@ corresponding types for all back ends can be safely casted to
</div>
</div>
<div id="outline-container-org023e4a5" class="outline-2">
<h2 id="org023e4a5"><span class="section-number-2">5</span> Flush function (templated part)</h2>
<div id="outline-container-org436e771" class="outline-2">
<h2 id="org436e771"><span class="section-number-2">5</span> Flush function (templated part)</h2>
<div class="outline-text-2" id="text-5">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -604,8 +605,8 @@ corresponding types for all back ends can be safely casted to
</div>
</div>
<div id="outline-container-orgc580483" class="outline-2">
<h2 id="orgc580483"><span class="section-number-2">6</span> Template for text read a group</h2>
<div id="outline-container-orgb7d31b8" class="outline-2">
<h2 id="orgb7d31b8"><span class="section-number-2">6</span> Template for text read a group</h2>
<div class="outline-text-2" id="text-6">
<div class="org-src-container">
<pre class="src src-c">$group$_t*
@ -831,8 +832,8 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
</div>
</div>
<div id="outline-container-orgc8936b4" class="outline-2">
<h2 id="orgc8936b4"><span class="section-number-2">7</span> Template for text has a group</h2>
<div id="outline-container-org79f1647" class="outline-2">
<h2 id="org79f1647"><span class="section-number-2">7</span> Template for text has a group</h2>
<div class="outline-text-2" id="text-7">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -872,8 +873,8 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
</div>
</div>
<div id="outline-container-org4f6762c" class="outline-2">
<h2 id="org4f6762c"><span class="section-number-2">8</span> Template for text flush a group</h2>
<div id="outline-container-org219178b" class="outline-2">
<h2 id="org219178b"><span class="section-number-2">8</span> Template for text flush a group</h2>
<div class="outline-text-2" id="text-8">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -937,8 +938,8 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
</div>
</div>
<div id="outline-container-org086a039" class="outline-2">
<h2 id="org086a039"><span class="section-number-2">9</span> Template for text free memory</h2>
<div id="outline-container-orgf2232d0" class="outline-2">
<h2 id="orgf2232d0"><span class="section-number-2">9</span> Template for text free memory</h2>
<div class="outline-text-2" id="text-9">
<p>
Memory is allocated when reading. The following function frees memory.
@ -1007,8 +1008,8 @@ This function is called upon the non-successful exit from the <code>trexio_text_
</div>
</div>
<div id="outline-container-orge565e65" class="outline-2">
<h2 id="orge565e65"><span class="section-number-2">10</span> Template for has/read/write a numerical attribute</h2>
<div id="outline-container-org7034821" class="outline-2">
<h2 id="org7034821"><span class="section-number-2">10</span> Template for has/read/write a numerical attribute</h2>
<div class="outline-text-2" id="text-10">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -1071,8 +1072,8 @@ This function is called upon the non-successful exit from the <code>trexio_text_
</div>
</div>
<div id="outline-container-orga0d282a" class="outline-2">
<h2 id="orga0d282a"><span class="section-number-2">11</span> Template for has/read/write a dataset of numerical data</h2>
<div id="outline-container-org8a2f19d" class="outline-2">
<h2 id="org8a2f19d"><span class="section-number-2">11</span> Template for has/read/write a dataset of numerical data</h2>
<div class="outline-text-2" id="text-11">
<p>
The <code>group_dset</code> array is assumed allocated with the appropriate size.
@ -1168,8 +1169,8 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
</div>
</div>
</div>
<div id="outline-container-org31593bd" class="outline-2">
<h2 id="org31593bd"><span class="section-number-2">12</span> Template for has/read/write a dataset of strings</h2>
<div id="outline-container-org4cd23dc" class="outline-2">
<h2 id="org4cd23dc"><span class="section-number-2">12</span> Template for has/read/write a dataset of strings</h2>
<div class="outline-text-2" id="text-12">
<p>
The <code>group_dset</code> array is assumed allocated with the appropriate size.
@ -1270,8 +1271,8 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
</div>
</div>
</div>
<div id="outline-container-orgb84cebd" class="outline-2">
<h2 id="orgb84cebd"><span class="section-number-2">13</span> Template for has/read/write a string attribute</h2>
<div id="outline-container-orge0f79f8" class="outline-2">
<h2 id="orge0f79f8"><span class="section-number-2">13</span> Template for has/read/write a string attribute</h2>
<div class="outline-text-2" id="text-13">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
@ -1345,8 +1346,8 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
</div>
</div>
</div>
<div id="outline-container-org9bca428" class="outline-2">
<h2 id="org9bca428"><span class="section-number-2">14</span> Template for has/read/write the dataset of sparse data</h2>
<div id="outline-container-orgf66c25c" class="outline-2">
<h2 id="orgf66c25c"><span class="section-number-2">14</span> Template for has/read/write the dataset of sparse data</h2>
<div class="outline-text-2" id="text-14">
<p>
Each sparse array is stored in a separate <code>.txt</code> file due to the fact that sparse I/O has to be decoupled
@ -1636,9 +1637,240 @@ User provides indices and values of the sparse array as two separate variables.
</div>
</div>
<div id="outline-container-orgb8dbd9a" class="outline-2">
<h2 id="orgb8dbd9a"><span class="section-number-2">15</span> Template for text delete a group (UNSAFE mode)</h2>
<div id="outline-container-orgad47a68" class="outline-2">
<h2 id="orgad47a68"><span class="section-number-2">15</span> Template for has/read/write a buffered vector</h2>
<div class="outline-text-2" id="text-15">
<p>
Each array is stored in a separate <code>.txt</code> file due to the fact that buffered I/O has to be decoupled
from conventional write/read/flush behaviour of the TEXT back end. Chunks are used to read/write the data
to prevent memory overflow. Chunks have a given <code>int64_t size</code>.
Size specifies the number of vector elements to be written.
</p>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_text_read_$group_dset$</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">offset_file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">rank</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint64_t</span>* <span style="color: #a0522d;">dims</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">eof_read_size</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">dset</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (eof_read_size == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_5;
<span style="color: #a020f0;">if</span> (dset == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_6;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_name</span>[256] = <span style="color: #8b2252;">"/$group_dset$.txt"</span>;
/* <span style="color: #b22222;">The full path to the destination TXT file with sparse data. This will include TREXIO directory name. </span>*/
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_full_path</span>[TREXIO_MAX_FILENAME_LENGTH];
/* <span style="color: #b22222;">Copy directory name in file_full_path </span>*/
strncpy (file_full_path, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
strncat (file_full_path, file_name, TREXIO_MAX_FILENAME_LENGTH - <span style="color: #a020f0;">sizeof</span>(file_name));
/* <span style="color: #b22222;">Open the file in "r" (read) mode to guarantee that no truncation happens upon consecutive reads </span>*/
<span style="color: #228b22;">FILE</span>* <span style="color: #a0522d;">f</span> = fopen(file_full_path, <span style="color: #8b2252;">"r"</span>);
<span style="color: #a020f0;">if</span> (f == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Specify the line length in order to offset properly.</span>
<span style="color: #b22222;"> Each double value 24 elements + one newline char.</span>
<span style="color: #b22222;"> </span>*/
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">line_length</span> = 25UL;
/* <span style="color: #b22222;">Offset in the file according to the provided value of offset_file and optimal line_length </span>*/
fseek(f, (<span style="color: #228b22;">long</span>) <span style="color: #228b22;">offset_file</span> * <span style="color: #a0522d;">line_length</span>, <span style="color: #a0522d;">SEEK_SET</span>);
/* <span style="color: #b22222;">Read the data from the file and check the return code of fprintf to verify that &gt; 0 bytes have been read or reached EOF </span>*/
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rc</span>;
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">buffer</span>[64];
<span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">buf_size</span> = <span style="color: #a020f0;">sizeof</span>(buffer);
/* <span style="color: #b22222;">Counter for number of elements beind processed </span>*/
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">count</span> = 0UL;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">i</span>=0UL; i &lt; dims[0]; ++i) {
memset(buffer, 0, buf_size);
<span style="color: #a020f0;">if</span> (fgets(buffer, buf_size-1, f) == <span style="color: #008b8b;">NULL</span>){
fclose(f);
*eof_read_size = count;
<span style="color: #a020f0;">return</span> TREXIO_END;
} <span style="color: #a020f0;">else</span> {
rc = sscanf(buffer, <span style="color: #8b2252;">"%lf"</span>, dset + i);
<span style="color: #a020f0;">if</span> (rc &lt;= 0) {
fclose(f);
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
}
count += 1UL;
}
}
/* <span style="color: #b22222;">Close the TXT file </span>*/
rc = fclose(f);
<span style="color: #a020f0;">if</span> (rc != 0) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
<span style="color: #228b22;">trexio_exit_code</span>
<span style="color: #0000ff;">trexio_text_read_$group_dset$_size</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>, <span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">size_max</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (size_max == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_2;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_name</span>[256] = <span style="color: #8b2252;">"/$group_dset$.txt.size"</span>;
/* <span style="color: #b22222;">The full path to the destination TXT file with sparse data. This will include TREXIO directory name. </span>*/
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_full_path</span>[TREXIO_MAX_FILENAME_LENGTH];
/* <span style="color: #b22222;">Copy directory name in file_full_path </span>*/
strncpy (file_full_path, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
strncat (file_full_path, file_name, TREXIO_MAX_FILENAME_LENGTH - <span style="color: #a020f0;">sizeof</span>(file_name));
/* <span style="color: #b22222;">Open the file in "r" (read) mode to guarantee that no truncation happens upon consecutive reads </span>*/
<span style="color: #228b22;">FILE</span>* <span style="color: #a0522d;">f</span> = fopen(file_full_path, <span style="color: #8b2252;">"r"</span>);
<span style="color: #a020f0;">if</span> (f == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Read the data from the file and check the return code of fprintf to verify that &gt; 0 bytes have been read or reached EOF </span>*/
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rc</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_item</span>, <span style="color: #a0522d;">size_accum</span>=0L;
/* <span style="color: #b22222;">Read the values from the file. BEWARE OF POSSIBLE MAX_INT64 OVERFLOW ! </span>*/
<span style="color: #a020f0;">while</span>(fscanf(f, <span style="color: #8b2252;">"%"</span> SCNd64, &amp;size_item) != EOF) {
/* <span style="color: #b22222;">Check that summation will not overflow the int64_t value </span>*/
<span style="color: #a020f0;">if</span> (INT64_MAX - size_accum &gt; size_item) {
size_accum += size_item;
} <span style="color: #a020f0;">else</span> {
fclose(f);
*size_max = -1L;
<span style="color: #a020f0;">return</span> TREXIO_INT_SIZE_OVERFLOW;
}
}
/* <span style="color: #b22222;">Close the TXT file </span>*/
rc = fclose(f);
<span style="color: #a020f0;">if</span> (rc != 0) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Overwrite the value at the input address and return TREXIO_SUCCESS </span>*/
*size_max = size_accum;
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_text_write_$group_dset$</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">offset_file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">rank</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint64_t</span>* <span style="color: #a0522d;">dims</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">dset</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (dset == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_5;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_name</span>[256] = <span style="color: #8b2252;">"/$group_dset$.txt"</span>;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int</span> <span style="color: #a0522d;">append_str_len</span> = 6;
/* <span style="color: #b22222;">The full path to the destination TXT file with sparse data. This will include TREXIO directory name. </span>*/
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_full_path</span>[TREXIO_MAX_FILENAME_LENGTH];
/* <span style="color: #b22222;">Copy directory name in file_full_path </span>*/
strncpy (file_full_path, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
strncat (file_full_path, file_name, TREXIO_MAX_FILENAME_LENGTH - <span style="color: #a020f0;">sizeof</span>(file_name));
/* <span style="color: #b22222;">Open the file in "a" (append) mode to guarantee that no truncation happens upon consecutive writes </span>*/
<span style="color: #228b22;">FILE</span>* <span style="color: #a0522d;">f</span> = fopen(file_full_path, <span style="color: #8b2252;">"a"</span>);
<span style="color: #a020f0;">if</span> (f == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Write the data in the file and check the return code of fprintf to verify that &gt; 0 bytes have been written </span>*/
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rc</span>;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">i</span>=0UL; i &lt; dims[0]; ++i) {
rc = fprintf(f, <span style="color: #8b2252;">"%24.16e\n"</span>, *(dset+ i));
<span style="color: #a020f0;">if</span> (rc &lt;= 0) {
fclose(f);
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
}
}
/* <span style="color: #b22222;">Close the TXT file </span>*/
rc = fclose(f);
<span style="color: #a020f0;">if</span> (rc != 0) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Append .size to the file_full_path in order to write additional info about the written buffer of data </span>*/
strncat(file_full_path, <span style="color: #8b2252;">".size"</span>, append_str_len);
/* <span style="color: #b22222;">Open the new file in "a" (append) mode to append info about the buffer that has been just written </span>*/
<span style="color: #228b22;">FILE</span> *<span style="color: #a0522d;">f_wSize</span> = fopen(file_full_path, <span style="color: #8b2252;">"a"</span>);
<span style="color: #a020f0;">if</span> (f_wSize == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Write the buffer_size </span>*/
rc = fprintf(f_wSize, <span style="color: #8b2252;">"%"</span> PRIu64 <span style="color: #8b2252;">"\n"</span>, dims[0]);
<span style="color: #a020f0;">if</span> (rc &lt;= 0) {
fclose(f_wSize);
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
}
/* <span style="color: #b22222;">Close the TXT file </span>*/
rc = fclose(f_wSize);
<span style="color: #a020f0;">if</span> (rc != 0) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Additional part for the trexio_text_has_group to work </span>*/
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">group_file_name</span>[256] = <span style="color: #8b2252;">"/$group$.txt"</span>;
memset (file_full_path, 0, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Copy directory name in file_full_path </span>*/
strncpy (file_full_path, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
strncat (file_full_path, group_file_name, TREXIO_MAX_FILENAME_LENGTH - <span style="color: #a020f0;">sizeof</span>(group_file_name));
<span style="color: #228b22;">bool</span> <span style="color: #a0522d;">file_exists</span> = trexio_text_file_exists(file_full_path);
/* <span style="color: #b22222;">Create an empty file for the trexio_text_has_group to work </span>*/
<span style="color: #a020f0;">if</span> (!file_exists) {
<span style="color: #228b22;">FILE</span> *<span style="color: #a0522d;">fp</span> = fopen(file_full_path, <span style="color: #8b2252;">"ab+"</span>);
fclose(fp);
}
/* <span style="color: #b22222;">Exit upon success </span>*/
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_text_has_$group_dset$</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_name</span>[256] = <span style="color: #8b2252;">"/$group_dset$.txt"</span>;
/* <span style="color: #b22222;">The full path to the destination TXT file with sparse data. This will include TREXIO directory name. </span>*/
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_full_path</span>[TREXIO_MAX_FILENAME_LENGTH];
/* <span style="color: #b22222;">Copy directory name in file_full_path </span>*/
strncpy (file_full_path, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
strncat (file_full_path, file_name, TREXIO_MAX_FILENAME_LENGTH - <span style="color: #a020f0;">sizeof</span>(file_name));
/* <span style="color: #b22222;">Check the return code of access function to determine whether the file with data exists or not </span>*/
<span style="color: #a020f0;">if</span> (access(file_full_path, F_OK) == 0){
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
} <span style="color: #a020f0;">else</span> {
<span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
}
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org21b9574" class="outline-2">
<h2 id="org21b9574"><span class="section-number-2">16</span> Template for text delete a group (UNSAFE mode)</h2>
<div class="outline-text-2" id="text-16">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
<span style="color: #0000ff;">trexio_text_delete_$group$</span> (<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
@ -1665,9 +1897,9 @@ User provides indices and values of the sparse array as two separate variables.
</div>
</div>
<div id="outline-container-orgeb697cc" class="outline-2">
<h2 id="orgeb697cc"><span class="section-number-2">16</span> Source code for the determinant part</h2>
<div class="outline-text-2" id="text-16">
<div id="outline-container-orgf02d803" class="outline-2">
<h2 id="orgf02d803"><span class="section-number-2">17</span> Source code for the determinant part</h2>
<div class="outline-text-2" id="text-17">
<p>
Each array is stored in a separate <code>.txt</code> file due to the fact that determinant I/O has to be decoupled
from conventional write/read/flush behaviour of the TEXT back end. Chunks are used to read/write the data
@ -1758,136 +1990,6 @@ Size specifies the number of data items, e.g. determinants.
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_text_read_determinant_coefficient</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">offset_file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">rank</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint64_t</span>* <span style="color: #a0522d;">dims</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">eof_read_size</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">coeff</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (eof_read_size == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_5;
<span style="color: #a020f0;">if</span> (coeff == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_6;
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">coeff_file_name</span>[256];
memset(coeff_file_name, 0, <span style="color: #a020f0;">sizeof</span>(coeff_file_name));
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">trexio_state</span> = file-&gt;state;
<span style="color: #a020f0;">if</span> (trexio_state != 0) {
sprintf(coeff_file_name, <span style="color: #8b2252;">"/determinant_coefficient_state_%"</span> PRId32 <span style="color: #8b2252;">".txt"</span>, trexio_state);
} <span style="color: #a020f0;">else</span> {
strncpy(coeff_file_name, <span style="color: #8b2252;">"/determinant_coefficient.txt"</span>, 32);
}
/* <span style="color: #b22222;">The full path to the destination TXT file with sparse data. This will include TREXIO directory name. </span>*/
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_full_path</span>[TREXIO_MAX_FILENAME_LENGTH];
/* <span style="color: #b22222;">Copy directory name in file_full_path </span>*/
strncpy (file_full_path, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
strncat (file_full_path, coeff_file_name,
TREXIO_MAX_FILENAME_LENGTH-strlen(coeff_file_name));
/* <span style="color: #b22222;">Open the file in "r" (read) mode to guarantee that no truncation happens upon consecutive reads </span>*/
<span style="color: #228b22;">FILE</span>* <span style="color: #a0522d;">f</span> = fopen(file_full_path, <span style="color: #8b2252;">"r"</span>);
<span style="color: #a020f0;">if</span> (f == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Specify the line length in order to offset properly.</span>
<span style="color: #b22222;"> Each double value 24 elements + one newline char.</span>
<span style="color: #b22222;"> </span>*/
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">line_length</span> = 25UL;
/* <span style="color: #b22222;">Offset in the file according to the provided value of offset_file and optimal line_length </span>*/
fseek(f, (<span style="color: #228b22;">long</span>) <span style="color: #228b22;">offset_file</span> * <span style="color: #a0522d;">line_length</span>, <span style="color: #a0522d;">SEEK_SET</span>);
/* <span style="color: #b22222;">Read the data from the file and check the return code of fprintf to verify that &gt; 0 bytes have been read or reached EOF </span>*/
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rc</span>;
/* <span style="color: #b22222;">Declare fixed buffer which will be used to read the determinant string &lt;a1 a2 ... a/\ b1 b2 ... b\/&gt; </span>*/
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">buffer</span>[64];
<span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">buf_size</span> = <span style="color: #a020f0;">sizeof</span>(buffer);
/* <span style="color: #b22222;">Counter for number of elements beind processed </span>*/
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">count</span> = 0UL;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">i</span>=0UL; i &lt; dims[0]; ++i) {
memset(buffer, 0, buf_size);
<span style="color: #a020f0;">if</span> (fgets(buffer, buf_size-1, f) == <span style="color: #008b8b;">NULL</span>){
fclose(f);
*eof_read_size = count;
<span style="color: #a020f0;">return</span> TREXIO_END;
} <span style="color: #a020f0;">else</span> {
rc = sscanf(buffer, <span style="color: #8b2252;">"%lf"</span>, coeff + i);
<span style="color: #a020f0;">if</span> (rc &lt;= 0) {
fclose(f);
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
}
count += 1UL;
}
}
/* <span style="color: #b22222;">Close the TXT file </span>*/
rc = fclose(f);
<span style="color: #a020f0;">if</span> (rc != 0) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
<span style="color: #228b22;">trexio_exit_code</span>
<span style="color: #0000ff;">trexio_text_read_determinant_coefficient_size</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>, <span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">size_max</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (size_max == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_2;
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">coeff_file_name</span>[256];
memset(coeff_file_name, 0, <span style="color: #a020f0;">sizeof</span>(coeff_file_name));
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">trexio_state</span> = file-&gt;state;
<span style="color: #a020f0;">if</span> (trexio_state != 0) {
sprintf(coeff_file_name, <span style="color: #8b2252;">"/determinant_coefficient_state_%"</span> PRId32 <span style="color: #8b2252;">".txt.size"</span>, trexio_state);
} <span style="color: #a020f0;">else</span> {
strncpy(coeff_file_name, <span style="color: #8b2252;">"/determinant_coefficient.txt.size"</span>, 64);
}
/* <span style="color: #b22222;">The full path to the destination TXT file with sparse data. This will include TREXIO directory name. </span>*/
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_full_path</span>[TREXIO_MAX_FILENAME_LENGTH];
/* <span style="color: #b22222;">Copy directory name in file_full_path </span>*/
strncpy (file_full_path, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
strncat (file_full_path, coeff_file_name,
TREXIO_MAX_FILENAME_LENGTH-strlen(coeff_file_name));
/* <span style="color: #b22222;">Open the file in "r" (read) mode to guarantee that no truncation happens upon consecutive reads </span>*/
<span style="color: #228b22;">FILE</span>* <span style="color: #a0522d;">f</span> = fopen(file_full_path, <span style="color: #8b2252;">"r"</span>);
<span style="color: #a020f0;">if</span> (f == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Read the data from the file and check the return code of fprintf to verify that &gt; 0 bytes have been read or reached EOF </span>*/
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rc</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_item</span>, <span style="color: #a0522d;">size_accum</span>=0L;
/* <span style="color: #b22222;">Read the values from the file. BEWARE OF POSSIBLE MAX_INT64 OVERFLOW ! </span>*/
<span style="color: #a020f0;">while</span>(fscanf(f, <span style="color: #8b2252;">"%"</span> SCNd64, &amp;size_item) != EOF) {
/* <span style="color: #b22222;">Check that summation will not overflow the int64_t value </span>*/
<span style="color: #a020f0;">if</span> (INT64_MAX - size_accum &gt; size_item) {
size_accum += size_item;
} <span style="color: #a020f0;">else</span> {
fclose(f);
*size_max = -1L;
<span style="color: #a020f0;">return</span> TREXIO_INT_SIZE_OVERFLOW;
}
}
/* <span style="color: #b22222;">Close the TXT file </span>*/
rc = fclose(f);
<span style="color: #a020f0;">if</span> (rc != 0) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Overwrite the value at the input address and return TREXIO_SUCCESS </span>*/
*size_max = size_accum;
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
</pre>
</div>
@ -1956,94 +2058,6 @@ Size specifies the number of data items, e.g. determinants.
/* <span style="color: #b22222;">Exit upon success </span>*/
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_text_write_determinant_coefficient</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">offset_file</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">rank</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint64_t</span>* <span style="color: #a0522d;">dims</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coeff</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #a020f0;">if</span> (coeff == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_5;
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">coeff_file_name</span>[256];
memset(coeff_file_name, 0, <span style="color: #a020f0;">sizeof</span>(coeff_file_name));
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">trexio_state</span> = file-&gt;state;
<span style="color: #a020f0;">if</span> (trexio_state != 0) {
sprintf(coeff_file_name, <span style="color: #8b2252;">"/determinant_coefficient_state_%"</span> PRId32 <span style="color: #8b2252;">".txt"</span>, trexio_state);
} <span style="color: #a020f0;">else</span> {
strncpy(coeff_file_name, <span style="color: #8b2252;">"/determinant_coefficient.txt"</span>, 32);
}
/* <span style="color: #b22222;">The full path to the destination TXT file with sparse data. This will include TREXIO directory name. </span>*/
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_full_path</span>[TREXIO_MAX_FILENAME_LENGTH];
/* <span style="color: #b22222;">Copy directory name in file_full_path </span>*/
strncpy (file_full_path, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
strncat (file_full_path, coeff_file_name,
TREXIO_MAX_FILENAME_LENGTH-strlen(coeff_file_name));
/* <span style="color: #b22222;">Open the file in "a" (append) mode to guarantee that no truncation happens upon consecutive writes </span>*/
<span style="color: #228b22;">FILE</span>* <span style="color: #a0522d;">f</span> = fopen(file_full_path, <span style="color: #8b2252;">"a"</span>);
<span style="color: #a020f0;">if</span> (f == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Write the data in the file and check the return code of fprintf to verify that &gt; 0 bytes have been written </span>*/
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rc</span>;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">i</span>=0UL; i &lt; dims[0]; ++i) {
rc = fprintf(f, <span style="color: #8b2252;">"%24.16e\n"</span>, *(coeff + i));
<span style="color: #a020f0;">if</span> (rc &lt;= 0) {
fclose(f);
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
}
}
/* <span style="color: #b22222;">Close the TXT file </span>*/
rc = fclose(f);
<span style="color: #a020f0;">if</span> (rc != 0) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Append .size to the file_full_path in order to write additional info about the written buffer of data </span>*/
strncat(file_full_path, <span style="color: #8b2252;">".size"</span>, 6);
/* <span style="color: #b22222;">Open the new file in "a" (append) mode to append info about the buffer that has been just written </span>*/
<span style="color: #228b22;">FILE</span> *<span style="color: #a0522d;">f_wSize</span> = fopen(file_full_path, <span style="color: #8b2252;">"a"</span>);
<span style="color: #a020f0;">if</span> (f_wSize == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Write the buffer_size </span>*/
rc = fprintf(f_wSize, <span style="color: #8b2252;">"%"</span> PRIu64 <span style="color: #8b2252;">"\n"</span>, dims[0]);
<span style="color: #a020f0;">if</span> (rc &lt;= 0) {
fclose(f_wSize);
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
}
/* <span style="color: #b22222;">Close the TXT file </span>*/
rc = fclose(f_wSize);
<span style="color: #a020f0;">if</span> (rc != 0) <span style="color: #a020f0;">return</span> TREXIO_FILE_ERROR;
/* <span style="color: #b22222;">Additional part for the trexio_text_has_group to work </span>*/
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">det_file_name</span>[256] = <span style="color: #8b2252;">"/determinant.txt"</span>;
memset (file_full_path, 0, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Copy directory name in file_full_path </span>*/
strncpy (file_full_path, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
strncat (file_full_path, det_file_name,
TREXIO_MAX_FILENAME_LENGTH-strlen(det_file_name));
<span style="color: #228b22;">bool</span> <span style="color: #a0522d;">file_exists</span> = trexio_text_file_exists(file_full_path);
/* <span style="color: #b22222;">Create an empty file for the trexio_text_has_group to work </span>*/
<span style="color: #a020f0;">if</span> (!file_exists) {
<span style="color: #228b22;">FILE</span> *<span style="color: #a0522d;">fp</span> = fopen(file_full_path, <span style="color: #8b2252;">"ab+"</span>);
fclose(fp);
}
/* <span style="color: #b22222;">Exit upon success </span>*/
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
}
</pre>
</div>
@ -2069,36 +2083,6 @@ Size specifies the number of data items, e.g. determinants.
<span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
}
}
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #0000ff;">trexio_text_has_determinant_coefficient</span>(<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
{
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">coeff_file_name</span>[256];
memset(coeff_file_name, 0, <span style="color: #a020f0;">sizeof</span>(coeff_file_name));
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">trexio_state</span> = file-&gt;state;
<span style="color: #a020f0;">if</span> (trexio_state != 0) {
sprintf(coeff_file_name, <span style="color: #8b2252;">"/determinant_coefficient_state_%"</span> PRId32 <span style="color: #8b2252;">".txt"</span>, trexio_state);
} <span style="color: #a020f0;">else</span> {
strncpy(coeff_file_name, <span style="color: #8b2252;">"/determinant_coefficient.txt"</span>, 32);
}
/* <span style="color: #b22222;">The full path to the destination TXT file with sparse data. This will include TREXIO directory name. </span>*/
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_full_path</span>[TREXIO_MAX_FILENAME_LENGTH];
/* <span style="color: #b22222;">Copy directory name in file_full_path </span>*/
strncpy (file_full_path, file-&gt;file_name, TREXIO_MAX_FILENAME_LENGTH);
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
strncat (file_full_path, coeff_file_name,
TREXIO_MAX_FILENAME_LENGTH-strlen(coeff_file_name));
/* <span style="color: #b22222;">Check the return code of access function to determine whether the file with data exists or not </span>*/
<span style="color: #a020f0;">if</span> (access(file_full_path, F_OK) == 0){
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
} <span style="color: #a020f0;">else</span> {
<span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
}
}
</pre>
</div>
</div>
@ -2106,7 +2090,7 @@ Size specifies the number of data items, e.g. determinants.
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2022-10-04 Tue 15:30</p>
<p class="date">Created: 2022-10-06 Thu 13:35</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

217
trex.html
View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2022-10-04 Tue 15:30 -->
<!-- 2022-10-06 Thu 13:35 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>TREX Configuration file</title>
@ -333,38 +333,38 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgcfb3c67">1. Metadata (metadata group)</a></li>
<li><a href="#orga4b5862">2. Electron (electron group)</a></li>
<li><a href="#org2d50454">3. Nucleus (nucleus group)</a></li>
<li><a href="#org97a33ae">4. Effective core potentials (ecp group)</a>
<li><a href="#org7c9c73c">1. Metadata (metadata group)</a></li>
<li><a href="#org6b7505d">2. Electron (electron group)</a></li>
<li><a href="#orgc5286a4">3. Nucleus (nucleus group)</a></li>
<li><a href="#org4377a79">4. Effective core potentials (ecp group)</a>
<ul>
<li><a href="#orgf7a6b1a">4.1. Example</a></li>
<li><a href="#org2bdb917">4.1. Example</a></li>
</ul>
</li>
<li><a href="#orgd6c1173">5. Basis set (basis group)</a>
<li><a href="#org0233771">5. Basis set (basis group)</a>
<ul>
<li><a href="#org6fe9c1d">5.1. Example</a></li>
<li><a href="#orgdc9e405">5.1. Example</a></li>
</ul>
</li>
<li><a href="#org0da7d13">6. Atomic orbitals (ao group)</a>
<li><a href="#org5d37b3d">6. Atomic orbitals (ao group)</a>
<ul>
<li><a href="#ao_one_e">6.1. One-electron integrals (<code>ao_1e_int</code> group)</a></li>
<li><a href="#ao_two_e">6.2. Two-electron integrals (<code>ao_2e_int</code> group)</a></li>
</ul>
</li>
<li><a href="#org45503ff">7. Molecular orbitals (mo group)</a>
<li><a href="#org27eb989">7. Molecular orbitals (mo group)</a>
<ul>
<li><a href="#orgcec550d">7.1. One-electron integrals (<code>mo_1e_int</code> group)</a></li>
<li><a href="#org9fc2375">7.2. Two-electron integrals (<code>mo_2e_int</code> group)</a></li>
<li><a href="#org9794d0b">7.1. One-electron integrals (<code>mo_1e_int</code> group)</a></li>
<li><a href="#orgca36d07">7.2. Two-electron integrals (<code>mo_2e_int</code> group)</a></li>
</ul>
</li>
<li><a href="#orgd129c28">8. Slater determinants (determinant group)</a></li>
<li><a href="#org984dea8">9. Configuration state functions (csf group)</a></li>
<li><a href="#org3b3fd1d">10. Excited states (state group)</a></li>
<li><a href="#orga37907c">11. Reduced density matrices (rdm group)</a></li>
<li><a href="#org3fd50f4">12. Cell (cell group)</a></li>
<li><a href="#org0724618">13. Periodic boundary calculations (pbc group)</a></li>
<li><a href="#orgdae0106">14. Quantum Monte Carlo data (qmc group)</a></li>
<li><a href="#org68e3033">8. Slater determinants (determinant group)</a></li>
<li><a href="#org689e4f7">9. Configuration state functions (csf group)</a></li>
<li><a href="#org898ce1d">10. Excited states (state group)</a></li>
<li><a href="#orge93dc97">11. Reduced density matrices (rdm group)</a></li>
<li><a href="#org2dd29e9">12. Cell (cell group)</a></li>
<li><a href="#orgdf2d928">13. Periodic boundary calculations (pbc group)</a></li>
<li><a href="#org773d882">14. Quantum Monte Carlo data (qmc group)</a></li>
</ul>
</div>
</div>
@ -410,16 +410,24 @@ For sparse data structures such as electron replusion integrals,
the data can be too large to fit in memory and the data needs to be
fetched using multiple function calls to perform I/O on buffers.
For more information on how to read/write sparse data structures, see
the <a href="./examples.html">examples</a>.
the <a href="./examples.html">examples</a>. The <code>sparse</code> data representation implies the
<a href="https://en.wikipedia.org/wiki/Sparse_matrix#Coordinate_list_(COO)">coordinate list</a> representation, namely the user has to write a list
of indices and values.
</p>
<p>
For determinants, the <code>special</code> attribute is present in the type. This
means that the source code is not produced by the generator, but hand-written.
For the Configuration Interfaction (CI) and Configuration State Function (CSF)
groups, the <code>buffered</code> data type is introduced, which allows similar incremental
I/O as for <code>sparse</code> data but without the need to write indices of the sparse values.
</p>
<div id="outline-container-orgcfb3c67" class="outline-2">
<h2 id="orgcfb3c67"><span class="section-number-2">1</span> Metadata (metadata group)</h2>
<p>
For determinant lists (integer bit fields), the <code>special</code> attribute is present in the type.
This means that the source code is not produced by the generator, but hand-written.
</p>
<div id="outline-container-org7c9c73c" class="outline-2">
<h2 id="org7c9c73c"><span class="section-number-2">1</span> Metadata (metadata group)</h2>
<div class="outline-text-2" id="text-1">
<p>
As we expect our files to be archived in open-data repositories, we
@ -429,7 +437,7 @@ which have participated to the creation of the file, a list of
authors of the file, and a textual description.
</p>
<table id="org0a21c09" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="orgbd8a047" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -510,15 +518,15 @@ then the <code>unsafe</code> attribute value can be manually overwritten (in uns
</div>
</div>
<div id="outline-container-orga4b5862" class="outline-2">
<h2 id="orga4b5862"><span class="section-number-2">2</span> Electron (electron group)</h2>
<div id="outline-container-org6b7505d" class="outline-2">
<h2 id="org6b7505d"><span class="section-number-2">2</span> Electron (electron group)</h2>
<div class="outline-text-2" id="text-2">
<p>
We consider wave functions expressed in the spin-free formalism, where
the number of &uarr; and &darr; electrons is fixed.
</p>
<table id="org5bf7a54" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org09a208a" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -564,15 +572,15 @@ the number of &uarr; and &darr; electrons is fixed.
</div>
</div>
<div id="outline-container-org2d50454" class="outline-2">
<h2 id="org2d50454"><span class="section-number-2">3</span> Nucleus (nucleus group)</h2>
<div id="outline-container-orgc5286a4" class="outline-2">
<h2 id="orgc5286a4"><span class="section-number-2">3</span> Nucleus (nucleus group)</h2>
<div class="outline-text-2" id="text-3">
<p>
The nuclei are considered as fixed point charges. Coordinates are
given in Cartesian \((x,y,z)\) format.
</p>
<table id="org9182fd4" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="orgf8aa393" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -639,8 +647,8 @@ given in Cartesian \((x,y,z)\) format.
</div>
</div>
<div id="outline-container-org97a33ae" class="outline-2">
<h2 id="org97a33ae"><span class="section-number-2">4</span> Effective core potentials (ecp group)</h2>
<div id="outline-container-org4377a79" class="outline-2">
<h2 id="org4377a79"><span class="section-number-2">4</span> Effective core potentials (ecp group)</h2>
<div class="outline-text-2" id="text-4">
<p>
An effective core potential (ECP) \(V_A^{\text{ECP}}\) replacing the
@ -673,7 +681,7 @@ The functions \(V_{A\ell}\) are parameterized as:
See <a href="http://dx.doi.org/10.1063/1.4984046">http://dx.doi.org/10.1063/1.4984046</a> or <a href="https://doi.org/10.1063/1.5121006">https://doi.org/10.1063/1.5121006</a> for more info.
</p>
<table id="org71f0ead" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="orgcc9670a" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -775,8 +783,8 @@ If you encounter the aforementioned issue, please report it to our <a href="http
</p>
</div>
<div id="outline-container-orgf7a6b1a" class="outline-3">
<h3 id="orgf7a6b1a"><span class="section-number-3">4.1</span> Example</h3>
<div id="outline-container-org2bdb917" class="outline-3">
<h3 id="org2bdb917"><span class="section-number-3">4.1</span> Example</h3>
<div class="outline-text-3" id="text-4-1">
<p>
For example, consider H<sub>2</sub> molecule with the following
@ -839,8 +847,8 @@ power = [
</div>
</div>
<div id="outline-container-orgd6c1173" class="outline-2">
<h2 id="orgd6c1173"><span class="section-number-2">5</span> Basis set (basis group)</h2>
<div id="outline-container-org0233771" class="outline-2">
<h2 id="org0233771"><span class="section-number-2">5</span> Basis set (basis group)</h2>
<div class="outline-text-2" id="text-5">
<p>
We consider here basis functions centered on nuclei. Hence, we enable
@ -893,7 +901,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:
</p>
<table id="org25d85a6" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org402c4c0" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -987,8 +995,8 @@ All the basis set parameters are stored in one-dimensional arrays:
</table>
</div>
<div id="outline-container-org6fe9c1d" class="outline-3">
<h3 id="org6fe9c1d"><span class="section-number-3">5.1</span> Example</h3>
<div id="outline-container-orgdc9e405" class="outline-3">
<h3 id="orgdc9e405"><span class="section-number-3">5.1</span> Example</h3>
<div class="outline-text-3" id="text-5-1">
<p>
For example, consider H<sub>2</sub> with the following basis set (in GAMESS
@ -1066,8 +1074,8 @@ prim_factor =
</div>
</div>
<div id="outline-container-org0da7d13" class="outline-2">
<h2 id="org0da7d13"><span class="section-number-2">6</span> Atomic orbitals (ao group)</h2>
<div id="outline-container-org5d37b3d" class="outline-2">
<h2 id="org5d37b3d"><span class="section-number-2">6</span> Atomic orbitals (ao group)</h2>
<div class="outline-text-2" id="text-6">
<p>
Going from the atomic basis set to AOs implies a systematic
@ -1120,13 +1128,13 @@ shell, as in the GAMESS convention where
<p>
In such a case, one should set the normalization of the shell (in
the <a href="#orgd6c1173">Basis set</a> section) to \(\mathcal{N}_{z^2}\), which is the
the <a href="#org0233771">Basis set</a> 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}}\).
</p>
<table id="org70a7808" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org24c8e11" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1178,8 +1186,8 @@ introduced here should be \(\frac{\mathcal{N}_{xy}}{\mathcal{N}_{z^2}}\).
</table>
</div>
<div id="outline-container-orgab675b8" class="outline-3">
<h3 id="ao_one_e"><a id="orgab675b8"></a><span class="section-number-3">6.1</span> One-electron integrals (<code>ao_1e_int</code> group)</h3>
<div id="outline-container-org4c98bf7" class="outline-3">
<h3 id="ao_one_e"><a id="org4c98bf7"></a><span class="section-number-3">6.1</span> One-electron integrals (<code>ao_1e_int</code> group)</h3>
<div class="outline-text-3" id="text-ao_one_e">
<ul class="org-ul">
<li>\[ \hat{V}_{\text{ne}} = \sum_{A=1}^{N_\text{nucl}}
@ -1196,7 +1204,7 @@ The one-electron integrals for a one-electron operator \(\hat{O}\) are
over atomic orbitals.
</p>
<table id="org4a086f5" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org018befe" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1291,8 +1299,8 @@ over atomic orbitals.
</div>
</div>
<div id="outline-container-org2b5510e" class="outline-3">
<h3 id="ao_two_e"><a id="org2b5510e"></a><span class="section-number-3">6.2</span> Two-electron integrals (<code>ao_2e_int</code> group)</h3>
<div id="outline-container-org3bd21d5" class="outline-3">
<h3 id="ao_two_e"><a id="org3bd21d5"></a><span class="section-number-3">6.2</span> Two-electron integrals (<code>ao_2e_int</code> group)</h3>
<div class="outline-text-3" id="text-ao_two_e">
<p>
The two-electron integrals for a two-electron operator \(\hat{O}\) are
@ -1313,7 +1321,7 @@ notation.
\mathbf{r}_j \vert)}{\vert \mathbf{r}_i - \mathbf{r}_j \vert} \] : electron-electron long range potential</li>
</ul>
<table id="orge89ece0" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org4e86641" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1353,10 +1361,10 @@ notation.
</div>
</div>
<div id="outline-container-org45503ff" class="outline-2">
<h2 id="org45503ff"><span class="section-number-2">7</span> Molecular orbitals (mo group)</h2>
<div id="outline-container-org27eb989" class="outline-2">
<h2 id="org27eb989"><span class="section-number-2">7</span> Molecular orbitals (mo group)</h2>
<div class="outline-text-2" id="text-7">
<table id="orgd105e00" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="orgbe48c84" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1443,8 +1451,8 @@ notation.
</table>
</div>
<div id="outline-container-orgcec550d" class="outline-3">
<h3 id="orgcec550d"><span class="section-number-3">7.1</span> One-electron integrals (<code>mo_1e_int</code> group)</h3>
<div id="outline-container-org9794d0b" class="outline-3">
<h3 id="org9794d0b"><span class="section-number-3">7.1</span> One-electron integrals (<code>mo_1e_int</code> group)</h3>
<div class="outline-text-3" id="text-7-1">
<p>
The operators as the same as those defined in the
@ -1452,7 +1460,7 @@ The operators as the same as those defined in the
the basis of molecular orbitals.
</p>
<table id="org3dfe259" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="orgea44942" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1547,8 +1555,8 @@ the basis of molecular orbitals.
</div>
</div>
<div id="outline-container-org9fc2375" class="outline-3">
<h3 id="org9fc2375"><span class="section-number-3">7.2</span> Two-electron integrals (<code>mo_2e_int</code> group)</h3>
<div id="outline-container-orgca36d07" class="outline-3">
<h3 id="orgca36d07"><span class="section-number-3">7.2</span> Two-electron integrals (<code>mo_2e_int</code> group)</h3>
<div class="outline-text-3" id="text-7-2">
<p>
The operators as the same as those defined in the
@ -1556,7 +1564,7 @@ The operators as the same as those defined in the
the basis of molecular orbitals.
</p>
<table id="org93b3ee2" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org60c7037" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1596,8 +1604,8 @@ the basis of molecular orbitals.
</div>
</div>
<div id="outline-container-orgd129c28" class="outline-2">
<h2 id="orgd129c28"><span class="section-number-2">8</span> Slater determinants (determinant group)</h2>
<div id="outline-container-org68e3033" class="outline-2">
<h2 id="org68e3033"><span class="section-number-2">8</span> Slater determinants (determinant group)</h2>
<div class="outline-text-2" id="text-8">
<p>
The configuration interaction (CI) wave function \(\Psi\)
@ -1639,7 +1647,7 @@ produced by the code generator.
An illustration on how to read determinants is presented in the <a href="./examples.html">examples</a>.
</p>
<table id="orge480ea8" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org4bfa01d" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1676,8 +1684,8 @@ An illustration on how to read determinants is presented in the <a href="./examp
<tr>
<td class="org-left"><code>coefficient</code></td>
<td class="org-left"><code>float special</code></td>
<td class="org-left"><code>(state.num,determinant.num)</code></td>
<td class="org-left"><code>float buffered</code></td>
<td class="org-left"><code>(determinant.num)</code></td>
<td class="org-left">Coefficients of the determinants from the CI expansion</td>
</tr>
</tbody>
@ -1685,8 +1693,8 @@ An illustration on how to read determinants is presented in the <a href="./examp
</div>
</div>
<div id="outline-container-org984dea8" class="outline-2">
<h2 id="org984dea8"><span class="section-number-2">9</span> Configuration state functions (csf group)</h2>
<div id="outline-container-org689e4f7" class="outline-2">
<h2 id="org689e4f7"><span class="section-number-2">9</span> Configuration state functions (csf group)</h2>
<div class="outline-text-2" id="text-9">
<p>
The configuration interaction (CI) wave function \(\Psi\) can be
@ -1708,7 +1716,7 @@ matrix \(\langle D_I | \psi_J \rangle\) needed to project the CSFs in
the basis of Slater determinants.
</p>
<table id="org42b53ec" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org32a1175" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1738,8 +1746,8 @@ the basis of Slater determinants.
<tr>
<td class="org-left"><code>coefficient</code></td>
<td class="org-left"><code>float special</code></td>
<td class="org-left"><code>(state.num,csf.num)</code></td>
<td class="org-left"><code>float buffered</code></td>
<td class="org-left"><code>(csf.num)</code></td>
<td class="org-left">Coefficients of the CSFs from the CI expansion</td>
</tr>
@ -1754,17 +1762,23 @@ the basis of Slater determinants.
</div>
</div>
<div id="outline-container-org3b3fd1d" class="outline-2">
<h2 id="org3b3fd1d"><span class="section-number-2">10</span> Excited states (state group)</h2>
<div id="outline-container-org898ce1d" class="outline-2">
<h2 id="org898ce1d"><span class="section-number-2">10</span> Excited states (state group)</h2>
<div class="outline-text-2" id="text-10">
<p>
By default, the <code>determinant</code> group corresponds to the ground state.
However, it should be also possible to store the coefficients that
correspond to excited state wave functions for the same set of
determinants. This is the goal of the present group
This group contains information about excited state. Since TREXIO version 2.3.0
the state-specific data (e.g. CI/CSF coeffcients, RDMs) is written in a separate
file in order to avoid over-complicated internal logics and global state switches.
</p>
<table id="org5673aae" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<p>
The <code>file_name</code> and <code>label</code> arrays have to be written only for the master file,
e.g. the one containing the ground state wave function.
The <code>id</code> and <code>current_label</code> attributes have to be specified for each file
(containing both ground and excited state data).
</p>
<table id="org65ab8ed" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1792,19 +1806,40 @@ determinants. This is the goal of the present group
<td class="org-left">Number of states (including the ground state)</td>
</tr>
<tr>
<td class="org-left"><code>id</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Index of a current state (0 is ground state)</td>
</tr>
<tr>
<td class="org-left"><code>label</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left"><code>(state.num)</code></td>
<td class="org-left">Label of a given state (e.g. 'S' for singlets)</td>
<td class="org-left">Labels of all states related to this file (e.g. 'S' for singlets)</td>
</tr>
<tr>
<td class="org-left"><code>current_label</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Labels of the current state that is in a file</td>
</tr>
<tr>
<td class="org-left"><code>file_name</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left"><code>(state.num)</code></td>
<td class="org-left">Names of the TREXIO files linked to the current one (i.e. containing data for excited states)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-orga37907c" class="outline-2">
<h2 id="orga37907c"><span class="section-number-2">11</span> Reduced density matrices (rdm group)</h2>
<div id="outline-container-orge93dc97" class="outline-2">
<h2 id="orge93dc97"><span class="section-number-2">11</span> Reduced density matrices (rdm group)</h2>
<div class="outline-text-2" id="text-11">
<p>
The reduced density matrices are defined in the basis of molecular
@ -1857,7 +1892,7 @@ The total energy can be computed as:
\]
</p>
<table id="orgc54848e" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org13d8cf3" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1938,10 +1973,10 @@ The total energy can be computed as:
</div>
</div>
<div id="outline-container-org3fd50f4" class="outline-2">
<h2 id="org3fd50f4"><span class="section-number-2">12</span> Cell (cell group)</h2>
<div id="outline-container-org2dd29e9" class="outline-2">
<h2 id="org2dd29e9"><span class="section-number-2">12</span> Cell (cell group)</h2>
<div class="outline-text-2" id="text-12">
<table id="org31b804e" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="orga81c0ae" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -1987,10 +2022,10 @@ The total energy can be computed as:
</div>
</div>
<div id="outline-container-org0724618" class="outline-2">
<h2 id="org0724618"><span class="section-number-2">13</span> Periodic boundary calculations (pbc group)</h2>
<div id="outline-container-orgdf2d928" class="outline-2">
<h2 id="orgdf2d928"><span class="section-number-2">13</span> Periodic boundary calculations (pbc group)</h2>
<div class="outline-text-2" id="text-13">
<table id="org335a3b3" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org38577ad" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -2029,8 +2064,8 @@ The total energy can be computed as:
</div>
</div>
<div id="outline-container-orgdae0106" class="outline-2">
<h2 id="orgdae0106"><span class="section-number-2">14</span> Quantum Monte Carlo data (qmc group)</h2>
<div id="outline-container-org773d882" class="outline-2">
<h2 id="org773d882"><span class="section-number-2">14</span> Quantum Monte Carlo data (qmc group)</h2>
<div class="outline-text-2" id="text-14">
<p>
In quantum Monte Carlo calculations, the wave function is evaluated
@ -2044,7 +2079,7 @@ By convention, the electron coordinates contain first all the electrons
of $&uarr;$-spin and then all the $&darr;$-spin.
</p>
<table id="org76b1072" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org1f3e44b" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -2099,7 +2134,7 @@ of $&uarr;$-spin and then all the $&darr;$-spin.
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2022-10-04 Tue 15:30</p>
<p class="date">Created: 2022-10-06 Thu 13:35</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>