mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-12-24 13:23:44 +01:00
Deploying to gh-pages from @ TREX-CoE/trexio@bc92e139da 🚀
This commit is contained in:
parent
9fdbef0937
commit
cbb58a3358
@ -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-01-24 Mon 17:22 -->
|
||||
<!-- 2022-01-25 Tue 15:19 -->
|
||||
<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-01-24 Mon 17:22</p>
|
||||
<p class="date">Created: 2022-01-25 Tue 15:19</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -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-01-24 Mon 17:22 -->
|
||||
<!-- 2022-01-25 Tue 15:19 -->
|
||||
<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,24 +333,24 @@ for the JavaScript code in this tag.
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#orgacb424b">1. Accessing sparse quantities</a>
|
||||
<li><a href="#org510b6d3">1. Accessing sparse quantities</a>
|
||||
<ul>
|
||||
<li><a href="#org68425e2">1.1. Fortran</a>
|
||||
<li><a href="#org41943a1">1.1. Fortran</a>
|
||||
<ul>
|
||||
<li><a href="#org740c76f">1.1.1. Declare Temporary variables</a></li>
|
||||
<li><a href="#org1c2c3ca">1.1.2. Obtain the name of the TREXIO file from the command line, and open it for reading</a></li>
|
||||
<li><a href="#orga7c53cc">1.1.3. Read the nuclear repulsion energy</a></li>
|
||||
<li><a href="#orgdefc685">1.1.4. Read the number of molecular orbitals</a></li>
|
||||
<li><a href="#org12c1cee">1.1.5. Allocate memory</a></li>
|
||||
<li><a href="#org4c09e65">1.1.6. Read one-electron quantities</a></li>
|
||||
<li><a href="#org51207f7">1.1.7. Read two-electron quantities</a>
|
||||
<li><a href="#orgc1fea90">1.1.1. Declare Temporary variables</a></li>
|
||||
<li><a href="#orge0221dd">1.1.2. Obtain the name of the TREXIO file from the command line, and open it for reading</a></li>
|
||||
<li><a href="#org8c86df5">1.1.3. Read the nuclear repulsion energy</a></li>
|
||||
<li><a href="#org98c6d4b">1.1.4. Read the number of molecular orbitals</a></li>
|
||||
<li><a href="#orga2626ef">1.1.5. Allocate memory</a></li>
|
||||
<li><a href="#org418387a">1.1.6. Read one-electron quantities</a></li>
|
||||
<li><a href="#orga4c8a95">1.1.7. Read two-electron quantities</a>
|
||||
<ul>
|
||||
<li><a href="#org0f68a1a">1.1.7.1. Electron repulsion integrals</a></li>
|
||||
<li><a href="#org75754f5">1.1.7.2. Reduced density matrix</a></li>
|
||||
<li><a href="#org0b5b544">1.1.7.1. Electron repulsion integrals</a></li>
|
||||
<li><a href="#org83b7eab">1.1.7.2. Reduced density matrix</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#orgc4f3a55">1.1.8. Compute the energy</a></li>
|
||||
<li><a href="#org89706f7">1.1.9. Terminate</a></li>
|
||||
<li><a href="#org4d88245">1.1.8. Compute the energy</a></li>
|
||||
<li><a href="#orga2338f4">1.1.9. Terminate</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
@ -360,12 +360,12 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
|
||||
|
||||
<div id="outline-container-orgacb424b" class="outline-2">
|
||||
<h2 id="orgacb424b"><span class="section-number-2">1</span> Accessing sparse quantities</h2>
|
||||
<div id="outline-container-org510b6d3" class="outline-2">
|
||||
<h2 id="org510b6d3"><span class="section-number-2">1</span> Accessing sparse quantities</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
</div>
|
||||
<div id="outline-container-org68425e2" class="outline-3">
|
||||
<h3 id="org68425e2"><span class="section-number-3">1.1</span> Fortran</h3>
|
||||
<div id="outline-container-org41943a1" class="outline-3">
|
||||
<h3 id="org41943a1"><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>
|
||||
@ -411,8 +411,8 @@ One needs to read from the TREXIO file:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org740c76f" class="outline-4">
|
||||
<h4 id="org740c76f"><span class="section-number-4">1.1.1</span> Declare Temporary variables</h4>
|
||||
<div id="outline-container-orgc1fea90" class="outline-4">
|
||||
<h4 id="orgc1fea90"><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>
|
||||
@ -427,8 +427,8 @@ One needs to read from the TREXIO file:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org1c2c3ca" class="outline-4">
|
||||
<h4 id="org1c2c3ca"><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-orge0221dd" class="outline-4">
|
||||
<h4 id="orge0221dd"><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)
|
||||
@ -444,8 +444,8 @@ f = trexio_open (filename, <span style="color: #8b2252;">'r'</span>, TREXIO_HDF5
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orga7c53cc" class="outline-4">
|
||||
<h4 id="orga7c53cc"><span class="section-number-4">1.1.3</span> Read the nuclear repulsion energy</h4>
|
||||
<div id="outline-container-org8c86df5" class="outline-4">
|
||||
<h4 id="org8c86df5"><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)
|
||||
@ -459,8 +459,8 @@ f = trexio_open (filename, <span style="color: #8b2252;">'r'</span>, TREXIO_HDF5
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgdefc685" class="outline-4">
|
||||
<h4 id="orgdefc685"><span class="section-number-4">1.1.4</span> Read the number of molecular orbitals</h4>
|
||||
<div id="outline-container-org98c6d4b" class="outline-4">
|
||||
<h4 id="org98c6d4b"><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)
|
||||
@ -474,8 +474,8 @@ f = trexio_open (filename, <span style="color: #8b2252;">'r'</span>, TREXIO_HDF5
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org12c1cee" class="outline-4">
|
||||
<h4 id="org12c1cee"><span class="section-number-4">1.1.5</span> Allocate memory</h4>
|
||||
<div id="outline-container-orga2626ef" class="outline-4">
|
||||
<h4 id="orga2626ef"><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) )
|
||||
@ -487,8 +487,8 @@ W(:,:,:,:) = 0.d0
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org4c09e65" class="outline-4">
|
||||
<h4 id="org4c09e65"><span class="section-number-4">1.1.6</span> Read one-electron quantities</h4>
|
||||
<div id="outline-container-org418387a" class="outline-4">
|
||||
<h4 id="org418387a"><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)
|
||||
@ -520,8 +520,8 @@ rc = trexio_read_rdm_1e(f, D)
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org51207f7" class="outline-4">
|
||||
<h4 id="org51207f7"><span class="section-number-4">1.1.7</span> Read two-electron quantities</h4>
|
||||
<div id="outline-container-orga4c8a95" class="outline-4">
|
||||
<h4 id="orga4c8a95"><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
|
||||
@ -537,8 +537,8 @@ to be protected in the critical section when modified.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org0f68a1a" class="outline-5">
|
||||
<h5 id="org0f68a1a"><span class="section-number-5">1.1.7.1</span> Electron repulsion integrals</h5>
|
||||
<div id="outline-container-org0b5b544" class="outline-5">
|
||||
<h5 id="org0b5b544"><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)
|
||||
@ -587,8 +587,8 @@ icount = BUFSIZE
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org75754f5" class="outline-5">
|
||||
<h5 id="org75754f5"><span class="section-number-5">1.1.7.2</span> Reduced density matrix</h5>
|
||||
<div id="outline-container-org83b7eab" class="outline-5">
|
||||
<h5 id="org83b7eab"><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)
|
||||
@ -632,8 +632,8 @@ icount = bufsize
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgc4f3a55" class="outline-4">
|
||||
<h4 id="orgc4f3a55"><span class="section-number-4">1.1.8</span> Compute the energy</h4>
|
||||
<div id="outline-container-org4d88245" class="outline-4">
|
||||
<h4 id="org4d88245"><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
|
||||
@ -679,8 +679,8 @@ E = E + E_nn
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org89706f7" class="outline-4">
|
||||
<h4 id="org89706f7"><span class="section-number-4">1.1.9</span> Terminate</h4>
|
||||
<div id="outline-container-orga2338f4" class="outline-4">
|
||||
<h4 id="orga2338f4"><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 )
|
||||
@ -695,7 +695,7 @@ E = E + E_nn
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX-CoE</p>
|
||||
<p class="date">Created: 2022-01-24 Mon 17:22</p>
|
||||
<p class="date">Created: 2022-01-25 Tue 15:19</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -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-01-24 Mon 17:22 -->
|
||||
<!-- 2022-01-25 Tue 15:19 -->
|
||||
<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-01-24 Mon 17:22</p>
|
||||
<p class="date">Created: 2022-01-25 Tue 15:19</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
@ -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-01-24 Mon 17:22 -->
|
||||
<!-- 2022-01-25 Tue 15:19 -->
|
||||
<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,30 +311,23 @@ for the JavaScript code in this tag.
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#org296fc0b">1. HDF5 back end</a>
|
||||
<ul>
|
||||
<li><a href="#orgcbf5324">1.1. Template for HDF5 definitions</a></li>
|
||||
<li><a href="#org1362474">1.2. Template for HDF5 structures</a></li>
|
||||
<li><a href="#org6fb743f">1.3. Template for HDF5 init/deinit</a></li>
|
||||
<li><a href="#org1e43f1f">1.4. Template for HDF5 has/read/write the numerical attribute</a></li>
|
||||
<li><a href="#orgcbd0458">1.5. Template for HDF5 has/read/write the dataset of numerical data</a></li>
|
||||
<li><a href="#orgeb6cfbd">1.6. Template for HDF5 has/read/write the dataset of sparse data</a></li>
|
||||
<li><a href="#org97b0074">1.7. Template for HDF5 has/read/write the dataset of strings</a></li>
|
||||
<li><a href="#org06de11a">1.8. Template for HDF5 has/read/write the string attribute</a></li>
|
||||
<li><a href="#orgeb3710c">1.9. Helper functions</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#orgdd23018">1. Template for HDF5 definitions</a></li>
|
||||
<li><a href="#orgf4ca766">2. Template for HDF5 structures</a></li>
|
||||
<li><a href="#orgdd2fa5c">3. Template for HDF5 init/deinit</a></li>
|
||||
<li><a href="#org7f3dcbe">4. Template for HDF5 has/read/write a numerical attribute</a></li>
|
||||
<li><a href="#orge503562">5. Template for HDF5 has/read/write a dataset of numerical data</a></li>
|
||||
<li><a href="#orgd7bf701">6. Template for HDF5 has/read/write a dataset of sparse data</a></li>
|
||||
<li><a href="#org9503454">7. Template for HDF5 has/read/write a dataset of strings</a></li>
|
||||
<li><a href="#org1a93155">8. Template for HDF5 has/read/write a string attribute</a></li>
|
||||
<li><a href="#orgad30cf3">9. Template for HDF5 delete a group (UNSAFE mode)</a></li>
|
||||
<li><a href="#orgdfe2065">10. Helper functions</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org296fc0b" class="outline-2">
|
||||
<h2 id="org296fc0b"><span class="section-number-2">1</span> HDF5 back end</h2>
|
||||
<div id="outline-container-orgdd23018" class="outline-2">
|
||||
<h2 id="orgdd23018"><span class="section-number-2">1</span> Template for HDF5 definitions</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
</div>
|
||||
<div id="outline-container-orgcbf5324" class="outline-3">
|
||||
<h3 id="orgcbf5324"><span class="section-number-3">1.1</span> Template for HDF5 definitions</h3>
|
||||
<div class="outline-text-3" id="text-1-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>
|
||||
<span style="color: #483d8b;">#define</span> $GROUP_NUM$_NAME <span style="color: #8b2252;">"$group_num$"</span>
|
||||
@ -345,9 +338,9 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org1362474" class="outline-3">
|
||||
<h3 id="org1362474"><span class="section-number-3">1.2</span> Template for HDF5 structures</h3>
|
||||
<div class="outline-text-3" id="text-1-2">
|
||||
<div id="outline-container-orgf4ca766" class="outline-2">
|
||||
<h2 id="orgf4ca766"><span class="section-number-2">2</span> Template for HDF5 structures</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">trexio_hdf5_s</span> {
|
||||
<span style="color: #228b22;">trexio_t</span> <span style="color: #a0522d;">parent</span> ;
|
||||
@ -359,9 +352,9 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org6fb743f" class="outline-3">
|
||||
<h3 id="org6fb743f"><span class="section-number-3">1.3</span> Template for HDF5 init/deinit</h3>
|
||||
<div class="outline-text-3" id="text-1-3">
|
||||
<div id="outline-container-orgdd2fa5c" class="outline-2">
|
||||
<h2 id="orgdd2fa5c"><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>
|
||||
<span style="color: #0000ff;">trexio_hdf5_inquire</span>(<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">file_name</span>)
|
||||
@ -399,6 +392,7 @@ for the JavaScript code in this tag.
|
||||
// <span style="color: #b22222;">reading the existing file -> open as RDONLY</span>
|
||||
f->file_id = H5Fopen(file->file_name, H5F_ACC_RDONLY, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'u'</span>:
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'w'</span>:
|
||||
// <span style="color: #b22222;">writing the existing file -> open as RDWRITE</span>
|
||||
f->file_id = H5Fopen(file->file_name, H5F_ACC_RDWR, H5P_DEFAULT);
|
||||
@ -411,6 +405,7 @@ for the JavaScript code in this tag.
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'r'</span>:
|
||||
// <span style="color: #b22222;">reading non-existing file -> error</span>
|
||||
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'u'</span>:
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'w'</span>:
|
||||
// <span style="color: #b22222;">writing non-existing file -> create it</span>
|
||||
f->file_id = H5Fcreate(file->file_name, H5F_ACC_EXCL, H5P_DEFAULT, H5P_DEFAULT);
|
||||
@ -424,6 +419,7 @@ for the JavaScript code in this tag.
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'r'</span>:
|
||||
f->$group$_group = H5Gopen(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">break</span>;
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'u'</span>:
|
||||
<span style="color: #a020f0;">case</span> <span style="color: #8b2252;">'w'</span>:
|
||||
<span style="color: #a020f0;">if</span> (f_exists == 1) {
|
||||
f->$group$_group = H5Gopen(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT);
|
||||
@ -460,9 +456,9 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org1e43f1f" class="outline-3">
|
||||
<h3 id="org1e43f1f"><span class="section-number-3">1.4</span> Template for HDF5 has/read/write the numerical attribute</h3>
|
||||
<div class="outline-text-3" id="text-1-4">
|
||||
<div id="outline-container-org7f3dcbe" class="outline-2">
|
||||
<h2 id="org7f3dcbe"><span class="section-number-2">4</span> Template for HDF5 has/read/write a numerical attribute</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>
|
||||
<span style="color: #0000ff;">trexio_hdf5_read_$group_num$</span> (<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>, $group_num_dtype_double$* <span style="color: #a020f0;">const</span> num)
|
||||
@ -501,29 +497,38 @@ for the JavaScript code in this tag.
|
||||
|
||||
<span style="color: #228b22;">trexio_hdf5_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">f</span> = (<span style="color: #228b22;">trexio_hdf5_t</span>*) file;
|
||||
|
||||
/* <span style="color: #b22222;">Write the dimensioning variables </span>*/
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dtype</span> = H5Tcopy(H5T_$GROUP_NUM_H5_DTYPE$);
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dspace</span> = H5Screate(H5S_SCALAR);
|
||||
/* <span style="color: #b22222;">Delete the attribute if it exists and if the file is open in UNSAFE mode </span>*/
|
||||
<span style="color: #a020f0;">if</span> (trexio_hdf5_has_$group_num$(file) == TREXIO_SUCCESS && file->mode == <span style="color: #8b2252;">'u'</span>) {
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status_del</span> = H5Adelete(f->$group$_group, $GROUP_NUM$_NAME);
|
||||
<span style="color: #a020f0;">if</span> (status_del < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">num_id</span> = H5Acreate(f->$group$_group, $GROUP_NUM$_NAME,
|
||||
dtype, dspace, H5P_DEFAULT, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (num_id <= 0) {
|
||||
H5Sclose(dspace);
|
||||
H5Tclose(dtype);
|
||||
/* <span style="color: #b22222;">Setup the dataspace </span>*/
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dtype_id</span> = H5Tcopy(H5T_$GROUP_NUM_H5_DTYPE$);
|
||||
<span style="color: #a020f0;">if</span> (dtype_id <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dspace_id</span> = H5Screate(H5S_SCALAR);
|
||||
<span style="color: #a020f0;">if</span> (dspace_id <= 0) {
|
||||
H5Tclose(dtype_id);
|
||||
<span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5Awrite(num_id, dtype, &(num));
|
||||
<span style="color: #a020f0;">if</span> (status < 0) {
|
||||
H5Aclose(num_id);
|
||||
H5Sclose(dspace);
|
||||
H5Tclose(dtype);
|
||||
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">num_id</span> = H5Acreate(f->$group$_group,
|
||||
$GROUP_NUM$_NAME,
|
||||
dtype_id, dspace_id,
|
||||
H5P_DEFAULT, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (num_id <= 0) {
|
||||
H5Sclose(dspace_id);
|
||||
H5Tclose(dtype_id);
|
||||
<span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
}
|
||||
|
||||
H5Sclose(dspace);
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5Awrite(num_id, dtype_id, &num);
|
||||
|
||||
H5Sclose(dspace_id);
|
||||
H5Aclose(num_id);
|
||||
H5Tclose(dtype);
|
||||
H5Tclose(dtype_id);
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
|
||||
}
|
||||
@ -555,9 +560,9 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgcbd0458" class="outline-3">
|
||||
<h3 id="orgcbd0458"><span class="section-number-3">1.5</span> Template for HDF5 has/read/write the dataset of numerical data</h3>
|
||||
<div class="outline-text-3" id="text-1-5">
|
||||
<div id="outline-container-orge503562" class="outline-2">
|
||||
<h2 id="orge503562"><span class="section-number-2">5</span> Template for HDF5 has/read/write a dataset of numerical data</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>
|
||||
<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>, $group_dset_dtype$* <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>)
|
||||
@ -623,30 +628,41 @@ for the JavaScript code in this tag.
|
||||
|
||||
<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> ( H5LTfind_dataset(f->$group$_group, $GROUP_DSET$_NAME) != 1 ) {
|
||||
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5LTmake_dataset(f->$group$_group,
|
||||
$GROUP_DSET$_NAME,
|
||||
(<span style="color: #228b22;">int</span>) rank, (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hsize_t</span>*) dims,
|
||||
H5T_$GROUP_DSET_H5_DTYPE$,
|
||||
$group_dset$);
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
} <span style="color: #a020f0;">else</span> {
|
||||
|
||||
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dset_id</span> = H5Dopen(f->$group$_group, $GROUP_DSET$_NAME, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (dset_id <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5Dwrite(dset_id,
|
||||
H5T_$GROUP_DSET_H5_DTYPE$,
|
||||
H5S_ALL, H5S_ALL, H5P_DEFAULT,
|
||||
$group_dset$);
|
||||
|
||||
H5Dclose(dset_id);
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
/*
|
||||
<span style="color: #b22222;"> Try to delete an existing dataset by unlinking it from the group (UNSAFE mode).</span>
|
||||
<span style="color: #b22222;"> NOTE: In principle, HDF5 should see the deallocated (unused) file space and free it,</span>
|
||||
<span style="color: #b22222;"> thus reducing the size of the HDF5 file. In practic, this is not always the case.</span>
|
||||
|
||||
<span style="color: #b22222;"> Consider using HDF5-native h5repack utility after deleting/overwriting big datasets.</span>
|
||||
<span style="color: #b22222;"> </span>*/
|
||||
<span style="color: #a020f0;">if</span> (H5LTfind_dataset(f->$group$_group, $GROUP_DSET$_NAME) == 1 && file->mode == <span style="color: #8b2252;">'u'</span>) {
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status_del</span> = H5Ldelete(f->$group$_group, $GROUP_DSET$_NAME, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (status_del < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
}
|
||||
|
||||
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dspace_id</span> = H5Screate_simple( (<span style="color: #228b22;">int</span>) rank, (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hsize_t</span>*) dims, <span style="color: #008b8b;">NULL</span>);
|
||||
<span style="color: #a020f0;">if</span> (dspace_id <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
|
||||
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dset_id</span> = H5Dcreate (f->$group$_group,
|
||||
$GROUP_DSET$_NAME,
|
||||
H5T_$GROUP_DSET_H5_DTYPE$,
|
||||
dspace_id,
|
||||
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (dset_id <= 0) {
|
||||
H5Sclose(dspace_id);
|
||||
<span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
}
|
||||
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5Dwrite(dset_id,
|
||||
H5T_$GROUP_DSET_H5_DTYPE$,
|
||||
H5S_ALL,
|
||||
dspace_id,
|
||||
H5P_DEFAULT,
|
||||
$group_dset$);
|
||||
H5Dclose(dset_id);
|
||||
H5Sclose(dspace_id);
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
|
||||
|
||||
}
|
||||
@ -678,9 +694,9 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgeb6cfbd" class="outline-3">
|
||||
<h3 id="orgeb6cfbd"><span class="section-number-3">1.6</span> Template for HDF5 has/read/write the dataset of sparse data</h3>
|
||||
<div class="outline-text-3" id="text-1-6">
|
||||
<div id="outline-container-orgd7bf701" class="outline-2">
|
||||
<h2 id="orgd7bf701"><span class="section-number-2">6</span> Template for HDF5 has/read/write a dataset of sparse data</h2>
|
||||
<div class="outline-text-2" id="text-6">
|
||||
<p>
|
||||
Sparse data is stored using extensible datasets of HDF5. Extensibility is required
|
||||
due to the fact that the sparse data will be written in chunks of user-defined size.
|
||||
@ -880,9 +896,9 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org97b0074" class="outline-3">
|
||||
<h3 id="org97b0074"><span class="section-number-3">1.7</span> Template for HDF5 has/read/write the dataset of strings</h3>
|
||||
<div class="outline-text-3" id="text-1-7">
|
||||
<div id="outline-container-org9503454" class="outline-2">
|
||||
<h2 id="org9503454"><span class="section-number-2">7</span> Template for HDF5 has/read/write a dataset of strings</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>
|
||||
<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>)
|
||||
@ -1000,6 +1016,18 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
|
||||
<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: #b22222;"> Try to delete an existing dataset by unlinking it from the group (UNSAFE mode).</span>
|
||||
<span style="color: #b22222;"> NOTE: In principle, HDF5 should see the deallocated (unused) file space and free it,</span>
|
||||
<span style="color: #b22222;"> thus reducing the size of the HDF5 file. In practic, this is not always the case.</span>
|
||||
|
||||
<span style="color: #b22222;"> Consider using HDF5-provided h5repack utility after deleting/overwriting big datasets.</span>
|
||||
<span style="color: #b22222;"> </span>*/
|
||||
<span style="color: #a020f0;">if</span> (H5LTfind_dataset(f->$group$_group, $GROUP_DSET$_NAME) == 1 && file->mode == <span style="color: #8b2252;">'u'</span>) {
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status_del</span> = H5Ldelete(f->$group$_group, $GROUP_DSET$_NAME, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (status_del < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
}
|
||||
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span>;
|
||||
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dset_id</span>;
|
||||
|
||||
@ -1010,49 +1038,30 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
status = H5Tset_size (memtype, H5T_VARIABLE);
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
<span style="color: #a020f0;">if</span> ( H5LTfind_dataset(f->$group$_group, $GROUP_DSET$_NAME) != 1 ) {
|
||||
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dspace</span> = H5Screate_simple( (<span style="color: #228b22;">int</span>) rank, (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hsize_t</span>*) dims, <span style="color: #008b8b;">NULL</span>);
|
||||
<span style="color: #a020f0;">if</span> (dspace <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
|
||||
/* <span style="color: #b22222;">code to create dataset </span>*/
|
||||
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">filetype</span> = H5Tcopy (H5T_FORTRAN_S1);
|
||||
<span style="color: #a020f0;">if</span> (filetype <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
/* <span style="color: #b22222;">code to create dataset </span>*/
|
||||
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">filetype</span> = H5Tcopy (H5T_FORTRAN_S1);
|
||||
<span style="color: #a020f0;">if</span> (filetype <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
|
||||
status = H5Tset_size (filetype, H5T_VARIABLE);
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
status = H5Tset_size (filetype, H5T_VARIABLE);
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dspace</span> = H5Screate_simple( (<span style="color: #228b22;">int</span>) rank, (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hsize_t</span>*) dims, <span style="color: #008b8b;">NULL</span>);
|
||||
<span style="color: #a020f0;">if</span> (dspace <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
dset_id = H5Dcreate (f->$group$_group, $GROUP_DSET$_NAME, filetype, dspace,
|
||||
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (dset_id <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
|
||||
dset_id = H5Dcreate (f->$group$_group, $GROUP_DSET$_NAME, filetype, dspace,
|
||||
H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (dset_id <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
status = H5Dwrite (dset_id, memtype,
|
||||
H5S_ALL, H5S_ALL, H5P_DEFAULT,
|
||||
$group_dset$);
|
||||
|
||||
status = H5Dwrite (dset_id, memtype,
|
||||
H5S_ALL, H5S_ALL, H5P_DEFAULT,
|
||||
$group_dset$);
|
||||
H5Dclose (dset_id);
|
||||
H5Sclose (dspace);
|
||||
H5Tclose (filetype);
|
||||
H5Tclose (memtype);
|
||||
|
||||
H5Dclose (dset_id);
|
||||
H5Sclose (dspace);
|
||||
H5Tclose (filetype);
|
||||
H5Tclose (memtype);
|
||||
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
} <span style="color: #a020f0;">else</span> {
|
||||
|
||||
dset_id = H5Dopen(f->$group$_group, $GROUP_DSET$_NAME, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (dset_id <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
|
||||
/* <span style="color: #b22222;">code to write dataset </span>*/
|
||||
status = H5Dwrite(dset_id, memtype,
|
||||
H5S_ALL, H5S_ALL, H5P_DEFAULT,
|
||||
$group_dset$);
|
||||
|
||||
H5Dclose(dset_id);
|
||||
H5Tclose(memtype);
|
||||
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
}
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
|
||||
|
||||
@ -1085,9 +1094,9 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org06de11a" class="outline-3">
|
||||
<h3 id="org06de11a"><span class="section-number-3">1.8</span> Template for HDF5 has/read/write the string attribute</h3>
|
||||
<div class="outline-text-3" id="text-1-8">
|
||||
<div id="outline-container-org1a93155" class="outline-2">
|
||||
<h2 id="org1a93155"><span class="section-number-2">8</span> Template for HDF5 has/read/write a string attribute</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>
|
||||
<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>)
|
||||
@ -1140,8 +1149,13 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
|
||||
<span style="color: #228b22;">trexio_hdf5_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">f</span> = (<span style="color: #228b22;">trexio_hdf5_t</span>*) file;
|
||||
|
||||
/* <span style="color: #b22222;">Delete the attribute if it exists and if the file is open in UNSAFE mode </span>*/
|
||||
<span style="color: #a020f0;">if</span> (trexio_hdf5_has_$group_str$(file) == TREXIO_SUCCESS && file->mode == <span style="color: #8b2252;">'u'</span>) {
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status_del</span> = H5Adelete(f->$group$_group, $GROUP_STR$_NAME);
|
||||
<span style="color: #a020f0;">if</span> (status_del < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
}
|
||||
|
||||
/* <span style="color: #b22222;">Setup the dataspace </span>*/
|
||||
/* <span style="color: #b22222;">Setup the datatype for variable length string </span>*/
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dtype_id</span> = H5Tcopy(H5T_C_S1);
|
||||
<span style="color: #a020f0;">if</span> (dtype_id <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
|
||||
@ -1154,12 +1168,15 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
status = H5Tset_strpad(dtype_id, H5T_STR_NULLTERM);
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
/* <span style="color: #b22222;">Setup the dataspace </span>*/
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dspace_id</span> = H5Screate(H5S_SCALAR);
|
||||
<span style="color: #a020f0;">if</span> (dspace_id <= 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
|
||||
/* <span style="color: #b22222;">Create the $group_str$ attribute of $group$ group </span>*/
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">str_id</span> = H5Acreate(f->$group$_group, $GROUP_STR$_NAME, dtype_id, dspace_id,
|
||||
H5P_DEFAULT, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">str_id</span> = H5Acreate(f->$group$_group,
|
||||
$GROUP_STR$_NAME,
|
||||
dtype_id, dspace_id,
|
||||
H5P_DEFAULT, H5P_DEFAULT);
|
||||
|
||||
<span style="color: #a020f0;">if</span> (str_id <= 0) {
|
||||
H5Sclose(dspace_id);
|
||||
@ -1168,18 +1185,14 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
}
|
||||
|
||||
status = H5Awrite(str_id, dtype_id, str);
|
||||
<span style="color: #a020f0;">if</span> (status < 0) {
|
||||
H5Aclose(str_id);
|
||||
H5Sclose(dspace_id);
|
||||
H5Tclose(dtype_id);
|
||||
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
}
|
||||
|
||||
H5Aclose(str_id);
|
||||
H5Sclose(dspace_id);
|
||||
H5Tclose(dtype_id);
|
||||
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
|
||||
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
@ -1208,9 +1221,50 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgeb3710c" class="outline-3">
|
||||
<h3 id="orgeb3710c"><span class="section-number-3">1.9</span> Helper functions</h3>
|
||||
<div class="outline-text-3" id="text-1-9">
|
||||
<div id="outline-container-orgad30cf3" class="outline-2">
|
||||
<h2 id="orgad30cf3"><span class="section-number-2">9</span> Template for HDF5 delete a group (UNSAFE mode)</h2>
|
||||
<div class="outline-text-2" id="text-9">
|
||||
<p>
|
||||
<b><b>Note:</b></b> in early versions of the HDF5 library (v < 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).
|
||||
Nevertheless, some space might remain occupied even after deleting the associated object in recent version.
|
||||
To take the best use of the deleted file space, we recommend to write the deleted group within the same session
|
||||
(i.e. before closing the TREXIO file).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In principle, one can use HDF5-provided <code>h5repack</code> binary, which copies all existing objects from one file into another.
|
||||
Thus, any corrupted/lost file space will remain in the first file. The use of <code>h5repack</code> is highly encouraged.
|
||||
</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_delete_$group$</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: #b22222;">delete the link to the existing group: this should free the associated space</span>
|
||||
H5Gclose(f->$group$_group);
|
||||
f->$group$_group = 0;
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5Ldelete(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (status < 0) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
// <span style="color: #b22222;">re-create the group (with the new link ?)</span>
|
||||
f->$group$_group = H5Gcreate(f->file_id, $GROUP$_GROUP_NAME, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (f->$group$_group <= 0L) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ID;
|
||||
|
||||
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgdfe2065" class="outline-2">
|
||||
<h2 id="orgdfe2065"><span class="section-number-2">10</span> Helper functions</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_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>,
|
||||
@ -1468,10 +1522,9 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX-CoE</p>
|
||||
<p class="date">Created: 2022-01-24 Mon 17:22</p>
|
||||
<p class="date">Created: 2022-01-25 Tue 15:19</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
@ -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-01-24 Mon 17:22 -->
|
||||
<!-- 2022-01-25 Tue 15:19 -->
|
||||
<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,28 +311,29 @@ for the JavaScript code in this tag.
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#orge38e1d2">1. TEXT back end</a>
|
||||
<li><a href="#org4e1f8e8">1. TEXT back end</a>
|
||||
<ul>
|
||||
<li><a href="#orgfb08429">1.1. Template for group-related structures in text back end</a></li>
|
||||
<li><a href="#org35452f8">1.2. Template for general structure in text back end</a></li>
|
||||
<li><a href="#org13b5fd7">1.3. Initialize function (constant part)</a></li>
|
||||
<li><a href="#org5876a02">1.4. Deinitialize function (templated part)</a></li>
|
||||
<li><a href="#orgf13b5c9">1.5. Template for text read struct</a></li>
|
||||
<li><a href="#orgb973239">1.6. Template for text flush struct</a></li>
|
||||
<li><a href="#org2877301">1.7. Template for text free memory</a></li>
|
||||
<li><a href="#org7e6af7e">1.8. Template for has/read/write the numerical attribute</a></li>
|
||||
<li><a href="#org4ae2244">1.9. Template for has/read/write the dataset of numerical data</a></li>
|
||||
<li><a href="#org5e429ca">1.10. Template for has/read/write the dataset of strings</a></li>
|
||||
<li><a href="#orge6ea6a3">1.11. Template for has/read/write the string attribute</a></li>
|
||||
<li><a href="#org247f33d">1.12. Template for has/read/write the dataset of sparse data</a></li>
|
||||
<li><a href="#orgd0a84ce">1.1. Template for group-related structures in text back end</a></li>
|
||||
<li><a href="#org0441f3a">1.2. Template for general structure in text back end</a></li>
|
||||
<li><a href="#org1f36fbb">1.3. Initialize function (constant part)</a></li>
|
||||
<li><a href="#org56f6fd2">1.4. Deinitialize function (templated part)</a></li>
|
||||
<li><a href="#orgda7da3c">1.5. Template for text read a group</a></li>
|
||||
<li><a href="#org6229363">1.6. Template for text flush a group</a></li>
|
||||
<li><a href="#org50f5721">1.7. Template for text free memory</a></li>
|
||||
<li><a href="#org6b3bffb">1.8. Template for has/read/write a numerical attribute</a></li>
|
||||
<li><a href="#org866dd99">1.9. Template for has/read/write a dataset of numerical data</a></li>
|
||||
<li><a href="#org908ec28">1.10. Template for has/read/write a dataset of strings</a></li>
|
||||
<li><a href="#org88d7458">1.11. Template for has/read/write a string attribute</a></li>
|
||||
<li><a href="#org857d53e">1.12. Template for has/read/write the dataset of sparse data</a></li>
|
||||
<li><a href="#org58ff87c">1.13. Template for text delete a group (UNSAFE mode)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orge38e1d2" class="outline-2">
|
||||
<h2 id="orge38e1d2"><span class="section-number-2">1</span> TEXT back end</h2>
|
||||
<div id="outline-container-org4e1f8e8" class="outline-2">
|
||||
<h2 id="org4e1f8e8"><span class="section-number-2">1</span> TEXT back end</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<p>
|
||||
The "file" produced by the text back end is a directory with one
|
||||
@ -353,8 +354,8 @@ The file is written when closed, or when the flush function is called.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgfb08429" class="outline-3">
|
||||
<h3 id="orgfb08429"><span class="section-number-3">1.1</span> Template for group-related structures in text back end</h3>
|
||||
<div id="outline-container-orgd0a84ce" class="outline-3">
|
||||
<h3 id="orgd0a84ce"><span class="section-number-3">1.1</span> Template for group-related structures in text back end</h3>
|
||||
<div class="outline-text-3" id="text-1-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 {
|
||||
@ -373,8 +374,8 @@ The file is written when closed, or when the flush function is called.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org35452f8" class="outline-3">
|
||||
<h3 id="org35452f8"><span class="section-number-3">1.2</span> Template for general structure in text back end</h3>
|
||||
<div id="outline-container-org0441f3a" class="outline-3">
|
||||
<h3 id="org0441f3a"><span class="section-number-3">1.2</span> Template for general structure in text back end</h3>
|
||||
<div class="outline-text-3" id="text-1-2">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">trexio_text_s</span> {
|
||||
@ -387,8 +388,8 @@ The file is written when closed, or when the flush function is called.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org13b5fd7" class="outline-3">
|
||||
<h3 id="org13b5fd7"><span class="section-number-3">1.3</span> Initialize function (constant part)</h3>
|
||||
<div id="outline-container-org1f36fbb" class="outline-3">
|
||||
<h3 id="org1f36fbb"><span class="section-number-3">1.3</span> Initialize function (constant part)</h3>
|
||||
<div class="outline-text-3" id="text-1-3">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
|
||||
@ -531,8 +532,8 @@ The file is written when closed, or when the flush function is called.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org5876a02" class="outline-3">
|
||||
<h3 id="org5876a02"><span class="section-number-3">1.4</span> Deinitialize function (templated part)</h3>
|
||||
<div id="outline-container-org56f6fd2" class="outline-3">
|
||||
<h3 id="org56f6fd2"><span class="section-number-3">1.4</span> Deinitialize function (templated part)</h3>
|
||||
<div class="outline-text-3" id="text-1-4">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
|
||||
@ -554,8 +555,8 @@ The file is written when closed, or when the flush function is called.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgf13b5c9" class="outline-3">
|
||||
<h3 id="orgf13b5c9"><span class="section-number-3">1.5</span> Template for text read struct</h3>
|
||||
<div id="outline-container-orgda7da3c" class="outline-3">
|
||||
<h3 id="orgda7da3c"><span class="section-number-3">1.5</span> Template for text read a group</h3>
|
||||
<div class="outline-text-3" id="text-1-5">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c">$group$_t*
|
||||
@ -847,8 +848,8 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgb973239" class="outline-3">
|
||||
<h3 id="orgb973239"><span class="section-number-3">1.6</span> Template for text flush struct</h3>
|
||||
<div id="outline-container-org6229363" class="outline-3">
|
||||
<h3 id="org6229363"><span class="section-number-3">1.6</span> Template for text flush a group</h3>
|
||||
<div class="outline-text-3" id="text-1-6">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
|
||||
@ -860,12 +861,11 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
|
||||
<span style="color: #a020f0;">if</span> (file->parent.mode == <span style="color: #8b2252;">'r'</span>) <span style="color: #a020f0;">return</span> TREXIO_READONLY;
|
||||
|
||||
$group$_t* $group$ = file->$group$;
|
||||
|
||||
<span style="color: #a020f0;">if</span> ($group$ == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
|
||||
|
||||
<span style="color: #a020f0;">if</span> ($group$->to_flush == 0) <span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
|
||||
|
||||
assert (file->parent.mode == <span style="color: #8b2252;">'w'</span>);
|
||||
assert (file->parent.mode == <span style="color: #8b2252;">'w'</span> || file->parent.mode == <span style="color: #8b2252;">'u'</span>);
|
||||
|
||||
<span style="color: #228b22;">FILE</span>* <span style="color: #a0522d;">f</span> = fopen($group$->file_name, <span style="color: #8b2252;">"w"</span>);
|
||||
<span style="color: #a020f0;">if</span> (f == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_1;
|
||||
@ -913,8 +913,8 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org2877301" class="outline-3">
|
||||
<h3 id="org2877301"><span class="section-number-3">1.7</span> Template for text free memory</h3>
|
||||
<div id="outline-container-org50f5721" class="outline-3">
|
||||
<h3 id="org50f5721"><span class="section-number-3">1.7</span> Template for text free memory</h3>
|
||||
<div class="outline-text-3" id="text-1-7">
|
||||
<p>
|
||||
Memory is allocated when reading. The following function frees memory.
|
||||
@ -951,6 +951,8 @@ Memory is allocated when reading. The following function frees memory.
|
||||
// <span style="color: #b22222;">END REPEAT GROUP_ATTR_STR</span>
|
||||
|
||||
FREE ($group$);
|
||||
file->$group$ = <span style="color: #008b8b;">NULL</span>;
|
||||
|
||||
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
|
||||
|
||||
}
|
||||
@ -959,8 +961,8 @@ Memory is allocated when reading. The following function frees memory.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org7e6af7e" class="outline-3">
|
||||
<h3 id="org7e6af7e"><span class="section-number-3">1.8</span> Template for has/read/write the numerical attribute</h3>
|
||||
<div id="outline-container-org6b3bffb" class="outline-3">
|
||||
<h3 id="org6b3bffb"><span class="section-number-3">1.8</span> Template for has/read/write a numerical attribute</h3>
|
||||
<div class="outline-text-3" id="text-1-8">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
|
||||
@ -1023,8 +1025,8 @@ Memory is allocated when reading. The following function frees memory.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org4ae2244" class="outline-3">
|
||||
<h3 id="org4ae2244"><span class="section-number-3">1.9</span> Template for has/read/write the dataset of numerical data</h3>
|
||||
<div id="outline-container-org866dd99" class="outline-3">
|
||||
<h3 id="org866dd99"><span class="section-number-3">1.9</span> Template for has/read/write a dataset of numerical data</h3>
|
||||
<div class="outline-text-3" id="text-1-9">
|
||||
<p>
|
||||
The <code>group_dset</code> array is assumed allocated with the appropriate size.
|
||||
@ -1120,8 +1122,8 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org5e429ca" class="outline-3">
|
||||
<h3 id="org5e429ca"><span class="section-number-3">1.10</span> Template for has/read/write the dataset of strings</h3>
|
||||
<div id="outline-container-org908ec28" class="outline-3">
|
||||
<h3 id="org908ec28"><span class="section-number-3">1.10</span> Template for has/read/write a dataset of strings</h3>
|
||||
<div class="outline-text-3" id="text-1-10">
|
||||
<p>
|
||||
The <code>group_dset</code> array is assumed allocated with the appropriate size.
|
||||
@ -1222,8 +1224,8 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orge6ea6a3" class="outline-3">
|
||||
<h3 id="orge6ea6a3"><span class="section-number-3">1.11</span> Template for has/read/write the string attribute</h3>
|
||||
<div id="outline-container-org88d7458" class="outline-3">
|
||||
<h3 id="org88d7458"><span class="section-number-3">1.11</span> Template for has/read/write a string attribute</h3>
|
||||
<div class="outline-text-3" id="text-1-11">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">trexio_exit_code</span>
|
||||
@ -1297,8 +1299,8 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org247f33d" class="outline-3">
|
||||
<h3 id="org247f33d"><span class="section-number-3">1.12</span> Template for has/read/write the dataset of sparse data</h3>
|
||||
<div id="outline-container-org857d53e" class="outline-3">
|
||||
<h3 id="org857d53e"><span class="section-number-3">1.12</span> Template for has/read/write the dataset of sparse data</h3>
|
||||
<div class="outline-text-3" id="text-1-12">
|
||||
<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
|
||||
@ -1571,11 +1573,40 @@ User provides indices and values of the sparse array as two separate variables.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org58ff87c" class="outline-3">
|
||||
<h3 id="org58ff87c"><span class="section-number-3">1.13</span> Template for text delete a group (UNSAFE mode)</h3>
|
||||
<div class="outline-text-3" id="text-1-13">
|
||||
<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>)
|
||||
{
|
||||
<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_text_t</span>* <span style="color: #a0522d;">f</span> = (<span style="color: #228b22;">trexio_text_t</span>*) file;
|
||||
|
||||
$group$_t* $group$ = trexio_text_read_$group$(f);
|
||||
<span style="color: #a020f0;">if</span> ($group$ == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rc</span> = remove($group$->file_name);
|
||||
<span style="color: #a020f0;">if</span> (rc == -1) <span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
|
||||
$group$->to_flush = 0;
|
||||
|
||||
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #a0522d;">rc_free</span> = trexio_text_free_$group$(f);
|
||||
<span style="color: #a020f0;">if</span> (rc_free != TREXIO_SUCCESS) <span style="color: #a020f0;">return</span> rc_free;
|
||||
|
||||
<span style="color: #a020f0;">return</span> TREXIO_SUCCESS;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX-CoE</p>
|
||||
<p class="date">Created: 2022-01-24 Mon 17:22</p>
|
||||
<p class="date">Created: 2022-01-25 Tue 15:19</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
130
trex.html
130
trex.html
@ -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-01-24 Mon 17:22 -->
|
||||
<!-- 2022-01-25 Tue 15:19 -->
|
||||
<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,33 +333,33 @@ for the JavaScript code in this tag.
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#org67be512">1. Metadata (metadata group)</a></li>
|
||||
<li><a href="#org3e95b37">2. Electron (electron group)</a></li>
|
||||
<li><a href="#orgba6a084">3. Nucleus (nucleus group)</a></li>
|
||||
<li><a href="#orga47d7f9">4. Effective core potentials (ecp group)</a>
|
||||
<li><a href="#org30cfbb9">1. Metadata (metadata group)</a></li>
|
||||
<li><a href="#orgac328f5">2. Electron (electron group)</a></li>
|
||||
<li><a href="#org5fafbd7">3. Nucleus (nucleus group)</a></li>
|
||||
<li><a href="#org4d8bba8">4. Effective core potentials (ecp group)</a>
|
||||
<ul>
|
||||
<li><a href="#orgb42ac10">4.1. Example</a></li>
|
||||
<li><a href="#org917e096">4.1. Example</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org9769ac1">5. Basis set (basis group)</a>
|
||||
<li><a href="#org3c9f450">5. Basis set (basis group)</a>
|
||||
<ul>
|
||||
<li><a href="#orgc749b8c">5.1. Example</a></li>
|
||||
<li><a href="#org205694a">5.1. Example</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org793b44d">6. Atomic orbitals (ao group)</a>
|
||||
<li><a href="#org1c1146c">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="#org15c7250">7. Molecular orbitals (mo group)</a>
|
||||
<li><a href="#orgbfdc0e2">7. Molecular orbitals (mo group)</a>
|
||||
<ul>
|
||||
<li><a href="#org3b49505">7.1. One-electron integrals (<code>mo_1e_int</code> group)</a></li>
|
||||
<li><a href="#orgced8595">7.2. Two-electron integrals (<code>mo_2e_int</code> group)</a></li>
|
||||
<li><a href="#orga06ee7b">7.1. One-electron integrals (<code>mo_1e_int</code> group)</a></li>
|
||||
<li><a href="#org2d578b9">7.2. Two-electron integrals (<code>mo_2e_int</code> group)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org250ed58">8. <span class="todo TODO">TODO</span> Slater determinants</a></li>
|
||||
<li><a href="#org037f311">9. Reduced density matrices (rdm group)</a></li>
|
||||
<li><a href="#orgf9b0d2d">8. <span class="todo TODO">TODO</span> Slater determinants</a></li>
|
||||
<li><a href="#orgfa4ea16">9. Reduced density matrices (rdm group)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -409,8 +409,8 @@ fetched using multiple function calls to perform I/O on buffers.
|
||||
</p>
|
||||
|
||||
|
||||
<div id="outline-container-org67be512" class="outline-2">
|
||||
<h2 id="org67be512"><span class="section-number-2">1</span> Metadata (metadata group)</h2>
|
||||
<div id="outline-container-org30cfbb9" class="outline-2">
|
||||
<h2 id="org30cfbb9"><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
|
||||
@ -420,7 +420,7 @@ which have participated to the creation of the file, a list of
|
||||
authors of the file, and a textual description.
|
||||
</p>
|
||||
|
||||
<table id="orgbef8356" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org55ec242" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -482,20 +482,34 @@ authors of the file, and a textual description.
|
||||
<td class="org-left"> </td>
|
||||
<td class="org-left">Text describing the content of file</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>unsafe</code></td>
|
||||
<td class="org-left"><code>int</code></td>
|
||||
<td class="org-left"> </td>
|
||||
<td class="org-left"><code>1</code>: true, <code>0</code>: false</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
<b><b>Note:</b></b> <code>unsafe</code> attribute of the <code>metadata</code> group indicates whether the file has been previously opened with <code>'u'</code> mode.
|
||||
It is automatically written in the file upon the first unsafe opening.
|
||||
If the user has checked that the TREXIO file is valid (e.g. using <code>trexio-tools</code>) after unsafe operations,
|
||||
then the <code>unsafe</code> attribute value can be manually overwritten (in unsafe mode) from <code>1</code> to <code>0</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org3e95b37" class="outline-2">
|
||||
<h2 id="org3e95b37"><span class="section-number-2">2</span> Electron (electron group)</h2>
|
||||
<div id="outline-container-orgac328f5" class="outline-2">
|
||||
<h2 id="orgac328f5"><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 ↑ and ↓ electrons is fixed.
|
||||
</p>
|
||||
|
||||
<table id="org14d2718" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="orge9e1e7c" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -534,15 +548,15 @@ the number of ↑ and ↓ electrons is fixed.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgba6a084" class="outline-2">
|
||||
<h2 id="orgba6a084"><span class="section-number-2">3</span> Nucleus (nucleus group)</h2>
|
||||
<div id="outline-container-org5fafbd7" class="outline-2">
|
||||
<h2 id="org5fafbd7"><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="org757305b" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org0196fbf" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -609,8 +623,8 @@ given in Cartesian \((x,y,z)\) format.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orga47d7f9" class="outline-2">
|
||||
<h2 id="orga47d7f9"><span class="section-number-2">4</span> Effective core potentials (ecp group)</h2>
|
||||
<div id="outline-container-org4d8bba8" class="outline-2">
|
||||
<h2 id="org4d8bba8"><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
|
||||
@ -643,7 +657,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="org770cf4c" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org5be31a3" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -741,8 +755,8 @@ The latter causes issues when written before <code>ang_mom</code> in the TREXIO
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgb42ac10" class="outline-3">
|
||||
<h3 id="orgb42ac10"><span class="section-number-3">4.1</span> Example</h3>
|
||||
<div id="outline-container-org917e096" class="outline-3">
|
||||
<h3 id="org917e096"><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
|
||||
@ -805,8 +819,8 @@ power = [
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org9769ac1" class="outline-2">
|
||||
<h2 id="org9769ac1"><span class="section-number-2">5</span> Basis set (basis group)</h2>
|
||||
<div id="outline-container-org3c9f450" class="outline-2">
|
||||
<h2 id="org3c9f450"><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
|
||||
@ -859,7 +873,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="org7be90af" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org5a9e73b" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -953,8 +967,8 @@ All the basis set parameters are stored in one-dimensional arrays:
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgc749b8c" class="outline-3">
|
||||
<h3 id="orgc749b8c"><span class="section-number-3">5.1</span> Example</h3>
|
||||
<div id="outline-container-org205694a" class="outline-3">
|
||||
<h3 id="org205694a"><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
|
||||
@ -1032,8 +1046,8 @@ prim_factor =
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org793b44d" class="outline-2">
|
||||
<h2 id="org793b44d"><span class="section-number-2">6</span> Atomic orbitals (ao group)</h2>
|
||||
<div id="outline-container-org1c1146c" class="outline-2">
|
||||
<h2 id="org1c1146c"><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
|
||||
@ -1086,13 +1100,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="#org9769ac1">Basis set</a> section) to \(\mathcal{N}_{z^2}\), which is the
|
||||
the <a href="#org3c9f450">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="org3ddcdaa" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="orge6a6e3b" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1144,8 +1158,8 @@ introduced here should be \(\frac{\mathcal{N}_{xy}}{\mathcal{N}_{z^2}}\).
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgb9191c9" class="outline-3">
|
||||
<h3 id="ao_one_e"><a id="orgb9191c9"></a><span class="section-number-3">6.1</span> One-electron integrals (<code>ao_1e_int</code> group)</h3>
|
||||
<div id="outline-container-org42ebd61" class="outline-3">
|
||||
<h3 id="ao_one_e"><a id="org42ebd61"></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}}
|
||||
@ -1163,7 +1177,7 @@ The one-electron integrals for a one-electron operator \(\hat{O}\) are
|
||||
over atomic orbitals.
|
||||
</p>
|
||||
|
||||
<table id="org2aecfd1" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org7c6775a" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1230,8 +1244,8 @@ over atomic orbitals.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org6aeee3d" class="outline-3">
|
||||
<h3 id="ao_two_e"><a id="org6aeee3d"></a><span class="section-number-3">6.2</span> Two-electron integrals (<code>ao_2e_int</code> group)</h3>
|
||||
<div id="outline-container-org04ad7a5" class="outline-3">
|
||||
<h3 id="ao_two_e"><a id="org04ad7a5"></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
|
||||
@ -1252,7 +1266,7 @@ notation.
|
||||
\mathbf{r}_j \vert)}{\vert \mathbf{r}_i - \mathbf{r}_j \vert} \] : electron-electron long range potential</li>
|
||||
</ul>
|
||||
|
||||
<table id="orgdef6991" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org1f9a94c" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1292,10 +1306,10 @@ notation.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org15c7250" class="outline-2">
|
||||
<h2 id="org15c7250"><span class="section-number-2">7</span> Molecular orbitals (mo group)</h2>
|
||||
<div id="outline-container-orgbfdc0e2" class="outline-2">
|
||||
<h2 id="orgbfdc0e2"><span class="section-number-2">7</span> Molecular orbitals (mo group)</h2>
|
||||
<div class="outline-text-2" id="text-7">
|
||||
<table id="orgf720360" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="orga3583de" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1361,8 +1375,8 @@ notation.
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org3b49505" class="outline-3">
|
||||
<h3 id="org3b49505"><span class="section-number-3">7.1</span> One-electron integrals (<code>mo_1e_int</code> group)</h3>
|
||||
<div id="outline-container-orga06ee7b" class="outline-3">
|
||||
<h3 id="orga06ee7b"><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
|
||||
@ -1370,7 +1384,7 @@ The operators as the same as those defined in the
|
||||
the basis of molecular orbitals.
|
||||
</p>
|
||||
|
||||
<table id="org720caa1" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="orga01718a" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1437,8 +1451,8 @@ the basis of molecular orbitals.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgced8595" class="outline-3">
|
||||
<h3 id="orgced8595"><span class="section-number-3">7.2</span> Two-electron integrals (<code>mo_2e_int</code> group)</h3>
|
||||
<div id="outline-container-org2d578b9" class="outline-3">
|
||||
<h3 id="org2d578b9"><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
|
||||
@ -1446,7 +1460,7 @@ The operators as the same as those defined in the
|
||||
the basis of molecular orbitals.
|
||||
</p>
|
||||
|
||||
<table id="org5ab3f27" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org4e043b1" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1486,11 +1500,11 @@ the basis of molecular orbitals.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org250ed58" class="outline-2">
|
||||
<h2 id="org250ed58"><span class="section-number-2">8</span> <span class="todo TODO">TODO</span> Slater determinants</h2>
|
||||
<div id="outline-container-orgf9b0d2d" class="outline-2">
|
||||
<h2 id="orgf9b0d2d"><span class="section-number-2">8</span> <span class="todo TODO">TODO</span> Slater determinants</h2>
|
||||
</div>
|
||||
<div id="outline-container-org037f311" class="outline-2">
|
||||
<h2 id="org037f311"><span class="section-number-2">9</span> Reduced density matrices (rdm group)</h2>
|
||||
<div id="outline-container-orgfa4ea16" class="outline-2">
|
||||
<h2 id="orgfa4ea16"><span class="section-number-2">9</span> Reduced density matrices (rdm group)</h2>
|
||||
<div class="outline-text-2" id="text-9">
|
||||
<p>
|
||||
The reduced density matrices are defined in the basis of molecular
|
||||
@ -1543,7 +1557,7 @@ The total energy can be computed as:
|
||||
\]
|
||||
</p>
|
||||
|
||||
<table id="orgbfeeafe" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="orgb2f33a2" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1626,7 +1640,7 @@ The total energy can be computed as:
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX-CoE</p>
|
||||
<p class="date">Created: 2022-01-24 Mon 17:22</p>
|
||||
<p class="date">Created: 2022-01-25 Tue 15:19</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
Loading…
Reference in New Issue
Block a user