1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-06-01 02:45:43 +02:00
qmckl/qmckl_ao.html

4369 lines
242 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2024-03-29 Fri 08:29 -->
<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>
<meta name="generator" content="Org mode" />
<meta name="author" content="TREX CoE" />
<style type="text/css">
<!--/*--><![CDATA[/*><!--*/
.title { text-align: center;
margin-bottom: .2em; }
.subtitle { text-align: center;
font-size: medium;
font-weight: bold;
margin-top:0; }
.todo { font-family: monospace; color: red; }
.done { font-family: monospace; color: green; }
.priority { font-family: monospace; color: orange; }
.tag { background-color: #eee; font-family: monospace;
padding: 2px; font-size: 80%; font-weight: normal; }
.timestamp { color: #bebebe; }
.timestamp-kwd { color: #5f9ea0; }
.org-right { margin-left: auto; margin-right: 0px; text-align: right; }
.org-left { margin-left: 0px; margin-right: auto; text-align: left; }
.org-center { margin-left: auto; margin-right: auto; text-align: center; }
.underline { text-decoration: underline; }
#postamble p, #preamble p { font-size: 90%; margin: .2em; }
p.verse { margin-left: 3%; }
pre {
border: 1px solid #ccc;
box-shadow: 3px 3px 3px #eee;
padding: 8pt;
font-family: monospace;
overflow: auto;
margin: 1.2em;
}
pre.src {
position: relative;
overflow: visible;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link rel="stylesheet" title="Standard" href="qmckl.css" type="text/css" />
<script type="text/javascript" src="org-info.js">
/**
*
* @source: org-info.js
*
* @licstart The following is the entire license notice for the
* JavaScript code in org-info.js.
*
* Copyright (C) 2012-2020 Free Software Foundation, Inc.
*
*
* The JavaScript code in this tag is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in org-info.js.
*
*/
</script>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
org_html_manager.set("TOC_DEPTH", "4");
org_html_manager.set("LINK_HOME", "index.html");
org_html_manager.set("LINK_UP", "");
org_html_manager.set("LOCAL_TOC", "1");
org_html_manager.set("VIEW_BUTTONS", "0");
org_html_manager.set("MOUSE_HINT", "underline");
org_html_manager.set("FIXED_TOC", "0");
org_html_manager.set("TOC", "1");
org_html_manager.set("VIEW", "info");
org_html_manager.setup(); // activate after the parameters are set
/*]]>*///-->
</script>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2020 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "center",
displayIndent: "0em",
"HTML-CSS": { scale: 100,
linebreaks: { automatic: "false" },
webFont: "TeX"
},
SVG: {scale: 100,
linebreaks: { automatic: "false" },
font: "TeX"},
NativeMML: {scale: 100},
TeX: { equationNumbers: {autoNumber: "AMS"},
MultLineWidth: "85%",
TagSide: "right",
TagIndent: ".8em"
}
});
</script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href=""> UP </a>
|
<a accesskey="H" href="index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Atomic Orbitals</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org7c41ccb">1. Introduction</a></li>
<li><a href="#org66f2b99">2. Context</a>
<ul>
<li><a href="#org410c932">2.1. Constant data</a>
<ul>
<li><a href="#org25955ec">2.1.1. Initialization functions</a>
<ul>
<li><a href="#org2d1cb05">2.1.1.1. C interface</a></li>
<li><a href="#orgb6cb2d6">2.1.1.2. Fortran interface</a></li>
</ul>
</li>
<li><a href="#orga9f6551">2.1.2. Access functions</a>
<ul>
<li><a href="#orgce0aacb">2.1.2.1. C interface</a></li>
<li><a href="#orge891558">2.1.2.2. Fortran interface</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org0796900">2.2. Computed data</a>
<ul>
<li><a href="#org5a9fa39">2.2.1. After initialization</a></li>
<li><a href="#orgf3eb4c4">2.2.2. <span class="todo TODO">TODO</span> HPC-specific data structures</a></li>
<li><a href="#org5f8c9c7">2.2.3. Access functions</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#orgd5e2694">3. Radial part</a>
<ul>
<li><a href="#orga6c8405">3.1. General functions for Gaussian basis functions</a></li>
<li><a href="#org392e14d">3.2. Computation of primitives</a></li>
<li><a href="#org945cca5">3.3. Computation of shells</a></li>
</ul>
</li>
<li><a href="#org27da11b">4. Polynomial part</a>
<ul>
<li><a href="#org9b8b808">4.1. General functions for Powers of \(x-X_i\)</a></li>
<li><a href="#org6d33d56">4.2. General functions for Value, Gradient and Laplacian of a polynomial</a></li>
</ul>
</li>
<li><a href="#orgd6efc3d">5. Combining radial and polynomial parts</a>
<ul>
<li><a href="#orgffd133a">5.1. Determination of nucleus ranges</a></li>
<li><a href="#org1c2cc61">5.2. Values only</a>
<ul>
<li><a href="#org8ac7a82">5.2.1. Unoptimized version</a></li>
<li><a href="#org0946ac9">5.2.2. HPC version</a></li>
<li><a href="#org30c6a36">5.2.3. Interfaces</a></li>
</ul>
</li>
<li><a href="#orgb413cac">5.3. Value, gradients, Laplacian</a>
<ul>
<li><a href="#org11f7df7">5.3.1. Reference version</a></li>
<li><a href="#org47b8bf2">5.3.2. HPC version</a></li>
<li><a href="#org2b98700">5.3.3. Interfaces</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org7c41ccb" class="outline-2">
<h2 id="org7c41ccb"><span class="section-number-2">1</span> Introduction</h2>
<div class="outline-text-2" id="text-1">
<p>
The atomic basis set is defined as a list of shells. Each shell \(s\) is
centered on a nucleus \(A\), possesses a given angular momentum \(l\) and a
radial function \(R_s\). The radial function is a linear combination of
<i>primitive</i> functions that can be of type Slater (\(p=1\)) or
Gaussian (\(p=2\)):
</p>
<p>
\[
R_s(\mathbf{r}) = \mathcal{N}_s |\mathbf{r}-\mathbf{R}_A|^{n_s}
\sum_{k=1}^{N_{\text{prim}}} a_{ks}\, f_{ks}
\exp \left( - \gamma_{ks} | \mathbf{r}-\mathbf{R}_A | ^p \right).
\]
</p>
<p>
In the case of Gaussian functions, \(n_s\) is always zero. The
normalization factor \(\mathcal{N}_s\) ensures that all the functions of
the shell are normalized (integrate) to unity. Usually, basis sets are
given a combination of normalized primitives, so the normalization
coefficients of the primitives, \(f_{ks}\), need also to be provided.
</p>
<p>
Atomic orbitals (AOs) are defined as
</p>
<p>
\[
\chi_i (\mathbf{r}) = \mathcal{M}_i\, P_{\eta(i)}(\mathbf{r})\, R_{\theta(i)} (\mathbf{r})
\]
</p>
<p>
where \(\theta(i)\) returns the shell on which the AO is expanded, and
\(\eta(i)\) denotes which angular function is chosen and \(P\) are the
generating functions of the given angular momentum \(\eta(i)\). Here,
the parameter \(\mathcal{M}_i\) is an extra parameter which allows the
normalization of the different functions of the same shell to be
different, as in GAMESS for example.
</p>
<p>
In this section we describe first how the basis set is stored in the
context, and then we present the kernels used to compute the values,
gradients and Laplacian of the atomic basis functions.
</p>
</div>
</div>
<div id="outline-container-org66f2b99" class="outline-2">
<h2 id="org66f2b99"><span class="section-number-2">2</span> Context</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-org410c932" class="outline-3">
<h3 id="org410c932"><span class="section-number-3">2.1</span> Constant data</h3>
<div class="outline-text-3" id="text-2-1">
<p>
The following arrays are stored in the context, and need to be set
when initializing the library:
</p>
<table id="orgb0b2eaf" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>type</code></td>
<td class="org-left"><code>char</code></td>
<td class="org-left">Gaussian (<code>'G'</code>) or Slater (<code>'S'</code>)</td>
</tr>
<tr>
<td class="org-left"><code>shell_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">Number of shells</td>
</tr>
<tr>
<td class="org-left"><code>prim_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">Total number of primitives</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_index</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">Index of the first shell of each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_shell_num</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">Number of shells per nucleus</td>
</tr>
<tr>
<td class="org-left"><code>shell_ang_mom</code></td>
<td class="org-left"><code>int32_t[shell_num]</code></td>
<td class="org-left">Angular momentum of each shell</td>
</tr>
<tr>
<td class="org-left"><code>shell_prim_num</code></td>
<td class="org-left"><code>int64_t[shell_num]</code></td>
<td class="org-left">Number of primitives in each shell</td>
</tr>
<tr>
<td class="org-left"><code>shell_prim_index</code></td>
<td class="org-left"><code>int64_t[shell_num]</code></td>
<td class="org-left">Address of the first primitive of each shell in the <code>EXPONENT</code> array</td>
</tr>
<tr>
<td class="org-left"><code>shell_factor</code></td>
<td class="org-left"><code>double[shell_num]</code></td>
<td class="org-left">Normalization factor for each shell</td>
</tr>
<tr>
<td class="org-left"><code>exponent</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">Array of exponents</td>
</tr>
<tr>
<td class="org-left"><code>coefficient</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">Array of coefficients</td>
</tr>
<tr>
<td class="org-left"><code>prim_factor</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">Normalization factors of the primtives</td>
</tr>
<tr>
<td class="org-left"><code>ao_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">Number of AOs</td>
</tr>
<tr>
<td class="org-left"><code>ao_cartesian</code></td>
<td class="org-left"><code>bool</code></td>
<td class="org-left">If true, use polynomials. Otherwise, use spherical harmonics</td>
</tr>
<tr>
<td class="org-left"><code>ao_factor</code></td>
<td class="org-left"><code>double[ao_num]</code></td>
<td class="org-left">Normalization factor of the AO</td>
</tr>
</tbody>
</table>
<p>
The following data is computed when the basis is finalized:
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>nucleus_prim_index</code></td>
<td class="org-left"><code>int64_t[nucl_num+1]</code></td>
<td class="org-left">Index of the first primitive of each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_max_ang_mom</code></td>
<td class="org-left"><code>int32_t[nucl_num]</code></td>
<td class="org-left">Maximum angular momentum of each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>coefficient_normalized~</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">Normalized array of coefficients</td>
</tr>
<tr>
<td class="org-left"><code>ao_ang_mom</code></td>
<td class="org-left"><code>int32_t[ao_num]</code></td>
<td class="org-left">Angular momentum of the shell to which the AO belongs</td>
</tr>
<tr>
<td class="org-left"><code>ao_nucl</code></td>
<td class="org-left"><code>int64_t[ao_num]</code></td>
<td class="org-left">Nucleus on which the AO is centered</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_range</code></td>
<td class="org-left"><code>double[nucl_num]</code></td>
<td class="org-left">Used to compute the distance beyond which all Gaussian AOs are zero, depending on the precision</td>
</tr>
</tbody>
</table>
<p>
For H<sub>2</sub> with the following basis set,
</p>
<pre class="example" id="basis">
HYDROGEN
S 5
1 3.387000E+01 6.068000E-03
2 5.095000E+00 4.530800E-02
3 1.159000E+00 2.028220E-01
4 3.258000E-01 5.039030E-01
5 1.027000E-01 3.834210E-01
S 1
1 3.258000E-01 1.000000E+00
S 1
1 1.027000E-01 1.000000E+00
P 1
1 1.407000E+00 1.000000E+00
P 1
1 3.880000E-01 1.000000E+00
D 1
1 1.057000E+00 1.0000000
</pre>
<p>
we have:
</p>
<pre class="example" id="params">
type = 'G'
shell_num = 12
prim_num = 20
ao_num = 30
nucleus_index = [0 , 6]
shell_ang_mom = [0, 0, 0, 1, 1, 2, 0, 0, 0, 1, 1, 2]
shell_factor = [ 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]
shell_prim_num = [5, 1, 1, 1, 1, 1, 5, 1, 1, 1, 1, 1]
shell_prim_index = [0 , 5 , 6 , 7 , 8 , 9 , 10, 15, 16, 17, 18, 19]
exponent = [ 33.87, 5.095, 1.159, 0.3258, 0.1027, 0.3258, 0.1027, 1.407,
0.388, 1.057, 33.87, 5.095, 1.159, 0.3258, 0.1027, 0.3258, 0.1027, 1.407,
0.388, 1.057]
coefficient = [ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421, 1.0, 1.0,
1.0, 1.0, 1.0, 0.006068, 0.045308, 0.202822, 0.503903, 0.383421, 1.0, 1.0,
1.0, 1.0, 1.0]
prim_factor = [ 1.0006253235944540e+01, 2.4169531573445120e+00, 7.9610924849766440e-01
3.0734305383061117e-01, 1.2929684417481876e-01, 3.0734305383061117e-01,
1.2929684417481876e-01, 2.1842769845268308e+00, 4.3649547399719840e-01,
1.8135965626177861e+00, 1.0006253235944540e+01, 2.4169531573445120e+00,
7.9610924849766440e-01, 3.0734305383061117e-01, 1.2929684417481876e-01,
3.0734305383061117e-01, 1.2929684417481876e-01, 2.1842769845268308e+00,
4.3649547399719840e-01, 1.8135965626177861e+00 ]
</pre>
<p>
A scalar variable <code>$V$</code> present in this table can be set or get by
calling the functions:
</p>
<div class="org-src-container">
<pre class="src src-C" id="org21c09f7"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_ao_basis_$V$</span> ( <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #a020f0;">const</span> $type_of_V$ $V$);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_ao_basis_$V$</span> ( <span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
$type_of_V$ <span style="color: #a020f0;">const</span> $V$);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>) <span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_$V$</span> (context, $V$)<span style="color: #a0522d;"> </span><span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
$f_type_of_V$ , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> :: $V$
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_$V$</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>) <span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_$V$</span> (context, $V$)<span style="color: #a0522d;"> </span><span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
$f_type_of_V$ , <span style="color: #a020f0;">intent</span>(out) :: $V$
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_$V$</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
<p>
For array variables, use the rule:
</p>
<div class="org-src-container">
<pre class="src src-C" id="org10a92b8"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_ao_basis_$V$</span> ( <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #a020f0;">const</span> $type_of_V$ $V$,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_ao_basis_$V$</span> ( <span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
$type_of_V$ <span style="color: #a020f0;">const</span> $V$,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_$V$ (context, </span><span style="color: #a020f0;">&amp;</span>
$V$, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
$f_type_of_V$ , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> :: $V$
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_$V$</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_$V$ (context, </span><span style="color: #a020f0;">&amp;</span>
$V$, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
$f_type_of_V$ , <span style="color: #a020f0;">intent</span>(out) :: $V$
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_$V$</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
<div id="outline-container-org25955ec" class="outline-4">
<h4 id="org25955ec"><span class="section-number-4">2.1.1</span> Initialization functions</h4>
<div class="outline-text-4" id="text-2-1-1">
<p>
<code>size_max</code> is the dimension of the input array, which should be
equal of larger than the value given in the table of section <a href="#org66f2b99">2</a>.
</p>
</div>
<div id="outline-container-org2d1cb05" class="outline-5">
<h5 id="org2d1cb05"><span class="section-number-5">2.1.1.1</span> C interface</h5>
<div class="outline-text-5" id="text-2-1-1-1">
<p>
To set the basis set, all the following functions need to be
called.
</p>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_type</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;">basis_type</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_shell_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;">shell_num</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_prim_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;">prim_num</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_nucleus_shell_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;">nucleus_shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_nucleus_index</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;">nucleus_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_shell_ang_mom</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">shell_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_shell_prim_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;">shell_prim_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_shell_prim_index</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;">shell_prim_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_shell_factor</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;">shell_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_exponent</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;">exponent</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_coefficient</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;">coefficient</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_prim_factor</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;">prim_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_ao_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;">ao_num</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_ao_factor</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;">ao_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_set_ao_basis_cartesian</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">bool</span> <span style="color: #a0522d;">cartesian</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb6cb2d6" class="outline-5">
<h5 id="orgb6cb2d6"><span class="section-number-5">2.1.1.2</span> Fortran interface</h5>
<div class="outline-text-5" id="text-2-1-1-2">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_type (context, </span><span style="color: #a020f0;">&amp;</span>
basis_type) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">character</span>(<span style="color: #008b8b;">c_char</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> basis_type</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_type</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_shell_num(context, </span><span style="color: #a020f0;">&amp;</span>
num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_shell_num</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_prim_num(context, </span><span style="color: #a020f0;">&amp;</span>
num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_prim_num</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_nucleus_index(context, </span><span style="color: #a020f0;">&amp;</span>
idx, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> idx(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_nucleus_index</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_nucleus_shell_num(context, </span><span style="color: #a020f0;">&amp;</span>
shell_num, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_num(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_nucleus_shell_num</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_shell_ang_mom(context, </span><span style="color: #a020f0;">&amp;</span>
shell_ang_mom, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_ang_mom(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_shell_ang_mom</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_shell_prim_num(context, </span><span style="color: #a020f0;">&amp;</span>
shell_prim_num, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_prim_num(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_shell_prim_num</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_shell_prim_index(context, </span><span style="color: #a020f0;">&amp;</span>
shell_prim_index, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_prim_index(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_shell_prim_index</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_shell_factor(context, </span><span style="color: #a020f0;">&amp;</span>
shell_factor, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_factor(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_shell_factor</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_exponent(context, </span><span style="color: #a020f0;">&amp;</span>
exponent, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> exponent(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_exponent</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_coefficient(context, </span><span style="color: #a020f0;">&amp;</span>
coefficient, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coefficient(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_coefficient</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_prim_factor(context, </span><span style="color: #a020f0;">&amp;</span>
prim_factor, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> prim_factor(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_prim_factor</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_ao_num(context, </span><span style="color: #a020f0;">&amp;</span>
num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_ao_num</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_cartesian(context, </span><span style="color: #a020f0;">&amp;</span>
cartesian) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">logical</span> (<span style="color: #008b8b;">c_bool</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> cartesian</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_cartesian</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_ao_basis_ao_factor(context, </span><span style="color: #a020f0;">&amp;</span>
ao_factor, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> ao_factor(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_ao_basis_ao_factor</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orga9f6551" class="outline-4">
<h4 id="orga9f6551"><span class="section-number-4">2.1.2</span> Access functions</h4>
<div class="outline-text-4" id="text-2-1-2">
<p>
<code>size_max</code> is the dimension of the input array, which should be
equal of larger than the value given in the table of section <a href="#org66f2b99">2</a>.
</p>
</div>
<div id="outline-container-orgce0aacb" class="outline-5">
<h5 id="orgce0aacb"><span class="section-number-5">2.1.2.1</span> C interface</h5>
<div class="outline-text-5" id="text-2-1-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_ao_basis_type</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">char</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">basis_type</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_shell_num</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">shell_num</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_prim_num</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">prim_num</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_nucleus_shell_num</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">nucleus_shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_nucleus_index</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">nucleus_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_shell_ang_mom</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">shell_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_shell_prim_num</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">shell_prim_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_shell_prim_index</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">shell_prim_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_shell_factor</span> (<span style="color: #a020f0;">const</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;">shell_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_exponent</span> (<span style="color: #a020f0;">const</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;">exponent</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_coefficient</span> (<span style="color: #a020f0;">const</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;">coefficient</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_prim_factor</span> (<span style="color: #a020f0;">const</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;">prim_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_ao_num</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ao_num</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_ao_factor</span> (<span style="color: #a020f0;">const</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;">ao_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<p>
When all the data for the AOs have been provided, the following
function returns <code>true</code>.
</p>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_ao_basis_provided</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-orge891558" class="outline-5">
<h5 id="orge891558"><span class="section-number-5">2.1.2.2</span> Fortran interface</h5>
<div class="outline-text-5" id="text-2-1-2-2">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_type (context, </span><span style="color: #a020f0;">&amp;</span>
basis_type) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">character</span>(<span style="color: #008b8b;">c_char</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> basis_type</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_type</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_shell_num(context, </span><span style="color: #a020f0;">&amp;</span>
num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_shell_num</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_prim_num(context, </span><span style="color: #a020f0;">&amp;</span>
num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_prim_num</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_nucleus_shell_num(context, </span><span style="color: #a020f0;">&amp;</span>
shell_num, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> shell_num(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_nucleus_shell_num</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_nucleus_index(context, </span><span style="color: #a020f0;">&amp;</span>
idx, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> idx(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_nucleus_index</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_shell_ang_mom(context, </span><span style="color: #a020f0;">&amp;</span>
shell_ang_mom, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> shell_ang_mom(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_shell_ang_mom</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_shell_prim_num(context, </span><span style="color: #a020f0;">&amp;</span>
shell_prim_num, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> shell_prim_num(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_shell_prim_num</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_shell_prim_index(context, </span><span style="color: #a020f0;">&amp;</span>
shell_prim_index, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> shell_prim_index(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_shell_prim_index</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_shell_factor(context, </span><span style="color: #a020f0;">&amp;</span>
shell_factor, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> shell_factor(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_shell_factor</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_exponent(context, </span><span style="color: #a020f0;">&amp;</span>
exponent, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> exponent(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_exponent</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_coefficient(context, </span><span style="color: #a020f0;">&amp;</span>
coefficient, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> coefficient(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_coefficient</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_prim_factor(context, </span><span style="color: #a020f0;">&amp;</span>
prim_factor, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> prim_factor(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_prim_factor</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_ao_num(context, </span><span style="color: #a020f0;">&amp;</span>
num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_ao_num</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_cartesian(context, </span><span style="color: #a020f0;">&amp;</span>
cartesian) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">logical</span> (<span style="color: #008b8b;">c_bool</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> cartesian</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_cartesian</span>
<span style="color: #a020f0;">end interface</span>
<span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_get_ao_basis_ao_factor(context, </span><span style="color: #a020f0;">&amp;</span>
ao_factor, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">import</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> ao_factor(*)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_ao_basis_ao_factor</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="outline-container-org0796900" class="outline-3">
<h3 id="org0796900"><span class="section-number-3">2.2</span> Computed data</h3>
<div class="outline-text-3" id="text-2-2">
<p>
The following data is computed as described in the next sections:
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>primitive_vgl</code></td>
<td class="org-left"><code>double[point_num][5][prim_num]</code></td>
<td class="org-left">Value, gradients, Laplacian of the primitives at current positions</td>
</tr>
<tr>
<td class="org-left"><code>primitive_vgl_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Last modification date of Value, gradients, Laplacian of the primitives at current positions</td>
</tr>
<tr>
<td class="org-left"><code>shell_vgl</code></td>
<td class="org-left"><code>double[point_num][5][shell_num]</code></td>
<td class="org-left">Value, gradients, Laplacian of the primitives at current positions</td>
</tr>
<tr>
<td class="org-left"><code>shell_vgl_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Last modification date of Value, gradients, Laplacian of the AOs at current positions</td>
</tr>
<tr>
<td class="org-left"><code>ao_vgl</code></td>
<td class="org-left"><code>double[point_num][5][ao_num]</code></td>
<td class="org-left">Value, gradients, Laplacian of the AOs at current positions</td>
</tr>
<tr>
<td class="org-left"><code>ao_vgl_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Last modification date of Value, gradients, Laplacian of the AOs at current positions</td>
</tr>
<tr>
<td class="org-left"><code>ao_value</code></td>
<td class="org-left"><code>double[point_num][ao_num]</code></td>
<td class="org-left">Values of the the AOs at current positions</td>
</tr>
<tr>
<td class="org-left"><code>ao_value_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Last modification date of the values of the AOs at current positions</td>
</tr>
</tbody>
</table>
</div>
<div id="outline-container-org5a9fa39" class="outline-4">
<h4 id="org5a9fa39"><span class="section-number-4">2.2.1</span> After initialization</h4>
<div class="outline-text-4" id="text-2-2-1">
<p>
When the basis set is completely entered, extra data structures may be
computed to accelerate the calculations. The primitives within each
contraction are sorted in ascending order of their exponents, such
that as soon as a primitive is zero all the following functions
vanish. Also, it is possible to compute a nuclear radius beyond which
all the primitives are zero up to the numerical accuracy defined in
the context.
</p>
</div>
</div>
<div id="outline-container-orgf3eb4c4" class="outline-4">
<h4 id="orgf3eb4c4"><span class="section-number-4">2.2.2</span> <span class="todo TODO">TODO</span> HPC-specific data structures</h4>
<div class="outline-text-4" id="text-2-2-2">
<p>
For faster access, we provide extra arrays for the shell information as:
</p>
<ul class="org-ul">
<li>\(C_{psa}\) = <code>coef_per_nucleus[inucl][ishell][iprim]</code></li>
<li>\(\gamma_{pa}\) <code>expo_per_nucleus[inucl][iprim]</code></li>
</ul>
<p>
such that the computation of the radial parts can be vectorized.
</p>
<p>
Exponents are sorted in increasing order to exit loops quickly,
and only unique exponents are kept. This also allows to pack the
exponents to enable vectorization of exponentials.
</p>
<p>
The computation of the radial part is made as
\[
R_{sa} = \sum_p C_{psa} \gamma_{pa}
\]
which is a matrix-vector product.
</p>
</div>
</div>
<div id="outline-container-org5f8c9c7" class="outline-4">
<h4 id="org5f8c9c7"><span class="section-number-4">2.2.3</span> Access functions</h4>
<div class="outline-text-4" id="text-2-2-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_primitive_vgl</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;">primitive_vgl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<p>
Returns the array of values, gradients an Laplacian of primitive
basis functions evaluated at the current coordinates.
See section <a href="#org392e14d">3.2</a>.
</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_ao_basis_shell_vgl</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;">shell_vgl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<p>
Returns the array of values, gradients an Laplacian of contracted shells
evaluated at the current coordinates. See section <a href="#org945cca5">3.3</a>.
</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_ao_basis_ao_vgl</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;">ao_vgl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<p>
Returns the array of values, gradients an Laplacian of the atomic orbitals
evaluated at the current coordinates.
See section <a href="#orgd6efc3d">5</a>.
</p>
<p>
Uses the given array to compute the VGL.
</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_ao_basis_ao_vgl_inplace</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;">ao_vgl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_ao_basis_ao_value</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;">ao_value</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
<p>
Returns the array of values of the atomic orbitals evaluated at
the current coordinates. See section <a href="#orgd6efc3d">5</a>.
</p>
<p>
Uses the given array to compute the value.
</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_ao_basis_ao_value_inplace</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;">ao_value</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="outline-container-orgd5e2694" class="outline-2">
<h2 id="orgd5e2694"><span class="section-number-2">3</span> Radial part</h2>
<div class="outline-text-2" id="text-3">
</div>
<div id="outline-container-orga6c8405" class="outline-3">
<h3 id="orga6c8405"><span class="section-number-3">3.1</span> General functions for 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
Laplacians at a given point of <code>n</code> Gaussian functions centered at
the same point:
</p>
<p>
\[ v_i = \exp(-a_i |X-R|^2) \]
\[ \nabla_x v_i = -2 a_i (X_x - R_x) v_i \]
\[ \nabla_y v_i = -2 a_i (X_y - R_y) v_i \]
\[ \nabla_z v_i = -2 a_i (X_z - R_z) v_i \]
\[ \Delta v_i = a_i (4 |X-R|^2 a_i - 6) v_i \]
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>context</code></td>
<td class="org-left"><code>qmckl_context</code></td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left"><code>X(3)</code></td>
<td class="org-left"><code>double[3]</code></td>
<td class="org-left">Array containing the coordinates of the points</td>
</tr>
<tr>
<td class="org-left"><code>R(3)</code></td>
<td class="org-left"><code>double[3]</code></td>
<td class="org-left">Array containing the x,y,z coordinates of the center</td>
</tr>
<tr>
<td class="org-left"><code>n</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">Number of computed Gaussians</td>
</tr>
<tr>
<td class="org-left"><code>A(n)</code></td>
<td class="org-left"><code>double[n]</code></td>
<td class="org-left">Exponents of the Gaussians</td>
</tr>
<tr>
<td class="org-left"><code>VGL(ldv,5)</code></td>
<td class="org-left"><code>double[5][ldv]</code></td>
<td class="org-left">Value, gradients and Laplacian of the Gaussians</td>
</tr>
<tr>
<td class="org-left"><code>ldv</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">Leading dimension of array <code>VGL</code></td>
</tr>
</tbody>
</table>
<p>
Requirements:
</p>
<ul class="org-ul">
<li><code>context</code> &ne; 0</li>
<li><code>n</code> &gt; 0</li>
<li><code>ldv</code> &gt;= 5</li>
<li><code>A(i)</code> &gt; 0 for all <code>i</code></li>
<li><code>X</code> is allocated with at least \(3 \times 8\) bytes</li>
<li><code>R</code> is allocated with at least \(3 \times 8\) bytes</li>
<li><code>A</code> is allocated with at least \(n \times 8\) bytes</li>
<li><code>VGL</code> is allocated with at least \(n \times 5 \times 8\) bytes</li>
</ul>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_ao_gaussian_vgl</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;">double</span> *<span style="color: #a0522d;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> *<span style="color: #a0522d;">R</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;">int64_t</span> *<span style="color: #a0522d;">A</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> *<span style="color: #a0522d;">VGL</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldv</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_ao_gaussian_vgl</span>(context, X, R, n, A, VGL, ldv) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C) <span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</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: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> X(3), R(3)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> n</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> ldv</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> A(n)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> VGL(ldv,5)</span>
<span style="color: #228b22;">integer</span> (qmckl_exit_code) ::<span style="color: #a0522d;"> info</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i,j</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> Y(3), r2, t, u, v</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> (n &lt;= 0) <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> (ldv &lt; n) <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;">do</span> i=1,3
Y(i) = X(i) - R(i)
<span style="color: #a020f0;">end do</span>
r2 = Y(1)*Y(1) + Y(2)*Y(2) + Y(3)*Y(3)
<span style="color: #a020f0;">do</span> i=1,n
VGL(i,1) = dexp(-A(i) * r2)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">do</span> i=1,n
VGL(i,5) = A(i) * VGL(i,1)
<span style="color: #a020f0;">end do</span>
t = -2.d0 * ( X(1) - R(1) )
u = -2.d0 * ( X(2) - R(2) )
v = -2.d0 * ( X(3) - R(3) )
<span style="color: #a020f0;">do</span> i=1,n
VGL(i,2) = t * VGL(i,5)
VGL(i,3) = u * VGL(i,5)
VGL(i,4) = v * VGL(i,5)
<span style="color: #a020f0;">end do</span>
t = 4.d0 * r2
<span style="color: #a020f0;">do</span> i=1,n
VGL(i,5) = (t * A(i) - 6.d0) * VGL(i,5)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_ao_gaussian_vgl</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org392e14d" class="outline-3">
<h3 id="org392e14d"><span class="section-number-3">3.2</span> Computation of primitives</h3>
<div class="outline-text-3" id="text-3-2">
<table id="orge060967" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">In/Out</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>context</code></td>
<td class="org-left"><code>qmckl_context</code></td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left"><code>prim_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of primitives</td>
</tr>
<tr>
<td class="org-left"><code>point_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of points considered</td>
</tr>
<tr>
<td class="org-left"><code>nucl_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of nuclei</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_prim_index</code></td>
<td class="org-left"><code>int64_t[nucl_num+1]</code></td>
<td class="org-left">in</td>
<td class="org-left">Index of the 1st primitive of each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>coord</code></td>
<td class="org-left"><code>double[3][point_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucl_coord</code></td>
<td class="org-left"><code>double[3][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Nuclear coordinates</td>
</tr>
<tr>
<td class="org-left"><code>expo</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Exponents of the primitives</td>
</tr>
<tr>
<td class="org-left"><code>primitive_vgl</code></td>
<td class="org-left"><code>double[point_num][5][prim_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Value, gradients and Laplacian of the primitives</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_compute_ao_basis_primitive_gaussian_vgl</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;">int64_t</span> <span style="color: #a0522d;">prim_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">point_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_prim_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">expo</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">primitive_vgl</span> );
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_compute_ao_basis_primitive_gaussian_vgl</span> <span style="color: #a020f0;">&amp;</span>
(context, prim_num, point_num, nucl_num, nucleus_prim_index, coord, nucl_coord, expo, primitive_vgl) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C) <span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>, <span style="color: #a020f0;">only</span>: qmckl_get_numprec_precision
<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: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> prim_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> point_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_prim_index(nucl_num+1)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord(point_num,3)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_coord(nucl_num,3)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> expo(prim_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> primitive_vgl(prim_num,5,point_num)</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code) ::<span style="color: #a0522d;"> info</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> inucl, iprim, ipoint</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, y, z, two_a, ar2, r2, v, cutoff</span>
info = QMCKL_SUCCESS
! <span style="color: #b22222;">Don't compute exponentials when the result will be almost zero.</span>
cutoff = qmckl_get_numprec_precision(context)
cutoff = dlog(2.d0**(cutoff-2))
<span style="color: #a020f0;">do</span> inucl=1,nucl_num
! <span style="color: #b22222;">C is zero-based, so shift bounds by one</span>
<span style="color: #a020f0;">do</span> iprim = nucleus_prim_index(inucl)+1, nucleus_prim_index(inucl+1)
<span style="color: #a020f0;">do</span> ipoint = 1, point_num
x = coord(ipoint,1) - nucl_coord(inucl,1)
y = coord(ipoint,2) - nucl_coord(inucl,2)
z = coord(ipoint,3) - nucl_coord(inucl,3)
r2 = x*x + y*y + z*z
ar2 = expo(iprim)*r2
<span style="color: #a020f0;">if</span> (ar2 &gt; cutoff) <span style="color: #a020f0;">cycle</span>
v = dexp(-ar2)
two_a = -2.d0 * expo(iprim) * v
primitive_vgl(iprim, 1, ipoint) = v
primitive_vgl(iprim, 2, ipoint) = two_a * x
primitive_vgl(iprim, 3, ipoint) = two_a * y
primitive_vgl(iprim, 4, ipoint) = two_a * z
primitive_vgl(iprim, 5, ipoint) = two_a * (3.d0 - 2.d0*ar2)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_ao_basis_primitive_gaussian_vgl</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org945cca5" class="outline-3">
<h3 id="org945cca5"><span class="section-number-3">3.3</span> Computation of shells</h3>
<div class="outline-text-3" id="text-3-3">
<table id="org6a75092" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">In/Out</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>context</code></td>
<td class="org-left"><code>qmckl_context</code></td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left"><code>prim_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of primitives</td>
</tr>
<tr>
<td class="org-left"><code>shell_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of shells</td>
</tr>
<tr>
<td class="org-left"><code>point_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of points</td>
</tr>
<tr>
<td class="org-left"><code>nucl_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of nuclei</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_shell_num</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of shells for each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_index</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Index of the 1st shell of each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_range</code></td>
<td class="org-left"><code>double[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Range of the nucleus</td>
</tr>
<tr>
<td class="org-left"><code>shell_prim_index</code></td>
<td class="org-left"><code>int64_t[shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Index of the 1st primitive of each shell</td>
</tr>
<tr>
<td class="org-left"><code>shell_prim_num</code></td>
<td class="org-left"><code>int64_t[shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of primitives per shell</td>
</tr>
<tr>
<td class="org-left"><code>coord</code></td>
<td class="org-left"><code>double[3][point_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucl_coord</code></td>
<td class="org-left"><code>double[3][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Nuclear coordinates</td>
</tr>
<tr>
<td class="org-left"><code>expo</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Exponents of the primitives</td>
</tr>
<tr>
<td class="org-left"><code>coef_normalized</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Coefficients of the primitives</td>
</tr>
<tr>
<td class="org-left"><code>shell_vgl</code></td>
<td class="org-left"><code>double[point_num][5][shell_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Value, gradients and Laplacian of the shells</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_compute_ao_basis_shell_gaussian_vgl</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;">int64_t</span> <span style="color: #a0522d;">prim_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">point_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucleus_range</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">shell_prim_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">shell_prim_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">expo</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coef_normalized</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">shell_vgl</span> );
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_compute_ao_basis_shell_gaussian_vgl</span>( <span style="color: #a020f0;">&amp;</span>
context, prim_num, shell_num, point_num, nucl_num, <span style="color: #a020f0;">&amp;</span>
nucleus_shell_num, nucleus_index, nucleus_range, <span style="color: #a020f0;">&amp;</span>
shell_prim_index, shell_prim_num, coord, nucl_coord, <span style="color: #a020f0;">&amp;</span>
expo, coef_normalized, shell_vgl) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C) <span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>, <span style="color: #a020f0;">only</span>: qmckl_get_numprec_precision
<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: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> prim_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> shell_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> point_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_shell_num(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_index(nucl_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_range(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_prim_index(shell_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_prim_num(shell_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord(point_num,3)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_coord(nucl_num,3)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> expo(prim_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coef_normalized(prim_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> shell_vgl(shell_num,5,point_num)</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code) ::<span style="color: #a0522d;"> info</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> inucl, iprim, ipoint, ishell</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> ishell_start, ishell_end</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> iprim_start , iprim_end</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, y, z, two_a, ar2, r2, v, cutoff</span>
info = QMCKL_SUCCESS
! <span style="color: #b22222;">Don't compute exponentials when the result will be almost zero.</span>
cutoff = qmckl_get_numprec_precision(context)
cutoff = dlog(2.d0**(cutoff-2))
<span style="color: #a020f0;">do</span> ipoint = 1, point_num
<span style="color: #a020f0;">do</span> inucl=1,nucl_num
x = coord(ipoint,1) - nucl_coord(inucl,1)
y = coord(ipoint,2) - nucl_coord(inucl,2)
z = coord(ipoint,3) - nucl_coord(inucl,3)
r2 = x*x + y*y + z*z
<span style="color: #a020f0;">if</span> (r2 &gt; cutoff*nucleus_range(inucl)) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">cycle</span>
<span style="color: #a020f0;">end if</span>
! <span style="color: #b22222;">C is zero-based, so shift bounds by one</span>
ishell_start = nucleus_index(inucl) + 1
ishell_end = nucleus_index(inucl) + nucleus_shell_num(inucl)
<span style="color: #a020f0;">do</span> ishell=ishell_start, ishell_end
shell_vgl(ishell, 1, ipoint) = 0.d0
shell_vgl(ishell, 2, ipoint) = 0.d0
shell_vgl(ishell, 3, ipoint) = 0.d0
shell_vgl(ishell, 4, ipoint) = 0.d0
shell_vgl(ishell, 5, ipoint) = 0.d0
iprim_start = shell_prim_index(ishell) + 1
iprim_end = shell_prim_index(ishell) + shell_prim_num(ishell)
<span style="color: #a020f0;">do</span> iprim = iprim_start, iprim_end
ar2 = expo(iprim)*r2
<span style="color: #a020f0;">if</span> (ar2 &gt; cutoff) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">cycle</span>
<span style="color: #a020f0;">end if</span>
v = coef_normalized(iprim) * dexp(-ar2)
two_a = -2.d0 * expo(iprim) * v
shell_vgl(ishell, 1, ipoint) = <span style="color: #a020f0;">&amp;</span>
shell_vgl(ishell, 1, ipoint) + v
shell_vgl(ishell, 2, ipoint) = <span style="color: #a020f0;">&amp;</span>
shell_vgl(ishell, 2, ipoint) + two_a * x
shell_vgl(ishell, 3, ipoint) = <span style="color: #a020f0;">&amp;</span>
shell_vgl(ishell, 3, ipoint) + two_a * y
shell_vgl(ishell, 4, ipoint) = <span style="color: #a020f0;">&amp;</span>
shell_vgl(ishell, 4, ipoint) + two_a * z
shell_vgl(ishell, 5, ipoint) = <span style="color: #a020f0;">&amp;</span>
shell_vgl(ishell, 5, ipoint) + two_a * (3.d0 - 2.d0*ar2)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_ao_basis_shell_gaussian_vgl</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org27da11b" class="outline-2">
<h2 id="org27da11b"><span class="section-number-2">4</span> Polynomial part</h2>
<div class="outline-text-2" id="text-4">
<p>
Going from the atomic basis set to AOs implies a systematic
construction of all the angular functions of each shell. We
consider two cases for the angular functions: the real-valued
spherical harmonics, and the polynomials in Cartesian coordinates.
In the case of spherical harmonics, the AOs are ordered in
increasing magnetic quantum number (\(-l \le m \le l\)), and in the
case of polynomials we choose the canonical ordering, i.e
</p>
\begin{eqnarray}
p & : & p_x, p_y, p_z \nonumber \\
d & : & d_{xx}, d_{xy}, d_{xz}, d_{yy}, d_{yz}, d_{zz} \nonumber \\
f & : & f_{xxx}, f_{xxy}, f_{xxz}, f_{xyy}, f_{xyz}, f_{xzz}, f_{yyy}, f_{yyz}, f_{yzz}, f_{zzz} \nonumber \\
{\rm etc.} \nonumber
\end{eqnarray}
</div>
<div id="outline-container-org9b8b808" class="outline-3">
<h3 id="org9b8b808"><span class="section-number-3">4.1</span> General functions for Powers of \(x-X_i\)</h3>
<div class="outline-text-3" id="text-4-1">
<p>
The <code>qmckl_ao_power</code> function computes all the powers of the <code>n</code>
input data up to the given maximum value given in input for each of
the \(n\) points:
</p>
<p>
\[ P_{ik} = X_i^k \]
</p>
<table id="orgef627ef" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">In/Out</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>context</code></td>
<td class="org-left"><code>qmckl_context</code></td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left"><code>n</code></td>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">in</td>
<td class="org-left">Number of values</td>
</tr>
<tr>
<td class="org-left"><code>X</code></td>
<td class="org-left">double[n]</td>
<td class="org-left">in</td>
<td class="org-left">Array containing the input values</td>
</tr>
<tr>
<td class="org-left"><code>LMAX</code></td>
<td class="org-left">int32<sub>t</sub>[n]</td>
<td class="org-left">in</td>
<td class="org-left">Array containing the maximum power for each value</td>
</tr>
<tr>
<td class="org-left"><code>P</code></td>
<td class="org-left">double[n][ldp]</td>
<td class="org-left">out</td>
<td class="org-left">Array containing all the powers of <code>X</code></td>
</tr>
<tr>
<td class="org-left"><code>ldp</code></td>
<td class="org-left">int64<sub>t</sub></td>
<td class="org-left">in</td>
<td class="org-left">Leading dimension of array <code>P</code></td>
</tr>
</tbody>
</table>
<p>
Requirements:
</p>
<ul class="org-ul">
<li><code>context</code> is not <code>QMCKL_NULL_CONTEXT</code></li>
<li><code>n</code> &gt; 0</li>
<li><code>X</code> is allocated with at least \(n \times 8\) bytes</li>
<li><code>LMAX</code> is allocated with at least \(n \times 4\) bytes</li>
<li><code>P</code> is allocated with at least \(n \times \max_i \text{LMAX}_i \times 8\) bytes</li>
<li><code>LDP</code> &gt;= \(\max_i\) <code>LMAX[i]</code></li>
</ul>
<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> (
<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;">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;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">LMAX</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">P</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldp</span> );
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_ao_power</span>(context, n, X, LMAX, P, ldp) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C) <span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</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: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> n</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> ldp</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> X(n)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> LMAX(n)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> P(ldp,n)</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code) ::<span style="color: #a0522d;"> info</span>
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int64_t</span>) ::<span style="color: #a0522d;"> i,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> (n &lt;= ldp) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
k = <span style="color: #a020f0;">MAXVAL</span>(LMAX)
<span style="color: #a020f0;">if</span> (LDP &lt; k) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_6
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (k &lt;= 0) <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;">do</span> i=1,n
P(1,i) = X(i)
<span style="color: #a020f0;">do</span> k=2,LMAX(i)
P(k,i) = P(k-1,i) * X(i)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_ao_power</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org6d33d56" class="outline-3">
<h3 id="org6d33d56"><span class="section-number-3">4.2</span> General functions for Value, Gradient and Laplacian of a polynomial</h3>
<div class="outline-text-3" id="text-4-2">
<p>
A polynomial is centered on a nucleus \(\mathbf{R}_i\)
</p>
<p>
\[
P_l(\mathbf{r},\mathbf{R}_i) = (x-X_i)^a (y-Y_i)^b (z-Z_i)^c
\]
</p>
<p>
The gradients with respect to electron coordinates are
</p>
\begin{eqnarray*}
\frac{\partial }{\partial x} P_l\left(\mathbf{r},\mathbf{R}_i \right) &
= & a (x-X_i)^{a-1} (y-Y_i)^b (z-Z_i)^c \\
\frac{\partial }{\partial y} P_l\left(\mathbf{r},\mathbf{R}_i \right) &
= & b (x-X_i)^a (y-Y_i)^{b-1} (z-Z_i)^c \\
\frac{\partial }{\partial z} P_l\left(\mathbf{r},\mathbf{R}_i \right) &
= & c (x-X_i)^a (y-Y_i)^b (z-Z_i)^{c-1} \\
\end{eqnarray*}
<p>
and the Laplacian is
</p>
\begin{eqnarray*}
\left( \frac{\partial }{\partial x^2} +
\frac{\partial }{\partial y^2} +
\frac{\partial }{\partial z^2} \right) P_l
\left(\mathbf{r},\mathbf{R}_i \right) & = &
a(a-1) (x-X_i)^{a-2} (y-Y_i)^b (z-Z_i)^c + \\
&& b(b-1) (x-X_i)^a (y-Y_i)^{b-2} (z-Z_i)^c + \\
&& c(c-1) (x-X_i)^a (y-Y_i)^b (z-Z_i)^{c-2}.
\end{eqnarray*}
<p>
<code>qmckl_ao_polynomial_vgl</code> computes the values, gradients and
Laplacians at a given point in space, of all polynomials with an
angular momentum up to <code>lmax</code>.
</p>
<table id="org22deb82" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">In/Out</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>context</code></td>
<td class="org-left"><code>qmckl_context</code></td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left"><code>X</code></td>
<td class="org-left"><code>double[3]</code></td>
<td class="org-left">in</td>
<td class="org-left">Array containing the coordinates of the points</td>
</tr>
<tr>
<td class="org-left"><code>R</code></td>
<td class="org-left"><code>double[3]</code></td>
<td class="org-left">in</td>
<td class="org-left">Array containing the x,y,z coordinates of the center</td>
</tr>
<tr>
<td class="org-left"><code>lmax</code></td>
<td class="org-left"><code>int32_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Maximum angular momentum</td>
</tr>
<tr>
<td class="org-left"><code>n</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">inout</td>
<td class="org-left">Number of computed polynomials</td>
</tr>
<tr>
<td class="org-left"><code>L</code></td>
<td class="org-left"><code>int32_t[n][ldl]</code></td>
<td class="org-left">out</td>
<td class="org-left">Contains a,b,c for all <code>n</code> results</td>
</tr>
<tr>
<td class="org-left"><code>ldl</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Leading dimension of <code>L</code></td>
</tr>
<tr>
<td class="org-left"><code>VGL</code></td>
<td class="org-left"><code>double[n][ldv]</code></td>
<td class="org-left">out</td>
<td class="org-left">Value, gradients and Laplacian of the polynomials</td>
</tr>
<tr>
<td class="org-left"><code>ldv</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Leading dimension of array <code>VGL</code></td>
</tr>
</tbody>
</table>
<p>
Requirements:
</p>
<ul class="org-ul">
<li><code>context</code> &ne; <code>QMCKL_NULL_CONTEXT</code></li>
<li><code>n</code> &gt; 0</li>
<li><code>lmax</code> &gt;= 0</li>
<li><code>ldl</code> &gt;= 3</li>
<li><code>ldv</code> &gt;= 5</li>
<li><code>X</code> is allocated with at least \(3 \times 8\) bytes</li>
<li><code>R</code> is allocated with at least \(3 \times 8\) bytes</li>
<li><code>n</code> &gt;= <code>(lmax+1)(lmax+2)(lmax+3)/6</code></li>
<li><code>L</code> is allocated with at least \(3 \times n \times 4\) bytes</li>
<li><code>VGL</code> is allocated with at least \(5 \times n \times 8\) bytes</li>
<li>On output, <code>n</code> should be equal to <code>(lmax+1)(lmax+2)(lmax+3)/6</code></li>
<li>On output, the powers are given in the following order (l=a+b+c):
<ul class="org-ul">
<li>Increasing values of <code>l</code></li>
<li>Within a given value of <code>l</code>, alphabetical order of the
string made by a*"x" + b*"y" + c*"z" (in Python notation).
For example, with a=0, b=2 and c=1 the string is "yyz"</li>
</ul></li>
</ul>
<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> (
<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;">double</span>* <span style="color: #a0522d;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">R</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">lmax</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">n</span>,
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">L</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">VGL</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldv</span> );
</pre>
</div>
<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_doc</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;">double</span>* <span style="color: #a0522d;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">R</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">lmax</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">n</span>,
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">L</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">VGL</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldv</span> );
</pre>
</div>
<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> (<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;">double</span>* <span style="color: #a0522d;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">R</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">lmax</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">n</span>,
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">L</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">VGL</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldv</span> )
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
//<span style="color: #b22222;">return qmckl_ao_polynomial_vgl_hpc (context, X, R, lmax, n, L, ldl, VGL, ldv);</span>
<span style="color: #a020f0;">return</span> qmckl_ao_polynomial_vgl_doc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_ao_polynomial_vgl_doc
<span style="color: #483d8b;">#endif</span>
(context, X, R, lmax, n, L, ldl, VGL, ldv);
}
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_ao_polynomial_vgl_doc</span> (context, <span style="color: #a020f0;">&amp;</span>
X, R, lmax, n, L, ldl, VGL, ldv) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C) <span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</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: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> X(3)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> R(3)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> lmax</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(inout) ::<span style="color: #a0522d;"> n</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> ldl</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> ldv</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> L(ldl,(lmax+1)*(lmax+2)*(lmax+3)/6)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> VGL(ldv,(lmax+1)*(lmax+2)*(lmax+3)/6)</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code) ::<span style="color: #a0522d;"> info</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i,j</span>
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> a,b,c,d</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> Y(3)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> pows(-2:lmax,3)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> xy, yz, xz</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> da, db, dc, dd</span>
info = 0
<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> (lmax &lt; 0) <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> (ldl &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> (ldv &lt; 5) <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;">do</span> i=1,3
Y(i) = X(i) - R(i)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">if</span> (lmax == 0) <span style="color: #a020f0;">then</span>
VGL(1,1) = 1.d0
VGL(2,1) = 0.d0
VGL(3,1) = 0.d0
VGL(4,1) = 0.d0
VGL(5,1) = 0.d0
l(1,1) = 0
l(2,1) = 0
l(3,1) = 0
n=1
<span style="color: #a020f0;">else if</span> (lmax &gt; 0) <span style="color: #a020f0;">then</span>
pows(-2:0,1:3) = 1.d0
<span style="color: #a020f0;">do</span> i=1,lmax
pows(i,1) = pows(i-1,1) * Y(1)
pows(i,2) = pows(i-1,2) * Y(2)
pows(i,3) = pows(i-1,3) * Y(3)
<span style="color: #a020f0;">end do</span>
VGL(1:5,1:4) = 0.d0
VGL(1,1) = 1.d0
VGL(1,2) = pows(1,1)
VGL(2,2) = 1.d0
VGL(1,3) = pows(1,2)
VGL(3,3) = 1.d0
VGL(1,4) = pows(1,3)
VGL(4,4) = 1.d0
l (1:3,1:4) = 0
l (1,2) = 1
l (2,3) = 1
l (3,4) = 1
n=4
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">l&gt;=2</span>
dd = 2.d0
<span style="color: #a020f0;">do</span> d=2,lmax
da = dd
<span style="color: #a020f0;">do</span> a=d,0,-1
db = dd-da
<span style="color: #a020f0;">do</span> b=d-a,0,-1
c = d - a - b
dc = dd - da - db
n = n+1
l(1,n) = a
l(2,n) = b
l(3,n) = c
xy = pows(a,1) * pows(b,2)
yz = pows(b,2) * pows(c,3)
xz = pows(a,1) * pows(c,3)
VGL(1,n) = xy * pows(c,3)
xy = dc * xy
xz = db * xz
yz = da * yz
VGL(2,n) = pows(a-1,1) * yz
VGL(3,n) = pows(b-1,2) * xz
VGL(4,n) = pows(c-1,3) * xy
VGL(5,n) = <span style="color: #a020f0;">&amp;</span>
(da-1.d0) * pows(a-2,1) * yz + <span style="color: #a020f0;">&amp;</span>
(db-1.d0) * pows(b-2,2) * xz + <span style="color: #a020f0;">&amp;</span>
(dc-1.d0) * pows(c-2,3) * xy
db = db - 1.d0
<span style="color: #a020f0;">end do</span>
da = da - 1.d0
<span style="color: #a020f0;">end do</span>
dd = dd + 1.d0
<span style="color: #a020f0;">end do</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_ao_polynomial_vgl_doc</span>
</pre>
</div>
<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_transp_vgl</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;">double</span>* <span style="color: #a0522d;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">R</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">lmax</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">n</span>,
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">L</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">VGL</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldv</span> );
</pre>
</div>
<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_transp_vgl_doc</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;">double</span>* <span style="color: #a0522d;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">R</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">lmax</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">n</span>,
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">L</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">VGL</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldv</span> );
</pre>
</div>
<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_transp_vgl_hpc</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;">double</span>* <span style="color: #a0522d;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">R</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">lmax</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">n</span>,
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">L</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">VGL</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldv</span> );
</pre>
</div>
<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_transp_vgl</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;">double</span>* <span style="color: #a0522d;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">R</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">lmax</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">n</span>,
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">L</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">VGL</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldv</span> )
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_ao_polynomial_transp_vgl_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_ao_polynomial_transp_vgl_doc
<span style="color: #483d8b;">#endif</span>
(context, X, R, lmax, n, L, ldl, VGL, ldv);
}
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_ao_polynomial_transp_vgl_doc</span> (context, <span style="color: #a020f0;">&amp;</span>
X, R, lmax, n, L, ldl, VGL, ldv) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C) <span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</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: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> X(3)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> R(3)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> lmax</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(inout) ::<span style="color: #a0522d;"> n</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> ldl</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> ldv</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> L(ldl,(lmax+1)*(lmax+2)*(lmax+3)/6)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> VGL(ldv,5)</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code) ::<span style="color: #a0522d;"> info</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i,j</span>
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> a,b,c,d</span>
<span style="color: #228b22;">real</span>*8 ::<span style="color: #a0522d;"> Y(3)</span>
<span style="color: #228b22;">real</span>*8 ::<span style="color: #a0522d;"> pows(-2:21,3) </span>! <span style="color: #b22222;">lmax &lt; 22</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> xy, yz, xz</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> da, db, dc, dd</span>
info = 0
<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> (lmax &lt; 0) <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> (ldl &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> (ldv &lt; (lmax+1)*(lmax+2)*(lmax+3)/6) <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> (lmax &gt; 0) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">do</span> i=1,3
Y(i) = X(i) - R(i)
<span style="color: #a020f0;">end do</span>
pows(-2:0,1:3) = 1.d0
<span style="color: #a020f0;">do</span> i=1,lmax
pows(i,1) = pows(i-1,1) * Y(1)
pows(i,2) = pows(i-1,2) * Y(2)
pows(i,3) = pows(i-1,3) * Y(3)
<span style="color: #a020f0;">end do</span>
l (1:3,1:4) = 0
VGL(1:4,1:5) = 0.d0
VGL(1 ,1 ) = 1.d0
l (1,2) = 1
VGL(2,1) = Y(1)
VGL(2,2) = 1.d0
l (2,3) = 1
VGL(3,1) = Y(2)
VGL(3,3) = 1.d0
l (3,4) = 1
VGL(4,1) = Y(3)
VGL(4,4) = 1.d0
n=4
<span style="color: #a020f0;">else</span>
VGL(1,1) = 1.d0
VGL(1,2:5) = 0.d0
l(1:3,1) = 0
n=1
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">l&gt;=2</span>
dd = 2.d0
<span style="color: #a020f0;">do</span> d=2,lmax
da = dd
<span style="color: #a020f0;">do</span> a=d,0,-1
db = dd-da
<span style="color: #a020f0;">do</span> b=d-a,0,-1
c = d - a - b
dc = dd - da - db
n = n+1
xy = pows(a,1) * pows(b,2)
yz = pows(b,2) * pows(c,3)
xz = pows(a,1) * pows(c,3)
l(1,n) = a
l(2,n) = b
l(3,n) = c
VGL(n,1) = xy * pows(c,3)
xy = dc * xy
xz = db * xz
yz = da * yz
VGL(n,2) = pows(a-1,1) * yz
VGL(n,3) = pows(b-1,2) * xz
VGL(n,4) = pows(c-1,3) * xy
VGL(n,5) = <span style="color: #a020f0;">&amp;</span>
(da-1.d0) * pows(a-2,1) * yz + <span style="color: #a020f0;">&amp;</span>
(db-1.d0) * pows(b-2,2) * xz + <span style="color: #a020f0;">&amp;</span>
(dc-1.d0) * pows(c-2,3) * xy
db = db - 1.d0
<span style="color: #a020f0;">end do</span>
da = da - 1.d0
<span style="color: #a020f0;">end do</span>
dd = dd + 1.d0
<span style="color: #a020f0;">end do</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_ao_polynomial_transp_vgl_doc</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #a020f0;">static</span> <span style="color: #a020f0;">inline</span> <span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_ao_polynomial_transp_vgl_hpc_inline</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;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">R</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">lmax</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">n</span>,
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">L</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">VGL</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldv</span> )
{
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context_struct</span>* <span style="color: #a0522d;">ctx</span> = (<span style="color: #228b22;">qmckl_context_struct</span>*) context;
assert (ctx != <span style="color: #008b8b;">NULL</span> &amp;&amp; X != <span style="color: #008b8b;">NULL</span> &amp;&amp; R != <span style="color: #008b8b;">NULL</span> &amp;&amp; n != <span style="color: #008b8b;">NULL</span> &amp;&amp; L != <span style="color: #008b8b;">NULL</span> &amp;&amp; VGL != <span style="color: #008b8b;">NULL</span>);
<span style="color: #a020f0;">if</span> (lmax &lt; 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_4;
<span style="color: #a020f0;">if</span> (ldl &lt; 3) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_7;
<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">m</span>;
<span style="color: #a020f0;">switch</span> (lmax) {
<span style="color: #a020f0;">case</span> 0:
{
<span style="color: #a020f0;">if</span> (ldv &lt; 1) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_9;
L[0] = 0; L[1] = 0; L[2] = 0;
VGL[0 ] = 1.0;
VGL[ldv ] = 0.0;
VGL[ldv&lt;&lt;1 ] = 0.0;
VGL[(ldv&lt;&lt;1)+ldv] = 0.0;
VGL[ldv&lt;&lt;2 ] = 0.0;
m=1;
<span style="color: #a020f0;">break</span>;
}
<span style="color: #a020f0;">case</span> 1:
{
<span style="color: #a020f0;">if</span> (ldv &lt; 4) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_9;
<span style="color: #a020f0;">if</span> (ldl == 3) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">ltmp</span>[12] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1};
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;12 ; ++i)
L[i] = ltmp[i];
} <span style="color: #a020f0;">else</span> {
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">l</span>[4] = {L, L+ldl, L+(ldl&lt;&lt;1), L+ldl+(ldl&lt;&lt;1)};
l[0][0] = 0; l[0][1] = 0; l[0][2] = 0;
l[1][0] = 1; l[1][1] = 0; l[1][2] = 0;
l[2][0] = 0; l[2][1] = 1; l[2][2] = 0;
l[3][0] = 0; l[3][1] = 0; l[3][2] = 1;
}
<span style="color: #a020f0;">if</span> (ldv == 4) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">tmp</span>[20] = {1.0, X[0]-R[0], X[1]-R[1], X[2]-R[2],
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
0.0, 0.0, 0.0, 0.0};
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;20 ; ++i)
VGL[i] = tmp[i];
} <span style="color: #a020f0;">else</span> {
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl1</span> = VGL;
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl2</span> = VGL + ldv;
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl3</span> = VGL + (ldv &lt;&lt; 1);
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl4</span> = VGL + ldv + (ldv &lt;&lt; 1);
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl5</span> = VGL + (ldv &lt;&lt; 2);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">k</span>=0 ; k&lt;4 ; ++k) {
vgl2[k] = 0.0;
vgl3[k] = 0.0;
vgl4[k] = 0.0;
vgl5[k] = 0.0;
}
vgl1[0] = 1.0;
vgl1[1] = X[0]-R[0];
vgl1[2] = X[1]-R[1];
vgl1[3] = X[2]-R[2];
vgl2[1] = 1.0;
vgl3[2] = 1.0;
vgl4[3] = 1.0;
}
m=4;
<span style="color: #a020f0;">break</span>;
}
<span style="color: #a020f0;">case</span> 2:
{
<span style="color: #a020f0;">if</span> (ldv &lt; 10) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_9;
<span style="color: #a020f0;">if</span> (ldl == 3) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">ltmp</span>[30] = {0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0, 1,
2, 0, 0, 1, 1, 0, 1, 0, 1, 0, 2, 0,
0, 1, 1, 0, 0, 2};
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;30 ; ++i)
L[i] = ltmp[i];
} <span style="color: #a020f0;">else</span> {
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">l</span>[10];
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;10 ; ++i) {
l[i] = L + i*ldl;
}
l[0][0] = 0; l[0][1] = 0; l[0][2] = 0;
l[1][0] = 1; l[1][1] = 0; l[1][2] = 0;
l[2][0] = 0; l[2][1] = 1; l[2][2] = 0;
l[3][0] = 0; l[3][1] = 0; l[3][2] = 1;
l[4][0] = 2; l[4][1] = 0; l[4][2] = 0;
l[5][0] = 1; l[5][1] = 1; l[5][2] = 0;
l[6][0] = 1; l[6][1] = 0; l[6][2] = 1;
l[7][0] = 0; l[7][1] = 2; l[7][2] = 0;
l[8][0] = 0; l[8][1] = 1; l[8][2] = 1;
l[9][0] = 0; l[9][1] = 0; l[9][2] = 2;
}
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">Y</span>[3] = { X[0]-R[0],
X[1]-R[1],
X[2]-R[2] };
<span style="color: #a020f0;">if</span> (ldv == 50) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">tmp</span>[50] = {
1.0, Y[0], Y[1], Y[2], Y[0] * Y[0],
Y[0] * Y[1], Y[0] * Y[2], Y[1] * Y[1], Y[1] * Y[2], Y[2] * Y[2],
0.0, 1.0, 0.0, 0.0, Y[0] + Y[0],
Y[1], Y[2], 0.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0, 0.0,
Y[0], 0.0, Y[1] + Y[1], Y[2], 0.0,
0.0, 0.0, 0.0, 1.0, 0.0,
0.0, Y[0], 0.0, Y[1], Y[2] + Y[2],
0.0, 0.0, 0.0, 0.0, 2.0,
0.0, 0.0, 2.0, 0., 2.0 };
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;50 ; ++i)
VGL[i] = tmp[i];
} <span style="color: #a020f0;">else</span> {
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl1</span> = VGL;
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl2</span> = VGL + ldv;
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl3</span> = VGL + (ldv &lt;&lt; 1);
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl4</span> = VGL + 3*ldv;
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl5</span> = VGL + (ldv &lt;&lt; 2);
vgl1[0] = 1.0 ; vgl1[1] = Y[0] ; vgl1[2] = Y[1];
vgl1[3] = Y[2] ; vgl1[4] = Y[0]*Y[0]; vgl1[5] = Y[0]*Y[1];
vgl1[6] = Y[0]*Y[2]; vgl1[7] = Y[1]*Y[1]; vgl1[8] = Y[1]*Y[2];
vgl1[9] = Y[2]*Y[2];
vgl2[0] = 0.0 ; vgl2[1] = 1.0 ; vgl2[2] = 0.0 ;
vgl2[3] = 0.0 ; vgl2[4] = Y[0]+Y[0]; vgl2[5] = Y[1];
vgl2[6] = Y[2]; vgl2[7] = 0.0 ; vgl2[8] = 0.0 ;
vgl2[9] = 0.0 ;
vgl3[0] = 0.0; vgl3[1] = 0.0 ; vgl3[2] = 1.0 ;
vgl3[3] = 0.0; vgl3[4] = 0.0 ; vgl3[5] = Y[0];
vgl3[6] = 0.0; vgl3[7] = Y[1]+Y[1]; vgl3[8] = Y[2];
vgl3[9] = 0.0;
vgl4[0] = 0.0 ; vgl4[1] = 0.0; vgl4[2] = 0.0 ;
vgl4[3] = 1.0 ; vgl4[4] = 0.0; vgl4[5] = 0.0 ;
vgl4[6] = Y[0] ; vgl4[7] = 0.0; vgl4[8] = Y[1];
vgl4[9] = Y[2]+Y[2];
vgl5[0] = 0.0; vgl5[1] = 0.0; vgl5[2] = 0.0;
vgl5[3] = 0.0; vgl5[4] = 2.0; vgl5[5] = 0.0;
vgl5[6] = 0.0; vgl5[7] = 2.0; vgl5[8] = 0.0;
vgl5[9] = 2.0;
}
m=10;
<span style="color: #a020f0;">break</span>;
}
<span style="color: #a020f0;">default</span>:
{
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">size_max</span> = (lmax+1)*(lmax+2)*(lmax+3)/6;
<span style="color: #a020f0;">if</span> (ldv &lt; size_max) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_9;
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl1</span> = VGL;
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl2</span> = VGL + ldv;
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl3</span> = VGL + (ldv&lt;&lt;1);
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl4</span> = VGL + ldv + (ldv&lt;&lt;1);
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">vgl5</span> = VGL + (ldv&lt;&lt;2);
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">Y</span>[3] = { X[0]-R[0],
X[1]-R[1],
X[2]-R[2] };
assert(size_max &gt; lmax+3);
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">pows</span>[3][size_max];
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;3 ; ++i) {
pows[0][i] = 1.0;
pows[1][i] = 1.0;
pows[2][i] = 1.0;
}
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">i</span>=3 ; i&lt;=lmax+2 ; ++i) {
pows[0][i] = pows[0][i-1] * Y[0];
pows[1][i] = pows[1][i-1] * Y[1];
pows[2][i] = pows[2][i-1] * Y[2];
}
<span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">l</span>[size_max];
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;size_max ; ++i) {
l[i] = &amp;(L[i*ldl]);
}
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;4 ; ++i) {
l[i][0] = 0;
l[i][1] = 0;
l[i][2] = 0;
}
l[1][0] = 1;
l[2][1] = 1;
l[3][2] = 1;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">k</span>=0 ; k&lt;4 ; ++k) {
vgl2[k] = 0.0;
vgl3[k] = 0.0;
vgl4[k] = 0.0;
vgl5[k] = 0.0;
}
vgl1[0] = 1.0;
vgl1[1] = Y[0];
vgl1[2] = Y[1];
vgl1[3] = Y[2];
vgl2[1] = 1.0;
vgl3[2] = 1.0;
vgl4[3] = 1.0;
m=4;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">dd</span> = 2.0;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">d</span>=2 ; d&lt;= lmax ; ++d) {
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">da</span> = dd;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">a</span>=d ; a&gt;=0 ; --a) {
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">db</span> = dd-da;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">b</span>=d-a ; b&gt;=0 ; --b) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">c</span> = d - a - b;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">dc</span> = dd - da - db;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">xy</span> = pows[0][a+2] * pows[1][b+2];
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">yz</span> = pows[1][b+2] * pows[2][c+2];
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">xz</span> = pows[0][a+2] * pows[2][c+2];
l[m][0] = a;
l[m][1] = b;
l[m][2] = c;
vgl1[m] = xy * pows[2][c+2];
xy *= dc;
xz *= db;
yz *= da;
vgl2[m] = pows[0][a+1] * yz;
vgl3[m] = pows[1][b+1] * xz;
vgl4[m] = pows[2][c+1] * xy;
vgl5[m] = (da-1.) * pows[0][a] * yz +
(db-1.) * pows[1][b] * xz +
(dc-1.) * pows[2][c] * xy;
db -= 1.0;
++m;
}
da -= 1.0;
}
dd += 1.0;
}
}
}
*n = m;
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
}
<span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_ao_polynomial_transp_vgl_hpc</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;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">X</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">R</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">lmax</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">n</span>,
<span style="color: #228b22;">int32_t</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">L</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">VGL</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ldv</span> )
{
<span style="color: #a020f0;">return</span> qmckl_ao_polynomial_transp_vgl_hpc_inline (context,
X, R, lmax, n, L, ldl, VGL, ldv );
}
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgd6efc3d" class="outline-2">
<h2 id="orgd6efc3d"><span class="section-number-2">5</span> Combining radial and polynomial parts</h2>
<div class="outline-text-2" id="text-5">
</div>
<div id="outline-container-orgffd133a" class="outline-3">
<h3 id="orgffd133a"><span class="section-number-3">5.1</span> Determination of nucleus ranges</h3>
<div class="outline-text-3" id="text-5-1">
<p>
The range of a nucleus is defined as the distance beyond which all
the AOs are zero, up to a given precision. For all possible numbers
of bits of precision (1-53), a range is given.
</p>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_compute_nucleus_range_gaussian</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;">int64_t</span> <span style="color: #a0522d;">ao_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">prim_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">nucleus_max_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">shell_prim_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">shell_prim_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">shell_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ao_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ao_expo</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coefficient_normalized</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">nucleus_range</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_compute_nucleus_range_gaussian</span>(context, <span style="color: #a020f0;">&amp;</span>
ao_num, shell_num, prim_num, nucl_num, <span style="color: #a020f0;">&amp;</span>
nucl_coord, nucleus_index, nucleus_shell_num, <span style="color: #a020f0;">&amp;</span>
nucleus_max_ang_mom, shell_prim_index, shell_prim_num, shell_ang_mom, <span style="color: #a020f0;">&amp;</span>
ao_factor, expo, coef_normalized, nucleus_range) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C) <span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>, <span style="color: #a020f0;">only</span>: qmckl_ao_polynomial_vgl, qmckl_get_numprec_precision
<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: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> ao_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> shell_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> prim_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_coord(nucl_num,3)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_index(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_shell_num(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_max_ang_mom(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_prim_index(shell_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_prim_num(shell_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_ang_mom(shell_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> ao_factor(ao_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> expo(prim_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coef_normalized(prim_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> nucleus_range(nucl_num,53)</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code) ::<span style="color: #a0522d;"> info</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> e_coord(3), n_coord(3)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> n_poly, iprim, iprim_start, iprim_end</span>
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> l, il, k, iprecision</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> ipoint, inucl, ishell</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> ishell_start, ishell_end</span>
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> lstart(0:20)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> shell_vgl(3)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, y, z, r2, ar2, two_a</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> vmax, cutoff, v</span>
<span style="color: #228b22;">double precision</span>, <span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> poly_vgl(:,:), ao_vgl(:,:)</span>
<span style="color: #228b22;">integer</span> , <span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> powers(:,:), ao_index(:)</span>
<span style="color: #a020f0;">allocate</span>(poly_vgl(5,ao_num), powers(3,ao_num), ao_index(ao_num))
! <span style="color: #b22222;">Pre-computed data</span>
<span style="color: #a020f0;">do</span> l=0,20
lstart(l) = l*(l+1)*(l+2)/6 +1
<span style="color: #a020f0;">end do</span>
k=1
<span style="color: #a020f0;">do</span> inucl=1,nucl_num
ishell_start = nucleus_index(inucl) + 1
ishell_end = nucleus_index(inucl) + nucleus_shell_num(inucl)
<span style="color: #a020f0;">do</span> ishell = ishell_start, ishell_end
l = shell_ang_mom(ishell)
ao_index(ishell) = k
k = k + lstart(l+1) - lstart(l)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
info = QMCKL_SUCCESS
n_coord(1) = 0.d0
n_coord(2) = 0.d0
n_coord(3) = 0.d0
e_coord(2) = 0.d0
e_coord(3) = 0.d0
nucleus_range = 50.d0
<span style="color: #a020f0;">do</span> inucl=1,nucl_num
x = 50.d0
<span style="color: #a020f0;">do</span> iprecision = 53,2,-1
cutoff = 1.d0 / ( 2.d0** (iprecision-2) )
vmax = 0.d0
<span style="color: #a020f0;">do while</span> ( (vmax &lt; cutoff) <span style="color: #a020f0;">.and.</span> (x &gt; 0.d0) )
x = x - .1d0
vmax = 0.d0
e_coord(1) = x
r2 = x*x
! <span style="color: #b22222;">Compute polynomials</span>
info = qmckl_ao_polynomial_vgl(context, e_coord, n_coord, <span style="color: #a020f0;">&amp;</span>
nucleus_max_ang_mom(inucl), n_poly, powers, 3_8, <span style="color: #a020f0;">&amp;</span>
poly_vgl, 5_8)
! <span style="color: #b22222;">Loop over shells</span>
ishell_start = nucleus_index(inucl) + 1
ishell_end = nucleus_index(inucl) + nucleus_shell_num(inucl)
<span style="color: #a020f0;">do</span> ishell = ishell_start, ishell_end
shell_vgl(1) = 0.d0
shell_vgl(2) = 0.d0
shell_vgl(3) = 0.d0
iprim_start = shell_prim_index(ishell) + 1
iprim_end = shell_prim_index(ishell) + shell_prim_num(ishell)
<span style="color: #a020f0;">do</span> iprim = iprim_start, iprim_end
ar2 = expo(iprim)*r2
v = coef_normalized(iprim) * dexp(-ar2)
two_a = -2.d0 * expo(iprim) * v
shell_vgl(1) = shell_vgl(1) + v
shell_vgl(2) = shell_vgl(2) + two_a * x
shell_vgl(3) = shell_vgl(3) + two_a * (3.d0 - 2.d0*ar2)
<span style="color: #a020f0;">end do</span>
k = ao_index(ishell)
l = shell_ang_mom(ishell)
<span style="color: #a020f0;">do</span> il = lstart(l), lstart(l+1)-1
vmax = <span style="color: #a020f0;">max</span>(vmax, poly_vgl(1,il) * shell_vgl(1) * ao_factor(k))
vmax = <span style="color: #a020f0;">max</span>(vmax, ( poly_vgl(2,il) * shell_vgl(1) + poly_vgl(1,il) * shell_vgl(2) ) * ao_factor(k))
vmax = <span style="color: #a020f0;">max</span>(vmax, ( poly_vgl(5,il) * shell_vgl(3) + poly_vgl(1,il) * shell_vgl(3) + <span style="color: #a020f0;">&amp;</span>
2.d0 * (poly_vgl(2,il) * shell_vgl(2) ) ) * ao_factor(k) )
k = k+1
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
nucleus_range(inucl,iprecision) = x
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">deallocate</span>(poly_vgl, powers)
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_nucleus_range_gaussian</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org1c2cc61" class="outline-3">
<h3 id="org1c2cc61"><span class="section-number-3">5.2</span> Values only</h3>
<div class="outline-text-3" id="text-5-2">
</div>
<div id="outline-container-org8ac7a82" class="outline-4">
<h4 id="org8ac7a82"><span class="section-number-4">5.2.1</span> Unoptimized version</h4>
<div class="outline-text-4" id="text-5-2-1">
<table id="org97dbce5" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">In/Out</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>context</code></td>
<td class="org-left"><code>qmckl_context</code></td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left"><code>ao_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of AOs</td>
</tr>
<tr>
<td class="org-left"><code>shell_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of shells</td>
</tr>
<tr>
<td class="org-left"><code>point_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of points</td>
</tr>
<tr>
<td class="org-left"><code>nucl_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of nuclei</td>
</tr>
<tr>
<td class="org-left"><code>coord</code></td>
<td class="org-left"><code>double[3][point_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucl_coord</code></td>
<td class="org-left"><code>double[3][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Nuclear coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_index</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Index of the 1st shell of each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_shell_num</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of shells per nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_range</code></td>
<td class="org-left"><code>double[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Range beyond which all is zero</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_max_ang_mom</code></td>
<td class="org-left"><code>int32_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Maximum angular momentum per nucleus</td>
</tr>
<tr>
<td class="org-left"><code>shell_ang_mom</code></td>
<td class="org-left"><code>int32_t[shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Angular momentum of each shell</td>
</tr>
<tr>
<td class="org-left"><code>ao_factor</code></td>
<td class="org-left"><code>double[ao_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Normalization factor of the AOs</td>
</tr>
<tr>
<td class="org-left"><code>shell_vgl</code></td>
<td class="org-left"><code>double[point_num][5][shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Value, gradients and Laplacian of the shells</td>
</tr>
<tr>
<td class="org-left"><code>ao_value</code></td>
<td class="org-left"><code>double[point_num][ao_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Values of the AOs</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_compute_ao_value_doc</span>(context, <span style="color: #a020f0;">&amp;</span>
ao_num, shell_num, point_num, nucl_num, <span style="color: #a020f0;">&amp;</span>
coord, nucl_coord, nucleus_index, nucleus_shell_num, <span style="color: #a020f0;">&amp;</span>
nucleus_range, nucleus_max_ang_mom, shell_ang_mom, <span style="color: #a020f0;">&amp;</span>
ao_factor, shell_vgl, ao_value) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C) <span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>, <span style="color: #a020f0;">only</span>: qmckl_ao_polynomial_vgl, qmckl_get_numprec_precision
<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: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> ao_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> shell_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> point_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord(point_num,3)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_coord(nucl_num,3)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_index(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_shell_num(nucl_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_range(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_max_ang_mom(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_ang_mom(shell_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> ao_factor(ao_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_vgl(shell_num,5,point_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> ao_value(ao_num,point_num)</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code) ::<span style="color: #a0522d;"> info</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> e_coord(3), n_coord(3)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> n_poly</span>
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> l, il, k</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> ipoint, inucl, ishell</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> ishell_start, ishell_end</span>
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> lstart(0:20)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, y, z, r2</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> cutoff</span>
<span style="color: #228b22;">double precision</span>, <span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> poly_vgl(:,:)</span>
<span style="color: #228b22;">integer</span> , <span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> powers(:,:), ao_index(:)</span>
<span style="color: #a020f0;">allocate</span>(poly_vgl(5,ao_num), powers(3,ao_num), ao_index(ao_num))
! <span style="color: #b22222;">Pre-computed data</span>
<span style="color: #a020f0;">do</span> l=0,20
lstart(l) = l*(l+1)*(l+2)/6 +1
<span style="color: #a020f0;">end do</span>
k=1
<span style="color: #a020f0;">do</span> inucl=1,nucl_num
ishell_start = nucleus_index(inucl) + 1
ishell_end = nucleus_index(inucl) + nucleus_shell_num(inucl)
<span style="color: #a020f0;">do</span> ishell = ishell_start, ishell_end
l = shell_ang_mom(ishell)
ao_index(ishell) = k
k = k + lstart(l+1) - lstart(l)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
info = QMCKL_SUCCESS
! <span style="color: #b22222;">Don't compute polynomials when the radial part is zero.</span>
cutoff = qmckl_get_numprec_precision(context)
cutoff = dlog(2.d0**(cutoff-2))
<span style="color: #a020f0;">do</span> ipoint = 1, point_num
e_coord(1) = coord(ipoint,1)
e_coord(2) = coord(ipoint,2)
e_coord(3) = coord(ipoint,3)
ao_value(:,ipoint) = 0.d0
<span style="color: #a020f0;">do</span> inucl=1,nucl_num
n_coord(1) = nucl_coord(inucl,1)
n_coord(2) = nucl_coord(inucl,2)
n_coord(3) = nucl_coord(inucl,3)
! <span style="color: #b22222;">Test if the point is in the range of the nucleus</span>
x = e_coord(1) - n_coord(1)
y = e_coord(2) - n_coord(2)
z = e_coord(3) - n_coord(3)
r2 = x*x + y*y + z*z
<span style="color: #a020f0;">if</span> (r2 &gt; cutoff*nucleus_range(inucl)) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">cycle</span>
<span style="color: #a020f0;">end if</span>
! <span style="color: #b22222;">Compute polynomials</span>
info = qmckl_ao_polynomial_vgl(context, e_coord, n_coord, <span style="color: #a020f0;">&amp;</span>
nucleus_max_ang_mom(inucl), n_poly, powers, 3_8, <span style="color: #a020f0;">&amp;</span>
poly_vgl, 5_8)
! <span style="color: #b22222;">Loop over shells</span>
ishell_start = nucleus_index(inucl) + 1
ishell_end = nucleus_index(inucl) + nucleus_shell_num(inucl)
<span style="color: #a020f0;">do</span> ishell = ishell_start, ishell_end
k = ao_index(ishell)
l = shell_ang_mom(ishell)
<span style="color: #a020f0;">do</span> il = lstart(l), lstart(l+1)-1
! <span style="color: #b22222;">Value</span>
ao_value(k,ipoint) = <span style="color: #a020f0;">&amp;</span>
poly_vgl(1,il) * shell_vgl(ishell,1,ipoint) * ao_factor(k)
k = k+1
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">deallocate</span>(poly_vgl, powers)
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_ao_value_doc</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org0946ac9" class="outline-4">
<h4 id="org0946ac9"><span class="section-number-4">5.2.2</span> HPC version</h4>
<div class="outline-text-4" id="text-5-2-2">
<table id="orgff7656d" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">In/Out</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>context</code></td>
<td class="org-left"><code>qmckl_context</code></td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left"><code>ao_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of AOs</td>
</tr>
<tr>
<td class="org-left"><code>shell_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of shells</td>
</tr>
<tr>
<td class="org-left"><code>prim_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of primitives</td>
</tr>
<tr>
<td class="org-left"><code>point_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of points</td>
</tr>
<tr>
<td class="org-left"><code>nucl_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of nuclei</td>
</tr>
<tr>
<td class="org-left"><code>coord</code></td>
<td class="org-left"><code>double[3][point_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucl_coord</code></td>
<td class="org-left"><code>double[3][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Nuclear coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_index</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Index of the 1st shell of each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_shell_num</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of shells per nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_range</code></td>
<td class="org-left"><code>double[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Range beyond which all is zero</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_max_ang_mom</code></td>
<td class="org-left"><code>int32_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Maximum angular momentum per nucleus</td>
</tr>
<tr>
<td class="org-left"><code>shell_ang_mom</code></td>
<td class="org-left"><code>int32_t[shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Angular momentum of each shell</td>
</tr>
<tr>
<td class="org-left"><code>shell_prim_index</code></td>
<td class="org-left"><code>int64_t[shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Index of the 1st primitive of each shell</td>
</tr>
<tr>
<td class="org-left"><code>shell_prim_num</code></td>
<td class="org-left"><code>int64_t[shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of primitives per shell</td>
</tr>
<tr>
<td class="org-left"><code>ao_factor</code></td>
<td class="org-left"><code>double[ao_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Normalization factor of the AOs</td>
</tr>
<tr>
<td class="org-left"><code>ao_expo</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Value, gradients and Laplacian of the shells</td>
</tr>
<tr>
<td class="org-left"><code>coef_normalized</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Value, gradients and Laplacian of the shells</td>
</tr>
<tr>
<td class="org-left"><code>ao_value</code></td>
<td class="org-left"><code>double[point_num][ao_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Values of the AOs</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org30c6a36" class="outline-4">
<h4 id="org30c6a36"><span class="section-number-4">5.2.3</span> Interfaces</h4>
<div class="outline-text-4" id="text-5-2-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_compute_ao_value_doc</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;">int64_t</span> <span style="color: #a0522d;">ao_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">point_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucleus_range</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">nucleus_max_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">shell_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ao_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">shell_vgl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ao_value</span> );
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_compute_ao_value_hpc_gaussian</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;">int64_t</span> <span style="color: #a0522d;">ao_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">prim_num_per_nucleus</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">point_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucleus_range</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">nucleus_max_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">shell_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ao_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_matrix</span> <span style="color: #a0522d;">expo_per_nucleus</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_tensor</span> <span style="color: #a0522d;">coef_per_nucleus</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ao_value</span> );
<span style="color: #483d8b;">#endif</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgb413cac" class="outline-3">
<h3 id="orgb413cac"><span class="section-number-3">5.3</span> Value, gradients, Laplacian</h3>
<div class="outline-text-3" id="text-5-3">
</div>
<div id="outline-container-org11f7df7" class="outline-4">
<h4 id="org11f7df7"><span class="section-number-4">5.3.1</span> Reference version</h4>
<div class="outline-text-4" id="text-5-3-1">
<table id="org14333f1" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">In/Out</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>context</code></td>
<td class="org-left"><code>qmckl_context</code></td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left"><code>ao_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of AOs</td>
</tr>
<tr>
<td class="org-left"><code>shell_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of shells</td>
</tr>
<tr>
<td class="org-left"><code>point_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of points</td>
</tr>
<tr>
<td class="org-left"><code>nucl_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of nuclei</td>
</tr>
<tr>
<td class="org-left"><code>coord</code></td>
<td class="org-left"><code>double[3][point_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucl_coord</code></td>
<td class="org-left"><code>double[3][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Nuclear coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_index</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Index of the 1st shell of each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_shell_num</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of shells per nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_range</code></td>
<td class="org-left"><code>double[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Range beyond which all is zero</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_max_ang_mom</code></td>
<td class="org-left"><code>int32_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Maximum angular momentum per nucleus</td>
</tr>
<tr>
<td class="org-left"><code>shell_ang_mom</code></td>
<td class="org-left"><code>int32_t[shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Angular momentum of each shell</td>
</tr>
<tr>
<td class="org-left"><code>ao_factor</code></td>
<td class="org-left"><code>double[ao_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Normalization factor of the AOs</td>
</tr>
<tr>
<td class="org-left"><code>shell_vgl</code></td>
<td class="org-left"><code>double[point_num][5][shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Value, gradients and Laplacian of the shells</td>
</tr>
<tr>
<td class="org-left"><code>ao_vgl</code></td>
<td class="org-left"><code>double[point_num][5][ao_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Value, gradients and Laplacian of the AOs</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_compute_ao_vgl_doc</span>(context, <span style="color: #a020f0;">&amp;</span>
ao_num, shell_num, point_num, nucl_num, <span style="color: #a020f0;">&amp;</span>
coord, nucl_coord, nucleus_index, nucleus_shell_num, <span style="color: #a020f0;">&amp;</span>
nucleus_range, nucleus_max_ang_mom, shell_ang_mom, <span style="color: #a020f0;">&amp;</span>
ao_factor, shell_vgl, ao_vgl) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">bind</span>(C) <span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl_constants</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>, <span style="color: #a020f0;">only</span> : qmckl_ao_polynomial_vgl, qmckl_get_numprec_precision
<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: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> ao_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> shell_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> point_num</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord(point_num,3)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_coord(nucl_num,3)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_index(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_shell_num(nucl_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_range(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucleus_max_ang_mom(nucl_num)</span>
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_ang_mom(shell_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> ao_factor(ao_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> shell_vgl(shell_num,5,point_num)</span>
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> ao_vgl(ao_num,5,point_num)</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code) ::<span style="color: #a0522d;"> info</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> e_coord(3), n_coord(3)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> n_poly</span>
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> l, il, k</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> ipoint, inucl, ishell</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> ishell_start, ishell_end</span>
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> lstart(0:20)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, y, z, r2</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> cutoff</span>
<span style="color: #228b22;">double precision</span>, <span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> poly_vgl(:,:)</span>
<span style="color: #228b22;">integer</span> , <span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> powers(:,:), ao_index(:)</span>
<span style="color: #a020f0;">allocate</span>(poly_vgl(5,ao_num), powers(3,ao_num), ao_index(ao_num))
! <span style="color: #b22222;">Pre-computed data</span>
<span style="color: #a020f0;">do</span> l=0,20
lstart(l) = l*(l+1)*(l+2)/6 +1
<span style="color: #a020f0;">end do</span>
k=1
<span style="color: #a020f0;">do</span> inucl=1,nucl_num
ishell_start = nucleus_index(inucl) + 1
ishell_end = nucleus_index(inucl) + nucleus_shell_num(inucl)
<span style="color: #a020f0;">do</span> ishell = ishell_start, ishell_end
l = shell_ang_mom(ishell)
ao_index(ishell) = k
k = k + lstart(l+1) - lstart(l)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
info = QMCKL_SUCCESS
! <span style="color: #b22222;">Don't compute polynomials when the radial part is zero.</span>
cutoff = qmckl_get_numprec_precision(context)
cutoff = dlog(2.d0**(cutoff-2))
<span style="color: #a020f0;">do</span> ipoint = 1, point_num
e_coord(1) = coord(ipoint,1)
e_coord(2) = coord(ipoint,2)
e_coord(3) = coord(ipoint,3)
ao_vgl(:,:,ipoint) = 0.d0
<span style="color: #a020f0;">do</span> inucl=1,nucl_num
n_coord(1) = nucl_coord(inucl,1)
n_coord(2) = nucl_coord(inucl,2)
n_coord(3) = nucl_coord(inucl,3)
! <span style="color: #b22222;">Test if the point is in the range of the nucleus</span>
x = e_coord(1) - n_coord(1)
y = e_coord(2) - n_coord(2)
z = e_coord(3) - n_coord(3)
r2 = x*x + y*y + z*z
<span style="color: #a020f0;">if</span> (r2 &gt; cutoff*nucleus_range(inucl)) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">cycle</span>
<span style="color: #a020f0;">end if</span>
! <span style="color: #b22222;">Compute polynomials</span>
info = qmckl_ao_polynomial_vgl(context, e_coord, n_coord, <span style="color: #a020f0;">&amp;</span>
nucleus_max_ang_mom(inucl), n_poly, powers, 3_8, <span style="color: #a020f0;">&amp;</span>
poly_vgl, 5_8)
! <span style="color: #b22222;">Loop over shells</span>
ishell_start = nucleus_index(inucl) + 1
ishell_end = nucleus_index(inucl) + nucleus_shell_num(inucl)
<span style="color: #a020f0;">do</span> ishell = ishell_start, ishell_end
k = ao_index(ishell)
l = shell_ang_mom(ishell)
<span style="color: #a020f0;">do</span> il = lstart(l), lstart(l+1)-1
! <span style="color: #b22222;">Value</span>
ao_vgl(k,1,ipoint) = <span style="color: #a020f0;">&amp;</span>
poly_vgl(1,il) * shell_vgl(ishell,1,ipoint) * ao_factor(k)
! <span style="color: #b22222;">Grad_x</span>
ao_vgl(k,2,ipoint) = ( <span style="color: #a020f0;">&amp;</span>
poly_vgl(2,il) * shell_vgl(ishell,1,ipoint) + <span style="color: #a020f0;">&amp;</span>
poly_vgl(1,il) * shell_vgl(ishell,2,ipoint) <span style="color: #a020f0;">&amp;</span>
) * ao_factor(k)
! <span style="color: #b22222;">Grad_y</span>
ao_vgl(k,3,ipoint) = ( <span style="color: #a020f0;">&amp;</span>
poly_vgl(3,il) * shell_vgl(ishell,1,ipoint) + <span style="color: #a020f0;">&amp;</span>
poly_vgl(1,il) * shell_vgl(ishell,3,ipoint) <span style="color: #a020f0;">&amp;</span>
) * ao_factor(k)
! <span style="color: #b22222;">Grad_z</span>
ao_vgl(k,4,ipoint) = ( <span style="color: #a020f0;">&amp;</span>
poly_vgl(4,il) * shell_vgl(ishell,1,ipoint) + <span style="color: #a020f0;">&amp;</span>
poly_vgl(1,il) * shell_vgl(ishell,4,ipoint) <span style="color: #a020f0;">&amp;</span>
) * ao_factor(k)
! <span style="color: #b22222;">Lapl_z</span>
ao_vgl(k,5,ipoint) = ( <span style="color: #a020f0;">&amp;</span>
poly_vgl(5,il) * shell_vgl(ishell,1,ipoint) + <span style="color: #a020f0;">&amp;</span>
poly_vgl(1,il) * shell_vgl(ishell,5,ipoint) + <span style="color: #a020f0;">&amp;</span>
2.d0 * ( <span style="color: #a020f0;">&amp;</span>
poly_vgl(2,il) * shell_vgl(ishell,2,ipoint) + <span style="color: #a020f0;">&amp;</span>
poly_vgl(3,il) * shell_vgl(ishell,3,ipoint) + <span style="color: #a020f0;">&amp;</span>
poly_vgl(4,il) * shell_vgl(ishell,4,ipoint) ) <span style="color: #a020f0;">&amp;</span>
) * ao_factor(k)
k = k+1
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">deallocate</span>(poly_vgl, powers)
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_ao_vgl_doc</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org47b8bf2" class="outline-4">
<h4 id="org47b8bf2"><span class="section-number-4">5.3.2</span> HPC version</h4>
<div class="outline-text-4" id="text-5-3-2">
<table id="org7fec46e" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Variable</th>
<th scope="col" class="org-left">Type</th>
<th scope="col" class="org-left">In/Out</th>
<th scope="col" class="org-left">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>context</code></td>
<td class="org-left"><code>qmckl_context</code></td>
<td class="org-left">in</td>
<td class="org-left">Global state</td>
</tr>
<tr>
<td class="org-left"><code>ao_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of AOs</td>
</tr>
<tr>
<td class="org-left"><code>shell_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of shells</td>
</tr>
<tr>
<td class="org-left"><code>prim_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of primitives</td>
</tr>
<tr>
<td class="org-left"><code>point_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of points</td>
</tr>
<tr>
<td class="org-left"><code>nucl_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of nuclei</td>
</tr>
<tr>
<td class="org-left"><code>coord</code></td>
<td class="org-left"><code>double[3][point_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucl_coord</code></td>
<td class="org-left"><code>double[3][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Nuclear coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_index</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Index of the 1st shell of each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_shell_num</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of shells per nucleus</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_range</code></td>
<td class="org-left"><code>double[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Range beyond which all is zero</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_max_ang_mom</code></td>
<td class="org-left"><code>int32_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Maximum angular momentum per nucleus</td>
</tr>
<tr>
<td class="org-left"><code>shell_ang_mom</code></td>
<td class="org-left"><code>int32_t[shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Angular momentum of each shell</td>
</tr>
<tr>
<td class="org-left"><code>shell_prim_index</code></td>
<td class="org-left"><code>int64_t[shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Index of the 1st primitive of each shell</td>
</tr>
<tr>
<td class="org-left"><code>shell_prim_num</code></td>
<td class="org-left"><code>int64_t[shell_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of primitives per shell</td>
</tr>
<tr>
<td class="org-left"><code>ao_factor</code></td>
<td class="org-left"><code>double[ao_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Normalization factor of the AOs</td>
</tr>
<tr>
<td class="org-left"><code>ao_expo</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Exponents of the primitives</td>
</tr>
<tr>
<td class="org-left"><code>coef_normalized</code></td>
<td class="org-left"><code>double[prim_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Normalized coefficients of the primitives</td>
</tr>
<tr>
<td class="org-left"><code>ao_vgl</code></td>
<td class="org-left"><code>double[point_num][5][ao_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Value, gradients and Laplacian of the AOs</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org2b98700" class="outline-4">
<h4 id="org2b98700"><span class="section-number-4">5.3.3</span> Interfaces</h4>
<div class="outline-text-4" id="text-5-3-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_compute_ao_vgl_doc</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;">int64_t</span> <span style="color: #a0522d;">ao_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">point_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucleus_range</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">nucleus_max_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">shell_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ao_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">shell_vgl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ao_vgl</span> );
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_compute_ao_vgl_hpc_gaussian</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;">int64_t</span> <span style="color: #a0522d;">ao_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">prim_num_per_nucleus</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">point_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_shell_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucleus_range</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">nucleus_max_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">shell_ang_mom</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ao_factor</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_matrix</span> <span style="color: #a0522d;">expo_per_nucleus</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_tensor</span> <span style="color: #a0522d;">coef_per_nucleus</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ao_vgl</span> );
<span style="color: #483d8b;">#endif</span>
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2024-03-29 Fri 08:29</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>