mirror of
https://github.com/TREX-CoE/trexio.git
synced 2024-11-03 20:54:07 +01:00
Deploying to gh-pages from @ TREX-CoE/trexio@5ca632af2d 🚀
This commit is contained in:
parent
255359160c
commit
6ead45967a
@ -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-04-14 Thu 14:11 -->
|
||||
<!-- 2022-04-23 Sat 17:25 -->
|
||||
<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-04-14 Thu 14:11</p>
|
||||
<p class="date">Created: 2022-04-23 Sat 17:25</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-04-14 Thu 14:11 -->
|
||||
<!-- 2022-04-23 Sat 17:25 -->
|
||||
<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="#org777cd15">1. Accessing sparse quantities</a>
|
||||
<li><a href="#orge209c9c">1. Accessing sparse quantities</a>
|
||||
<ul>
|
||||
<li><a href="#org11e9433">1.1. Fortran</a>
|
||||
<li><a href="#orge4fbfb2">1.1. Fortran</a>
|
||||
<ul>
|
||||
<li><a href="#org2d8d889">1.1.1. Declare Temporary variables</a></li>
|
||||
<li><a href="#orgc64cbfa">1.1.2. Obtain the name of the TREXIO file from the command line, and open it for reading</a></li>
|
||||
<li><a href="#org4c2c934">1.1.3. Read the nuclear repulsion energy</a></li>
|
||||
<li><a href="#org3747847">1.1.4. Read the number of molecular orbitals</a></li>
|
||||
<li><a href="#orge94fe49">1.1.5. Allocate memory</a></li>
|
||||
<li><a href="#org19d45c8">1.1.6. Read one-electron quantities</a></li>
|
||||
<li><a href="#orgf8a5b38">1.1.7. Read two-electron quantities</a>
|
||||
<li><a href="#orgbeda0d7">1.1.1. Declare Temporary variables</a></li>
|
||||
<li><a href="#orgdf0476a">1.1.2. Obtain the name of the TREXIO file from the command line, and open it for reading</a></li>
|
||||
<li><a href="#org0a14b92">1.1.3. Read the nuclear repulsion energy</a></li>
|
||||
<li><a href="#orga341584">1.1.4. Read the number of molecular orbitals</a></li>
|
||||
<li><a href="#orgd6ed761">1.1.5. Allocate memory</a></li>
|
||||
<li><a href="#org7b2c717">1.1.6. Read one-electron quantities</a></li>
|
||||
<li><a href="#orgf35e2e6">1.1.7. Read two-electron quantities</a>
|
||||
<ul>
|
||||
<li><a href="#org91f5bb6">1.1.7.1. Electron repulsion integrals</a></li>
|
||||
<li><a href="#orgd6e3a36">1.1.7.2. Reduced density matrix</a></li>
|
||||
<li><a href="#org63b5853">1.1.7.1. Electron repulsion integrals</a></li>
|
||||
<li><a href="#org8429996">1.1.7.2. Reduced density matrix</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#orgbc2f639">1.1.8. Compute the energy</a></li>
|
||||
<li><a href="#org4a281b6">1.1.9. Terminate</a></li>
|
||||
<li><a href="#org2e61f8f">1.1.8. Compute the energy</a></li>
|
||||
<li><a href="#orgfad49b7">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-org777cd15" class="outline-2">
|
||||
<h2 id="org777cd15"><span class="section-number-2">1</span> Accessing sparse quantities</h2>
|
||||
<div id="outline-container-orge209c9c" class="outline-2">
|
||||
<h2 id="orge209c9c"><span class="section-number-2">1</span> Accessing sparse quantities</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
</div>
|
||||
<div id="outline-container-org11e9433" class="outline-3">
|
||||
<h3 id="org11e9433"><span class="section-number-3">1.1</span> Fortran</h3>
|
||||
<div id="outline-container-orge4fbfb2" class="outline-3">
|
||||
<h3 id="orge4fbfb2"><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-org2d8d889" class="outline-4">
|
||||
<h4 id="org2d8d889"><span class="section-number-4">1.1.1</span> Declare Temporary variables</h4>
|
||||
<div id="outline-container-orgbeda0d7" class="outline-4">
|
||||
<h4 id="orgbeda0d7"><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-orgc64cbfa" class="outline-4">
|
||||
<h4 id="orgc64cbfa"><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-orgdf0476a" class="outline-4">
|
||||
<h4 id="orgdf0476a"><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-org4c2c934" class="outline-4">
|
||||
<h4 id="org4c2c934"><span class="section-number-4">1.1.3</span> Read the nuclear repulsion energy</h4>
|
||||
<div id="outline-container-org0a14b92" class="outline-4">
|
||||
<h4 id="org0a14b92"><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-org3747847" class="outline-4">
|
||||
<h4 id="org3747847"><span class="section-number-4">1.1.4</span> Read the number of molecular orbitals</h4>
|
||||
<div id="outline-container-orga341584" class="outline-4">
|
||||
<h4 id="orga341584"><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-orge94fe49" class="outline-4">
|
||||
<h4 id="orge94fe49"><span class="section-number-4">1.1.5</span> Allocate memory</h4>
|
||||
<div id="outline-container-orgd6ed761" class="outline-4">
|
||||
<h4 id="orgd6ed761"><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-org19d45c8" class="outline-4">
|
||||
<h4 id="org19d45c8"><span class="section-number-4">1.1.6</span> Read one-electron quantities</h4>
|
||||
<div id="outline-container-org7b2c717" class="outline-4">
|
||||
<h4 id="org7b2c717"><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-orgf8a5b38" class="outline-4">
|
||||
<h4 id="orgf8a5b38"><span class="section-number-4">1.1.7</span> Read two-electron quantities</h4>
|
||||
<div id="outline-container-orgf35e2e6" class="outline-4">
|
||||
<h4 id="orgf35e2e6"><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-org91f5bb6" class="outline-5">
|
||||
<h5 id="org91f5bb6"><span class="section-number-5">1.1.7.1</span> Electron repulsion integrals</h5>
|
||||
<div id="outline-container-org63b5853" class="outline-5">
|
||||
<h5 id="org63b5853"><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-orgd6e3a36" class="outline-5">
|
||||
<h5 id="orgd6e3a36"><span class="section-number-5">1.1.7.2</span> Reduced density matrix</h5>
|
||||
<div id="outline-container-org8429996" class="outline-5">
|
||||
<h5 id="org8429996"><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-orgbc2f639" class="outline-4">
|
||||
<h4 id="orgbc2f639"><span class="section-number-4">1.1.8</span> Compute the energy</h4>
|
||||
<div id="outline-container-org2e61f8f" class="outline-4">
|
||||
<h4 id="org2e61f8f"><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-org4a281b6" class="outline-4">
|
||||
<h4 id="org4a281b6"><span class="section-number-4">1.1.9</span> Terminate</h4>
|
||||
<div id="outline-container-orgfad49b7" class="outline-4">
|
||||
<h4 id="orgfad49b7"><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-04-14 Thu 14:11</p>
|
||||
<p class="date">Created: 2022-04-23 Sat 17:25</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-04-14 Thu 14:11 -->
|
||||
<!-- 2022-04-23 Sat 17:25 -->
|
||||
<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-04-14 Thu 14:11</p>
|
||||
<p class="date">Created: 2022-04-23 Sat 17:25</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
2262
templator_front.html
2262
templator_front.html
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-04-14 Thu 14:11 -->
|
||||
<!-- 2022-04-23 Sat 17:25 -->
|
||||
<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,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="#org8bd2c1c">1. Template for HDF5 definitions</a></li>
|
||||
<li><a href="#org586f2be">2. Template for HDF5 structures</a></li>
|
||||
<li><a href="#org35ea29f">3. Template for HDF5 init/deinit</a></li>
|
||||
<li><a href="#org6fa5341">4. Template for HDF5 has/read/write a numerical attribute</a></li>
|
||||
<li><a href="#org0ab77a0">5. Template for HDF5 has/read/write a dataset of numerical data</a></li>
|
||||
<li><a href="#org03ba27c">6. Template for HDF5 has/read/write a dataset of sparse data</a></li>
|
||||
<li><a href="#orgbace666">7. Template for HDF5 has/read/write a dataset of strings</a></li>
|
||||
<li><a href="#org08df0ff">8. Template for HDF5 has/read/write a string attribute</a></li>
|
||||
<li><a href="#org9bf2bce">9. Template for HDF5 delete a group (UNSAFE mode)</a></li>
|
||||
<li><a href="#org6183197">10. Helper functions</a></li>
|
||||
<li><a href="#org55a9518">1. Template for HDF5 definitions</a></li>
|
||||
<li><a href="#org56b9583">2. Template for HDF5 structures</a></li>
|
||||
<li><a href="#org56ba993">3. Template for HDF5 init/deinit</a></li>
|
||||
<li><a href="#org3c9893c">4. Template for HDF5 has/read/write a numerical attribute</a></li>
|
||||
<li><a href="#orgb8253a8">5. Template for HDF5 has/read/write a dataset of numerical data</a></li>
|
||||
<li><a href="#org6084d09">6. Template for HDF5 has/read/write a dataset of sparse data</a></li>
|
||||
<li><a href="#orgd46a575">7. Template for HDF5 has/read/write a dataset of strings</a></li>
|
||||
<li><a href="#orgae033da">8. Template for HDF5 has/read/write a string attribute</a></li>
|
||||
<li><a href="#orgbcaa669">9. Template for HDF5 delete a group (UNSAFE mode)</a></li>
|
||||
<li><a href="#org89a28af">10. Source code for the determinant part</a></li>
|
||||
<li><a href="#org097c733">11. Helper functions</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org8bd2c1c" class="outline-2">
|
||||
<h2 id="org8bd2c1c"><span class="section-number-2">1</span> Template for HDF5 definitions</h2>
|
||||
<div id="outline-container-org55a9518" class="outline-2">
|
||||
<h2 id="org55a9518"><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>
|
||||
@ -338,8 +339,8 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org586f2be" class="outline-2">
|
||||
<h2 id="org586f2be"><span class="section-number-2">2</span> Template for HDF5 structures</h2>
|
||||
<div id="outline-container-org56b9583" class="outline-2">
|
||||
<h2 id="org56b9583"><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> {
|
||||
@ -352,8 +353,8 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org35ea29f" class="outline-2">
|
||||
<h2 id="org35ea29f"><span class="section-number-2">3</span> Template for HDF5 init/deinit</h2>
|
||||
<div id="outline-container-org56ba993" class="outline-2">
|
||||
<h2 id="org56ba993"><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>
|
||||
@ -458,8 +459,8 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org6fa5341" class="outline-2">
|
||||
<h2 id="org6fa5341"><span class="section-number-2">4</span> Template for HDF5 has/read/write a numerical attribute</h2>
|
||||
<div id="outline-container-org3c9893c" class="outline-2">
|
||||
<h2 id="org3c9893c"><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>
|
||||
@ -545,6 +546,7 @@ for the JavaScript code in this tag.
|
||||
<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;">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: #a020f0;">if</span> (f->$group$_group == (<span style="color: #228b22;">hsize_t</span>) 0) <span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
|
||||
|
||||
<span style="color: #228b22;">htri_t</span> <span style="color: #a0522d;">status</span> = H5Aexists(f->$group$_group, $GROUP_NUM$_NAME);
|
||||
/* <span style="color: #b22222;">H5Aexists returns positive value if attribute exists, 0 if does not, negative if error </span>*/
|
||||
@ -562,8 +564,8 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org0ab77a0" class="outline-2">
|
||||
<h2 id="org0ab77a0"><span class="section-number-2">5</span> Template for HDF5 has/read/write a dataset of numerical data</h2>
|
||||
<div id="outline-container-orgb8253a8" class="outline-2">
|
||||
<h2 id="orgb8253a8"><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>
|
||||
@ -679,6 +681,7 @@ for the JavaScript code in this tag.
|
||||
<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->$group$_group == (<span style="color: #228b22;">hsize_t</span>) 0) <span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
|
||||
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5LTfind_dataset(f->$group$_group, $GROUP_DSET$_NAME);
|
||||
/* <span style="color: #b22222;">H5LTfind_dataset returns 1 if dataset exists, 0 otherwise </span>*/
|
||||
@ -696,8 +699,8 @@ for the JavaScript code in this tag.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org03ba27c" class="outline-2">
|
||||
<h2 id="org03ba27c"><span class="section-number-2">6</span> Template for HDF5 has/read/write a dataset of sparse data</h2>
|
||||
<div id="outline-container-org6084d09" class="outline-2">
|
||||
<h2 id="org6084d09"><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
|
||||
@ -719,7 +722,7 @@ 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: #228b22;">hid_t</span> <span style="color: #a0522d;">index_dtype</span>;
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">void</span>* <span style="color: #a0522d;">index_p</span>;
|
||||
<span style="color: #228b22;">void</span>* <span style="color: #a0522d;">index_p</span> = <span style="color: #008b8b;">NULL</span>;
|
||||
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">size_ranked</span> = (<span style="color: #228b22;">uint64_t</span>) size * $group_dset_rank$;
|
||||
/* <span style="color: #b22222;">Determine the optimal type for storing indices depending on the size_max (usually mo_num or ao_num) </span>*/
|
||||
<span style="color: #a020f0;">if</span> (size_max < UINT8_MAX) {
|
||||
@ -739,7 +742,7 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
index_p = index;
|
||||
index_dtype = H5T_NATIVE_UINT16;
|
||||
} <span style="color: #a020f0;">else</span> {
|
||||
index_p = (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>*) index_sparse;
|
||||
index_p = (<span style="color: #228b22;">int32_t</span>*) index_sparse;
|
||||
index_dtype = H5T_NATIVE_INT32;
|
||||
}
|
||||
|
||||
@ -825,11 +828,11 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
<span style="color: #228b22;">trexio_exit_code</span> <span style="color: #a0522d;">rc_read</span>;
|
||||
|
||||
// <span style="color: #b22222;">attempt to read indices</span>
|
||||
rc_read = trexio_hdf5_open_read_dset_sparse(f->$group$_group, dset_index_name, offset_i, count_i, <span style="color: #008b8b;">NULL</span>, is_index, index_read);
|
||||
rc_read = trexio_hdf5_open_read_dset_sparse(f->$group$_group, dset_index_name, $group_dset_rank$, offset_i, count_i, <span style="color: #008b8b;">NULL</span>, is_index, index_read);
|
||||
<span style="color: #a020f0;">if</span> (rc_read != TREXIO_SUCCESS && rc_read != TREXIO_END) <span style="color: #a020f0;">return</span> rc_read;
|
||||
// <span style="color: #b22222;">attempt to read values</span>
|
||||
// <span style="color: #b22222;">when EOF is encountered - the count_v[0] is modified and contains the number of elements being read</span>
|
||||
rc_read = trexio_hdf5_open_read_dset_sparse(f->$group$_group, dset_value_name, offset_v, count_v, eof_read_size, is_value, value_read);
|
||||
rc_read = trexio_hdf5_open_read_dset_sparse(f->$group$_group, dset_value_name, 1, offset_v, count_v, eof_read_size, is_value, value_read);
|
||||
<span style="color: #a020f0;">if</span> (rc_read != TREXIO_SUCCESS && rc_read != TREXIO_END) <span style="color: #a020f0;">return</span> rc_read;
|
||||
|
||||
<span style="color: #a020f0;">return</span> rc_read;
|
||||
@ -844,6 +847,7 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
{
|
||||
|
||||
<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;">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;
|
||||
|
||||
@ -881,6 +885,7 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
<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->$group$_group == (<span style="color: #228b22;">hsize_t</span>) 0) <span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
|
||||
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5LTfind_dataset(f->$group$_group, $GROUP_DSET$_NAME <span style="color: #8b2252;">"_values"</span>);
|
||||
/* <span style="color: #b22222;">H5LTfind_dataset returns 1 if dataset exists, 0 otherwise </span>*/
|
||||
@ -898,8 +903,8 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgbace666" class="outline-2">
|
||||
<h2 id="orgbace666"><span class="section-number-2">7</span> Template for HDF5 has/read/write a dataset of strings</h2>
|
||||
<div id="outline-container-orgd46a575" class="outline-2">
|
||||
<h2 id="orgd46a575"><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>
|
||||
@ -1079,6 +1084,7 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
<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->$group$_group == (<span style="color: #228b22;">hsize_t</span>) 0) <span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
|
||||
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5LTfind_dataset(f->$group$_group, $GROUP_DSET$_NAME);
|
||||
/* <span style="color: #b22222;">H5LTfind_dataset returns 1 if dataset exists, 0 otherwise </span>*/
|
||||
@ -1096,8 +1102,8 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org08df0ff" class="outline-2">
|
||||
<h2 id="org08df0ff"><span class="section-number-2">8</span> Template for HDF5 has/read/write a string attribute</h2>
|
||||
<div id="outline-container-orgae033da" class="outline-2">
|
||||
<h2 id="orgae033da"><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>
|
||||
@ -1207,6 +1213,7 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
<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;">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: #a020f0;">if</span> (f->$group$_group == (<span style="color: #228b22;">hsize_t</span>) 0) <span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
|
||||
|
||||
<span style="color: #228b22;">htri_t</span> <span style="color: #a0522d;">status</span> = H5Aexists(f->$group$_group, $GROUP_STR$_NAME);
|
||||
/* <span style="color: #b22222;">H5Aexists returns positive value if attribute exists, 0 if does not, negative if error </span>*/
|
||||
@ -1223,8 +1230,8 @@ due to the fact that the sparse data will be written in chunks of user-defined s
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org9bf2bce" class="outline-2">
|
||||
<h2 id="org9bf2bce"><span class="section-number-2">9</span> Template for HDF5 delete a group (UNSAFE mode)</h2>
|
||||
<div id="outline-container-orgbcaa669" class="outline-2">
|
||||
<h2 id="orgbcaa669"><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
|
||||
@ -1264,9 +1271,263 @@ Thus, any corrupted/lost file space will remain in the first file. The use of <c
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org6183197" class="outline-2">
|
||||
<h2 id="org6183197"><span class="section-number-2">10</span> Helper functions</h2>
|
||||
<div id="outline-container-org89a28af" class="outline-2">
|
||||
<h2 id="org89a28af"><span class="section-number-2">10</span> Source code for the determinant part</h2>
|
||||
<div class="outline-text-2" id="text-10">
|
||||
<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>.
|
||||
Size specifies the number of data items (e.g. determinants) to process.
|
||||
</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_determinant_list</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;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">list</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> (list == <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;">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;">char</span> <span style="color: #a0522d;">dset_det_name</span>[256] = <span style="color: #8b2252;">"determinant_list"</span>;
|
||||
|
||||
<span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">offset</span>[1] = {(<span style="color: #228b22;">hsize_t</span>) offset_file * dims[1]};
|
||||
<span style="color: #228b22;">hsize_t</span> <span style="color: #a0522d;">count</span>[1] = {(<span style="color: #228b22;">hsize_t</span>) dims[0] * dims[1]};
|
||||
|
||||
/* <span style="color: #b22222;">Attempt to read determinants (if EOF -> 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->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->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 -> 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->determinant_group, dset_coeff_name, 1, offset, count, eof_read_size, 0, coeff);
|
||||
}
|
||||
</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_determinant_list</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;">int64_t</span>* <span style="color: #a0522d;">list</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> (list == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_5;
|
||||
|
||||
<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_INT64;
|
||||
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">size_ranked</span> = dims[1]*dims[0];
|
||||
|
||||
/* <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] = {size_ranked};
|
||||
|
||||
/* <span style="color: #b22222;">Indices and values are stored as 2 independent datasets in the HDF5 file </span>*/
|
||||
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">dset_det_name</span>[256] = <span style="color: #8b2252;">"determinant_list"</span>;
|
||||
|
||||
<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->determinant_group, dset_det_name) != 1 ) {
|
||||
/* <span style="color: #b22222;">If the file does not exist -> 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->determinant_group, dset_det_name, det_dtype, chunk_dims, list);
|
||||
<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 -> 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 * dims[1]};
|
||||
|
||||
/* <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->determinant_group, dset_det_name, det_dtype, chunk_dims, offset_data, list);
|
||||
<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_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->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->determinant_group, dset_coeff_name) != 1 ) {
|
||||
/* <span style="color: #b22222;">If the file does not exist -> 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->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 -> 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->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->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->determinant_group, dset_coeff_name, H5P_DEFAULT);
|
||||
<span style="color: #a020f0;">if</span> (dset_id <= 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 < 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_determinant_list</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->determinant_group == (<span style="color: #228b22;">hsize_t</span>) 0) <span style="color: #a020f0;">return</span> TREXIO_HAS_NOT;
|
||||
|
||||
<span style="color: #228b22;">herr_t</span> <span style="color: #a0522d;">status</span> = H5LTfind_dataset(f->determinant_group, <span style="color: #8b2252;">"determinant_list"</span>);
|
||||
/* <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;
|
||||
}
|
||||
}
|
||||
|
||||
<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->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->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->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-org097c733" class="outline-2">
|
||||
<h2 id="org097c733"><span class="section-number-2">11</span> Helper functions</h2>
|
||||
<div class="outline-text-2" id="text-11">
|
||||
<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>,
|
||||
@ -1401,6 +1662,7 @@ Thus, any corrupted/lost file space will remain in the first file. The use of <c
|
||||
<span style="color: #228b22;">trexio_exit_code</span>
|
||||
<span style="color: #0000ff;">trexio_hdf5_open_read_dset_sparse</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">group_id</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">dset_name</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">dset_rank</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">hsize_t</span>* <span style="color: #a0522d;">offset_file</span>,
|
||||
<span style="color: #228b22;">hsize_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">size_read</span>,
|
||||
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">eof_read_size</span>,
|
||||
@ -1409,6 +1671,7 @@ Thus, any corrupted/lost file space will remain in the first file. The use of <c
|
||||
)
|
||||
{
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int</span> <span style="color: #a0522d;">h5_rank</span> = 1;
|
||||
<span style="color: #a020f0;">if</span> (dset_rank == 0) <span style="color: #a020f0;">return</span> TREXIO_INVALID_ARG_3;
|
||||
|
||||
// <span style="color: #b22222;">get the dataset handle</span>
|
||||
<span style="color: #228b22;">hid_t</span> <span style="color: #a0522d;">dset_id</span> = H5Dopen(group_id, dset_name, H5P_DEFAULT);
|
||||
@ -1439,9 +1702,9 @@ Thus, any corrupted/lost file space will remain in the first file. The use of <c
|
||||
<span style="color: #a020f0;">if</span> (max_offset > ddims[0]) {
|
||||
is_EOF = 1;
|
||||
// <span style="color: #b22222;">lower the value of count to reduce the number of elements which will be read</span>
|
||||
size_read[0] -= max_offset - ddims[0];
|
||||
size_read[0] -= (max_offset - ddims[0]);
|
||||
// <span style="color: #b22222;">modified the value of eof_read_size passed by address</span>
|
||||
<span style="color: #a020f0;">if</span> (eof_read_size != <span style="color: #008b8b;">NULL</span>) *eof_read_size = size_read[0];
|
||||
<span style="color: #a020f0;">if</span> (eof_read_size != <span style="color: #008b8b;">NULL</span>) *eof_read_size = size_read[0]/dset_rank;
|
||||
}
|
||||
|
||||
// <span style="color: #b22222;">special case when reading int indices</span>
|
||||
@ -1526,7 +1789,7 @@ Thus, any corrupted/lost file space will remain in the first file. The use of <c
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX-CoE</p>
|
||||
<p class="date">Created: 2022-04-14 Thu 14:11</p>
|
||||
<p class="date">Created: 2022-04-23 Sat 17:25</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-04-14 Thu 14:11 -->
|
||||
<!-- 2022-04-23 Sat 17:25 -->
|
||||
<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,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="#org8f87798">1. TEXT back end</a>
|
||||
<ul>
|
||||
<li><a href="#orgc430f97">1.1. Template for group-related structures in text back end</a></li>
|
||||
<li><a href="#orged96a0c">1.2. Template for general structure in text back end</a></li>
|
||||
<li><a href="#org09f982b">1.3. Initialize function (constant part)</a></li>
|
||||
<li><a href="#org6071fd8">1.4. Deinitialize function (templated part)</a></li>
|
||||
<li><a href="#org9c60c43">1.5. Template for text read a group</a></li>
|
||||
<li><a href="#org3f46f33">1.6. Template for text flush a group</a></li>
|
||||
<li><a href="#org1ef46cc">1.7. Template for text free memory</a></li>
|
||||
<li><a href="#orgf3a937e">1.8. Template for has/read/write a numerical attribute</a></li>
|
||||
<li><a href="#orgc66c584">1.9. Template for has/read/write a dataset of numerical data</a></li>
|
||||
<li><a href="#org69996a9">1.10. Template for has/read/write a dataset of strings</a></li>
|
||||
<li><a href="#org560f71b">1.11. Template for has/read/write a string attribute</a></li>
|
||||
<li><a href="#orgbe0d8e0">1.12. Template for has/read/write the dataset of sparse data</a></li>
|
||||
<li><a href="#orge06f150">1.13. Template for text delete a group (UNSAFE mode)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#orgc8f3103">1. Template for group-related structures in text back end</a></li>
|
||||
<li><a href="#org1864327">2. Template for general structure in text back end</a></li>
|
||||
<li><a href="#orga2224cc">3. Initialize function (constant part)</a></li>
|
||||
<li><a href="#org81f40dc">4. Deinitialize function (templated part)</a></li>
|
||||
<li><a href="#org8ab908b">5. Template for text read a group</a></li>
|
||||
<li><a href="#org6291106">6. Template for text flush a group</a></li>
|
||||
<li><a href="#orga996111">7. Template for text free memory</a></li>
|
||||
<li><a href="#org64eae79">8. Template for has/read/write a numerical attribute</a></li>
|
||||
<li><a href="#orgd23d0f8">9. Template for has/read/write a dataset of numerical data</a></li>
|
||||
<li><a href="#orga3d0c43">10. Template for has/read/write a dataset of strings</a></li>
|
||||
<li><a href="#org9f53962">11. Template for has/read/write a string attribute</a></li>
|
||||
<li><a href="#orgbec12bd">12. Template for has/read/write the dataset of sparse data</a></li>
|
||||
<li><a href="#org936d9a5">13. Template for text delete a group (UNSAFE mode)</a></li>
|
||||
<li><a href="#org5c4aa04">14. Source code for the determinant part</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org8f87798" class="outline-2">
|
||||
<h2 id="org8f87798"><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
|
||||
file per group.
|
||||
@ -352,11 +345,10 @@ directory.
|
||||
<p>
|
||||
The file is written when closed, or when the flush function is called.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgc430f97" class="outline-3">
|
||||
<h3 id="orgc430f97"><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 id="outline-container-orgc8f3103" class="outline-2">
|
||||
<h2 id="orgc8f3103"><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 {
|
||||
$group_num_dtype_double$ $group_num$;
|
||||
@ -374,9 +366,9 @@ The file is written when closed, or when the flush function is called.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orged96a0c" class="outline-3">
|
||||
<h3 id="orged96a0c"><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 id="outline-container-org1864327" class="outline-2">
|
||||
<h2 id="org1864327"><span class="section-number-2">2</span> Template for general structure in text back end</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_text_s</span> {
|
||||
<span style="color: #228b22;">trexio_t</span> <span style="color: #a0522d;">parent</span> ;
|
||||
@ -388,9 +380,9 @@ The file is written when closed, or when the flush function is called.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org09f982b" class="outline-3">
|
||||
<h3 id="org09f982b"><span class="section-number-3">1.3</span> Initialize function (constant part)</h3>
|
||||
<div class="outline-text-3" id="text-1-3">
|
||||
<div id="outline-container-orga2224cc" class="outline-2">
|
||||
<h2 id="orga2224cc"><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;">trexio_exit_code</span>
|
||||
<span style="color: #0000ff;">trexio_text_inquire</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">file_name</span>)
|
||||
@ -532,9 +524,9 @@ The file is written when closed, or when the flush function is called.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org6071fd8" class="outline-3">
|
||||
<h3 id="org6071fd8"><span class="section-number-3">1.4</span> Deinitialize function (templated part)</h3>
|
||||
<div class="outline-text-3" id="text-1-4">
|
||||
<div id="outline-container-org81f40dc" class="outline-2">
|
||||
<h2 id="org81f40dc"><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>
|
||||
<span style="color: #0000ff;">trexio_text_deinit</span> (<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
|
||||
@ -555,9 +547,9 @@ The file is written when closed, or when the flush function is called.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org9c60c43" class="outline-3">
|
||||
<h3 id="org9c60c43"><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 id="outline-container-org8ab908b" class="outline-2">
|
||||
<h2 id="org8ab908b"><span class="section-number-2">5</span> Template for text read a group</h2>
|
||||
<div class="outline-text-2" id="text-5">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c">$group$_t*
|
||||
trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
|
||||
@ -857,9 +849,9 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org3f46f33" class="outline-3">
|
||||
<h3 id="org3f46f33"><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 id="outline-container-org6291106" class="outline-2">
|
||||
<h2 id="org6291106"><span class="section-number-2">6</span> Template for text flush a group</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>
|
||||
<span style="color: #0000ff;">trexio_text_flush_$group$</span> (<span style="color: #228b22;">trexio_text_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
|
||||
@ -922,9 +914,9 @@ trexio_text_read_$group$ (<span style="color: #228b22;">trexio_text_t</span>* <s
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org1ef46cc" class="outline-3">
|
||||
<h3 id="org1ef46cc"><span class="section-number-3">1.7</span> Template for text free memory</h3>
|
||||
<div class="outline-text-3" id="text-1-7">
|
||||
<div id="outline-container-orga996111" class="outline-2">
|
||||
<h2 id="orga996111"><span class="section-number-2">7</span> Template for text free memory</h2>
|
||||
<div class="outline-text-2" id="text-7">
|
||||
<p>
|
||||
Memory is allocated when reading. The following function frees memory.
|
||||
</p>
|
||||
@ -970,9 +962,9 @@ Memory is allocated when reading. The following function frees memory.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgf3a937e" class="outline-3">
|
||||
<h3 id="orgf3a937e"><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 id="outline-container-org64eae79" class="outline-2">
|
||||
<h2 id="org64eae79"><span class="section-number-2">8</span> Template for has/read/write a numerical 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_text_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)
|
||||
@ -1034,9 +1026,9 @@ Memory is allocated when reading. The following function frees memory.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgc66c584" class="outline-3">
|
||||
<h3 id="orgc66c584"><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">
|
||||
<div id="outline-container-orgd23d0f8" class="outline-2">
|
||||
<h2 id="orgd23d0f8"><span class="section-number-2">9</span> Template for has/read/write a dataset of numerical data</h2>
|
||||
<div class="outline-text-2" id="text-9">
|
||||
<p>
|
||||
The <code>group_dset</code> array is assumed allocated with the appropriate size.
|
||||
</p>
|
||||
@ -1131,9 +1123,9 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org69996a9" class="outline-3">
|
||||
<h3 id="org69996a9"><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">
|
||||
<div id="outline-container-orga3d0c43" class="outline-2">
|
||||
<h2 id="orga3d0c43"><span class="section-number-2">10</span> Template for has/read/write a dataset of strings</h2>
|
||||
<div class="outline-text-2" id="text-10">
|
||||
<p>
|
||||
The <code>group_dset</code> array is assumed allocated with the appropriate size.
|
||||
</p>
|
||||
@ -1233,9 +1225,9 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org560f71b" class="outline-3">
|
||||
<h3 id="org560f71b"><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 id="outline-container-org9f53962" class="outline-2">
|
||||
<h2 id="org9f53962"><span class="section-number-2">11</span> Template for has/read/write a string attribute</h2>
|
||||
<div class="outline-text-2" id="text-11">
|
||||
<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_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>)
|
||||
@ -1308,9 +1300,9 @@ The <code>group_dset</code> array is assumed allocated with the appropriate size
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgbe0d8e0" class="outline-3">
|
||||
<h3 id="orgbe0d8e0"><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">
|
||||
<div id="outline-container-orgbec12bd" class="outline-2">
|
||||
<h2 id="orgbec12bd"><span class="section-number-2">12</span> Template for has/read/write the dataset of sparse data</h2>
|
||||
<div class="outline-text-2" id="text-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
|
||||
from conventional write/read/flush behaviour of the TEXT back end. Chunks are used to read/write sparse data
|
||||
@ -1583,9 +1575,9 @@ User provides indices and values of the sparse array as two separate variables.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orge06f150" class="outline-3">
|
||||
<h3 id="orge06f150"><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 id="outline-container-org936d9a5" class="outline-2">
|
||||
<h2 id="org936d9a5"><span class="section-number-2">13</span> Template for text delete a group (UNSAFE mode)</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_text_delete_$group$</span> (<span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
|
||||
@ -1611,11 +1603,413 @@ User provides indices and values of the sparse array as two separate variables.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org5c4aa04" class="outline-2">
|
||||
<h2 id="org5c4aa04"><span class="section-number-2">14</span> Source code for the determinant part</h2>
|
||||
<div class="outline-text-2" id="text-14">
|
||||
<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
|
||||
to prevent memory overflow. Chunks have a given <code>int64_t size</code>.
|
||||
Size specifies the number of data items, e.g. determinants.
|
||||
</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_determinant_list</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;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">list</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> (list == <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;">determinant_list_file_name</span>[256] = <span style="color: #8b2252;">"/determinant_list.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->file_name, TREXIO_MAX_FILENAME_LENGTH);
|
||||
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
|
||||
strncat (file_full_path, determinant_list_file_name,
|
||||
TREXIO_MAX_FILENAME_LENGTH-strlen(determinant_list_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 64-bit integer takes at most 10 slots and requires one space,</span>
|
||||
<span style="color: #b22222;"> we have int_num integers per up-spin determinant,</span>
|
||||
<span style="color: #b22222;"> then this number is doubled because we have the same number for down-spin electrons,</span>
|
||||
<span style="color: #b22222;"> and then one newline char.</span>
|
||||
<span style="color: #b22222;"> </span>*/
|
||||
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">line_length</span> = dims[1]*11UL + 1UL; // <span style="color: #b22222;">10 digits per int64_t bitfield + 1 space = 11 spots + 1 newline char</span>
|
||||
|
||||
/* <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 > 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 <a1 a2 ... a/\ b1 b2 ... b\/> </span>*/
|
||||
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">buffer</span>[1024];
|
||||
<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;">Parameters to post-process the buffer and to get bit fields integers </span>*/
|
||||
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">accum</span> = 0UL;
|
||||
<span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">shift_int64</span> = 11U;
|
||||
/* <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 < dims[0]; ++i) {
|
||||
|
||||
accum = 0UL;
|
||||
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> {
|
||||
|
||||
/* <span style="color: #b22222;">The format string is not anymore static but rather dynamic (the number of ints depend on the mo_num)</span>
|
||||
<span style="color: #b22222;"> Thus, we parse the buffer string int_num*2 times to get the bit field determinants.</span>
|
||||
<span style="color: #b22222;"> </span>*/
|
||||
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">j</span>=0; j < (<span style="color: #228b22;">uint32_t</span>) dims[1]; ++j) {
|
||||
rc = sscanf(buffer+accum, <span style="color: #8b2252;">"%10"</span> SCNd64, list + dims[1]*i + j);
|
||||
<span style="color: #a020f0;">if</span>(rc <= 0) {
|
||||
fclose(f);
|
||||
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
}
|
||||
accum += shift_int64;
|
||||
}
|
||||
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</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->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->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 > 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 <a1 a2 ... a/\ b1 b2 ... b\/> </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 < 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 <= 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->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->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 > 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, &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 > 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_determinant_list</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;">int64_t</span>* <span style="color: #a0522d;">list</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> (list == <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;">determinant_list_file_name</span>[256] = <span style="color: #8b2252;">"/determinant_list.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->file_name, TREXIO_MAX_FILENAME_LENGTH);
|
||||
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
|
||||
strncat (file_full_path, determinant_list_file_name,
|
||||
TREXIO_MAX_FILENAME_LENGTH-strlen(determinant_list_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 > 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 < dims[0]; ++i) {
|
||||
|
||||
/* <span style="color: #b22222;">The loop below is needed to write a line with int bit fields for alpha and beta electrons </span>*/
|
||||
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">j</span>=0; j < (<span style="color: #228b22;">uint32_t</span>) dims[1]; ++j) {
|
||||
rc = fprintf(f, <span style="color: #8b2252;">"%10"</span> PRId64 <span style="color: #8b2252;">" "</span>, *(list + i*dims[1] + j));
|
||||
<span style="color: #a020f0;">if</span>(rc <= 0) {
|
||||
fclose(f);
|
||||
<span style="color: #a020f0;">return</span> TREXIO_FAILURE;
|
||||
}
|
||||
}
|
||||
fprintf(f, <span style="color: #8b2252;">"%s"</span>, <span style="color: #8b2252;">"\n"</span>);
|
||||
|
||||
}
|
||||
|
||||
/* <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;">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->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->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 > 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 < dims[0]; ++i) {
|
||||
|
||||
rc = fprintf(f, <span style="color: #8b2252;">"%24.16e\n"</span>, *(coeff + i));
|
||||
<span style="color: #a020f0;">if</span>(rc <= 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 <= 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;">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_determinant_list</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;">determinant_list_file_name</span>[256] = <span style="color: #8b2252;">"/determinant_list.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->file_name, TREXIO_MAX_FILENAME_LENGTH);
|
||||
/* <span style="color: #b22222;">Append name of the file with sparse data </span>*/
|
||||
strncat (file_full_path, determinant_list_file_name,
|
||||
TREXIO_MAX_FILENAME_LENGTH-strlen(determinant_list_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;
|
||||
}
|
||||
}
|
||||
|
||||
<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->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->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>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX-CoE</p>
|
||||
<p class="date">Created: 2022-04-14 Thu 14:11</p>
|
||||
<p class="date">Created: 2022-04-23 Sat 17:25</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
285
trex.html
285
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-04-14 Thu 14:11 -->
|
||||
<!-- 2022-04-23 Sat 17:25 -->
|
||||
<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,34 +333,35 @@ for the JavaScript code in this tag.
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#org6968ccd">1. Metadata (metadata group)</a></li>
|
||||
<li><a href="#orgf3b35f3">2. Electron (electron group)</a></li>
|
||||
<li><a href="#orgb62332b">3. Nucleus (nucleus group)</a></li>
|
||||
<li><a href="#org100097b">4. Effective core potentials (ecp group)</a>
|
||||
<li><a href="#orgc8c3858">1. Metadata (metadata group)</a></li>
|
||||
<li><a href="#org469e525">2. Electron (electron group)</a></li>
|
||||
<li><a href="#orgcab1c16">3. Nucleus (nucleus group)</a></li>
|
||||
<li><a href="#org5e137f5">4. Effective core potentials (ecp group)</a>
|
||||
<ul>
|
||||
<li><a href="#org0cc7e96">4.1. Example</a></li>
|
||||
<li><a href="#org010853f">4.1. Example</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org388959c">5. Basis set (basis group)</a>
|
||||
<li><a href="#orgd336b3b">5. Basis set (basis group)</a>
|
||||
<ul>
|
||||
<li><a href="#org11c0016">5.1. Example</a></li>
|
||||
<li><a href="#org96e4dd7">5.1. Example</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org7713e00">6. Atomic orbitals (ao group)</a>
|
||||
<li><a href="#org14294dc">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="#org5a63275">7. Molecular orbitals (mo group)</a>
|
||||
<li><a href="#orgb3aa56b">7. Molecular orbitals (mo group)</a>
|
||||
<ul>
|
||||
<li><a href="#org238bda6">7.1. One-electron integrals (<code>mo_1e_int</code> group)</a></li>
|
||||
<li><a href="#orgb18ffbc">7.2. Two-electron integrals (<code>mo_2e_int</code> group)</a></li>
|
||||
<li><a href="#org4f450d9">7.1. One-electron integrals (<code>mo_1e_int</code> group)</a></li>
|
||||
<li><a href="#orgf189221">7.2. Two-electron integrals (<code>mo_2e_int</code> group)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org9bb5930">8. <span class="todo TODO">TODO</span> Slater determinants</a></li>
|
||||
<li><a href="#orgeeac284">9. Reduced density matrices (rdm group)</a></li>
|
||||
<li><a href="#org6357ae0">10. Quantum Monte Carlo data (qmc group)</a></li>
|
||||
<li><a href="#orgf7656ea">8. Slater determinants (determinant group)</a></li>
|
||||
<li><a href="#org597622e">9. Excited states (state group)</a></li>
|
||||
<li><a href="#org21dd486">10. Reduced density matrices (rdm group)</a></li>
|
||||
<li><a href="#org9aff83b">11. Quantum Monte Carlo data (qmc group)</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
@ -406,8 +407,8 @@ the <a href="./examples.html">examples</a>.
|
||||
</p>
|
||||
|
||||
|
||||
<div id="outline-container-org6968ccd" class="outline-2">
|
||||
<h2 id="org6968ccd"><span class="section-number-2">1</span> Metadata (metadata group)</h2>
|
||||
<div id="outline-container-orgc8c3858" class="outline-2">
|
||||
<h2 id="orgc8c3858"><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
|
||||
@ -417,7 +418,7 @@ which have participated to the creation of the file, a list of
|
||||
authors of the file, and a textual description.
|
||||
</p>
|
||||
|
||||
<table id="org37ea8ee" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org7c61ec7" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -498,15 +499,15 @@ then the <code>unsafe</code> attribute value can be manually overwritten (in uns
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgf3b35f3" class="outline-2">
|
||||
<h2 id="orgf3b35f3"><span class="section-number-2">2</span> Electron (electron group)</h2>
|
||||
<div id="outline-container-org469e525" class="outline-2">
|
||||
<h2 id="org469e525"><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="org39b102e" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org01c4ab0" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -552,15 +553,15 @@ the number of ↑ and ↓ electrons is fixed.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgb62332b" class="outline-2">
|
||||
<h2 id="orgb62332b"><span class="section-number-2">3</span> Nucleus (nucleus group)</h2>
|
||||
<div id="outline-container-orgcab1c16" class="outline-2">
|
||||
<h2 id="orgcab1c16"><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="org68c935e" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org6671f2a" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -627,8 +628,8 @@ given in Cartesian \((x,y,z)\) format.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org100097b" class="outline-2">
|
||||
<h2 id="org100097b"><span class="section-number-2">4</span> Effective core potentials (ecp group)</h2>
|
||||
<div id="outline-container-org5e137f5" class="outline-2">
|
||||
<h2 id="org5e137f5"><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
|
||||
@ -661,7 +662,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="org8baba87" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org53bbecc" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -763,8 +764,8 @@ If you encounter the aforementioned issue, please report it to our <a href="http
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org0cc7e96" class="outline-3">
|
||||
<h3 id="org0cc7e96"><span class="section-number-3">4.1</span> Example</h3>
|
||||
<div id="outline-container-org010853f" class="outline-3">
|
||||
<h3 id="org010853f"><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
|
||||
@ -827,8 +828,8 @@ power = [
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org388959c" class="outline-2">
|
||||
<h2 id="org388959c"><span class="section-number-2">5</span> Basis set (basis group)</h2>
|
||||
<div id="outline-container-orgd336b3b" class="outline-2">
|
||||
<h2 id="orgd336b3b"><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
|
||||
@ -881,7 +882,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="org9f9737d" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org142ef02" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -975,8 +976,8 @@ All the basis set parameters are stored in one-dimensional arrays:
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org11c0016" class="outline-3">
|
||||
<h3 id="org11c0016"><span class="section-number-3">5.1</span> Example</h3>
|
||||
<div id="outline-container-org96e4dd7" class="outline-3">
|
||||
<h3 id="org96e4dd7"><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
|
||||
@ -1054,8 +1055,8 @@ prim_factor =
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org7713e00" class="outline-2">
|
||||
<h2 id="org7713e00"><span class="section-number-2">6</span> Atomic orbitals (ao group)</h2>
|
||||
<div id="outline-container-org14294dc" class="outline-2">
|
||||
<h2 id="org14294dc"><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
|
||||
@ -1108,13 +1109,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="#org388959c">Basis set</a> section) to \(\mathcal{N}_{z^2}\), which is the
|
||||
the <a href="#orgd336b3b">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="org56bae99" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org73fa33b" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1166,8 +1167,8 @@ introduced here should be \(\frac{\mathcal{N}_{xy}}{\mathcal{N}_{z^2}}\).
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgcaf6bc5" class="outline-3">
|
||||
<h3 id="ao_one_e"><a id="orgcaf6bc5"></a><span class="section-number-3">6.1</span> One-electron integrals (<code>ao_1e_int</code> group)</h3>
|
||||
<div id="outline-container-org8461ba5" class="outline-3">
|
||||
<h3 id="ao_one_e"><a id="org8461ba5"></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}}
|
||||
@ -1184,7 +1185,7 @@ The one-electron integrals for a one-electron operator \(\hat{O}\) are
|
||||
over atomic orbitals.
|
||||
</p>
|
||||
|
||||
<table id="orgbab1d50" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="orgfd9c5f3" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1244,8 +1245,8 @@ over atomic orbitals.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org04c57d9" class="outline-3">
|
||||
<h3 id="ao_two_e"><a id="org04c57d9"></a><span class="section-number-3">6.2</span> Two-electron integrals (<code>ao_2e_int</code> group)</h3>
|
||||
<div id="outline-container-orgb7186ad" class="outline-3">
|
||||
<h3 id="ao_two_e"><a id="orgb7186ad"></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
|
||||
@ -1266,7 +1267,7 @@ notation.
|
||||
\mathbf{r}_j \vert)}{\vert \mathbf{r}_i - \mathbf{r}_j \vert} \] : electron-electron long range potential</li>
|
||||
</ul>
|
||||
|
||||
<table id="org6739406" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org1e839eb" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1306,10 +1307,10 @@ notation.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org5a63275" class="outline-2">
|
||||
<h2 id="org5a63275"><span class="section-number-2">7</span> Molecular orbitals (mo group)</h2>
|
||||
<div id="outline-container-orgb3aa56b" class="outline-2">
|
||||
<h2 id="orgb3aa56b"><span class="section-number-2">7</span> Molecular orbitals (mo group)</h2>
|
||||
<div class="outline-text-2" id="text-7">
|
||||
<table id="org300fc1b" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="orga032fb9" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1375,8 +1376,8 @@ notation.
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org238bda6" class="outline-3">
|
||||
<h3 id="org238bda6"><span class="section-number-3">7.1</span> One-electron integrals (<code>mo_1e_int</code> group)</h3>
|
||||
<div id="outline-container-org4f450d9" class="outline-3">
|
||||
<h3 id="org4f450d9"><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
|
||||
@ -1384,7 +1385,7 @@ The operators as the same as those defined in the
|
||||
the basis of molecular orbitals.
|
||||
</p>
|
||||
|
||||
<table id="org4f43cf0" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org92148f6" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1444,8 +1445,8 @@ the basis of molecular orbitals.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgb18ffbc" class="outline-3">
|
||||
<h3 id="orgb18ffbc"><span class="section-number-3">7.2</span> Two-electron integrals (<code>mo_2e_int</code> group)</h3>
|
||||
<div id="outline-container-orgf189221" class="outline-3">
|
||||
<h3 id="orgf189221"><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
|
||||
@ -1453,7 +1454,7 @@ The operators as the same as those defined in the
|
||||
the basis of molecular orbitals.
|
||||
</p>
|
||||
|
||||
<table id="org0f83eac" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org02b5ae8" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1493,13 +1494,171 @@ the basis of molecular orbitals.
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org9bb5930" class="outline-2">
|
||||
<h2 id="org9bb5930"><span class="section-number-2">8</span> <span class="todo TODO">TODO</span> Slater determinants</h2>
|
||||
<div id="outline-container-orgf7656ea" class="outline-2">
|
||||
<h2 id="orgf7656ea"><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\)
|
||||
can be expanded in the basis of Slater determinants \(D_I\) as follows
|
||||
</p>
|
||||
|
||||
<p>
|
||||
\[
|
||||
</p>
|
||||
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left">Ψ> = ∑<sub>I</sub> C<sub>I</sub></td>
|
||||
<td class="org-left">D<sub>I</sub>></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>
|
||||
\]
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For relatively small expansions, a given determinant can be represented as a list of <code>mo.num</code> occupation numbers.
|
||||
However, this requires a lot of extra memory and would be technically impossible for larger expansions
|
||||
(<code>millions of determinants). This is why the determinants are stored as bit fields in the TREXIO file
|
||||
(see ~int bitfield</code> type in the table below). By default, the chemist notation is used, namely
|
||||
</p>
|
||||
|
||||
<p>
|
||||
\[
|
||||
</p>
|
||||
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left">D<sub>I</sub> > =</td>
|
||||
<td class="org-left">α<sub>1</sub> α<sub>2</sub> \ldots α<sub>n↑</sub> β<sub>1</sub> β<sub>2</sub> \ldots β<sub>n↓</sub> ></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<p>
|
||||
\]
|
||||
</p>
|
||||
|
||||
<p>
|
||||
where \(\alpha\) and \(\beta\) denote $↑$-spin and $↓$-spin electrons, respectively,
|
||||
\(n\uparrow\) and \(n\downarrow\) correspond to <code>electron.up_num</code> and <code>electron.dn_num</code>, respectively.
|
||||
Internally, bit fields for \(\alpha\) and \(\beta\) electrons are stored separately,
|
||||
which is why the <code>determinant.list</code> attribute has a second dimension.
|
||||
</p>
|
||||
|
||||
<table id="org635ea7c" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="org-left">Variable</th>
|
||||
<th scope="col" class="org-left">Type</th>
|
||||
<th scope="col" class="org-left">Dimensions</th>
|
||||
<th scope="col" class="org-left">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left"><code>num</code></td>
|
||||
<td class="org-left"><code>dim</code></td>
|
||||
<td class="org-left"> </td>
|
||||
<td class="org-left">Number of determinants</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>list</code></td>
|
||||
<td class="org-left"><code>int special</code></td>
|
||||
<td class="org-left"><code>(determinant.num)</code></td>
|
||||
<td class="org-left">List of determinants as integer bit fields</td>
|
||||
</tr>
|
||||
|
||||
<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">Coefficients of the determinants from the CI expansion</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div id="outline-container-orgeeac284" class="outline-2">
|
||||
<h2 id="orgeeac284"><span class="section-number-2">9</span> Reduced density matrices (rdm group)</h2>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org597622e" class="outline-2">
|
||||
<h2 id="org597622e"><span class="section-number-2">9</span> Excited states (state group)</h2>
|
||||
<div class="outline-text-2" id="text-9">
|
||||
<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
|
||||
</p>
|
||||
|
||||
<table id="orgc3f6671" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="org-left">Variable</th>
|
||||
<th scope="col" class="org-left">Type</th>
|
||||
<th scope="col" class="org-left">Dimensions</th>
|
||||
<th scope="col" class="org-left">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left"><code>num</code></td>
|
||||
<td class="org-left"><code>dim</code></td>
|
||||
<td class="org-left"> </td>
|
||||
<td class="org-left">Number of states (including the 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>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org21dd486" class="outline-2">
|
||||
<h2 id="org21dd486"><span class="section-number-2">10</span> Reduced density matrices (rdm group)</h2>
|
||||
<div class="outline-text-2" id="text-10">
|
||||
<p>
|
||||
The reduced density matrices are defined in the basis of molecular
|
||||
orbitals.
|
||||
</p>
|
||||
@ -1550,7 +1709,7 @@ The total energy can be computed as:
|
||||
\]
|
||||
</p>
|
||||
|
||||
<table id="orgf552a18" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="orge5ba890" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1631,9 +1790,9 @@ The total energy can be computed as:
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org6357ae0" class="outline-2">
|
||||
<h2 id="org6357ae0"><span class="section-number-2">10</span> Quantum Monte Carlo data (qmc group)</h2>
|
||||
<div class="outline-text-2" id="text-10">
|
||||
<div id="outline-container-org9aff83b" class="outline-2">
|
||||
<h2 id="org9aff83b"><span class="section-number-2">11</span> Quantum Monte Carlo data (qmc group)</h2>
|
||||
<div class="outline-text-2" id="text-11">
|
||||
<p>
|
||||
In quantum Monte Carlo calculations, the wave function is evaluated
|
||||
at points of the 3N-dimensional space. Some algorithms require multiple
|
||||
@ -1646,7 +1805,7 @@ By convention, the electron coordinates contain first all the electrons
|
||||
of $↑$-spin and then all the $↓$-spin.
|
||||
</p>
|
||||
|
||||
<table id="org08f7909" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
<table id="org478e67d" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
@ -1701,7 +1860,7 @@ of $↑$-spin and then all the $↓$-spin.
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX-CoE</p>
|
||||
<p class="date">Created: 2022-04-14 Thu 14:11</p>
|
||||
<p class="date">Created: 2022-04-23 Sat 17:25</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