1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-11-03 20:54:09 +01:00

Deploying to gh-pages from @ TREX-CoE/qmckl@d29f3a039b 🚀

This commit is contained in:
scemama 2021-05-26 09:42:24 +00:00
parent 1fbb4f83f8
commit 96363b0b1e
12 changed files with 1463 additions and 383 deletions

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>QMCkl source code documentation</title>
@ -352,7 +352,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: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Introduction</title>
@ -333,30 +333,30 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgd0e35a1">1. Using QMCkl</a></li>
<li><a href="#orge719266">2. Developing in QMCkl</a>
<li><a href="#org3747206">1. Using QMCkl</a></li>
<li><a href="#orga438521">2. Developing in QMCkl</a>
<ul>
<li><a href="#org23bdf82">2.1. Literate programming</a></li>
<li><a href="#org912c464">2.2. Source code editing</a></li>
<li><a href="#org2de16e0">2.3. Choice of the programming language</a></li>
<li><a href="#org4b0e3a0">2.4. Coding rules</a></li>
<li><a href="#orge7f55b2">2.5. Design of the library</a></li>
<li><a href="#org8bc012a">2.6. Naming conventions</a></li>
<li><a href="#orgf289101">2.7. Application programming interface</a></li>
<li><a href="#orgc3f5973">2.8. Global state</a></li>
<li><a href="#org533b023">2.9. Headers</a></li>
<li><a href="#org621edd0">2.10. Low-level functions</a></li>
<li><a href="#org11f1486">2.11. High-level functions</a></li>
<li><a href="#orga9f2334">2.12. Numerical precision</a></li>
<li><a href="#org2b64ef8">2.13. Algorithms</a></li>
<li><a href="#org933b0e4">2.1. Literate programming</a></li>
<li><a href="#org81282da">2.2. Source code editing</a></li>
<li><a href="#org7039191">2.3. Choice of the programming language</a></li>
<li><a href="#orgb821999">2.4. Coding rules</a></li>
<li><a href="#orgddfef2c">2.5. Design of the library</a></li>
<li><a href="#org1abc11c">2.6. Naming conventions</a></li>
<li><a href="#orgc3fec82">2.7. Application programming interface</a></li>
<li><a href="#org51b7aeb">2.8. Global state</a></li>
<li><a href="#org393b3d0">2.9. Headers</a></li>
<li><a href="#orge0b080f">2.10. Low-level functions</a></li>
<li><a href="#org0e15a06">2.11. High-level functions</a></li>
<li><a href="#orge6a5dd7">2.12. Numerical precision</a></li>
<li><a href="#org0926b15">2.13. Algorithms</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-orgd0e35a1" class="outline-2">
<h2 id="orgd0e35a1"><span class="section-number-2">1</span> Using QMCkl</h2>
<div id="outline-container-org3747206" class="outline-2">
<h2 id="org3747206"><span class="section-number-2">1</span> Using QMCkl</h2>
<div class="outline-text-2" id="text-1">
<p>
The <code>qmckl.h</code> header file installed in the <code>${prefix}/include</code> directory
@ -385,12 +385,12 @@ Both files are located in the <code>include/</code> directory.
</div>
</div>
<div id="outline-container-orge719266" class="outline-2">
<h2 id="orge719266"><span class="section-number-2">2</span> Developing in QMCkl</h2>
<div id="outline-container-orga438521" class="outline-2">
<h2 id="orga438521"><span class="section-number-2">2</span> Developing in QMCkl</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-org23bdf82" class="outline-3">
<h3 id="org23bdf82"><span class="section-number-3">2.1</span> Literate programming</h3>
<div id="outline-container-org933b0e4" class="outline-3">
<h3 id="org933b0e4"><span class="section-number-3">2.1</span> Literate programming</h3>
<div class="outline-text-3" id="text-2-1">
<p>
In a traditional source code, most of the lines of source files of a program
@ -435,8 +435,8 @@ interactively, in the same spirit as Jupyter notebooks.
</div>
</div>
<div id="outline-container-org912c464" class="outline-3">
<h3 id="org912c464"><span class="section-number-3">2.2</span> Source code editing</h3>
<div id="outline-container-org81282da" class="outline-3">
<h3 id="org81282da"><span class="section-number-3">2.2</span> Source code editing</h3>
<div class="outline-text-3" id="text-2-2">
<p>
For a tutorial on literate programming with org-mode, follow <a href="http://www.howardism.org/Technical/Emacs/literate-programming-tutorial.html">this link</a>.
@ -467,8 +467,8 @@ org-mode.
</div>
</div>
<div id="outline-container-org2de16e0" class="outline-3">
<h3 id="org2de16e0"><span class="section-number-3">2.3</span> Choice of the programming language</h3>
<div id="outline-container-org7039191" class="outline-3">
<h3 id="org7039191"><span class="section-number-3">2.3</span> Choice of the programming language</h3>
<div class="outline-text-3" id="text-2-3">
<p>
Most of the codes of the <a href="https://trex-coe.eu">TREX CoE</a> are written in Fortran with some scripts in
@ -516,8 +516,8 @@ For more guidelines on using Fortran to generate a C interface, see
</div>
</div>
<div id="outline-container-org4b0e3a0" class="outline-3">
<h3 id="org4b0e3a0"><span class="section-number-3">2.4</span> Coding rules</h3>
<div id="outline-container-orgb821999" class="outline-3">
<h3 id="orgb821999"><span class="section-number-3">2.4</span> Coding rules</h3>
<div class="outline-text-3" id="text-2-4">
<p>
The authors should follow the recommendations of the C99
@ -535,8 +535,8 @@ Compliance can be checked with <code>cppcheck</code> as:
</div>
</div>
<div id="outline-container-orge7f55b2" class="outline-3">
<h3 id="orge7f55b2"><span class="section-number-3">2.5</span> Design of the library</h3>
<div id="outline-container-orgddfef2c" class="outline-3">
<h3 id="orgddfef2c"><span class="section-number-3">2.5</span> Design of the library</h3>
<div class="outline-text-3" id="text-2-5">
<p>
The proposed API should allow the library to: deal with memory transfers
@ -547,8 +547,8 @@ functions (see below).
</div>
</div>
<div id="outline-container-org8bc012a" class="outline-3">
<h3 id="org8bc012a"><span class="section-number-3">2.6</span> Naming conventions</h3>
<div id="outline-container-org1abc11c" class="outline-3">
<h3 id="org1abc11c"><span class="section-number-3">2.6</span> Naming conventions</h3>
<div class="outline-text-3" id="text-2-6">
<p>
To avoid namespace collisions, we use <code>qmckl_</code> as a prefix for all exported
@ -573,8 +573,8 @@ form is allowed.
</div>
</div>
<div id="outline-container-orgf289101" class="outline-3">
<h3 id="orgf289101"><span class="section-number-3">2.7</span> Application programming interface</h3>
<div id="outline-container-orgc3fec82" class="outline-3">
<h3 id="orgc3fec82"><span class="section-number-3">2.7</span> Application programming interface</h3>
<div class="outline-text-3" id="text-2-7">
<p>
In the C language, the number of bits used by the integer types can change
@ -606,15 +606,15 @@ bindings in other languages in other repositories.
</div>
</div>
<div id="outline-container-orgc3f5973" class="outline-3">
<h3 id="orgc3f5973"><span class="section-number-3">2.8</span> Global state</h3>
<div id="outline-container-org51b7aeb" class="outline-3">
<h3 id="org51b7aeb"><span class="section-number-3">2.8</span> Global state</h3>
<div class="outline-text-3" id="text-2-8">
<p>
Global variables should be avoided in the library, because it is
possible that one single program needs to use multiple instances
of the library. To solve this problem we propose to use a pointer
to a <a href="./qmckl_context.html"><code>context</code></a> variable, built by the library with the
<code>qmckl_context_create</code> function. The <a id="org63701cd">=context=</a> contains the global
<code>qmckl_context_create</code> function. The <a id="org2d620a4">=context=</a> contains the global
state of the library, and is used as the first argument of many
QMCkl functions.
</p>
@ -628,8 +628,8 @@ the state is done by setters and getters, prefixed by
</div>
</div>
<div id="outline-container-org533b023" class="outline-3">
<h3 id="org533b023"><span class="section-number-3">2.9</span> Headers</h3>
<div id="outline-container-org393b3d0" class="outline-3">
<h3 id="org393b3d0"><span class="section-number-3">2.9</span> Headers</h3>
<div class="outline-text-3" id="text-2-9">
<p>
A single <code>qmckl.h</code> header to be distributed by the library
@ -652,11 +652,11 @@ types contained inside the context. For example, a
value in the <code>qmckl_numprec_struct</code> contained in the context.
Because of these intricate dependencies, a private header is
created, containing the <code>qmckl_numprec_struct</code>. This header is
included in the private header which defines the type of the
context. Headers for private types are suffixed by <code>_private_type.h</code>
and headers for private functions, <code>_private_func.h</code>.
Fortran interfaces should also be written in the <code>*_f_func.f90</code> file,
and the types definitions should be written in the <code>*_f_type.f90</code> file.
included in the private header file which defines the type of the
context. Header files for private types are suffixed by <code>_private_type.h</code>
and header files for private functions are suffixed by <code>_private_func.h</code>.
Fortran interfaces should also be written in the <code>*fh_func.f90</code> file,
and the types definitions should be written in the <code>*fh_type.f90</code> file.
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
@ -717,8 +717,8 @@ and the types definitions should be written in the <code>*_f_type.f90</code> fil
</div>
</div>
<div id="outline-container-org621edd0" class="outline-3">
<h3 id="org621edd0"><span class="section-number-3">2.10</span> Low-level functions</h3>
<div id="outline-container-orge0b080f" class="outline-3">
<h3 id="orge0b080f"><span class="section-number-3">2.10</span> Low-level functions</h3>
<div class="outline-text-3" id="text-2-10">
<p>
Low-level functions are very simple functions which are leaves of
@ -727,14 +727,14 @@ the function call tree (they don't call any other QMCkl function).
<p>
These functions are <i>pure</i>, and unaware of the QMCkl
<a href="#org63701cd"><code>context</code></a>. They are not allowed to allocate/deallocate memory, and
<a href="#org2d620a4"><code>context</code></a>. They are not allowed to allocate/deallocate memory, and
if they need temporary memory it should be provided in input.
</p>
</div>
</div>
<div id="outline-container-org11f1486" class="outline-3">
<h3 id="org11f1486"><span class="section-number-3">2.11</span> High-level functions</h3>
<div id="outline-container-org0e15a06" class="outline-3">
<h3 id="org0e15a06"><span class="section-number-3">2.11</span> High-level functions</h3>
<div class="outline-text-3" id="text-2-11">
<p>
High-level functions are at the top of the function call tree.
@ -747,27 +747,27 @@ temporary storage, to simplify the use of accelerators.
<p>
The high-level functions should be pure, unless the introduction
of non-purity is justified. All the side effects should be made in
the <a href="#org63701cd"><code>context</code></a> variable.
the <a href="#org2d620a4"><code>context</code></a> variable.
</p>
</div>
</div>
<div id="outline-container-orga9f2334" class="outline-3">
<h3 id="orga9f2334"><span class="section-number-3">2.12</span> Numerical precision</h3>
<div id="outline-container-orge6a5dd7" class="outline-3">
<h3 id="orge6a5dd7"><span class="section-number-3">2.12</span> Numerical precision</h3>
<div class="outline-text-3" id="text-2-12">
<p>
The number of bits of precision required for a function should be
given as an input of low-level computational functions. This input
will be used to define the values of the different thresholds that
might be used to avoid computing unnecessary noise. High-level
functions will use the precision specified in the <a href="#org63701cd"><code>context</code></a>
functions will use the precision specified in the <a href="#org2d620a4"><code>context</code></a>
variable.
</p>
</div>
</div>
<div id="outline-container-org2b64ef8" class="outline-3">
<h3 id="org2b64ef8"><span class="section-number-3">2.13</span> Algorithms</h3>
<div id="outline-container-org0926b15" class="outline-3">
<h3 id="org0926b15"><span class="section-number-3">2.13</span> Algorithms</h3>
<div class="outline-text-3" id="text-2-13">
<p>
Reducing the scaling of an algorithm usually implies also reducing
@ -783,7 +783,7 @@ implemented adapted to different problem sizes.
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Atomic Orbitals</title>
@ -333,52 +333,52 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org3fa2df7">1. Context</a>
<li><a href="#orgbb47f92">1. Context</a>
<ul>
<li><a href="#org110e4f1">1.1. Data structure</a></li>
<li><a href="#org36c53e8">1.2. Access functions</a></li>
<li><a href="#org080e90f">1.3. Initialization functions</a></li>
<li><a href="#org0e5a2bb">1.4. <span class="todo TODO">TODO</span> Fortran interfaces</a></li>
<li><a href="#org211e55c">1.1. Data structure</a></li>
<li><a href="#orga2cc257">1.2. Access functions</a></li>
<li><a href="#orgf98376a">1.3. Initialization functions</a></li>
<li><a href="#org3e0a2c0">1.4. <span class="todo TODO">TODO</span> Fortran interfaces</a></li>
</ul>
</li>
<li><a href="#org2203dac">2. Polynomial part</a>
<li><a href="#orgbe47f74">2. Polynomial part</a>
<ul>
<li><a href="#org989c326">2.1. Powers of \(x-X_i\)</a>
<li><a href="#org7eda098">2.1. Powers of \(x-X_i\)</a>
<ul>
<li><a href="#org9c7e374">2.1.1. Requirements</a></li>
<li><a href="#org5f69c96">2.1.2. C Header</a></li>
<li><a href="#org67c829f">2.1.3. Source</a></li>
<li><a href="#orgaff90e2">2.1.4. C interface</a></li>
<li><a href="#org500b06b">2.1.5. Fortran interface</a></li>
<li><a href="#org5a27198">2.1.6. Test</a></li>
<li><a href="#org6e89a3b">2.1.1. Requirements</a></li>
<li><a href="#org2d12318">2.1.2. C Header</a></li>
<li><a href="#org62421ab">2.1.3. Source</a></li>
<li><a href="#org67b9625">2.1.4. C interface</a></li>
<li><a href="#org713c30b">2.1.5. Fortran interface</a></li>
<li><a href="#org3e237fb">2.1.6. Test</a></li>
</ul>
</li>
<li><a href="#orgefd4391">2.2. Value, Gradient and Laplacian of a polynomial</a>
<li><a href="#org1b4e3d8">2.2. Value, Gradient and Laplacian of a polynomial</a>
<ul>
<li><a href="#org41430ea">2.2.1. Requirements</a></li>
<li><a href="#org39e5c14">2.2.2. C Header</a></li>
<li><a href="#org06d2a1c">2.2.3. Source</a></li>
<li><a href="#orgf647981">2.2.4. C interface</a></li>
<li><a href="#orgd5f0280">2.2.5. Fortran interface</a></li>
<li><a href="#orga2e17ab">2.2.6. Test</a></li>
<li><a href="#org6e8c05d">2.2.1. Requirements</a></li>
<li><a href="#org0eee2f9">2.2.2. C Header</a></li>
<li><a href="#org29d637b">2.2.3. Source</a></li>
<li><a href="#org4edf0db">2.2.4. C interface</a></li>
<li><a href="#orgaa29edb">2.2.5. Fortran interface</a></li>
<li><a href="#org1bc5b9a">2.2.6. Test</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#orgb9a759c">3. Radial part</a>
<li><a href="#org28dbc19">3. Radial part</a>
<ul>
<li><a href="#org45099e1">3.1. Gaussian basis functions</a></li>
<li><a href="#orgd8a7f86">3.2. <span class="todo TODO">TODO</span> Slater basis functions</a></li>
<li><a href="#org18ac37b">3.3. <span class="todo TODO">TODO</span> Radial functions on a grid</a></li>
<li><a href="#org42d53f6">3.1. Gaussian basis functions</a></li>
<li><a href="#org2999058">3.2. <span class="todo TODO">TODO</span> Slater basis functions</a></li>
<li><a href="#org9942b67">3.3. <span class="todo TODO">TODO</span> Radial functions on a grid</a></li>
</ul>
</li>
<li><a href="#org6f0b6d5">4. Combining radial and polynomial parts</a></li>
<li><a href="#org886eb84">4. Combining radial and polynomial parts</a></li>
</ul>
</div>
</div>
<div id="outline-container-org3fa2df7" class="outline-2">
<h2 id="org3fa2df7"><span class="section-number-2">1</span> Context</h2>
<div id="outline-container-orgbb47f92" class="outline-2">
<h2 id="orgbb47f92"><span class="section-number-2">1</span> Context</h2>
<div class="outline-text-2" id="text-1">
<p>
The following arrays are stored in the context:
@ -503,8 +503,8 @@ coefficient = [ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421,
</pre>
</div>
<div id="outline-container-org110e4f1" class="outline-3">
<h3 id="org110e4f1"><span class="section-number-3">1.1</span> Data structure</h3>
<div id="outline-container-org211e55c" class="outline-3">
<h3 id="org211e55c"><span class="section-number-3">1.1</span> Data structure</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">qmckl_ao_basis_struct</span> {
@ -533,8 +533,8 @@ struct is then initialized and <code>provided == true</code>.
</div>
</div>
<div id="outline-container-org36c53e8" class="outline-3">
<h3 id="org36c53e8"><span class="section-number-3">1.2</span> Access functions</h3>
<div id="outline-container-orga2cc257" class="outline-3">
<h3 id="orga2cc257"><span class="section-number-3">1.2</span> Access functions</h3>
<div class="outline-text-3" id="text-1-2">
<p>
When all the data for the AOs have been provided, the following
@ -548,8 +548,8 @@ function returns <code>true</code>.
</div>
</div>
<div id="outline-container-org080e90f" class="outline-3">
<h3 id="org080e90f"><span class="section-number-3">1.3</span> Initialization functions</h3>
<div id="outline-container-orgf98376a" class="outline-3">
<h3 id="orgf98376a"><span class="section-number-3">1.3</span> Initialization functions</h3>
<div class="outline-text-3" id="text-1-3">
<p>
To set the basis set, all the following functions need to be
@ -572,17 +572,17 @@ called. When
</div>
</div>
<div id="outline-container-org0e5a2bb" class="outline-3">
<h3 id="org0e5a2bb"><span class="section-number-3">1.4</span> <span class="todo TODO">TODO</span> Fortran interfaces</h3>
<div id="outline-container-org3e0a2c0" class="outline-3">
<h3 id="org3e0a2c0"><span class="section-number-3">1.4</span> <span class="todo TODO">TODO</span> Fortran interfaces</h3>
</div>
</div>
<div id="outline-container-org2203dac" class="outline-2">
<h2 id="org2203dac"><span class="section-number-2">2</span> Polynomial part</h2>
<div id="outline-container-orgbe47f74" class="outline-2">
<h2 id="orgbe47f74"><span class="section-number-2">2</span> Polynomial part</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-org989c326" class="outline-3">
<h3 id="org989c326"><span class="section-number-3">2.1</span> Powers of \(x-X_i\)</h3>
<div id="outline-container-org7eda098" class="outline-3">
<h3 id="org7eda098"><span class="section-number-3">2.1</span> Powers of \(x-X_i\)</h3>
<div class="outline-text-3" id="text-2-1">
<p>
The <code>qmckl_ao_power</code> function computes all the powers of the <code>n</code>
@ -594,7 +594,7 @@ the \(n\) points:
\[ P_{ik} = X_i^k \]
</p>
<table id="orgb19db8c" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org71f76d1" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -652,8 +652,8 @@ the \(n\) points:
</table>
</div>
<div id="outline-container-org9c7e374" class="outline-4">
<h4 id="org9c7e374"><span class="section-number-4">2.1.1</span> Requirements</h4>
<div id="outline-container-org6e89a3b" class="outline-4">
<h4 id="org6e89a3b"><span class="section-number-4">2.1.1</span> Requirements</h4>
<div class="outline-text-4" id="text-2-1-1">
<ul class="org-ul">
<li><code>context</code> is not <code>QMCKL_NULL_CONTEXT</code></li>
@ -666,8 +666,8 @@ the \(n\) points:
</div>
</div>
<div id="outline-container-org5f69c96" class="outline-4">
<h4 id="org5f69c96"><span class="section-number-4">2.1.2</span> C Header</h4>
<div id="outline-container-org2d12318" class="outline-4">
<h4 id="org2d12318"><span class="section-number-4">2.1.2</span> C Header</h4>
<div class="outline-text-4" id="text-2-1-2">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_ao_power</span> (
@ -682,8 +682,8 @@ the \(n\) points:
</div>
</div>
<div id="outline-container-org67c829f" class="outline-4">
<h4 id="org67c829f"><span class="section-number-4">2.1.3</span> Source</h4>
<div id="outline-container-org62421ab" class="outline-4">
<h4 id="org62421ab"><span class="section-number-4">2.1.3</span> Source</h4>
<div class="outline-text-4" id="text-2-1-3">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer </span><span style="color: #a020f0;">function</span><span style="color: #a0522d;"> </span><span style="color: #0000ff;">qmckl_ao_power_f</span><span style="color: #000000; background-color: #ffffff;">(context, n, X, LMAX, P, ldp) result(info)</span>
@ -734,15 +734,15 @@ the \(n\) points:
</div>
</div>
<div id="outline-container-orgaff90e2" class="outline-4">
<h4 id="orgaff90e2"><span class="section-number-4">2.1.4</span> C interface</h4>
<div id="outline-container-org67b9625" class="outline-4">
<h4 id="org67b9625"><span class="section-number-4">2.1.4</span> C interface</h4>
</div>
<div id="outline-container-org500b06b" class="outline-4">
<h4 id="org500b06b"><span class="section-number-4">2.1.5</span> Fortran interface</h4>
<div id="outline-container-org713c30b" class="outline-4">
<h4 id="org713c30b"><span class="section-number-4">2.1.5</span> Fortran interface</h4>
</div>
<div id="outline-container-org5a27198" class="outline-4">
<h4 id="org5a27198"><span class="section-number-4">2.1.6</span> Test</h4>
<div id="outline-container-org3e237fb" class="outline-4">
<h4 id="org3e237fb"><span class="section-number-4">2.1.6</span> Test</h4>
<div class="outline-text-4" id="text-2-1-6">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>) <span style="color: #a020f0;">function</span> <span style="color: #0000ff;">test_qmckl_ao_power</span>(context) <span style="color: #a020f0;">bind</span>(C)
@ -793,8 +793,8 @@ the \(n\) points:
</div>
</div>
<div id="outline-container-orgefd4391" class="outline-3">
<h3 id="orgefd4391"><span class="section-number-3">2.2</span> Value, Gradient and Laplacian of a polynomial</h3>
<div id="outline-container-org1b4e3d8" class="outline-3">
<h3 id="org1b4e3d8"><span class="section-number-3">2.2</span> Value, Gradient and Laplacian of a polynomial</h3>
<div class="outline-text-3" id="text-2-2">
<p>
A polynomial is centered on a nucleus \(\mathbf{R}_i\)
@ -839,7 +839,7 @@ Laplacians at a given point in space, of all polynomials with an
angular momentum up to <code>lmax</code>.
</p>
<table id="org41b2385" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org57637ae" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -918,8 +918,8 @@ angular momentum up to <code>lmax</code>.
</table>
</div>
<div id="outline-container-org41430ea" class="outline-4">
<h4 id="org41430ea"><span class="section-number-4">2.2.1</span> Requirements</h4>
<div id="outline-container-org6e8c05d" class="outline-4">
<h4 id="org6e8c05d"><span class="section-number-4">2.2.1</span> Requirements</h4>
<div class="outline-text-4" id="text-2-2-1">
<ul class="org-ul">
<li><code>context</code> is not <code>QMCKL_NULL_CONTEXT</code></li>
@ -944,8 +944,8 @@ For example, with a=0, b=2 and c=1 the string is "yyz"</li>
</div>
</div>
<div id="outline-container-org39e5c14" class="outline-4">
<h4 id="org39e5c14"><span class="section-number-4">2.2.2</span> C Header</h4>
<div id="outline-container-org0eee2f9" class="outline-4">
<h4 id="org0eee2f9"><span class="section-number-4">2.2.2</span> C Header</h4>
<div class="outline-text-4" id="text-2-2-2">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_ao_polynomial_vgl</span> (
@ -963,8 +963,8 @@ For example, with a=0, b=2 and c=1 the string is "yyz"</li>
</div>
</div>
<div id="outline-container-org06d2a1c" class="outline-4">
<h4 id="org06d2a1c"><span class="section-number-4">2.2.3</span> Source</h4>
<div id="outline-container-org29d637b" class="outline-4">
<h4 id="org29d637b"><span class="section-number-4">2.2.3</span> Source</h4>
<div class="outline-text-4" id="text-2-2-3">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer </span><span style="color: #a020f0;">function</span><span style="color: #a0522d;"> </span><span style="color: #0000ff;">qmckl_ao_polynomial_vgl_f</span><span style="color: #000000; background-color: #ffffff;">(context, X, R, lmax, n, L, ldl, VGL, ldv) result(info)</span>
@ -1099,16 +1099,16 @@ For example, with a=0, b=2 and c=1 the string is "yyz"</li>
</div>
</div>
<div id="outline-container-orgf647981" class="outline-4">
<h4 id="orgf647981"><span class="section-number-4">2.2.4</span> C interface</h4>
<div id="outline-container-org4edf0db" class="outline-4">
<h4 id="org4edf0db"><span class="section-number-4">2.2.4</span> C interface</h4>
</div>
<div id="outline-container-orgd5f0280" class="outline-4">
<h4 id="orgd5f0280"><span class="section-number-4">2.2.5</span> Fortran interface</h4>
<div id="outline-container-orgaa29edb" class="outline-4">
<h4 id="orgaa29edb"><span class="section-number-4">2.2.5</span> Fortran interface</h4>
</div>
<div id="outline-container-orga2e17ab" class="outline-4">
<h4 id="orga2e17ab"><span class="section-number-4">2.2.6</span> Test</h4>
<div id="outline-container-org1bc5b9a" class="outline-4">
<h4 id="org1bc5b9a"><span class="section-number-4">2.2.6</span> Test</h4>
<div class="outline-text-4" id="text-2-2-6">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>) <span style="color: #a020f0;">function</span> <span style="color: #0000ff;">test_qmckl_ao_polynomial_vgl</span>(context) <span style="color: #a020f0;">bind</span>(C)
@ -1213,12 +1213,12 @@ assert(0 == test_qmckl_ao_polynomial_vgl(context));
</div>
</div>
<div id="outline-container-orgb9a759c" class="outline-2">
<h2 id="orgb9a759c"><span class="section-number-2">3</span> Radial part</h2>
<div id="outline-container-org28dbc19" class="outline-2">
<h2 id="org28dbc19"><span class="section-number-2">3</span> Radial part</h2>
<div class="outline-text-2" id="text-3">
</div>
<div id="outline-container-org45099e1" class="outline-3">
<h3 id="org45099e1"><span class="section-number-3">3.1</span> Gaussian basis functions</h3>
<div id="outline-container-org42d53f6" class="outline-3">
<h3 id="org42d53f6"><span class="section-number-3">3.1</span> Gaussian basis functions</h3>
<div class="outline-text-3" id="text-3-1">
<p>
<code>qmckl_ao_gaussian_vgl</code> computes the values, gradients and
@ -1450,21 +1450,21 @@ Requirements
</div>
</div>
<div id="outline-container-orgd8a7f86" class="outline-3">
<h3 id="orgd8a7f86"><span class="section-number-3">3.2</span> <span class="todo TODO">TODO</span> Slater basis functions</h3>
<div id="outline-container-org2999058" class="outline-3">
<h3 id="org2999058"><span class="section-number-3">3.2</span> <span class="todo TODO">TODO</span> Slater basis functions</h3>
</div>
<div id="outline-container-org18ac37b" class="outline-3">
<h3 id="org18ac37b"><span class="section-number-3">3.3</span> <span class="todo TODO">TODO</span> Radial functions on a grid</h3>
<div id="outline-container-org9942b67" class="outline-3">
<h3 id="org9942b67"><span class="section-number-3">3.3</span> <span class="todo TODO">TODO</span> Radial functions on a grid</h3>
</div>
</div>
<div id="outline-container-org6f0b6d5" class="outline-2">
<h2 id="org6f0b6d5"><span class="section-number-2">4</span> Combining radial and polynomial parts</h2>
<div id="outline-container-org886eb84" class="outline-2">
<h2 id="org886eb84"><span class="section-number-2">4</span> Combining radial and polynomial parts</h2>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Context</title>
@ -311,21 +311,21 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org1f3bcfe">1. Context handling</a>
<li><a href="#orga5c78aa">1. Context handling</a>
<ul>
<li><a href="#orgaf9e304">1.1. Data structure</a></li>
<li><a href="#orgd5a4678">1.2. Creation</a></li>
<li><a href="#orgb7e2aac">1.3. Locking</a></li>
<li><a href="#orgcab2299">1.4. <span class="todo TODO">TODO</span> Copy</a></li>
<li><a href="#org7c34e69">1.5. Destroy</a></li>
<li><a href="#orge2b40ed">1.1. Data structure</a></li>
<li><a href="#orgb46e438">1.2. Creation</a></li>
<li><a href="#org6fd65ca">1.3. Locking</a></li>
<li><a href="#org88584c7">1.4. <span class="todo TODO">TODO</span> Copy</a></li>
<li><a href="#org2db81d4">1.5. Destroy</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org1f3bcfe" class="outline-2">
<h2 id="org1f3bcfe"><span class="section-number-2">1</span> Context handling</h2>
<div id="outline-container-orga5c78aa" class="outline-2">
<h2 id="orga5c78aa"><span class="section-number-2">1</span> Context handling</h2>
<div class="outline-text-2" id="text-1">
<p>
The context variable is a handle for the state of the library,
@ -338,7 +338,7 @@ A value of <code>QMCKL_NULL_CONTEXT</code> for the context is equivalent to a
</p>
<div class="org-src-container">
<pre class="src src-c" id="org1df2d7d"><span style="color: #a020f0;">typedef</span> <span style="color: #228b22;">int64_t</span> <span style="color: #228b22;">qmckl_context</span> ;
<pre class="src src-c" id="org5199b36"><span style="color: #a020f0;">typedef</span> <span style="color: #228b22;">int64_t</span> <span style="color: #228b22;">qmckl_context</span> ;
<span style="color: #483d8b;">#define</span> <span style="color: #a0522d;">QMCKL_NULL_CONTEXT</span> (qmckl_context) 0
</pre>
</div>
@ -356,8 +356,8 @@ and <code>ctx</code> is a <code>qmckl_context_struct*</code> pointer.
</p>
</div>
<div id="outline-container-orgaf9e304" class="outline-3">
<h3 id="orgaf9e304"><span class="section-number-3">1.1</span> Data structure</h3>
<div id="outline-container-orge2b40ed" class="outline-3">
<h3 id="orge2b40ed"><span class="section-number-3">1.1</span> Data structure</h3>
<div class="outline-text-3" id="text-1-1">
<p>
The context keeps a ``date'' that allows to check which data needs
@ -367,7 +367,7 @@ coordinates are updated.
<p>
When a new element is added to the context, the functions
<a href="#orgd5a4678">qmckl<sub>context</sub><sub>create</sub></a>, <a href="#org7c34e69">qmckl<sub>context</sub><sub>destroy</sub></a> and <a href="#orgcab2299">qmckl<sub>context</sub><sub>copy</sub></a>
<a href="#orgb46e438">qmckl<sub>context</sub><sub>create</sub></a>, <a href="#org2db81d4">qmckl<sub>context</sub><sub>destroy</sub></a> and <a href="#org88584c7">qmckl<sub>context</sub><sub>copy</sub></a>
should be updated inorder to make deep copies.
</p>
@ -416,8 +416,8 @@ if the context is valid, <code>QMCKL_NULL_CONTEXT</code> otherwise.
</div>
</div>
<div id="outline-container-orgd5a4678" class="outline-3">
<h3 id="orgd5a4678"><span class="section-number-3">1.2</span> Creation</h3>
<div id="outline-container-orgb46e438" class="outline-3">
<h3 id="orgb46e438"><span class="section-number-3">1.2</span> Creation</h3>
<div class="outline-text-3" id="text-1-2">
<p>
To create a new context, <code>qmckl_context_create()</code> should be used.
@ -425,6 +425,7 @@ To create a new context, <code>qmckl_context_create()</code> should be used.
<ul class="org-ul">
<li>Upon success, it returns a pointer to a new context with the <code>qmckl_context</code> type</li>
<li>It returns <code>QMCKL_NULL_CONTEXT</code> upon failure to allocate the internal data structure</li>
<li>A new context always has all its members initialized with a NULL value</li>
</ul>
<div class="org-src-container">
@ -468,8 +469,8 @@ To create a new context, <code>qmckl_context_create()</code> should be used.
ctx-&gt;numprec.range = QMCKL_DEFAULT_RANGE;
ctx-&gt;ao_basis.uninitialized = (1 &lt;&lt; 10) - 1;
ctx-&gt;nucleus.uninitialized = (1 &lt;&lt; 3) - 1;
ctx-&gt;electron.uninitialized = (1 &lt;&lt; 2) - 1;
ctx-&gt;nucleus.uninitialized = (1 &lt;&lt; 4) - 1;
ctx-&gt;electron.uninitialized = (1 &lt;&lt; 3) - 1;
/* <span style="color: #b22222;">Allocate qmckl_memory_struct </span>*/
{
@ -492,8 +493,8 @@ To create a new context, <code>qmckl_context_create()</code> should be used.
</div>
</div>
</div>
<div id="outline-container-orgb7e2aac" class="outline-3">
<h3 id="orgb7e2aac"><span class="section-number-3">1.3</span> Locking</h3>
<div id="outline-container-org6fd65ca" class="outline-3">
<h3 id="org6fd65ca"><span class="section-number-3">1.3</span> Locking</h3>
<div class="outline-text-3" id="text-1-3">
<p>
For thread safety, the context may be locked/unlocked. The lock is
@ -538,8 +539,8 @@ number of times the thread has locked it is saved in the
</div>
</div>
<div id="outline-container-orgcab2299" class="outline-3">
<h3 id="orgcab2299"><span class="section-number-3">1.4</span> <span class="todo TODO">TODO</span> Copy</h3>
<div id="outline-container-org88584c7" class="outline-3">
<h3 id="org88584c7"><span class="section-number-3">1.4</span> <span class="todo TODO">TODO</span> Copy</h3>
<div class="outline-text-3" id="text-1-4">
<p>
<code>qmckl_context_copy</code> makes a deep copy of a context. It returns
@ -587,8 +588,8 @@ number of times the thread has locked it is saved in the
</div>
</div>
</div>
<div id="outline-container-org7c34e69" class="outline-3">
<h3 id="org7c34e69"><span class="section-number-3">1.5</span> Destroy</h3>
<div id="outline-container-org2db81d4" class="outline-3">
<h3 id="org2db81d4"><span class="section-number-3">1.5</span> Destroy</h3>
<div class="outline-text-3" id="text-1-5">
<p>
The context is destroyed with <code>qmckl_context_destroy</code>, leaving the ancestors untouched.
@ -642,7 +643,7 @@ It frees the context, and returns the previous context.
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Inter-particle distances</title>
@ -333,26 +333,38 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org75dd2de">1. Squared distance</a>
<li><a href="#orgeffdaa1">1. Squared distance</a>
<ul>
<li><a href="#org94062bc">1.1. <code>qmckl_distance_sq</code></a>
<li><a href="#org9562d52">1.1. <code>qmckl_distance_sq</code></a>
<ul>
<li><a href="#org32641a0">1.1.1. Requirements</a></li>
<li><a href="#orgcc44315">1.1.2. C header</a></li>
<li><a href="#orgec6c751">1.1.3. Source</a></li>
<li><a href="#orgfd6a48a">1.1.4. Performance</a></li>
<li><a href="#orge24cbd0">1.1.1. Requirements</a></li>
<li><a href="#org95dac18">1.1.2. C header</a></li>
<li><a href="#org06a9225">1.1.3. Source</a></li>
<li><a href="#orgad888f6">1.1.4. Performance</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org1136d4f">2. Distance</a>
<li><a href="#org47608a6">2. Distance</a>
<ul>
<li><a href="#orgc5dd9b9">2.1. <code>qmckl_distance</code></a>
<li><a href="#orgf2d67ab">2.1. <code>qmckl_distance</code></a>
<ul>
<li><a href="#orgbddd0e8">2.1.1. Requirements</a></li>
<li><a href="#org4f01c97">2.1.2. C header</a></li>
<li><a href="#orgfca50b2">2.1.3. Source</a></li>
<li><a href="#org4d79110">2.1.4. Performance</a></li>
<li><a href="#org4ca468a">2.1.1. Requirements</a></li>
<li><a href="#org9c3ca4d">2.1.2. C header</a></li>
<li><a href="#orgad4212a">2.1.3. Source</a></li>
<li><a href="#org85d1eb9">2.1.4. Performance</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#orga0491bc">3. Rescaled Distance</a>
<ul>
<li><a href="#org4a7b27b">3.1. <code>qmckl_distance_rescaled</code></a>
<ul>
<li><a href="#org940c0f4">3.1.1. Requirements</a></li>
<li><a href="#org2b5ed35">3.1.2. C header</a></li>
<li><a href="#org881062c">3.1.3. Source</a></li>
<li><a href="#orgd5f887c">3.1.4. Performance</a></li>
</ul>
</li>
</ul>
@ -361,12 +373,12 @@ for the JavaScript code in this tag.
</div>
</div>
<div id="outline-container-org75dd2de" class="outline-2">
<h2 id="org75dd2de"><span class="section-number-2">1</span> Squared distance</h2>
<div id="outline-container-orgeffdaa1" class="outline-2">
<h2 id="orgeffdaa1"><span class="section-number-2">1</span> Squared distance</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org94062bc" class="outline-3">
<h3 id="org94062bc"><span class="section-number-3">1.1</span> <code>qmckl_distance_sq</code></h3>
<div id="outline-container-org9562d52" class="outline-3">
<h3 id="org9562d52"><span class="section-number-3">1.1</span> <code>qmckl_distance_sq</code></h3>
<div class="outline-text-3" id="text-1-1">
<p>
<code>qmckl_distance_sq</code> computes the matrix of the squared distances
@ -379,7 +391,7 @@ between all pairs of points in two sets, one point within each set:
\]
</p>
<table id="orge55dbee" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org5e343db" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -472,8 +484,8 @@ between all pairs of points in two sets, one point within each set:
</table>
</div>
<div id="outline-container-org32641a0" class="outline-4">
<h4 id="org32641a0"><span class="section-number-4">1.1.1</span> Requirements</h4>
<div id="outline-container-orge24cbd0" class="outline-4">
<h4 id="orge24cbd0"><span class="section-number-4">1.1.1</span> Requirements</h4>
<div class="outline-text-4" id="text-1-1-1">
<ul class="org-ul">
<li><code>context</code> is not <code>QMCKL_NULL_CONTEXT</code></li>
@ -491,11 +503,11 @@ between all pairs of points in two sets, one point within each set:
</div>
</div>
<div id="outline-container-orgcc44315" class="outline-4">
<h4 id="orgcc44315"><span class="section-number-4">1.1.2</span> C header</h4>
<div id="outline-container-org95dac18" class="outline-4">
<h4 id="org95dac18"><span class="section-number-4">1.1.2</span> C header</h4>
<div class="outline-text-4" id="text-1-1-2">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_distance</span> (
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_distance_rescaled</span> (
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transa</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transb</span>,
@ -512,8 +524,8 @@ between all pairs of points in two sets, one point within each set:
</div>
</div>
<div id="outline-container-orgec6c751" class="outline-4">
<h4 id="orgec6c751"><span class="section-number-4">1.1.3</span> Source</h4>
<div id="outline-container-org06a9225" class="outline-4">
<h4 id="org06a9225"><span class="section-number-4">1.1.3</span> Source</h4>
<div class="outline-text-4" id="text-1-1-3">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_distance_sq_f(context, transa, transb, m, n, </span><span style="color: #a020f0;">&amp;</span>
@ -648,8 +660,8 @@ between all pairs of points in two sets, one point within each set:
</div>
</div>
<div id="outline-container-orgfd6a48a" class="outline-4">
<h4 id="orgfd6a48a"><span class="section-number-4">1.1.4</span> Performance</h4>
<div id="outline-container-orgad888f6" class="outline-4">
<h4 id="orgad888f6"><span class="section-number-4">1.1.4</span> Performance</h4>
<div class="outline-text-4" id="text-1-1-4">
<p>
This function is more efficient when <code>A</code> and <code>B</code> are
@ -659,12 +671,12 @@ transposed.
</div>
</div>
</div>
<div id="outline-container-org1136d4f" class="outline-2">
<h2 id="org1136d4f"><span class="section-number-2">2</span> Distance</h2>
<div id="outline-container-org47608a6" class="outline-2">
<h2 id="org47608a6"><span class="section-number-2">2</span> Distance</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-orgc5dd9b9" class="outline-3">
<h3 id="orgc5dd9b9"><span class="section-number-3">2.1</span> <code>qmckl_distance</code></h3>
<div id="outline-container-orgf2d67ab" class="outline-3">
<h3 id="orgf2d67ab"><span class="section-number-3">2.1</span> <code>qmckl_distance</code></h3>
<div class="outline-text-3" id="text-2-1">
<p>
<code>qmckl_distance</code> computes the matrix of the distances between all
@ -682,7 +694,7 @@ If the input array is normal (<code>'N'</code>), the xyz coordinates are in
the leading dimension: <code>[n][3]</code> in C and <code>(3,n)</code> in Fortran.
</p>
<table id="orgfe9f754" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org3d8b6f1" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -775,8 +787,8 @@ the leading dimension: <code>[n][3]</code> in C and <code>(3,n)</code> in Fortra
</table>
</div>
<div id="outline-container-orgbddd0e8" class="outline-4">
<h4 id="orgbddd0e8"><span class="section-number-4">2.1.1</span> Requirements</h4>
<div id="outline-container-org4ca468a" class="outline-4">
<h4 id="org4ca468a"><span class="section-number-4">2.1.1</span> Requirements</h4>
<div class="outline-text-4" id="text-2-1-1">
<ul class="org-ul">
<li><code>context</code> is not <code>QMCKL_NULL_CONTEXT</code></li>
@ -794,11 +806,11 @@ the leading dimension: <code>[n][3]</code> in C and <code>(3,n)</code> in Fortra
</div>
</div>
<div id="outline-container-org4f01c97" class="outline-4">
<h4 id="org4f01c97"><span class="section-number-4">2.1.2</span> C header</h4>
<div id="outline-container-org9c3ca4d" class="outline-4">
<h4 id="org9c3ca4d"><span class="section-number-4">2.1.2</span> C header</h4>
<div class="outline-text-4" id="text-2-1-2">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_distance</span> (
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_distance_rescaled</span> (
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transa</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transb</span>,
@ -815,8 +827,8 @@ the leading dimension: <code>[n][3]</code> in C and <code>(3,n)</code> in Fortra
</div>
</div>
<div id="outline-container-orgfca50b2" class="outline-4">
<h4 id="orgfca50b2"><span class="section-number-4">2.1.3</span> Source</h4>
<div id="outline-container-orgad4212a" class="outline-4">
<h4 id="orgad4212a"><span class="section-number-4">2.1.3</span> Source</h4>
<div class="outline-text-4" id="text-2-1-3">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_distance_f(context, transa, transb, m, n, </span><span style="color: #a020f0;">&amp;</span>
@ -876,6 +888,7 @@ the leading dimension: <code>[n][3]</code> in C and <code>(3,n)</code> in Fortra
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">check for LDA</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,1) == 0 <span style="color: #a020f0;">.and.</span> LDA &lt; 3) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_7
<span style="color: #a020f0;">return</span>
@ -896,6 +909,33 @@ the leading dimension: <code>[n][3]</code> in C and <code>(3,n)</code> in Fortra
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">check for LDB</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,1) == 0 <span style="color: #a020f0;">.and.</span> LDB &lt; 3) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_9
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,1) == 1 <span style="color: #a020f0;">.and.</span> LDB &lt; n) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_9
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,2) == 0 <span style="color: #a020f0;">.and.</span> LDB &lt; 3) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_9
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,2) == 2 <span style="color: #a020f0;">.and.</span> LDB &lt; n) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_9
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">check for LDC</span>
<span style="color: #a020f0;">if</span> (LDC &lt; m) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_11
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">select case</span> (transab)
@ -955,8 +995,8 @@ the leading dimension: <code>[n][3]</code> in C and <code>(3,n)</code> in Fortra
</div>
</div>
<div id="outline-container-org4d79110" class="outline-4">
<h4 id="org4d79110"><span class="section-number-4">2.1.4</span> Performance</h4>
<div id="outline-container-org85d1eb9" class="outline-4">
<h4 id="org85d1eb9"><span class="section-number-4">2.1.4</span> Performance</h4>
<div class="outline-text-4" id="text-2-1-4">
<p>
This function is more efficient when <code>A</code> and <code>B</code> are transposed.
@ -965,10 +1005,356 @@ This function is more efficient when <code>A</code> and <code>B</code> are trans
</div>
</div>
</div>
<div id="outline-container-orga0491bc" class="outline-2">
<h2 id="orga0491bc"><span class="section-number-2">3</span> Rescaled Distance</h2>
<div class="outline-text-2" id="text-3">
</div>
<div id="outline-container-org4a7b27b" class="outline-3">
<h3 id="org4a7b27b"><span class="section-number-3">3.1</span> <code>qmckl_distance_rescaled</code></h3>
<div class="outline-text-3" id="text-3-1">
<p>
<code>qmckl_distance_rescaled</code> computes the matrix of the rescaled distances between all
pairs of points in two sets, one point within each set:
</p>
<p>
\[
C_{ij} = \left( 1 - \exp{-\kappa C_{ij}}\right)/\kappa
\]
</p>
<p>
If the input array is normal (<code>'N'</code>), the xyz coordinates are in
the leading dimension: <code>[n][3]</code> in C and <code>(3,n)</code> in Fortran.
</p>
<table id="org1c737f0" 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>
<tbody>
<tr>
<td class="org-left">qmckl<sub>context</sub></td>
<td class="org-left">context</td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left">char</td>
<td class="org-left">transa</td>
<td class="org-left">in</td>
<td class="org-left">Array <code>A</code> is <code>'N'</code>: Normal, <code>'T'</code>: Transposed</td>
</tr>
<tr>
<td class="org-left">char</td>
<td class="org-left">transb</td>
<td class="org-left">in</td>
<td class="org-left">Array <code>B</code> is <code>'N'</code>: Normal, <code>'T'</code>: Transposed</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">m</td>
<td class="org-left">in</td>
<td class="org-left">Number of points in the first set</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">n</td>
<td class="org-left">in</td>
<td class="org-left">Number of points in the second set</td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">A[][lda]</td>
<td class="org-left">in</td>
<td class="org-left">Array containing the \(m \times 3\) matrix \(A\)</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">lda</td>
<td class="org-left">in</td>
<td class="org-left">Leading dimension of array <code>A</code></td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">B[][ldb]</td>
<td class="org-left">in</td>
<td class="org-left">Array containing the \(n \times 3\) matrix \(B\)</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">ldb</td>
<td class="org-left">in</td>
<td class="org-left">Leading dimension of array <code>B</code></td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">C[n][ldc]</td>
<td class="org-left">out</td>
<td class="org-left">Array containing the \(m \times n\) matrix \(C\)</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">ldc</td>
<td class="org-left">in</td>
<td class="org-left">Leading dimension of array <code>C</code></td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">rescale<sub>factor</sub><sub>kappa</sub></td>
<td class="org-left">in</td>
<td class="org-left">Factor for calculating rescaled distances</td>
</tr>
</tbody>
</table>
</div>
<div id="outline-container-org940c0f4" class="outline-4">
<h4 id="org940c0f4"><span class="section-number-4">3.1.1</span> Requirements</h4>
<div class="outline-text-4" id="text-3-1-1">
<ul class="org-ul">
<li><code>context</code> is not <code>QMCKL_NULL_CONTEXT</code></li>
<li><code>m &gt; 0</code></li>
<li><code>n &gt; 0</code></li>
<li><code>lda &gt;= 3</code> if <code>transa == 'N'</code></li>
<li><code>lda &gt;= m</code> if <code>transa == 'T'</code></li>
<li><code>ldb &gt;= 3</code> if <code>transb == 'N'</code></li>
<li><code>ldb &gt;= n</code> if <code>transb == 'T'</code></li>
<li><code>ldc &gt;= m</code></li>
<li><code>A</code> is allocated with at least \(3 \times m \times 8\) bytes</li>
<li><code>B</code> is allocated with at least \(3 \times n \times 8\) bytes</li>
<li><code>C</code> is allocated with at least \(m \times n \times 8\) bytes</li>
</ul>
</div>
</div>
<div id="outline-container-org2b5ed35" class="outline-4">
<h4 id="org2b5ed35"><span class="section-number-4">3.1.2</span> C header</h4>
<div class="outline-text-4" id="text-3-1-2">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_distance_rescaled</span> (
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transa</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transb</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">m</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">n</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">A</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">lda</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">B</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldb</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">C</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldc</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_kappa</span> );
</pre>
</div>
</div>
</div>
<div id="outline-container-org881062c" class="outline-4">
<h4 id="org881062c"><span class="section-number-4">3.1.3</span> Source</h4>
<div class="outline-text-4" id="text-3-1-3">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_distance_rescaled_f(context, transa, transb, m, n, </span><span style="color: #a020f0;">&amp;</span>
A, LDA, B, LDB, C, LDC, rescale_factor_kappa) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">character</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> transa, transb</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> m, n</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> lda</span>
<span style="color: #228b22;">real</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> A(lda,*)</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> ldb</span>
<span style="color: #228b22;">real</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> B(ldb,*)</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> ldc</span>
<span style="color: #228b22;">real</span>*8 , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> C(ldc,*)</span>
<span style="color: #228b22;">real</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_kappa</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i,j</span>
<span style="color: #228b22;">real</span>*8 ::<span style="color: #a0522d;"> x, y, z, dist, rescale_factor_kappa_inv</span>
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> transab</span>
rescale_factor_kappa_inv = 1.0d0/rescale_factor_kappa;
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (m &lt;= 0_8) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_4
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (n &lt;= 0_8) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (transa == <span style="color: #8b2252;">'N'</span> <span style="color: #a020f0;">.or.</span> transa == <span style="color: #8b2252;">'n'</span>) <span style="color: #a020f0;">then</span>
transab = 0
<span style="color: #a020f0;">else if</span> (transa == <span style="color: #8b2252;">'T'</span> <span style="color: #a020f0;">.or.</span> transa == <span style="color: #8b2252;">'t'</span>) <span style="color: #a020f0;">then</span>
transab = 1
<span style="color: #a020f0;">else</span>
transab = -100
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (transb == <span style="color: #8b2252;">'N'</span> <span style="color: #a020f0;">.or.</span> transb == <span style="color: #8b2252;">'n'</span>) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">continue</span>
<span style="color: #a020f0;">else if</span> (transa == <span style="color: #8b2252;">'T'</span> <span style="color: #a020f0;">.or.</span> transa == <span style="color: #8b2252;">'t'</span>) <span style="color: #a020f0;">then</span>
transab = transab + 2
<span style="color: #a020f0;">else</span>
transab = -100
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">check for LDA</span>
<span style="color: #a020f0;">if</span> (transab &lt; 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_1
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,1) == 0 <span style="color: #a020f0;">.and.</span> LDA &lt; 3) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_7
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,1) == 1 <span style="color: #a020f0;">.and.</span> LDA &lt; m) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_7
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,2) == 0 <span style="color: #a020f0;">.and.</span> LDA &lt; 3) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_7
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,2) == 2 <span style="color: #a020f0;">.and.</span> LDA &lt; m) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_7
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">check for LDB</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,1) == 0 <span style="color: #a020f0;">.and.</span> LDB &lt; 3) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_9
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,1) == 1 <span style="color: #a020f0;">.and.</span> LDB &lt; n) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_9
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,2) == 0 <span style="color: #a020f0;">.and.</span> LDB &lt; 3) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_9
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(transab,2) == 2 <span style="color: #a020f0;">.and.</span> LDB &lt; n) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_9
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">check for LDC</span>
<span style="color: #a020f0;">if</span> (LDC &lt; m) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_11
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">select case</span> (transab)
<span style="color: #a020f0;">case</span>(0)
<span style="color: #a020f0;">do</span> j=1,n
<span style="color: #a020f0;">do</span> i=1,m
x = A(1,i) - B(1,j)
y = A(2,i) - B(2,j)
z = A(3,i) - B(3,j)
dist = dsqrt(x*x + y*y + z*z)
C(i,j) = (1.0d0 - dexp(-rescale_factor_kappa * dist)) * rescale_factor_kappa_inv
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">case</span>(1)
<span style="color: #a020f0;">do</span> j=1,n
<span style="color: #a020f0;">do</span> i=1,m
x = A(i,1) - B(1,j)
y = A(i,2) - B(2,j)
z = A(i,3) - B(3,j)
dist = dsqrt(x*x + y*y + z*z)
C(i,j) = (1.0d0 - dexp(-rescale_factor_kappa * dist)) * rescale_factor_kappa_inv
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">case</span>(2)
<span style="color: #a020f0;">do</span> j=1,n
<span style="color: #a020f0;">do</span> i=1,m
x = A(1,i) - B(j,1)
y = A(2,i) - B(j,2)
z = A(3,i) - B(j,3)
dist = dsqrt(x*x + y*y + z*z)
C(i,j) = (1.0d0 - dexp(-rescale_factor_kappa * dist)) * rescale_factor_kappa_inv
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">case</span>(3)
<span style="color: #a020f0;">do</span> j=1,n
<span style="color: #a020f0;">do</span> i=1,m
x = A(i,1) - B(j,1)
y = A(i,2) - B(j,2)
z = A(i,3) - B(j,3)
dist = dsqrt(x*x + y*y + z*z)
C(i,j) = (1.0d0 - dexp(-rescale_factor_kappa * dist)) * rescale_factor_kappa_inv
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end select</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_distance_rescaled_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd5f887c" class="outline-4">
<h4 id="orgd5f887c"><span class="section-number-4">3.1.4</span> Performance</h4>
<div class="outline-text-4" id="text-3-1-4">
<p>
This function is more efficient when <code>A</code> and <code>B</code> are transposed.
</p>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Electrons</title>
@ -311,34 +311,49 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgde95466">1. Context</a>
<li><a href="#org6888be3">1. Context</a>
<ul>
<li><a href="#org121c1a1">1.1. Data structure</a></li>
<li><a href="#orga724ce3">1.2. Access functions</a>
<li><a href="#org7272fb1">1.1. Data structure</a></li>
<li><a href="#org208f9d6">1.2. Access functions</a>
<ul>
<li><a href="#org52a73f2">1.2.1. Number of electrons</a></li>
<li><a href="#org4d343d0">1.2.2. Number of walkers</a></li>
<li><a href="#orgba335f7">1.2.3. Electron coordinates</a></li>
<li><a href="#org650e8cd">1.2.1. Number of electrons</a></li>
<li><a href="#org3b9e26e">1.2.2. Number of walkers</a></li>
<li><a href="#orgbababd3">1.2.3. Scaling factors Kappa</a></li>
<li><a href="#orgcdf0a0a">1.2.4. Electron coordinates</a></li>
</ul>
</li>
<li><a href="#org431e419">1.3. Initialization functions</a></li>
<li><a href="#orge54c695">1.4. Test</a></li>
<li><a href="#orgd5417a6">1.3. Initialization functions</a></li>
<li><a href="#orgec74f37">1.4. Test</a></li>
</ul>
</li>
<li><a href="#orgd5bf04c">2. Computation</a>
<li><a href="#org88686a7">2. Computation</a>
<ul>
<li><a href="#org41f92cb">2.1. Electron-electron distances</a>
<li><a href="#orgb5fc938">2.1. Electron-electron distances</a>
<ul>
<li><a href="#org8a5acfd">2.1.1. Get</a></li>
<li><a href="#orgd074c86">2.1.2. Compute</a></li>
<li><a href="#org6fb842b">2.1.3. Test</a></li>
<li><a href="#orgf1bda1a">2.1.1. Get</a></li>
<li><a href="#org1207487">2.1.2. Compute</a></li>
<li><a href="#org5efd036">2.1.3. Test</a></li>
</ul>
</li>
<li><a href="#org595d37d">2.2. Electron-nucleus distances</a>
<li><a href="#org41dd312">2.2. Electron-electron rescaled distances</a>
<ul>
<li><a href="#orgd3cdad2">2.2.1. Get</a></li>
<li><a href="#org007027e">2.2.2. Compute</a></li>
<li><a href="#org2e2f500">2.2.3. Test</a></li>
<li><a href="#org902e18f">2.2.1. Get</a></li>
<li><a href="#orgc59724a">2.2.2. Compute</a></li>
<li><a href="#org0a169cb">2.2.3. Test</a></li>
</ul>
</li>
<li><a href="#orged03ec3">2.3. Electron-nucleus distances</a>
<ul>
<li><a href="#org274cedf">2.3.1. Get</a></li>
<li><a href="#org4a1ac9a">2.3.2. Compute</a></li>
<li><a href="#org2939c8b">2.3.3. Test</a></li>
</ul>
</li>
<li><a href="#org73c06ea">2.4. Electron-nucleus rescaled distances</a>
<ul>
<li><a href="#org949cfde">2.4.1. Get</a></li>
<li><a href="#orgbfa2f41">2.4.2. Compute</a></li>
<li><a href="#orgb964b60">2.4.3. Test</a></li>
</ul>
</li>
</ul>
@ -347,8 +362,8 @@ for the JavaScript code in this tag.
</div>
</div>
<div id="outline-container-orgde95466" class="outline-2">
<h2 id="orgde95466"><span class="section-number-2">1</span> Context</h2>
<div id="outline-container-org6888be3" class="outline-2">
<h2 id="org6888be3"><span class="section-number-2">1</span> Context</h2>
<div class="outline-text-2" id="text-1">
<p>
The following data stored in the context:
@ -395,6 +410,18 @@ The following data stored in the context:
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_kappa_ee</code></td>
<td class="org-left">double</td>
<td class="org-left">The distance scaling factor</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_kappa_en</code></td>
<td class="org-left">double</td>
<td class="org-left">The distance scaling factor</td>
</tr>
<tr>
<td class="org-left"><code>provided</code></td>
<td class="org-left">bool</td>
@ -442,12 +469,36 @@ The following data stored in the context:
<td class="org-left">uint64<sub>t</sub></td>
<td class="org-left">Last modification date of the electron-electron distances</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance_rescaled</code></td>
<td class="org-left">double[walk<sub>num</sub>][num][num]</td>
<td class="org-left">Electron-electron distances</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance_rescaled_date</code></td>
<td class="org-left">uint64<sub>t</sub></td>
<td class="org-left">Last modification date of the electron-electron distances</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled</code></td>
<td class="org-left">double[walk<sub>num</sub>][nucl<sub>num</sub>][num]</td>
<td class="org-left">Electron-nucleus distances</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled_date</code></td>
<td class="org-left">uint64<sub>t</sub></td>
<td class="org-left">Last modification date of the electron-electron distances</td>
</tr>
</tbody>
</table>
</div>
<div id="outline-container-org121c1a1" class="outline-3">
<h3 id="org121c1a1"><span class="section-number-3">1.1</span> Data structure</h3>
<div id="outline-container-org7272fb1" class="outline-3">
<h3 id="org7272fb1"><span class="section-number-3">1.1</span> Data structure</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">qmckl_electron_struct</span> {
@ -455,13 +506,19 @@ The following data stored in the context:
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">up_num</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">down_num</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">walk_num</span>;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_kappa_ee</span>;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_kappa_en</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">coord_new_date</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ee_distance_date</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">en_distance_date</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ee_distance_rescaled_date</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">en_distance_rescaled_date</span>;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord_new</span>;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord_old</span>;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance</span>;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">en_distance</span>;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled</span>;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">en_distance_rescaled</span>;
<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">uninitialized</span>;
<span style="color: #228b22;">bool</span> <span style="color: #a0522d;">provided</span>;
} <span style="color: #228b22;">qmckl_electron_struct</span>;
@ -487,8 +544,8 @@ following function returns <code>true</code>.
</div>
</div>
<div id="outline-container-orga724ce3" class="outline-3">
<h3 id="orga724ce3"><span class="section-number-3">1.2</span> Access functions</h3>
<div id="outline-container-org208f9d6" class="outline-3">
<h3 id="org208f9d6"><span class="section-number-3">1.2</span> Access functions</h3>
<div class="outline-text-3" id="text-1-2">
<p>
Access functions return <code>QMCKL_SUCCESS</code> when the data has been
@ -500,12 +557,12 @@ contains the requested data. Otherwise, this variable is untouched.
</p>
</div>
<div id="outline-container-org52a73f2" class="outline-4">
<h4 id="org52a73f2"><span class="section-number-4">1.2.1</span> Number of electrons</h4>
<div id="outline-container-org650e8cd" class="outline-4">
<h4 id="org650e8cd"><span class="section-number-4">1.2.1</span> Number of electrons</h4>
</div>
<div id="outline-container-org4d343d0" class="outline-4">
<h4 id="org4d343d0"><span class="section-number-4">1.2.2</span> Number of walkers</h4>
<div id="outline-container-org3b9e26e" class="outline-4">
<h4 id="org3b9e26e"><span class="section-number-4">1.2.2</span> Number of walkers</h4>
<div class="outline-text-4" id="text-1-2-2">
<p>
A walker is a set of electron coordinates that are arguments of
@ -514,9 +571,13 @@ the wave function. <code>walk_num</code> is the number of walkers.
</div>
</div>
<div id="outline-container-orgba335f7" class="outline-4">
<h4 id="orgba335f7"><span class="section-number-4">1.2.3</span> Electron coordinates</h4>
<div class="outline-text-4" id="text-1-2-3">
<div id="outline-container-orgbababd3" class="outline-4">
<h4 id="orgbababd3"><span class="section-number-4">1.2.3</span> Scaling factors Kappa</h4>
</div>
<div id="outline-container-orgcdf0a0a" class="outline-4">
<h4 id="orgcdf0a0a"><span class="section-number-4">1.2.4</span> Electron coordinates</h4>
<div class="outline-text-4" id="text-1-2-4">
<p>
Returns the current electron coordinates. The pointer is assumed
to point on a memory block of size <code>3 * elec_num * walk_num</code>.
@ -559,8 +620,8 @@ The order of the indices is:
</div>
<div id="outline-container-org431e419" class="outline-3">
<h3 id="org431e419"><span class="section-number-3">1.3</span> Initialization functions</h3>
<div id="outline-container-orgd5417a6" class="outline-3">
<h3 id="orgd5417a6"><span class="section-number-3">1.3</span> Initialization functions</h3>
<div class="outline-text-3" id="text-1-3">
<p>
To set the data relative to the electrons in the context, the
@ -571,6 +632,7 @@ both allocated.
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_electron_num</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">up_num</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">down_num</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_kappa</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_kappa_ee</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_kappa_en</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_electron_walk_num</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">walk_num</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_electron_coord</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transp</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>);
</pre>
@ -581,6 +643,14 @@ To set the number of electrons, we give the number of up-spin and
down-spin electrons to the context and we set the number of walkers.
</p>
<p>
The following function sets the number of walkers.
</p>
<p>
Next we set the rescale parameter for the rescaled distance metric.
</p>
<p>
The following function sets the electron coordinates of all the
walkers. When this is done, the pointers to the old and new sets
@ -596,8 +666,8 @@ in the context.
</div>
</div>
<div id="outline-container-orge54c695" class="outline-3">
<h3 id="orge54c695"><span class="section-number-3">1.4</span> Test</h3>
<div id="outline-container-orgec74f37" class="outline-3">
<h3 id="orgec74f37"><span class="section-number-3">1.4</span> Test</h3>
<div class="outline-text-3" id="text-1-4">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Reference input data </span>*/
@ -605,11 +675,14 @@ in the context.
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span> = chbrclf_elec_num;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_up_num</span> = chbrclf_elec_up_num;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_dn_num</span> = chbrclf_elec_dn_num;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_kappa_ee</span> = 1.0; // <span style="color: #b22222;">TODO Get rescale_factor_kappa_ee from chbrclf</span>
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_kappa_en</span> = 1.0; // <span style="color: #b22222;">TODO Get rescale_factor_kappa_en from chbrclf</span>
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">elec_coord</span> = &amp;(chbrclf_elec_coord[0][0][0]);
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span> = chbrclf_nucl_num;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">charge</span> = chbrclf_charge;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span> = &amp;(chbrclf_nucl_coord[0][0]);
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">nucl_rescale_factor_kappa</span> = 1.0; // <span style="color: #b22222;">TODO Change get rescale_factor_kappa from chbrclf example</span>
/* <span style="color: #b22222;">--- </span>*/
@ -644,6 +717,26 @@ rc = qmckl_get_electron_num (context, &amp;n);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #0000ff;">assert</span>(n == elec_num);
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">k_ee</span>;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">k_en</span>;
rc = qmckl_get_kappa_ee (context, &amp;k_ee);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_get_kappa_en (context, &amp;k_en);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_set_kappa (context, rescale_factor_kappa_ee, rescale_factor_kappa_en);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
assert(!qmckl_electron_provided(context));
rc = qmckl_get_kappa_ee (context, &amp;k_ee);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #0000ff;">assert</span>(k_ee == rescale_factor_kappa_ee);
rc = qmckl_get_kappa_en (context, &amp;k_en);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #0000ff;">assert</span>(k_en == rescale_factor_kappa_en);
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">w</span>;
rc = qmckl_get_electron_walk_num (context, &amp;w);
@ -676,8 +769,8 @@ rc = qmckl_get_electron_coord (context, <span style="color: #8b2252;">'N'</span>
</div>
</div>
<div id="outline-container-orgd5bf04c" class="outline-2">
<h2 id="orgd5bf04c"><span class="section-number-2">2</span> Computation</h2>
<div id="outline-container-org88686a7" class="outline-2">
<h2 id="org88686a7"><span class="section-number-2">2</span> Computation</h2>
<div class="outline-text-2" id="text-2">
<p>
The computed data is stored in the context so that it can be reused
@ -690,12 +783,12 @@ current date is stored.
</p>
</div>
<div id="outline-container-org41f92cb" class="outline-3">
<h3 id="org41f92cb"><span class="section-number-3">2.1</span> Electron-electron distances</h3>
<div id="outline-container-orgb5fc938" class="outline-3">
<h3 id="orgb5fc938"><span class="section-number-3">2.1</span> Electron-electron distances</h3>
<div class="outline-text-3" id="text-2-1">
</div>
<div id="outline-container-org8a5acfd" class="outline-4">
<h4 id="org8a5acfd"><span class="section-number-4">2.1.1</span> Get</h4>
<div id="outline-container-orgf1bda1a" class="outline-4">
<h4 id="orgf1bda1a"><span class="section-number-4">2.1.1</span> Get</h4>
<div class="outline-text-4" id="text-2-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_electron_ee_distance</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">distance</span>);
@ -704,10 +797,10 @@ current date is stored.
</div>
</div>
<div id="outline-container-orgd074c86" class="outline-4">
<h4 id="orgd074c86"><span class="section-number-4">2.1.2</span> Compute</h4>
<div id="outline-container-org1207487" class="outline-4">
<h4 id="org1207487"><span class="section-number-4">2.1.2</span> Compute</h4>
<div class="outline-text-4" id="text-2-1-2">
<table id="orgee01449" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="orgb41f401" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -803,8 +896,8 @@ current date is stored.
</div>
</div>
<div id="outline-container-org6fb842b" class="outline-4">
<h4 id="org6fb842b"><span class="section-number-4">2.1.3</span> Test</h4>
<div id="outline-container-org5efd036" class="outline-4">
<h4 id="org5efd036"><span class="section-number-4">2.1.3</span> Test</h4>
<div class="outline-text-4" id="text-2-1-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
@ -838,24 +931,182 @@ rc = qmckl_get_electron_ee_distance(context, ee_distance);
</div>
</div>
<div id="outline-container-org595d37d" class="outline-3">
<h3 id="org595d37d"><span class="section-number-3">2.2</span> Electron-nucleus distances</h3>
<div id="outline-container-org41dd312" class="outline-3">
<h3 id="org41dd312"><span class="section-number-3">2.2</span> Electron-electron rescaled distances</h3>
<div class="outline-text-3" id="text-2-2">
</div>
<div id="outline-container-orgd3cdad2" class="outline-4">
<h4 id="orgd3cdad2"><span class="section-number-4">2.2.1</span> Get</h4>
<div id="outline-container-org902e18f" class="outline-4">
<h4 id="org902e18f"><span class="section-number-4">2.2.1</span> Get</h4>
<div class="outline-text-4" id="text-2-2-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_electron_ee_distance_rescaled</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">distance_rescaled</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc59724a" class="outline-4">
<h4 id="orgc59724a"><span class="section-number-4">2.2.2</span> Compute</h4>
<div class="outline-text-4" id="text-2-2-2">
<table id="orge310237" 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>
<tbody>
<tr>
<td class="org-left">qmckl<sub>context</sub></td>
<td class="org-left">context</td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">elec<sub>num</sub></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">rescale<sub>factor</sub><sub>kappa</sub><sub>ee</sub></td>
<td class="org-left">in</td>
<td class="org-left">Factor to rescale ee distances</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">walk<sub>num</sub></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">coord[walk<sub>num</sub>][3][elec<sub>num</sub>]</td>
<td class="org-left">in</td>
<td class="org-left">Electron coordinates</td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">ee<sub>distance</sub>[walk<sub>num</sub>][elec<sub>num</sub>][elec<sub>num</sub>]</td>
<td class="org-left">out</td>
<td class="org-left">Electron-electron distances</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_ee_distance_rescaled_f(context, elec_num, rescale_factor_kappa_ee, walk_num, </span><span style="color: #a020f0;">&amp;</span>
coord, ee_distance_rescaled) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_kappa_ee</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord(elec_num,3,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> ee_distance_rescaled(elec_num,elec_num,walk_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> k</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> k=1,walk_num
info = qmckl_distance_rescaled(context, <span style="color: #8b2252;">'T'</span>, <span style="color: #8b2252;">'T'</span>, elec_num, elec_num, <span style="color: #a020f0;">&amp;</span>
coord(1,1,k), elec_num, <span style="color: #a020f0;">&amp;</span>
coord(1,1,k), elec_num, <span style="color: #a020f0;">&amp;</span>
ee_distance_rescaled(1,1,k), elec_num, rescale_factor_kappa_ee)
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">exit</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_ee_distance_rescaled_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org0a169cb" class="outline-4">
<h4 id="org0a169cb"><span class="section-number-4">2.2.3</span> Test</h4>
<div class="outline-text-4" id="text-2-2-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">ee_distance_rescaled</span>[walk_num * elec_num * elec_num];
rc = qmckl_get_electron_ee_distance_rescaled(context, ee_distance);
// <span style="color: #b22222;">TODO: Get exact values</span>
//// <span style="color: #b22222;">(e1,e2,w)</span>
//// <span style="color: #b22222;">(0,0,0) == 0.</span>
//<span style="color: #b22222;">assert(ee_distance[0] == 0.);</span>
//
//// <span style="color: #b22222;">(1,0,0) == (0,1,0)</span>
//<span style="color: #b22222;">assert(ee_distance[1] == ee_distance[elec_num]);</span>
//
//// <span style="color: #b22222;">value of (1,0,0)</span>
//<span style="color: #b22222;">assert(fabs(ee_distance[1]-7.152322512964209) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(0,0,1) == 0.</span>
//<span style="color: #b22222;">assert(ee_distance[elec_num*elec_num] == 0.);</span>
//
//// <span style="color: #b22222;">(1,0,1) == (0,1,1)</span>
//<span style="color: #b22222;">assert(ee_distance[elec_num*elec_num+1] == ee_distance[elec_num*elec_num+elec_num]);</span>
//
//// <span style="color: #b22222;">value of (1,0,1)</span>
//<span style="color: #b22222;">assert(fabs(ee_distance[elec_num*elec_num+1]-6.5517646321055665) &lt; 1.e-12);</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orged03ec3" class="outline-3">
<h3 id="orged03ec3"><span class="section-number-3">2.3</span> Electron-nucleus distances</h3>
<div class="outline-text-3" id="text-2-3">
</div>
<div id="outline-container-org274cedf" class="outline-4">
<h4 id="org274cedf"><span class="section-number-4">2.3.1</span> Get</h4>
<div class="outline-text-4" id="text-2-3-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_electron_en_distance</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">distance</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-org007027e" class="outline-4">
<h4 id="org007027e"><span class="section-number-4">2.2.2</span> Compute</h4>
<div class="outline-text-4" id="text-2-2-2">
<table id="orgac8c698" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<div id="outline-container-org4a1ac9a" class="outline-4">
<h4 id="org4a1ac9a"><span class="section-number-4">2.3.2</span> Compute</h4>
<div class="outline-text-4" id="text-2-3-2">
<table id="org0a97a7d" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -972,9 +1223,9 @@ rc = qmckl_get_electron_ee_distance(context, ee_distance);
</div>
</div>
<div id="outline-container-org2e2f500" class="outline-4">
<h4 id="org2e2f500"><span class="section-number-4">2.2.3</span> Test</h4>
<div class="outline-text-4" id="text-2-2-3">
<div id="outline-container-org2939c8b" class="outline-4">
<h4 id="org2939c8b"><span class="section-number-4">2.3.3</span> Test</h4>
<div class="outline-text-4" id="text-2-3-3">
<div class="org-src-container">
<pre class="src src-c">
assert(!qmckl_nucleus_provided(context));
@ -983,6 +1234,9 @@ assert(!qmckl_nucleus_provided(context));
rc = qmckl_set_nucleus_num (context, nucl_num);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_kappa (context, nucl_rescale_factor_kappa);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_charge (context, charge);
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
@ -1015,6 +1269,207 @@ rc = qmckl_get_electron_en_distance(context, &amp;(en_distance[0][0][0]));
// <span style="color: #b22222;">(2,1,2)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">en_distance</span>[1][0][1] - 3.1804527583077356) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org73c06ea" class="outline-3">
<h3 id="org73c06ea"><span class="section-number-3">2.4</span> Electron-nucleus rescaled distances</h3>
<div class="outline-text-3" id="text-2-4">
</div>
<div id="outline-container-org949cfde" class="outline-4">
<h4 id="org949cfde"><span class="section-number-4">2.4.1</span> Get</h4>
<div class="outline-text-4" id="text-2-4-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_electron_en_distance_rescaled</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">distance_rescaled</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-orgbfa2f41" class="outline-4">
<h4 id="orgbfa2f41"><span class="section-number-4">2.4.2</span> Compute</h4>
<div class="outline-text-4" id="text-2-4-2">
<table id="orge9a7a99" 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>
<tbody>
<tr>
<td class="org-left">qmckl<sub>context</sub></td>
<td class="org-left">context</td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">elec<sub>num</sub></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">nucl<sub>num</sub></td>
<td class="org-left">in</td>
<td class="org-left">Number of nuclei</td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">rescale<sub>factor</sub><sub>kappa</sub><sub>en</sub></td>
<td class="org-left">in</td>
<td class="org-left">The factor for rescaled distances</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">walk<sub>num</sub></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">elec<sub>coord</sub>[walk<sub>num</sub>][3][elec<sub>num</sub>]</td>
<td class="org-left">in</td>
<td class="org-left">Electron coordinates</td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">nucl<sub>coord</sub>[3][elec<sub>num</sub>]</td>
<td class="org-left">in</td>
<td class="org-left">Nuclear coordinates</td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">en<sub>distance</sub><sub>rescaled</sub><sub>date</sub>[walk<sub>num</sub>][nucl<sub>num</sub>][elec<sub>num</sub>]</td>
<td class="org-left">out</td>
<td class="org-left">Electron-nucleus distances</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_num, rescale_factor_kappa_en, walk_num, elec_coord, </span><span style="color: #a020f0;">&amp;</span>
nucl_coord, en_distance_rescaled) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_kappa_en</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_coord(elec_num,3,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_coord(nucl_num,3)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> en_distance_rescaled(elec_num,nucl_num,walk_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> k</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">TODO: comparison with 0</span>
!<span style="color: #b22222;">if (rescale_factor_kappa_en &lt;= 0) then</span>
! <span style="color: #b22222;">info = QMCKL_INVALID_ARG_4</span>
! <span style="color: #b22222;">return</span>
!<span style="color: #b22222;">endif</span>
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> k=1,walk_num
info = qmckl_distance_rescaled(context, <span style="color: #8b2252;">'T'</span>, <span style="color: #8b2252;">'T'</span>, elec_num, nucl_num, <span style="color: #a020f0;">&amp;</span>
elec_coord(1,1,k), elec_num, <span style="color: #a020f0;">&amp;</span>
nucl_coord, nucl_num, <span style="color: #a020f0;">&amp;</span>
en_distance_rescaled(1,1,k), elec_num, rescale_factor_kappa_en)
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">exit</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_en_distance_rescaled_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb964b60" class="outline-4">
<h4 id="orgb964b60"><span class="section-number-4">2.4.3</span> Test</h4>
<div class="outline-text-4" id="text-2-4-3">
<div class="org-src-container">
<pre class="src src-c">
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
rc = qmckl_set_nucleus_num (context, nucl_num);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_kappa (context, nucl_rescale_factor_kappa);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_charge (context, charge);
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
rc = qmckl_set_nucleus_coord (context, <span style="color: #8b2252;">'T'</span>, nucl_coord);
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_nucleus_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">en_distance_rescaled</span>[walk_num][nucl_num][elec_num];
rc = qmckl_get_electron_en_distance_rescaled(context, &amp;(en_distance[0][0][0]));
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
// <span style="color: #b22222;">TODO: check exact values</span>
//// <span style="color: #b22222;">(e,n,w) in Fortran notation</span>
//// <span style="color: #b22222;">(1,1,1)</span>
//<span style="color: #b22222;">assert(fabs(en_distance[0][0][0] - 7.546738741619978) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(1,2,1)</span>
//<span style="color: #b22222;">assert(fabs(en_distance[0][1][0] - 8.77102435246984) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(2,1,1)</span>
//<span style="color: #b22222;">assert(fabs(en_distance[0][0][1] - 3.698922010513608) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(1,1,2)</span>
//<span style="color: #b22222;">assert(fabs(en_distance[1][0][0] - 5.824059436060509) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(1,2,2)</span>
//<span style="color: #b22222;">assert(fabs(en_distance[1][1][0] - 7.080482110317645) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(2,1,2)</span>
//<span style="color: #b22222;">assert(fabs(en_distance[1][0][1] - 3.1804527583077356) &lt; 1.e-12);</span>
</pre>
</div>
</div>
@ -1024,7 +1479,7 @@ rc = qmckl_get_electron_en_distance(context, &amp;(en_distance[0][0][0]));
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Error handling</title>
@ -311,16 +311,17 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgb763c0c">1. Decoding errors</a></li>
<li><a href="#org3f50f2f">2. Data structure in context</a></li>
<li><a href="#org8855e31">3. Updating errors in the context</a></li>
<li><a href="#org10ea31d">4. Failing</a></li>
<li><a href="#org33b2807">1. Decoding errors</a></li>
<li><a href="#org0502409">2. Data structure in context</a></li>
<li><a href="#org0e83bee">3. Updating errors in the context</a></li>
<li><a href="#orgdd22932">4. Get the error</a></li>
<li><a href="#orgc5e25e5">5. Failing</a></li>
</ul>
</div>
</div>
<div id="outline-container-orgb763c0c" class="outline-2">
<h2 id="orgb763c0c"><span class="section-number-2">1</span> Decoding errors</h2>
<div id="outline-container-org33b2807" class="outline-2">
<h2 id="org33b2807"><span class="section-number-2">1</span> Decoding errors</h2>
<div class="outline-text-2" id="text-1">
<p>
To decode the error messages, <code>qmckl_string_of_error</code> converts an
@ -372,6 +373,36 @@ The text strings are extracted from the previous table.
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_10:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 10"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_11:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 11"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_12:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 12"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_13:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 13"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_14:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 14"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_15:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 15"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_16:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 16"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_17:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 17"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_18:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 18"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_19:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 19"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_INVALID_ARG_20:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Invalid argument 20"</span>;
<span style="color: #a020f0;">break</span>;
<span style="color: #a020f0;">case</span> QMCKL_FAILURE:
<span style="color: #a020f0;">return</span> <span style="color: #8b2252;">"Failure"</span>;
<span style="color: #a020f0;">break</span>;
@ -417,8 +448,8 @@ The text strings are extracted from the previous table.
</div>
</div>
<div id="outline-container-org3f50f2f" class="outline-2">
<h2 id="org3f50f2f"><span class="section-number-2">2</span> Data structure in context</h2>
<div id="outline-container-org0502409" class="outline-2">
<h2 id="org0502409"><span class="section-number-2">2</span> Data structure in context</h2>
<div class="outline-text-2" id="text-2">
<p>
The strings are declared with a maximum fixed size to avoid
@ -441,8 +472,8 @@ dynamic memory allocation.
</div>
</div>
<div id="outline-container-org8855e31" class="outline-2">
<h2 id="org8855e31"><span class="section-number-2">3</span> Updating errors in the context</h2>
<div id="outline-container-org0e83bee" class="outline-2">
<h2 id="org0e83bee"><span class="section-number-2">3</span> Updating errors in the context</h2>
<div class="outline-text-2" id="text-3">
<p>
The error is updated in the context using <code>qmckl_set_error</code>.
@ -488,10 +519,52 @@ explaining the error. The exit code can't be <code>QMCKL_SUCCESS</code>.
</div>
</div>
<div id="outline-container-org10ea31d" class="outline-2">
<h2 id="org10ea31d"><span class="section-number-2">4</span> Failing</h2>
<div id="outline-container-orgdd22932" class="outline-2">
<h2 id="orgdd22932"><span class="section-number-2">4</span> Get the error</h2>
<div class="outline-text-2" id="text-4">
<p>
Upon error, the error type and message can be obtained from the
context using <code>qmckl_get_error</code>. The message and function name
is returned in the variables provided. Therefore, passing a
function name and message is mandatory.
</p>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_error</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">qmckl_exit_code</span> *<span style="color: #a0522d;">exit_code</span>,
<span style="color: #228b22;">char</span>* <span style="color: #a0522d;">function_name</span>,
<span style="color: #228b22;">char</span>* <span style="color: #a0522d;">message</span>)
{
/* <span style="color: #b22222;">Passing a function name and a message is mandatory. </span>*/
assert (function_name != <span style="color: #008b8b;">NULL</span>);
assert (message != <span style="color: #008b8b;">NULL</span>);
/* <span style="color: #b22222;">The context is assumed to exist. </span>*/
assert (qmckl_context_check(context) != QMCKL_NULL_CONTEXT);
qmckl_lock(context);
{
<span style="color: #228b22;">qmckl_context_struct</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ctx</span> = (<span style="color: #228b22;">qmckl_context_struct</span>* <span style="color: #a020f0;">const</span>) context;
assert (ctx != <span style="color: #008b8b;">NULL</span>); /* <span style="color: #b22222;">Impossible because the context is valid. </span>*/
strncpy(function_name, ctx-&gt;error.function, QMCKL_MAX_FUN_LEN-1);
strncpy(message , ctx-&gt;error.message , QMCKL_MAX_MSG_LEN-1);
(*exit_code) = ctx-&gt;error.exit_code;
}
qmckl_unlock(context);
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc5e25e5" class="outline-2">
<h2 id="orgc5e25e5"><span class="section-number-2">5</span> Failing</h2>
<div class="outline-text-2" id="text-5">
<p>
To make a function fail, the <code>qmckl_failwith</code> function should be
called, such that information about the failure is stored in
the context. The desired exit code is given as an argument, as
@ -552,7 +625,7 @@ For example, this function can be used as
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Memory management</title>
@ -311,15 +311,15 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org6d7e2f1">1. Memory data structure for the context</a></li>
<li><a href="#org82c5645">2. Passing info to allocation routines</a></li>
<li><a href="#orgcffa980">3. Allocation/deallocation functions</a></li>
<li><a href="#orge116098">1. Memory data structure for the context</a></li>
<li><a href="#orgb81d28f">2. Passing info to allocation routines</a></li>
<li><a href="#org27d269a">3. Allocation/deallocation functions</a></li>
</ul>
</div>
</div>
<div id="outline-container-org6d7e2f1" class="outline-2">
<h2 id="org6d7e2f1"><span class="section-number-2">1</span> Memory data structure for the context</h2>
<div id="outline-container-orge116098" class="outline-2">
<h2 id="orge116098"><span class="section-number-2">1</span> Memory data structure for the context</h2>
<div class="outline-text-2" id="text-1">
<p>
Every time a new block of memory is allocated, the information
@ -361,8 +361,8 @@ array, and the number of allocated blocks.
</div>
</div>
<div id="outline-container-org82c5645" class="outline-2">
<h2 id="org82c5645"><span class="section-number-2">2</span> Passing info to allocation routines</h2>
<div id="outline-container-orgb81d28f" class="outline-2">
<h2 id="orgb81d28f"><span class="section-number-2">2</span> Passing info to allocation routines</h2>
<div class="outline-text-2" id="text-2">
<p>
Passing information to the allocation routine should be done by
@ -371,8 +371,8 @@ passing an instance of a <code>qmckl_memory_info_struct</code>.
</div>
</div>
<div id="outline-container-orgcffa980" class="outline-2">
<h2 id="orgcffa980"><span class="section-number-2">3</span> Allocation/deallocation functions</h2>
<div id="outline-container-org27d269a" class="outline-2">
<h2 id="org27d269a"><span class="section-number-2">3</span> Allocation/deallocation functions</h2>
<div class="outline-text-2" id="text-3">
<p>
Memory allocation inside the library should be done with
@ -535,7 +535,7 @@ allocation and needs to be updated.
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Nucleus</title>
@ -333,28 +333,35 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org2011336">1. Context</a>
<li><a href="#orgec04cab">1. Context</a>
<ul>
<li><a href="#org635e2e1">1.1. Data structure</a></li>
<li><a href="#org39609a2">1.2. Access functions</a></li>
<li><a href="#org70126ff">1.3. Initialization functions</a></li>
<li><a href="#org6361eb6">1.4. Test</a></li>
<li><a href="#orge91bac3">1.1. Data structure</a></li>
<li><a href="#org72048b9">1.2. Access functions</a></li>
<li><a href="#orgc876bc8">1.3. Initialization functions</a></li>
<li><a href="#org6c39031">1.4. Test</a></li>
</ul>
</li>
<li><a href="#org9301dde">2. Computation</a>
<li><a href="#orgd799cf2">2. Computation</a>
<ul>
<li><a href="#orgcef05a7">2.1. Nucleus-nucleus distances</a>
<li><a href="#org5b105fd">2.1. Nucleus-nucleus distances</a>
<ul>
<li><a href="#orgdb9b9d0">2.1.1. Get</a></li>
<li><a href="#org577a20b">2.1.2. Compute</a></li>
<li><a href="#orgbd6d3d7">2.1.3. Test</a></li>
<li><a href="#org2474612">2.1.1. Get</a></li>
<li><a href="#org8f2fcf6">2.1.2. Compute</a></li>
<li><a href="#org714c5b2">2.1.3. Test</a></li>
</ul>
</li>
<li><a href="#org6c88824">2.2. Nuclear repulsion energy</a>
<li><a href="#orgf53538e">2.2. Nucleus-nucleus rescaled distances</a>
<ul>
<li><a href="#org74f42d1">2.2.1. Get</a></li>
<li><a href="#orge576e4b">2.2.2. Compute</a></li>
<li><a href="#orgf10c436">2.2.3. Test</a></li>
<li><a href="#org0f0859d">2.2.1. Get</a></li>
<li><a href="#org1925a88">2.2.2. Compute</a></li>
<li><a href="#org0e2ec26">2.2.3. Test</a></li>
</ul>
</li>
<li><a href="#org2c2bec0">2.3. Nuclear repulsion energy</a>
<ul>
<li><a href="#org9a17acd">2.3.1. Get</a></li>
<li><a href="#orgacda5ab">2.3.2. Compute</a></li>
<li><a href="#org17e2601">2.3.3. Test</a></li>
</ul>
</li>
</ul>
@ -363,8 +370,8 @@ for the JavaScript code in this tag.
</div>
</div>
<div id="outline-container-org2011336" class="outline-2">
<h2 id="org2011336"><span class="section-number-2">1</span> Context</h2>
<div id="outline-container-orgec04cab" class="outline-2">
<h2 id="orgec04cab"><span class="section-number-2">1</span> Context</h2>
<div class="outline-text-2" id="text-1">
<p>
The following data stored in the context:
@ -423,6 +430,18 @@ The following data stored in the context:
<td class="org-left">Date when Nucleus-nucleus distances were computed</td>
</tr>
<tr>
<td class="org-left"><code>nn_distance_rescaled</code></td>
<td class="org-left">double[num][num]</td>
<td class="org-left">Nucleus-nucleus rescaled distances</td>
</tr>
<tr>
<td class="org-left"><code>nn_distance_rescaled_date</code></td>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">Date when Nucleus-nucleus rescaled distances were computed</td>
</tr>
<tr>
<td class="org-left"><code>repulsion</code></td>
<td class="org-left">double</td>
@ -434,22 +453,31 @@ The following data stored in the context:
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">Date when the nuclear repulsion energy was computed</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_kappa</code></td>
<td class="org-left">double</td>
<td class="org-left">The distance scaling factor</td>
</tr>
</tbody>
</table>
</div>
<div id="outline-container-org635e2e1" class="outline-3">
<h3 id="org635e2e1"><span class="section-number-3">1.1</span> Data structure</h3>
<div id="outline-container-orge91bac3" class="outline-3">
<h3 id="orge91bac3"><span class="section-number-3">1.1</span> Data structure</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">qmckl_nucleus_struct</span> {
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">num</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">repulsion_date</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nn_distance_date</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nn_distance_rescaled_date</span>;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">charge</span>;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nn_distance</span>;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nn_distance_rescaled</span>;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">repulsion</span>;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_kappa</span>;
<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">uninitialized</span>;
<span style="color: #228b22;">bool</span> <span style="color: #a0522d;">provided</span>;
} <span style="color: #228b22;">qmckl_nucleus_struct</span>;
@ -458,15 +486,15 @@ The following data stored in the context:
<p>
The <code>uninitialized</code> integer contains one bit set to one for each
initialization function which has not bee called. It becomes equal
initialization function which has not been called. It becomes equal
to zero after all initialization functions have been called. The
struct is then initialized and <code>provided == true</code>.
</p>
</div>
</div>
<div id="outline-container-org39609a2" class="outline-3">
<h3 id="org39609a2"><span class="section-number-3">1.2</span> Access functions</h3>
<div id="outline-container-org72048b9" class="outline-3">
<h3 id="org72048b9"><span class="section-number-3">1.2</span> Access functions</h3>
<div class="outline-text-3" id="text-1-2">
<p>
When all the data relative to nuclei have been set, the following
@ -480,8 +508,8 @@ function returns <code>true</code>.
</div>
</div>
<div id="outline-container-org70126ff" class="outline-3">
<h3 id="org70126ff"><span class="section-number-3">1.3</span> Initialization functions</h3>
<div id="outline-container-orgc876bc8" class="outline-3">
<h3 id="orgc876bc8"><span class="section-number-3">1.3</span> Initialization functions</h3>
<div class="outline-text-3" id="text-1-3">
<p>
To set the data relative to the nuclei in the context, the
@ -491,6 +519,7 @@ following functions need to be called.
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_nucleus_num</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">num</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_nucleus_charge</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">charge</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_nucleus_kappa</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_kappa</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_nucleus_coord</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transp</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>);
</pre>
</div>
@ -503,6 +532,10 @@ To set the number of nuclei, use
The following function sets the nuclear charges of all the atoms.
</p>
<p>
The following function sets the rescale parameter for the nuclear distances.
</p>
<p>
The following function sets the nuclear coordinates of all the
atoms. The coordinates should be given in atomic units.
@ -510,13 +543,14 @@ atoms. The coordinates should be given in atomic units.
</div>
</div>
<div id="outline-container-org6361eb6" class="outline-3">
<h3 id="org6361eb6"><span class="section-number-3">1.4</span> Test</h3>
<div id="outline-container-org6c39031" class="outline-3">
<h3 id="org6c39031"><span class="section-number-3">1.4</span> Test</h3>
<div class="outline-text-3" id="text-1-4">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span> = chbrclf_nucl_num;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_charge</span> = chbrclf_charge;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span> = &amp;(chbrclf_nucl_coord[0][0]);
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">nucl_rescale_factor_kappa</span> = 1.0; // <span style="color: #b22222;">TODO Change get rescale_factor_kappa from chbrclf example</span>
/* <span style="color: #b22222;">--- </span>*/
@ -537,6 +571,19 @@ rc = qmckl_get_nucleus_num (context, &amp;n);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #0000ff;">assert</span>(n == nucl_num);
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">k</span>;
rc = qmckl_get_nucleus_kappa (context, &amp;k);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_set_nucleus_kappa (context, nucl_rescale_factor_kappa);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
assert(!qmckl_nucleus_provided(context));
rc = qmckl_get_nucleus_kappa (context, &amp;k);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #0000ff;">assert</span>(k == nucl_rescale_factor_kappa);
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">nucl_coord2</span>[3*nucl_num];
rc = qmckl_get_nucleus_coord (context, <span style="color: #8b2252;">'T'</span>, nucl_coord2);
@ -581,8 +628,8 @@ rc = qmckl_get_nucleus_charge(context, nucl_charge2);
</div>
</div>
<div id="outline-container-org9301dde" class="outline-2">
<h2 id="org9301dde"><span class="section-number-2">2</span> Computation</h2>
<div id="outline-container-orgd799cf2" class="outline-2">
<h2 id="orgd799cf2"><span class="section-number-2">2</span> Computation</h2>
<div class="outline-text-2" id="text-2">
<p>
The computed data is stored in the context so that it can be reused
@ -595,12 +642,12 @@ current date is stored.
</p>
</div>
<div id="outline-container-orgcef05a7" class="outline-3">
<h3 id="orgcef05a7"><span class="section-number-3">2.1</span> Nucleus-nucleus distances</h3>
<div id="outline-container-org5b105fd" class="outline-3">
<h3 id="org5b105fd"><span class="section-number-3">2.1</span> Nucleus-nucleus distances</h3>
<div class="outline-text-3" id="text-2-1">
</div>
<div id="outline-container-orgdb9b9d0" class="outline-4">
<h4 id="orgdb9b9d0"><span class="section-number-4">2.1.1</span> Get</h4>
<div id="outline-container-org2474612" class="outline-4">
<h4 id="org2474612"><span class="section-number-4">2.1.1</span> Get</h4>
<div class="outline-text-4" id="text-2-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_nucleus_nn_distance</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">distance</span>);
@ -609,10 +656,10 @@ current date is stored.
</div>
</div>
<div id="outline-container-org577a20b" class="outline-4">
<h4 id="org577a20b"><span class="section-number-4">2.1.2</span> Compute</h4>
<div id="outline-container-org8f2fcf6" class="outline-4">
<h4 id="org8f2fcf6"><span class="section-number-4">2.1.2</span> Compute</h4>
<div class="outline-text-4" id="text-2-1-2">
<table id="org5c699ad" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org0bb4658" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -690,8 +737,8 @@ current date is stored.
</div>
</div>
<div id="outline-container-orgbd6d3d7" class="outline-4">
<h4 id="orgbd6d3d7"><span class="section-number-4">2.1.3</span> Test</h4>
<div id="outline-container-org714c5b2" class="outline-4">
<h4 id="org714c5b2"><span class="section-number-4">2.1.3</span> Test</h4>
<div class="outline-text-4" id="text-2-1-3">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Reference input data </span>*/
@ -710,9 +757,127 @@ rc = qmckl_get_nucleus_nn_distance(context, distance);
</div>
</div>
<div id="outline-container-org6c88824" class="outline-3">
<h3 id="org6c88824"><span class="section-number-3">2.2</span> Nuclear repulsion energy</h3>
<div id="outline-container-orgf53538e" class="outline-3">
<h3 id="orgf53538e"><span class="section-number-3">2.2</span> Nucleus-nucleus rescaled distances</h3>
<div class="outline-text-3" id="text-2-2">
</div>
<div id="outline-container-org0f0859d" class="outline-4">
<h4 id="org0f0859d"><span class="section-number-4">2.2.1</span> Get</h4>
<div class="outline-text-4" id="text-2-2-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_nucleus_nn_distance_rescaled</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">distance_rescaled</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-org1925a88" class="outline-4">
<h4 id="org1925a88"><span class="section-number-4">2.2.2</span> Compute</h4>
<div class="outline-text-4" id="text-2-2-2">
<table id="orgc5aa635" 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>
<tbody>
<tr>
<td class="org-left">qmckl<sub>context</sub></td>
<td class="org-left">context</td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">nucl<sub>num</sub></td>
<td class="org-left">in</td>
<td class="org-left">Number of nuclei</td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">coord[3][nucl<sub>num</sub>]</td>
<td class="org-left">in</td>
<td class="org-left">Nuclear coordinates (au)</td>
</tr>
<tr>
<td class="org-left">double</td>
<td class="org-left">nn<sub>distance</sub><sub>rescaled</sub>[nucl<sub>num</sub>][nucl<sub>num</sub>]</td>
<td class="org-left">out</td>
<td class="org-left">Nucleus-nucleus rescaled distances (au)</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer </span><span style="color: #a020f0;">function</span><span style="color: #a0522d;"> </span><span style="color: #0000ff;">qmckl_compute_nn_distance_rescaled_f</span><span style="color: #000000; background-color: #ffffff;">(context, nucl_num, rescale_factor_kappa, coord, nn_distance_rescaled)</span><span style="color: #a0522d;"> </span><span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_kappa</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord(nucl_num,3)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> nn_distance_rescaled(nucl_num,nucl_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> k</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
info = qmckl_distance_rescaled(context, <span style="color: #8b2252;">'T'</span>, <span style="color: #8b2252;">'T'</span>, nucl_num, nucl_num, <span style="color: #a020f0;">&amp;</span>
coord, nucl_num, <span style="color: #a020f0;">&amp;</span>
coord, nucl_num, <span style="color: #a020f0;">&amp;</span>
nn_distance_rescaled, nucl_num, rescale_factor_kappa)
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_nn_distance_rescaled_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org0e2ec26" class="outline-4">
<h4 id="org0e2ec26"><span class="section-number-4">2.2.3</span> Test</h4>
<div class="outline-text-4" id="text-2-2-3">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Reference input data </span>*/
/* <span style="color: #b22222;">TODO </span>*/
//<span style="color: #b22222;">assert(qmckl_nucleus_provided(context));</span>
//
//<span style="color: #b22222;">double distance[nucl_num*nucl_num];</span>
//<span style="color: #b22222;">rc = qmckl_get_nucleus_nn_distance(context, distance);</span>
//<span style="color: #b22222;">assert(distance[0] == 0.);</span>
//<span style="color: #b22222;">assert(distance[1] == distance[nucl_num]);</span>
//<span style="color: #b22222;">assert(fabs(distance[1]-2.070304721365169) &lt; 1.e-12);</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org2c2bec0" class="outline-3">
<h3 id="org2c2bec0"><span class="section-number-3">2.3</span> Nuclear repulsion energy</h3>
<div class="outline-text-3" id="text-2-3">
<p>
\[
V_{NN} = \sum_{A=1}^{N-1} \sum_{B>A}^N \frac{Q_A Q_B}{R_{AB}}
@ -720,9 +885,9 @@ rc = qmckl_get_nucleus_nn_distance(context, distance);
</p>
</div>
<div id="outline-container-org74f42d1" class="outline-4">
<h4 id="org74f42d1"><span class="section-number-4">2.2.1</span> Get</h4>
<div class="outline-text-4" id="text-2-2-1">
<div id="outline-container-org9a17acd" class="outline-4">
<h4 id="org9a17acd"><span class="section-number-4">2.3.1</span> Get</h4>
<div class="outline-text-4" id="text-2-3-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_nucleus_repulsion</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">energy</span>);
</pre>
@ -730,10 +895,10 @@ rc = qmckl_get_nucleus_nn_distance(context, distance);
</div>
</div>
<div id="outline-container-orge576e4b" class="outline-4">
<h4 id="orge576e4b"><span class="section-number-4">2.2.2</span> Compute</h4>
<div class="outline-text-4" id="text-2-2-2">
<table id="orgc05706f" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<div id="outline-container-orgacda5ab" class="outline-4">
<h4 id="orgacda5ab"><span class="section-number-4">2.3.2</span> Compute</h4>
<div class="outline-text-4" id="text-2-3-2">
<table id="org3848725" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -821,9 +986,9 @@ rc = qmckl_get_nucleus_nn_distance(context, distance);
</div>
</div>
<div id="outline-container-orgf10c436" class="outline-4">
<h4 id="orgf10c436"><span class="section-number-4">2.2.3</span> Test</h4>
<div class="outline-text-4" id="text-2-2-3">
<div id="outline-container-org17e2601" class="outline-4">
<h4 id="org17e2601"><span class="section-number-4">2.3.3</span> Test</h4>
<div class="outline-text-4" id="text-2-3-3">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Reference input data </span>*/
@ -842,7 +1007,7 @@ rc = qmckl_get_nucleus_repulsion(context, &amp;rep);
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Numerical precision</title>
@ -333,16 +333,16 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgff58000">1. Control of the numerical precision</a></li>
<li><a href="#org1a2027c">2. Precision</a></li>
<li><a href="#orgb9504f6">3. Range</a></li>
<li><a href="#org626920c">4. Helper functions</a></li>
<li><a href="#orgcd37a86">1. Control of the numerical precision</a></li>
<li><a href="#orgca51fb7">2. Precision</a></li>
<li><a href="#org4f170c5">3. Range</a></li>
<li><a href="#org80744f0">4. Helper functions</a></li>
</ul>
</div>
</div>
<div id="outline-container-orgff58000" class="outline-2">
<h2 id="orgff58000"><span class="section-number-2">1</span> Control of the numerical precision</h2>
<div id="outline-container-orgcd37a86" class="outline-2">
<h2 id="orgcd37a86"><span class="section-number-2">1</span> Control of the numerical precision</h2>
<div class="outline-text-2" id="text-1">
<p>
Controlling numerical precision enables optimizations. Here, the
@ -353,7 +353,7 @@ Arithmetic (IEEE 754),
refers to the number of exponent bits.
</p>
<table id="org57c0f42" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org22c6ab7" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -397,8 +397,8 @@ integer. The update functions return <code>QMCKL_SUCCESS</code> or
</div>
</div>
<div id="outline-container-org1a2027c" class="outline-2">
<h2 id="org1a2027c"><span class="section-number-2">2</span> Precision</h2>
<div id="outline-container-orgca51fb7" class="outline-2">
<h2 id="orgca51fb7"><span class="section-number-2">2</span> Precision</h2>
<div class="outline-text-2" id="text-2">
<p>
<code>qmckl_context_set_numprec_precision</code> modifies the parameter for the
@ -485,8 +485,8 @@ numerical precision in the context.
</div>
</div>
<div id="outline-container-orgb9504f6" class="outline-2">
<h2 id="orgb9504f6"><span class="section-number-2">3</span> Range</h2>
<div id="outline-container-org4f170c5" class="outline-2">
<h2 id="org4f170c5"><span class="section-number-2">3</span> Range</h2>
<div class="outline-text-2" id="text-3">
<p>
<code>qmckl_set_numprec_range</code> modifies the parameter for the numerical
@ -561,8 +561,8 @@ range in a given context.
</div>
</div>
</div>
<div id="outline-container-org626920c" class="outline-2">
<h2 id="org626920c"><span class="section-number-2">4</span> Helper functions</h2>
<div id="outline-container-org80744f0" class="outline-2">
<h2 id="org80744f0"><span class="section-number-2">4</span> Helper functions</h2>
<div class="outline-text-2" id="text-4">
<p>
<code>qmckl_get_numprec_epsilon</code> returns \(\epsilon = 2^{1-n}\) where <code>n</code> is the precision.
@ -581,7 +581,7 @@ We need to remove the sign bit from the precision.
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Data for Tests</title>
@ -233,19 +233,19 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgcc006f3">1. CHBrClF</a>
<li><a href="#org5c48cec">1. CHBrClF</a>
<ul>
<li><a href="#orgaf73a0a">1.1. XYZ coordinates</a></li>
<li><a href="#org7b2817a">1.2. Atomic basis set</a></li>
<li><a href="#orgddd0c59">1.3. Electron coordinates</a></li>
<li><a href="#orga9b6c0a">1.1. XYZ coordinates</a></li>
<li><a href="#orga7438d6">1.2. Atomic basis set</a></li>
<li><a href="#org7e55573">1.3. Electron coordinates</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-orgcc006f3" class="outline-2">
<h2 id="orgcc006f3"><span class="section-number-2">1</span> CHBrClF</h2>
<div id="outline-container-org5c48cec" class="outline-2">
<h2 id="org5c48cec"><span class="section-number-2">1</span> CHBrClF</h2>
<div class="outline-text-2" id="text-1">
<p>
This test is the all-electron Hartree-Fock wave function of CHClBr,
@ -329,8 +329,8 @@ and with a high maximum angular momentum.
</div>
<div id="outline-container-orgaf73a0a" class="outline-3">
<h3 id="orgaf73a0a"><span class="section-number-3">1.1</span> XYZ coordinates</h3>
<div id="outline-container-orga9b6c0a" class="outline-3">
<h3 id="orga9b6c0a"><span class="section-number-3">1.1</span> XYZ coordinates</h3>
<div class="outline-text-3" id="text-1-1">
<pre class="example">
5
@ -360,8 +360,8 @@ Nuclear coordinates are stored in atomic units in transposed format.
</div>
</div>
<div id="outline-container-org7b2817a" class="outline-3">
<h3 id="org7b2817a"><span class="section-number-3">1.2</span> Atomic basis set</h3>
<div id="outline-container-orga7438d6" class="outline-3">
<h3 id="orga7438d6"><span class="section-number-3">1.2</span> Atomic basis set</h3>
<div class="outline-text-3" id="text-1-2">
<pre class="example">
HYDROGEN
@ -836,8 +836,8 @@ F 1
</div>
</div>
<div id="outline-container-orgddd0c59" class="outline-3">
<h3 id="orgddd0c59"><span class="section-number-3">1.3</span> Electron coordinates</h3>
<div id="outline-container-org7e55573" class="outline-3">
<h3 id="org7e55573"><span class="section-number-3">1.3</span> Electron coordinates</h3>
<div class="outline-text-3" id="text-1-3">
<p>
Electron coordinates are stored in atomic units in normal format.
@ -997,7 +997,7 @@ Electron coordinates are stored in atomic units in normal format.
</div>
</div>
<div id="postamble" class="status">
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-05-26 Wed 08:03 -->
<!-- 2021-05-26 Wed 09:42 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Utility functions</title>
@ -333,13 +333,13 @@ for the JavaScript code in this tag.
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org092571a">1. Matrix operations</a>
<li><a href="#orgf66c9de">1. Matrix operations</a>
<ul>
<li><a href="#orgc55c675">1.1. <code>qmckl_transpose</code></a>
<li><a href="#orge0cfe2a">1.1. <code>qmckl_transpose</code></a>
<ul>
<li><a href="#orgcba427d">1.1.1. Requirements</a></li>
<li><a href="#org7b97021">1.1.2. C header</a></li>
<li><a href="#org6cdc744">1.1.3. Source</a></li>
<li><a href="#org6b029ad">1.1.1. Requirements</a></li>
<li><a href="#org755dc7e">1.1.2. C header</a></li>
<li><a href="#orgb466c63">1.1.3. Source</a></li>
</ul>
</li>
</ul>
@ -348,18 +348,18 @@ for the JavaScript code in this tag.
</div>
</div>
<div id="outline-container-org092571a" class="outline-2">
<h2 id="org092571a"><span class="section-number-2">1</span> Matrix operations</h2>
<div id="outline-container-orgf66c9de" class="outline-2">
<h2 id="orgf66c9de"><span class="section-number-2">1</span> Matrix operations</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-orgc55c675" class="outline-3">
<h3 id="orgc55c675"><span class="section-number-3">1.1</span> <code>qmckl_transpose</code></h3>
<div id="outline-container-orge0cfe2a" class="outline-3">
<h3 id="orge0cfe2a"><span class="section-number-3">1.1</span> <code>qmckl_transpose</code></h3>
<div class="outline-text-3" id="text-1-1">
<p>
Transposes a matrix: \(B_{ji} = A_{ij}\)
</p>
<table id="orgba0b871" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<table id="org5ddd394" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
@ -424,8 +424,8 @@ Transposes a matrix: \(B_{ji} = A_{ij}\)
</table>
</div>
<div id="outline-container-orgcba427d" class="outline-4">
<h4 id="orgcba427d"><span class="section-number-4">1.1.1</span> Requirements</h4>
<div id="outline-container-org6b029ad" class="outline-4">
<h4 id="org6b029ad"><span class="section-number-4">1.1.1</span> Requirements</h4>
<div class="outline-text-4" id="text-1-1-1">
<ul class="org-ul">
<li><code>context</code> is not <code>QMCKL_NULL_CONTEXT</code></li>
@ -439,8 +439,8 @@ Transposes a matrix: \(B_{ji} = A_{ij}\)
</div>
</div>
<div id="outline-container-org7b97021" class="outline-4">
<h4 id="org7b97021"><span class="section-number-4">1.1.2</span> C header</h4>
<div id="outline-container-org755dc7e" class="outline-4">
<h4 id="org755dc7e"><span class="section-number-4">1.1.2</span> C header</h4>
<div class="outline-text-4" id="text-1-1-2">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_transpose</span> (
@ -456,8 +456,8 @@ Transposes a matrix: \(B_{ji} = A_{ij}\)
</div>
</div>
<div id="outline-container-org6cdc744" class="outline-4">
<h4 id="org6cdc744"><span class="section-number-4">1.1.3</span> Source</h4>
<div id="outline-container-orgb466c63" class="outline-4">
<h4 id="orgb466c63"><span class="section-number-4">1.1.3</span> Source</h4>
<div class="outline-text-4" id="text-1-1-3">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer </span><span style="color: #a020f0;">function</span><span style="color: #a0522d;"> </span><span style="color: #0000ff;">qmckl_transpose_f</span><span style="color: #000000; background-color: #ffffff;">(context, m, n, A, LDA, B, LDB)</span><span style="color: #a0522d;"> </span><span style="color: #a020f0;">&amp;</span>
@ -516,7 +516,7 @@ Transposes a matrix: \(B_{ji} = A_{ij}\)
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2021-05-26 Wed 08:03</p>
<p class="date">Created: 2021-05-26 Wed 09:42</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>