1
0
mirror of https://github.com/TREX-CoE/qmckl.git synced 2024-11-03 12:43:57 +01:00
qmckl/qmckl_jastrow_champ.html

7913 lines
425 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>
<!-- 2023-10-06 Fri 09:36 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>CHAMP Jastrow Factor</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">CHAMP Jastrow Factor</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org51f73af">1. Introduction</a></li>
<li><a href="#org3342fbe">2. Context</a>
<ul>
<li><a href="#org02aa9c1">2.1. Data structure</a></li>
<li><a href="#org8eb5776">2.2. Initialization functions</a>
<ul>
<li>
<ul>
<li><a href="#orge09bcf9">2.2.0.1. Fortran interface</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org88dc27e">2.3. Access functions</a>
<ul>
<li>
<ul>
<li><a href="#orgb07d1da">2.3.0.1. Fortran interface</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org6ddd01c">2.4. Test</a></li>
</ul>
</li>
<li><a href="#org5b9013a">3. Computation</a>
<ul>
<li><a href="#org93a6f1b">3.1. Electron-electron component</a>
<ul>
<li><a href="#org89f2f89">3.1.1. Asymptotic component</a>
<ul>
<li><a href="#orgefd9110">3.1.1.1. Get</a></li>
<li><a href="#org6094529">3.1.1.2. Compute</a></li>
<li><a href="#org069181f">3.1.1.3. Test</a></li>
</ul>
</li>
<li><a href="#org953d341">3.1.2. Electron-electron component</a>
<ul>
<li><a href="#orge854230">3.1.2.1. Get</a></li>
<li><a href="#org99126bc">3.1.2.2. Compute</a></li>
<li><a href="#org6867d67">3.1.2.3. Test</a></li>
</ul>
</li>
<li><a href="#org28bc1d5">3.1.3. Derivative</a>
<ul>
<li><a href="#orga1ddf18">3.1.3.1. Get</a></li>
<li><a href="#orgc34708b">3.1.3.2. Compute</a></li>
<li><a href="#orgb9dc4db">3.1.3.3. Test</a></li>
</ul>
</li>
<li><a href="#org45a9862">3.1.4. Electron-electron rescaled distances</a>
<ul>
<li><a href="#org08e5e79">3.1.4.1. Get</a></li>
<li><a href="#org20546a3">3.1.4.2. Compute</a></li>
<li><a href="#org6bc675b">3.1.4.3. Test</a></li>
</ul>
</li>
<li><a href="#orgfbac371">3.1.5. Electron-electron rescaled distance gradients and Laplacian with respect to electron coordinates</a>
<ul>
<li><a href="#org3429775">3.1.5.1. Get</a></li>
<li><a href="#org0d0d3b0">3.1.5.2. Compute</a></li>
<li><a href="#org80ca276">3.1.5.3. Test</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org482f11a">3.2. Electron-nucleus component</a>
<ul>
<li><a href="#org301126b">3.2.1. Asymptotic component for</a>
<ul>
<li><a href="#orgc809d98">3.2.1.1. Get</a></li>
<li><a href="#org933040a">3.2.1.2. Compute</a></li>
<li><a href="#orga0efa28">3.2.1.3. Test</a></li>
</ul>
</li>
<li><a href="#orge3e35dd">3.2.2. Electron-nucleus component</a>
<ul>
<li><a href="#org27938cf">3.2.2.1. Get</a></li>
<li><a href="#org56978c3">3.2.2.2. Compute</a></li>
<li><a href="#org92df30d">3.2.2.3. Test</a></li>
</ul>
</li>
<li><a href="#org647fd84">3.2.3. Derivative</a>
<ul>
<li><a href="#org12f87f4">3.2.3.1. Get</a></li>
<li><a href="#org65674a5">3.2.3.2. Compute</a></li>
<li><a href="#orgae7161b">3.2.3.3. Test</a></li>
</ul>
</li>
<li><a href="#org3a15afa">3.2.4. Electron-nucleus rescaled distances</a>
<ul>
<li><a href="#orgc5b7ffc">3.2.4.1. Get</a></li>
<li><a href="#org3ef15a6">3.2.4.2. Compute</a></li>
<li><a href="#org0fdcbe8">3.2.4.3. Test</a></li>
</ul>
</li>
<li><a href="#org11ad976">3.2.5. Electron-electron rescaled distance gradients and Laplacian with respect to electron coordinates</a>
<ul>
<li><a href="#org54196ce">3.2.5.1. Get</a></li>
<li><a href="#org3ae97c6">3.2.5.2. Compute</a></li>
<li><a href="#orge131c5c">3.2.5.3. Test</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org4e6b156">3.3. Electron-electron-nucleus component</a>
<ul>
<li><a href="#org446b70c">3.3.1. Electron-electron rescaled distances in \(J_\text{eeN}\)</a>
<ul>
<li><a href="#org6026b90">3.3.1.1. Get</a></li>
<li><a href="#orgc7a572c">3.3.1.2. Compute</a></li>
<li><a href="#orgf731f56">3.3.1.3. Test</a></li>
</ul>
</li>
<li><a href="#orga45897e">3.3.2. Electron-electron rescaled distances derivatives in \(J_\text{eeN}\)</a>
<ul>
<li><a href="#orgaadfe77">3.3.2.1. Get</a></li>
<li><a href="#org89dd503">3.3.2.2. Compute</a></li>
<li><a href="#orgeb720dd">3.3.2.3. Test</a></li>
</ul>
</li>
<li><a href="#org6e32bed">3.3.3. Electron-nucleus rescaled distances in \(J_\text{eeN}\)</a>
<ul>
<li><a href="#org8499cc6">3.3.3.1. Get</a></li>
<li><a href="#org398dc81">3.3.3.2. Compute</a></li>
<li><a href="#org3ada697">3.3.3.3. Test</a></li>
</ul>
</li>
<li><a href="#org7346415">3.3.4. Electron-nucleus rescaled distances derivatives in \(J_\text{eeN}\)</a>
<ul>
<li><a href="#org096fdcb">3.3.4.1. Get</a></li>
<li><a href="#org47b366e">3.3.4.2. Compute</a></li>
<li><a href="#org2b2d946">3.3.4.3. Test</a></li>
</ul>
</li>
<li><a href="#org6550285">3.3.5. Temporary arrays for electron-electron-nucleus Jastrow \(f_{een}\)</a>
<ul>
<li><a href="#org4bc235e">3.3.5.1. Compute dim<sub>c</sub><sub>vector</sub></a></li>
<li><a href="#org1264e9d">3.3.5.2. Get</a></li>
<li><a href="#org74981a3">3.3.5.3. Compute c<sub>vector</sub><sub>full</sub></a></li>
<li><a href="#org7abd768">3.3.5.4. Compute lkpm<sub>combined</sub><sub>index</sub></a></li>
<li><a href="#org2aac1cd">3.3.5.5. Compute tmp<sub>c</sub></a></li>
<li><a href="#org164a2c2">3.3.5.6. Compute dtmp<sub>c</sub></a></li>
<li><a href="#org8da2a06">3.3.5.7. Test</a></li>
</ul>
</li>
<li><a href="#org703510f">3.3.6. Electron-electron-nucleus Jastrow \(f_{een}\)</a>
<ul>
<li><a href="#org697718c">3.3.6.1. Get</a></li>
<li><a href="#org47e8cc5">3.3.6.2. Compute naive</a></li>
<li><a href="#org31e6a63">3.3.6.3. Compute</a></li>
<li><a href="#org044487a">3.3.6.4. Test</a></li>
</ul>
</li>
<li><a href="#org3e7eba3">3.3.7. Electron-electron-nucleus Jastrow \(f_{een}\) derivative</a>
<ul>
<li><a href="#org719485a">3.3.7.1. Get</a></li>
<li><a href="#org67a9338">3.3.7.2. Compute Naive</a></li>
<li><a href="#org38d3996">3.3.7.3. Compute</a></li>
<li><a href="#orgd52cc1e">3.3.7.4. Test</a></li>
</ul>
</li>
</ul>
</li>
<li><a href="#org1cd501f">3.4. Total Jastrow</a>
<ul>
<li><a href="#orgba789c8">3.4.1. Value</a>
<ul>
<li><a href="#org4987f8c">3.4.1.1. Get</a></li>
<li><a href="#org0d40eb7">3.4.1.2. Compute</a></li>
<li><a href="#org2e7c995">3.4.1.3. Test</a></li>
</ul>
</li>
<li><a href="#org4eb8a1e">3.4.2. Derivatives</a>
<ul>
<li><a href="#orga055762">3.4.2.1. Get</a></li>
<li><a href="#org546df10">3.4.2.2. Compute</a></li>
<li><a href="#org6307068">3.4.2.3. Test</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org51f73af" class="outline-2">
<h2 id="org51f73af"><span class="section-number-2">1</span> Introduction</h2>
<div class="outline-text-2" id="text-1">
<p>
The Jastrow factor depends on the electronic (\(\mathbf{r}\)) and
nuclear (\(\mathbf{R}\)) coordinates. Its defined as \(\exp(J(\mathbf{r},\mathbf{R}))\), where
</p>
<p>
\[
J(\mathbf{r},\mathbf{R}) = J_{\text{eN}}(\mathbf{r},\mathbf{R}) + J_{\text{ee}}(\mathbf{r}) + J_{\text{eeN}}(\mathbf{r},\mathbf{R})
\]
</p>
<p>
In the following, we use the notations \(r_{ij} = |\mathbf{r}_i - \mathbf{r}_j|\) and
\(R_{i\alpha} = |\mathbf{r}_i - \mathbf{R}_\alpha|\).
</p>
<p>
\(J_{\text{eN}}\) contains electron-nucleus terms:
</p>
<p>
\[
J_{\text{eN}}(\mathbf{r},\mathbf{R}) =
\sum_{\alpha=1}^{N_\text{nucl}} \sum_{i=1}^{N_\text{elec}}
\frac{a_{1\,\alpha}\, f_\alpha(R_{i\alpha})}{1+a_{2\,\alpha}\, f_\alpha(R_{i\alpha})} +
\sum_{p=2}^{N_\text{ord}^a} a_{p+1\,\alpha}\, [f_\alpha(R_{i\alpha})]^p - J_{\text{eN}}^{\infty \alpha}
\]
</p>
<p>
\(J_{\text{ee}}\) contains electron-electron terms:
\[
J_{\text{ee}}(\mathbf{r}) =
\sum_{i=1}^{N_\text{elec}} \sum_{j=1}^{i-1}
\frac{\frac{1}{2}(1+\delta^{\uparrow\downarrow}_{ij}) b_1\, f_{\text{ee}}(r_{ij})}{1+b_2\, f_{\text{ee}}(r_{ij})} +
\sum_{p=2}^{N_\text{ord}^b} b_{p+1}\, [f_{\text{ee}}(r_{ij})]^p - J_{ee}^\infty
\]
</p>
<p>
and \(J_{\text{eeN}}\) contains electron-electron-Nucleus terms:
</p>
<p>
\[
J_{\text{eeN}}(\mathbf{r},\mathbf{R}) =
\sum_{\alpha=1}^{N_{\text{nucl}}}
\sum_{i=1}^{N_{\text{elec}}}
\sum_{j=1}^{i-1}
\sum_{p=2}^{N_{\text{ord}}}
\sum_{k=0}^{p-1}
\sum_{l=0}^{p-k-2\delta_{k,0}}
c_{lkp\alpha} \left[ g_\text{e}({r}_{ij}) \right]^k
\left[ \left[ g_\alpha({R}_{i\alpha}) \right]^l + \left[ g_\alpha({R}_{j\alpha}) \right]^l \right]
\left[ g_\alpha({R}_{i\,\alpha}) \, g_\alpha({R}_{j\alpha}) \right]^{(p-k-l)/2}
\]
</p>
<p>
\(c_{lkp\alpha}\) are non-zero only when \(p-k-l\) is even.
</p>
<p>
\(f\) and \(g\) are scaling function defined as
</p>
<p>
\[
f_\alpha(r) = \frac{1-e^{-\kappa_\alpha\, r}}{\kappa_\alpha} \text{ and }
g_\alpha(r) = e^{-\kappa_\alpha\, r} = 1-\kappa_\alpha f_\alpha(r).
\]
</p>
<p>
The terms \(J_{\text{ee}}^\infty\) and \(J_{\text{eN}}^\infty\) are shifts to ensure that
\(J_{\text{ee}}\) and \(J_{\text{eN}}\) have an asymptotic value of zero.
</p>
<p>
The eN and eeN parameters are the same of all identical nuclei.
Warning: The types of nuclei use zero-based indexing.
</p>
</div>
</div>
<div id="outline-container-org3342fbe" class="outline-2">
<h2 id="org3342fbe"><span class="section-number-2">2</span> Context</h2>
<div class="outline-text-2" id="text-2">
<p>
The following data stored in the context:
</p>
<table id="orgf704095" 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>uninitialized</code></td>
<td class="org-left"><code>int32_t</code></td>
<td class="org-left">Keeps bits set for uninitialized data</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_ee</code></td>
<td class="org-left"><code>double</code></td>
<td class="org-left">The distance scaling factor</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_en</code></td>
<td class="org-left"><code>double[type_nucl_num]</code></td>
<td class="org-left">The distance scaling factor</td>
</tr>
<tr>
<td class="org-left"><code>aord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">The number of a coeffecients</td>
</tr>
<tr>
<td class="org-left"><code>bord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">The number of b coeffecients</td>
</tr>
<tr>
<td class="org-left"><code>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">The number of c coeffecients</td>
</tr>
<tr>
<td class="org-left"><code>type_nucl_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">Number of Nuclei types</td>
</tr>
<tr>
<td class="org-left"><code>type_nucl_vector</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">IDs of types of Nuclei. These use 0-based indexing as in C.</td>
</tr>
<tr>
<td class="org-left"><code>a_vector</code></td>
<td class="org-left"><code>double[aord_num + 1][type_nucl_num]</code></td>
<td class="org-left">a polynomial coefficients</td>
</tr>
<tr>
<td class="org-left"><code>b_vector</code></td>
<td class="org-left"><code>double[bord_num + 1]</code></td>
<td class="org-left">b polynomial coefficients</td>
</tr>
<tr>
<td class="org-left"><code>c_vector</code></td>
<td class="org-left"><code>double[dim_c_vector][type_nucl_num]</code></td>
<td class="org-left">c polynomial coefficients</td>
</tr>
<tr>
<td class="org-left"><code>c_vector</code></td>
<td class="org-left"><code>double[dim_c_vector][type_nucl_num]</code></td>
<td class="org-left">c polynomial coefficients</td>
</tr>
<tr>
<td class="org-left"><code>spin_independent</code></td>
<td class="org-left"><code>int32_t</code></td>
<td class="org-left">If 1, use same parameters for parallel and anti-parallel spins. Otherwise, 0.</td>
</tr>
</tbody>
</table>
<p>
Computed data:
</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">In/Out</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left"><code>dim_c_vector</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">Number of unique C coefficients</td>
</tr>
<tr>
<td class="org-left"><code>dim_c_vector_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Number of unique C coefficients</td>
</tr>
<tr>
<td class="org-left"><code>asymp_jasa</code></td>
<td class="org-left"><code>double[type_nucl_num]</code></td>
<td class="org-left">Asymptotic component</td>
</tr>
<tr>
<td class="org-left"><code>asymp_jasa_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Ladt modification of the asymptotic component</td>
</tr>
<tr>
<td class="org-left"><code>asymp_jasb</code></td>
<td class="org-left"><code>double[2]</code></td>
<td class="org-left">Asymptotic component (up- or down-spin)</td>
</tr>
<tr>
<td class="org-left"><code>asymp_jasb_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Ladt modification of the asymptotic component</td>
</tr>
<tr>
<td class="org-left"><code>c_vector_full</code></td>
<td class="org-left"><code>double[dim_c_vector][nucl_num]</code></td>
<td class="org-left">vector of non-zero coefficients</td>
</tr>
<tr>
<td class="org-left"><code>c_vector_full_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Keep track of changes here</td>
</tr>
<tr>
<td class="org-left"><code>lkpm_combined_index</code></td>
<td class="org-left"><code>int64_t[4][dim_c_vector]</code></td>
<td class="org-left">Transform l,k,p, and m into consecutive indices</td>
</tr>
<tr>
<td class="org-left"><code>lkpm_combined_index_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Transform l,k,p, and m into consecutive indices</td>
</tr>
<tr>
<td class="org-left"><code>tmp_c</code></td>
<td class="org-left"><code>double[walk_num][cord_num][cord_num+1][nucl_num][elec_num]</code></td>
<td class="org-left">vector of non-zero coefficients</td>
</tr>
<tr>
<td class="org-left"><code>dtmp_c</code></td>
<td class="org-left"><code>double[walk_num][elec_num][4][nucl_num][cord_num+1][cord_num]</code></td>
<td class="org-left">vector of non-zero coefficients</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance_rescaled</code></td>
<td class="org-left"><code>double[walk_num][num][num]</code></td>
<td class="org-left">Electron-electron rescaled distances</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance_rescaled_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Last modification date of the electron-electron distances</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance_rescaled_gl</code></td>
<td class="org-left"><code>double[walk_num][num][num][4]</code></td>
<td class="org-left">Electron-electron rescaled distances derivatives</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance_rescaled_gl_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Last modification date of the electron-electron distance derivatives</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled</code></td>
<td class="org-left"><code>double[walk_num][nucl_num][num]</code></td>
<td class="org-left">Electron-nucleus distances</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Last modification date of the electron-electron distances</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled_gl</code></td>
<td class="org-left"><code>double[walk_num][nucl_num][num][4]</code></td>
<td class="org-left">Electron-electron rescaled distances derivatives</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled_gl_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Last modification date of the electron-electron distance derivatives</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n</code></td>
<td class="org-left"><code>double[walk_num][cord_num+1][nucl_num][elec_num]</code></td>
<td class="org-left">The electron-electron rescaled distances raised to the powers defined by cord</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Keep track of the date of creation</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_e_gl</code></td>
<td class="org-left"><code>double[walk_num][cord_num+1][elec_num][4][elec_num]</code></td>
<td class="org-left">The electron-electron rescaled distances raised to the powers defined by cord derivatives wrt electrons</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_e_gl_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Keep track of the date of creation</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n_gl</code></td>
<td class="org-left"><code>double[walk_num][cord_num+1][nucl_num][4][elec_num]</code></td>
<td class="org-left">The electron-electron rescaled distances raised to the powers defined by cord derivatives wrt electrons</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n_gl_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Keep track of the date of creation</td>
</tr>
<tr>
<td class="org-left"><code>factor_ee</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">Jastrow factor: electron-electron part</td>
</tr>
<tr>
<td class="org-left"><code>factor_ee_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Jastrow factor: electron-electron part</td>
</tr>
<tr>
<td class="org-left"><code>factor_en</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">Jastrow factor: electron-nucleus part</td>
</tr>
<tr>
<td class="org-left"><code>factor_en_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Jastrow factor: electron-nucleus part</td>
</tr>
<tr>
<td class="org-left"><code>factor_een</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">Jastrow factor: electron-electron-nucleus part</td>
</tr>
<tr>
<td class="org-left"><code>factor_een_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Jastrow factor: electron-electron-nucleus part</td>
</tr>
<tr>
<td class="org-left"><code>factor_ee_gl</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">Derivative of the Jastrow factor: electron-electron-nucleus part</td>
</tr>
<tr>
<td class="org-left"><code>factor_ee_gl_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Keep track of the date for the derivative</td>
</tr>
<tr>
<td class="org-left"><code>factor_en_gl</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">Derivative of the Jastrow factor: electron-electron-nucleus part</td>
</tr>
<tr>
<td class="org-left"><code>factor_en_gl_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Keep track of the date for the en derivative</td>
</tr>
<tr>
<td class="org-left"><code>factor_een_gl</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">Derivative of the Jastrow factor: electron-electron-nucleus part</td>
</tr>
<tr>
<td class="org-left"><code>factor_een_gl_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Keep track of the date for the een derivative</td>
</tr>
<tr>
<td class="org-left"><code>value</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">Value of the Jastrow factor</td>
</tr>
<tr>
<td class="org-left"><code>value_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Keep track of the date</td>
</tr>
<tr>
<td class="org-left"><code>gl</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">Gradient and Laplacian of the Jastrow factor</td>
</tr>
<tr>
<td class="org-left"><code>value_date</code></td>
<td class="org-left"><code>uint64_t</code></td>
<td class="org-left">Keep track of the date</td>
</tr>
</tbody>
</table>
</div>
<div id="outline-container-org02aa9c1" class="outline-3">
<h3 id="org02aa9c1"><span class="section-number-3">2.1</span> Data structure</h3>
<div class="outline-text-3" id="text-2-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">qmckl_jastrow_champ_struct</span>{
<span style="color: #228b22;">int64_t</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">lkpm_combined_index</span>;
<span style="color: #228b22;">int64_t</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">type_nucl_vector</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">asymp_jasa</span>;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">asymp_jasb</span>[2];
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">a_vector</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">b_vector</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">c_vector</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">c_vector_full</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">dtmp_c</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">ee_distance_rescaled</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">ee_distance_rescaled_gl</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">een_rescaled_e</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">een_rescaled_e_gl</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">een_rescaled_n</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">een_rescaled_n_gl</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">en_distance_rescaled</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">en_distance_rescaled_gl</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">factor_ee</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">factor_ee_gl</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">factor_een</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">factor_een_gl</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">factor_en</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">factor_en_gl</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">rescale_factor_en</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">tmp_c</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">value</span>;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">gl</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">aord_num</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">bord_num</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">cord_num</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">type_nucl_num</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">asymp_jasa_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">asymp_jasb_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">c_vector_full_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">dim_c_vector_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">dtmp_c_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">ee_distance_rescaled_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">ee_distance_rescaled_gl_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">een_rescaled_e_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">een_rescaled_e_gl_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">een_rescaled_n_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">een_rescaled_n_gl_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">en_distance_rescaled_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">en_distance_rescaled_gl_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">factor_ee_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">factor_ee_gl_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">factor_een_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">factor_een_gl_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">factor_en_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">factor_en_gl_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">lkpm_combined_index_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">tmp_c_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">value_date</span>;
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">gl_date</span>;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_ee</span>;
<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">uninitialized</span>;
<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">spin_independent</span>;
<span style="color: #228b22;">bool</span> <span style="color: #a0522d;">provided</span>;
} <span style="color: #228b22;">qmckl_jastrow_champ_struct</span>;
</pre>
</div>
<p>
The <code>uninitialized</code> integer contains one bit set to one for each
initialization function which has not been called. It becomes equal
to zero after all initialization functions have been called. The
struct is then initialized and <code>provided == true</code>.
Some values are initialized by default, and are not concerned by
this mechanism.
</p>
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_init_jastrow_champ</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</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_init_jastrow_champ</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>) {
<span style="color: #a020f0;">if</span> (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
<span style="color: #a020f0;">return</span> <span style="color: #008b8b;">false</span>;
}
<span style="color: #228b22;">qmckl_context_struct</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ctx</span> = (<span style="color: #228b22;">qmckl_context_struct</span>*) context;
assert (ctx != <span style="color: #008b8b;">NULL</span>);
ctx-&gt;jastrow_champ.uninitialized = (1 &lt;&lt; 11) - 1;
/* <span style="color: #b22222;">Default values</span> */
ctx-&gt;jastrow_champ.aord_num = -1;
ctx-&gt;jastrow_champ.bord_num = -1;
ctx-&gt;jastrow_champ.cord_num = -1;
ctx-&gt;jastrow_champ.dim_c_vector = -1;
ctx-&gt;jastrow_champ.type_nucl_num = -1;
ctx-&gt;jastrow_champ.spin_independent = -1;
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org8eb5776" class="outline-3">
<h3 id="org8eb5776"><span class="section-number-3">2.2</span> Initialization functions</h3>
<div class="outline-text-3" id="text-2-2">
<p>
To prepare for the Jastrow and its derivative, 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_jastrow_champ_rescale_factor_ee</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;">kappa_ee</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_rescale_factor_en</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;">kappa_en</span>, <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_set_jastrow_champ_aord_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;">aord_num</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_bord_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;">bord_num</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_cord_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;">cord_num</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_type_nucl_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;">type_nucl_num</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_type_nucl_vector</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;">type_nucl_vector</span>, <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_set_jastrow_champ_a_vector</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;">a_vector</span>, <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_set_jastrow_champ_b_vector</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;">b_vector</span>, <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_set_jastrow_champ_c_vector</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;">c_vector</span>, <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_set_jastrow_champ_spin_independent</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;">spin_independent</span>);
</pre>
</div>
<p>
When the required information is completely entered, other data structures are
computed to accelerate the calculations. The intermediates factors
are precontracted using BLAS LEVEL 3 operations.
</p>
</div>
<div id="outline-container-orge09bcf9" class="outline-5">
<h5 id="orge09bcf9"><span class="section-number-5">2.2.0.1</span> Fortran interface</h5>
<div class="outline-text-5" id="text-2-2-0-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_rescale_factor_ee (context, </span><span style="color: #a020f0;">&amp;</span>
kappa_ee) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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: #a020f0;">value</span> ::<span style="color: #a0522d;"> kappa_ee</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_rescale_factor_ee</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_rescale_factor_en (context, </span><span style="color: #a020f0;">&amp;</span>
kappa_en, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> kappa_en(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_rescale_factor_en</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_aord_num (context, </span><span style="color: #a020f0;">&amp;</span>
aord_num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> aord_num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_aord_num</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_bord_num (context, </span><span style="color: #a020f0;">&amp;</span>
bord_num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> bord_num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_bord_num</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_cord_num (context, </span><span style="color: #a020f0;">&amp;</span>
cord_num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> cord_num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_cord_num</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_type_nucl_num (context, </span><span style="color: #a020f0;">&amp;</span>
type_nucl_num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> type_nucl_num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_type_nucl_num</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_type_nucl_vector (context, </span><span style="color: #a020f0;">&amp;</span>
type_nucl_vector, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> type_nucl_vector(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_type_nucl_vector</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_a_vector(context, </span><span style="color: #a020f0;">&amp;</span>
a_vector, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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_vector(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_a_vector</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_b_vector(context, </span><span style="color: #a020f0;">&amp;</span>
b_vector, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> b_vector(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_b_vector</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_c_vector(context, </span><span style="color: #a020f0;">&amp;</span>
c_vector, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> c_vector(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_c_vector</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_set_jastrow_champ_spin_independent(context, </span><span style="color: #a020f0;">&amp;</span>
spin_independent) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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>(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_int32_t</span>), <span style="color: #a020f0;">intent</span>(in), <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> spin_independent</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_jastrow_champ_spin_independent</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org88dc27e" class="outline-3">
<h3 id="org88dc27e"><span class="section-number-3">2.3</span> Access functions</h3>
<div class="outline-text-3" id="text-2-3">
<p>
Along with these core functions, calculation of the jastrow factor
requires the following additional information to be set:
</p>
<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_jastrow_champ_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 id="outline-container-orgb07d1da" class="outline-5">
<h5 id="orgb07d1da"><span class="section-number-5">2.3.0.1</span> Fortran interface</h5>
<div class="outline-text-5" id="text-2-3-0-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_rescale_factor_ee (context, </span><span style="color: #a020f0;">&amp;</span>
kappa_ee) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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>(out) ::<span style="color: #a0522d;"> kappa_ee</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_rescale_factor_ee</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_rescale_factor_en (context, </span><span style="color: #a020f0;">&amp;</span>
kappa_en, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> kappa_en(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_rescale_factor_en</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_aord_num (context, </span><span style="color: #a020f0;">&amp;</span>
aord_num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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>(out) ::<span style="color: #a0522d;"> aord_num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_aord_num</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_bord_num (context, </span><span style="color: #a020f0;">&amp;</span>
bord_num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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>(out) ::<span style="color: #a0522d;"> bord_num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_bord_num</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_cord_num (context, </span><span style="color: #a020f0;">&amp;</span>
cord_num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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>(out) ::<span style="color: #a0522d;"> cord_num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_cord_num</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_type_nucl_num (context, </span><span style="color: #a020f0;">&amp;</span>
type_nucl_num) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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>(out) ::<span style="color: #a0522d;"> type_nucl_num</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_type_nucl_num</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_type_nucl_vector (context, </span><span style="color: #a020f0;">&amp;</span>
type_nucl_vector, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> type_nucl_vector(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_type_nucl_vector</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_a_vector(context, </span><span style="color: #a020f0;">&amp;</span>
a_vector, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> a_vector(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_a_vector</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_b_vector(context, </span><span style="color: #a020f0;">&amp;</span>
b_vector, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> b_vector(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_b_vector</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_c_vector(context, </span><span style="color: #a020f0;">&amp;</span>
c_vector, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> c_vector(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_c_vector</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_spin_independent(context, </span><span style="color: #a020f0;">&amp;</span>
spin_independent) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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>(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_int32_t</span>), <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> spin_independent</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_spin_independent</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org6ddd01c" class="outline-3">
<h3 id="org6ddd01c"><span class="section-number-3">2.4</span> Test</h3>
<div class="outline-text-3" id="text-2-4">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Reference input data</span> */
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">walk_num</span> = n2_walk_num;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span> = n2_elec_num;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_up_num</span> = n2_elec_up_num;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_dn_num</span> = n2_elec_dn_num;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span> = n2_nucl_num;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_ee</span> = 0.6;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_en</span>[2] = { 0.6, 0.6 };
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">elec_coord</span> = &amp;(n2_elec_coord[0][0][0]);
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_charge</span> = n2_charge;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span> = &amp;(n2_nucl_coord[0][0]);
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>;
/* <span style="color: #b22222;">Provide Electron data</span> */
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">rc</span>;
assert(!qmckl_electron_provided(context));
rc = qmckl_check(context,
qmckl_set_electron_num (context, elec_up_num, elec_dn_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
rc = qmckl_check(context,
qmckl_set_electron_coord (context, <span style="color: #8b2252;">'N'</span>, walk_num, elec_coord, walk_num*3*elec_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">elec_coord2</span>[walk_num*3*elec_num];
rc = qmckl_check(context,
qmckl_get_electron_coord (context, <span style="color: #8b2252;">'N'</span>, elec_coord2, walk_num*3*elec_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;3*elec_num ; ++i) {
assert( elec_coord[i] == elec_coord2[i] );
}
/* <span style="color: #b22222;">Provide Nucleus data</span> */
assert(!qmckl_nucleus_provided(context));
rc = qmckl_check(context,
qmckl_set_nucleus_num (context, nucl_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
assert(!qmckl_nucleus_provided(context));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">nucl_coord2</span>[3*nucl_num];
rc = qmckl_get_nucleus_coord (context, <span style="color: #8b2252;">'T'</span>, nucl_coord2, 3*nucl_num);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_check(context,
qmckl_set_nucleus_coord (context, <span style="color: #8b2252;">'T'</span>, &amp;(nucl_coord[0]), 3*nucl_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
assert(!qmckl_nucleus_provided(context));
rc = qmckl_check(context,
qmckl_get_nucleus_coord (context, <span style="color: #8b2252;">'N'</span>, nucl_coord2, nucl_num*3)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">k</span>=0 ; k&lt;3 ; ++k) {
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;nucl_num ; ++i) {
assert( nucl_coord[nucl_num*k+i] == nucl_coord2[3*i+k] );
}
}
rc = qmckl_check(context,
qmckl_get_nucleus_coord (context, <span style="color: #8b2252;">'T'</span>, nucl_coord2, nucl_num*3)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;3*nucl_num ; ++i) {
assert( nucl_coord[i] == nucl_coord2[i] );
}
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">nucl_charge2</span>[nucl_num];
rc = qmckl_get_nucleus_charge(context, nucl_charge2, nucl_num);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_NOT_PROVIDED);
rc = qmckl_check(context,
qmckl_set_nucleus_charge(context, nucl_charge, nucl_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_get_nucleus_charge(context, nucl_charge2, nucl_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;nucl_num ; ++i) {
assert( nucl_charge[i] == nucl_charge2[i] );
}
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_nucleus_provided</span>(<span style="color: #a0522d;">context</span>));
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org5b9013a" class="outline-2">
<h2 id="org5b9013a"><span class="section-number-2">3</span> Computation</h2>
<div class="outline-text-2" id="text-3">
<p>
The computed data is stored in the context so that it can be reused
by different kernels. To ensure that the data is valid, for each
computed data the date of the context is stored when it is computed.
To know if some data needs to be recomputed, we check if the date of
the dependencies are more recent than the date of the data to
compute. If it is the case, then the data is recomputed and the
current date is stored.
</p>
</div>
<div id="outline-container-org93a6f1b" class="outline-3">
<h3 id="org93a6f1b"><span class="section-number-3">3.1</span> Electron-electron component</h3>
<div class="outline-text-3" id="text-3-1">
</div>
<div id="outline-container-org89f2f89" class="outline-4">
<h4 id="org89f2f89"><span class="section-number-4">3.1.1</span> Asymptotic component</h4>
<div class="outline-text-4" id="text-3-1-1">
<p>
Calculate the asymptotic component <code>asymp_jasb</code> to be subtracted from the
electron-electron jastrow factor \(J_{\text{ee}}\). Two values are
computed. The first one is for parallel spin pairs, and the
second one for antiparallel spin pairs.
If the <code>spin_independent</code> variable is set to <code>1</code>, then
\(\delta^{\uparrow \downarrow}\) is always equal to one.
</p>
<p>
\[
J_{\text{ee}}^{\infty} = \frac{\frac{1}{2}(1+\delta^{\uparrow \downarrow})\,b_1 \kappa_\text{ee}^{-1}}{1 + b_2\,
\kappa_\text{ee}^{-1}} + \sum_{p=2}^{N_\text{ord}^b} b_{p+1}\, \kappa_\text{ee}^{-p}
\]
</p>
</div>
<div id="outline-container-orgefd9110" class="outline-5">
<h5 id="orgefd9110"><span class="section-number-5">3.1.1.1</span> Get</h5>
<div class="outline-text-5" id="text-3-1-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_jastrow_champ_asymp_jasb</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;">asymp_jasb</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
</div>
<ol class="org-ol">
<li><a id="orgcaf5c5f"></a>Fortran interface<br />
<div class="outline-text-6" id="text-3-1-1-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_asymp_jasb(context, </span><span style="color: #a020f0;">&amp;</span>
asymp_jasb, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> asymp_jasb(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_asymp_jasb</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</li>
</ol>
</div>
<div id="outline-container-org6094529" class="outline-5">
<h5 id="org6094529"><span class="section-number-5">3.1.1.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-1-1-2">
<table id="orgdd6b527" 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>bord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Order of the polynomial</td>
</tr>
<tr>
<td class="org-left"><code>b_vector</code></td>
<td class="org-left"><code>double[bord_num+1]</code></td>
<td class="org-left">in</td>
<td class="org-left">Values of b</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_ee</code></td>
<td class="org-left"><code>double</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron coordinates</td>
</tr>
<tr>
<td class="org-left"><code>spin_independent</code></td>
<td class="org-left"><code>int32_t</code></td>
<td class="org-left">in</td>
<td class="org-left">If 1, same parameters for parallel and anti-parallel pairs</td>
</tr>
<tr>
<td class="org-left"><code>asymp_jasb</code></td>
<td class="org-left"><code>double[2]</code></td>
<td class="org-left">out</td>
<td class="org-left">Asymptotic value</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_jastrow_champ_asymp_jasb_doc</span>(context, <span style="color: #a020f0;">&amp;</span>
bord_num, b_vector, rescale_factor_ee, spin_independent, asymp_jasb) <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: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (qmckl_context) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #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;"> bord_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;"> b_vector(bord_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: #a020f0;">value</span> ::<span style="color: #a0522d;"> rescale_factor_ee</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;"> spin_independent</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;"> asymp_jasb(2)</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, p</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> kappa_inv, x, asym_one</span>
kappa_inv = 1.0d0 / rescale_factor_ee
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> (bord_num &lt; 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
asym_one = b_vector(1) * kappa_inv / (1.0d0 + b_vector(2) * kappa_inv)
<span style="color: #a020f0;">if</span> (spin_independent == 1) <span style="color: #a020f0;">then</span>
asymp_jasb(:) = (/asym_one, asym_one/)
<span style="color: #a020f0;">else</span>
asymp_jasb(:) = (/0.5d0*asym_one, asym_one/)
<span style="color: #a020f0;">end if</span>
x = kappa_inv
<span style="color: #a020f0;">do</span> p = 2, bord_num
x = x * kappa_inv
<span style="color: #a020f0;">do</span> i = 1, 2
asymp_jasb(i) = asymp_jasb(i) + b_vector(p + 1) * x
<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_jastrow_champ_asymp_jasb_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_compute_jastrow_champ_asymp_jasb_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;">int64_t</span> <span style="color: #a0522d;">bord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">b_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">spin_independent</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">asymp_jasb</span> )
{
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) {
<span style="color: #a020f0;">return</span> QMCKL_INVALID_CONTEXT;
}
<span style="color: #a020f0;">if</span> (bord_num &lt; 0) {
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
}
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">kappa_inv</span> = 1.0 / rescale_factor_ee;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">asym_one</span> = b_vector[0] * kappa_inv / (1.0 + b_vector[1] * kappa_inv);
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">f</span> = 0.;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">x</span> = kappa_inv;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span> = 2; k &lt;= bord_num; ++k) {
x *= kappa_inv;
f += b_vector[k]*x;
}
asymp_jasb[0] = spin_independent == 1 ? asym_one + f : 0.5 * asym_one + f;
asymp_jasb[1] = asym_one + f;
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
}
</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_compute_jastrow_champ_asymp_jasb</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;">bord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">b_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">spin_independent</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">asymp_jasb</span> )
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_asymp_jasb_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_asymp_jasb_doc
<span style="color: #483d8b;">#endif</span>
(context, bord_num, b_vector, rescale_factor_ee, spin_independent, asymp_jasb);
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org069181f" class="outline-5">
<h5 id="org069181f"><span class="section-number-5">3.1.1.3</span> Test</h5>
<div class="outline-text-5" id="text-3-1-1-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">type_nucl_num</span> = n2_type_nucl_num;
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">type_nucl_vector</span> = &amp;(n2_type_nucl_vector[0]);
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">aord_num</span> = n2_aord_num;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">bord_num</span> = n2_bord_num;
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">cord_num</span> = n2_cord_num;
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">a_vector</span> = &amp;(n2_a_vector[0][0]);
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">b_vector</span> = &amp;(n2_b_vector[0]);
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">c_vector</span> = &amp;(n2_c_vector[0][0]);
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>=0;
assert(!qmckl_jastrow_champ_provided(context));
/* <span style="color: #b22222;">Set the data</span> */
rc = qmckl_check(context,
qmckl_set_jastrow_champ_spin_independent(context, 0)
);
rc = qmckl_check(context,
qmckl_set_jastrow_champ_aord_num(context, aord_num)
);
rc = qmckl_check(context,
qmckl_set_jastrow_champ_bord_num(context, bord_num)
);
rc = qmckl_check(context,
qmckl_set_jastrow_champ_cord_num(context, cord_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_set_jastrow_champ_type_nucl_num(context, type_nucl_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_set_jastrow_champ_type_nucl_vector(context, type_nucl_vector, nucl_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_set_jastrow_champ_a_vector(context, a_vector,(aord_num+1)*type_nucl_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_set_jastrow_champ_b_vector(context, b_vector,(bord_num+1))
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_get_jastrow_champ_dim_c_vector(context, &amp;dim_c_vector)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_set_jastrow_champ_c_vector(context, c_vector, dim_c_vector*type_nucl_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">k_ee</span> = 0.;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">k_en</span>[2] = { 0., 0. };
rc = qmckl_check(context,
qmckl_set_jastrow_champ_rescale_factor_en(context, rescale_factor_en, type_nucl_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_set_jastrow_champ_rescale_factor_ee(context, rescale_factor_ee)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_get_jastrow_champ_rescale_factor_ee (context, &amp;k_ee)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #0000ff;">assert</span>(k_ee == rescale_factor_ee);
rc = qmckl_check(context,
qmckl_get_jastrow_champ_rescale_factor_en (context, &amp;(k_en[0]), type_nucl_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i&lt;type_nucl_num ; ++i) {
assert(k_en[i] == rescale_factor_en[i]);
}
/* <span style="color: #b22222;">Check if Jastrow is properly initialized</span> */
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_jastrow_champ_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">asymp_jasb</span>[2];
rc = qmckl_check(context,
qmckl_get_jastrow_champ_asymp_jasb(context, asymp_jasb,2)
);
// <span style="color: #b22222;">calculate asymp_jasb</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">asymp_jasb</span>[0]-0.7115733522582638) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">asymp_jasb</span>[1]-1.043287918508297 ) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org953d341" class="outline-4">
<h4 id="org953d341"><span class="section-number-4">3.1.2</span> Electron-electron component</h4>
<div class="outline-text-4" id="text-3-1-2">
<p>
Calculate the electron-electron jastrow component <code>factor_ee</code> using the <code>asymp_jasb</code>
component and the electron-electron rescaled distances <code>ee_distance_rescaled</code>.
If the <code>spin_independent</code> variable is set to <code>1</code>, then
\(\delta^{\uparrow \downarrow}\) is always equal to one.
</p>
<p>
\[
f_\text{ee} = \sum_{i,j<i} \left[
\frac{\delta_{ij}^{\uparrow\downarrow} B_0\, C_{ij}}{1 + B_1\,
C_{ij}} + \sum_{k=2}^{n_\text{ord}} B_k\, C_{ij}^k - {J_{\text{ee}}^{\infty}}_{ij} \right]
\]
</p>
<p>
\(\delta\) is the spin factor, \(B\) is the vector of \(b\) parameters,
\(C\) is the array of rescaled distances.
</p>
<p>
\(f_{\text{ee}}\) can be rewritten as:
</p>
<p>
\[
f_\text{ee} = \frac{1}{2} \left[ \sum_{i,j} \frac{\delta_{ij}^{\uparrow\downarrow} B_0\, C_{ij}}{1 + B_1\, C_{ij}} + \sum_{i,j} \sum_{k=2}^{n_\text{ord}} B_k\, C_{ij}^k \right] - \left[ \frac{n_\uparrow (n_\uparrow-1) + n_\downarrow (n_\downarrow-1)}{2}\, J_{\text{ee}}^{\infty}}_{\uparrow \uparrow} + n_\uparrow\,n_\downarrow\, J_{\text{ee}}^{\infty}}_{\uparrow \downarrow} \right]
\]
</p>
</div>
<div id="outline-container-orge854230" class="outline-5">
<h5 id="orge854230"><span class="section-number-5">3.1.2.1</span> Get</h5>
<div class="outline-text-5" id="text-3-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_jastrow_champ_factor_ee</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;">factor_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
</div>
<ol class="org-ol">
<li><a id="org3390ea2"></a>Fortran interface<br />
<div class="outline-text-6" id="text-3-1-2-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_factor_ee (context, </span><span style="color: #a020f0;">&amp;</span>
factor_ee, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> factor_ee(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_factor_ee</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</li>
</ol>
</div>
<div id="outline-container-org99126bc" class="outline-5">
<h5 id="org99126bc"><span class="section-number-5">3.1.2.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-1-2-2">
<table id="org741fe1e" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</td>
</tr>
<tr>
<td class="org-left"><code>up_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of alpha electrons</td>
</tr>
<tr>
<td class="org-left"><code>bord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of coefficients</td>
</tr>
<tr>
<td class="org-left"><code>b_vector</code></td>
<td class="org-left"><code>double[bord_num+1]</code></td>
<td class="org-left">in</td>
<td class="org-left">List of coefficients</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance_rescaled</code></td>
<td class="org-left"><code>double[walk_num][elec_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-electron distances</td>
</tr>
<tr>
<td class="org-left"><code>asymp_jasb</code></td>
<td class="org-left"><code>double[2]</code></td>
<td class="org-left">in</td>
<td class="org-left">Asymptotic value of the Jastrow</td>
</tr>
<tr>
<td class="org-left"><code>factor_ee</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">\(f_{ee}\)</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_jastrow_champ_factor_ee_doc</span>(context, <span style="color: #a020f0;">&amp;</span>
walk_num, elec_num, up_num, bord_num, b_vector, <span style="color: #a020f0;">&amp;</span>
ee_distance_rescaled, asymp_jasb, spin_independent, factor_ee) <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: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (qmckl_context), <span style="color: #a020f0;">intent</span>(in), <span style="color: #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;"> walk_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;"> elec_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;"> up_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;"> bord_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;"> b_vector(bord_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;"> ee_distance_rescaled(elec_num,elec_num,walk_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;"> asymp_jasb(2)</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;"> spin_independent</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;"> factor_ee(walk_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;"> i, j, k, nw</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, xk</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> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (bord_num &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> nw =1, walk_num
factor_ee(nw) = 0.0d0
<span style="color: #a020f0;">do</span> j=1,elec_num
<span style="color: #a020f0;">do</span> i=1,j-1
x = ee_distance_rescaled(i,j,nw)
<span style="color: #a020f0;">if</span> (spin_independent == 1) <span style="color: #a020f0;">then</span>
factor_ee(nw) = factor_ee(nw) + b_vector(1) * x / (1.d0 + b_vector(2) * x) - asymp_jasb(2)
<span style="color: #a020f0;">else</span>
<span style="color: #a020f0;">if</span> ( (j &lt;= up_num)<span style="color: #a020f0;">.or.</span>(i &gt; up_num) ) <span style="color: #a020f0;">then</span>
factor_ee(nw) = factor_ee(nw) + 0.5d0 * b_vector(1) * x / (1.d0 + b_vector(2) * x) - asymp_jasb(1)
<span style="color: #a020f0;">else</span>
factor_ee(nw) = factor_ee(nw) + b_vector(1) * x / (1.d0 + b_vector(2) * x) - asymp_jasb(2)
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">endif</span>
xk = x
<span style="color: #a020f0;">do</span> k=2,bord_num
xk = xk * x
factor_ee(nw) = factor_ee(nw) + b_vector(k+1)* xk
<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_jastrow_champ_factor_ee_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_compute_jastrow_champ_factor_ee_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;">int64_t</span> <span style="color: #a0522d;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">up_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">bord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">b_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">asymp_jasb</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">spin_independent</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_ee</span> )
{
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) {
<span style="color: #a020f0;">return</span> QMCKL_INVALID_CONTEXT;
}
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) {
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
}
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) {
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_3;
}
<span style="color: #a020f0;">if</span> (bord_num &lt; 0) {
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_4;
}
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dn_num</span> = elec_num - up_num;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">fshift</span> = 0.5 * (<span style="color: #228b22;">double</span>) ((dn_num-1)*dn_num + (up_num-1)*up_num) * asymp_jasb[0] +
(<span style="color: #228b22;">float</span>) (up_num*dn_num) * asymp_jasb[1];
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">nw</span> = 0; nw &lt; walk_num; ++nw) {
factor_ee[nw] = 0.;
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">ishift</span> = nw * elec_num * elec_num;
<span style="color: #a020f0;">if</span> (spin_independent == 1) {
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">j</span> = 0; j &lt; elec_num; ++j ) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">xj</span> = &amp;(ee_distance_rescaled[j * elec_num + ishift]);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span> = 0; i &lt; j ; ++i) {
factor_ee[nw] += b_vector[0]*xj[i] / (1. + b_vector[1]*xj[i]);
}
}
} <span style="color: #a020f0;">else</span> {
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">j</span> = 0; j &lt; up_num; ++j ) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">xj</span> = &amp;(ee_distance_rescaled[j * elec_num + ishift]);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span> = 0; i &lt; j ; ++i) {
factor_ee[nw] += 0.5 * b_vector[0]*xj[i] / (1. + b_vector[1]*xj[i]);
}
}
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">j</span> = up_num ; j &lt; elec_num; ++j ) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">xj</span> = &amp;(ee_distance_rescaled[j * elec_num + ishift]);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span> = 0; i &lt; up_num; ++i) {
factor_ee[nw] += b_vector[0]*xj[i] / (1. + b_vector[1]*xj[i]);
}
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span> = up_num ; i &lt; j ; ++i) {
factor_ee[nw] += 0.5 * b_vector[0]*xj[i] / (1. + b_vector[1]*xj[i]);
}
}
}
factor_ee[nw] -= fshift;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">j</span>=0; j &lt; elec_num; ++j ) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">xj</span> = &amp;(ee_distance_rescaled[j * elec_num + ishift]);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0; i &lt; j ; ++i) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">x</span> = xj[i];
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">xk</span> = x;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span> = 2; k &lt;= bord_num; ++k) {
xk *= x;
factor_ee[nw] += b_vector[k] * xk;
}
}
}
}
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
}
</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_compute_jastrow_champ_factor_ee</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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">up_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">bord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">b_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">asymp_jasb</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">spin_independent</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_ee</span> )
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_ee_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_ee_doc
<span style="color: #483d8b;">#endif</span>
(context, walk_num, elec_num, up_num, bord_num, b_vector,
ee_distance_rescaled, asymp_jasb, spin_independent, factor_ee);
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org6867d67" class="outline-5">
<h5 id="org6867d67"><span class="section-number-5">3.1.2.3</span> Test</h5>
<div class="outline-text-5" id="text-3-1-2-3">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Check if Jastrow is properly initialized</span> */
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_jastrow_champ_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">factor_ee</span>[walk_num];
rc = qmckl_check(context,
qmckl_get_jastrow_champ_factor_ee(context, factor_ee, walk_num)
);
// <span style="color: #b22222;">calculate factor_ee</span>
printf(<span style="color: #8b2252;">"%e\n%e\n\n"</span>,factor_ee[0],-16.83886184243964);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">factor_ee</span>[0]+16.83886184243964) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org28bc1d5" class="outline-4">
<h4 id="org28bc1d5"><span class="section-number-4">3.1.3</span> Derivative</h4>
<div class="outline-text-4" id="text-3-1-3">
<p>
The derivative of <code>factor_ee</code> is computed using the <code>ee_distance_rescaled</code> and
the electron-electron rescaled distances derivatives
<code>ee_distance_rescaled_gl</code>.
There are four components, the gradient which has 3 components in the \(x, y, z\)
directions and the laplacian as the last component.
</p>
<p>
\[ \nabla_i f_\text{ee} = \sum_{j\ne i}
\left[\frac{\delta_{ij}^{\uparrow\downarrow} B_0\, \nabla_i
C_{ij}}{(1 + B_1\, C_{ij})^2} + \sum^{n_\text{ord}}_{k=2}
B_k\, k\, C_{ij}^{k-1} \nabla C_{ij} \right] \]
</p>
<p>
\[ \Delta_i f_\text{ee} = \sum_{j \ne i}
\left[ \delta_{ij}^{\uparrow\downarrow} B_0
\left(\frac{ \Delta_i C_{ij}}{(1 + B_1\, C_{ij})^2} -\frac{2\,B_1
\left(\nabla_i C_{ij}\right)^2 }{(1 + B_1\, C_{ij})^3} \right) + \sum^{n_\text{ord}}_{k=2}
B_k\, k\, \left((k-1)\, C_{ij}^{k-2} \left(\nabla_i C_{ij}\right)^2 + C_{ij}^{k-1} \Delta_i C_{ij} \right) \right] \]
</p>
</div>
<div id="outline-container-orga1ddf18" class="outline-5">
<h5 id="orga1ddf18"><span class="section-number-5">3.1.3.1</span> Get</h5>
<div class="outline-text-5" id="text-3-1-3-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_jastrow_champ_factor_ee_gl</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;">factor_ee_gl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
</div>
<ol class="org-ol">
<li><a id="orgfe065fa"></a>Fortran interface<br />
<div class="outline-text-6" id="text-3-1-3-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_factor_ee_gl (context, </span><span style="color: #a020f0;">&amp;</span>
factor_ee_gl, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> factor_ee_gl(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_factor_ee_gl</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</li>
</ol>
</div>
<div id="outline-container-orgc34708b" class="outline-5">
<h5 id="orgc34708b"><span class="section-number-5">3.1.3.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-1-3-2">
<table id="org5a2e25d" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</td>
</tr>
<tr>
<td class="org-left"><code>up_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of alpha electrons</td>
</tr>
<tr>
<td class="org-left"><code>bord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of coefficients</td>
</tr>
<tr>
<td class="org-left"><code>b_vector</code></td>
<td class="org-left"><code>double[bord_num+1]</code></td>
<td class="org-left">in</td>
<td class="org-left">List of coefficients</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance_rescaled</code></td>
<td class="org-left"><code>double[walk_num][elec_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-electron distances</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance_rescaled_gl</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-electron distances</td>
</tr>
<tr>
<td class="org-left"><code>spin_independent</code></td>
<td class="org-left"><code>int32_t</code></td>
<td class="org-left">in</td>
<td class="org-left">If 1, same parameters for parallel and antiparallel spins</td>
</tr>
<tr>
<td class="org-left"><code>factor_ee_gl</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-electron distances</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_compute_jastrow_champ_factor_ee_gl_doc</span>( <span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, up_num, bord_num, <span style="color: #a020f0;">&amp;</span>
b_vector, ee_distance_rescaled, ee_distance_rescaled_gl, <span style="color: #a020f0;">&amp;</span>
spin_independent, factor_ee_gl) <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: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (qmckl_context), <span style="color: #a020f0;">intent</span>(in), <span style="color: #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;"> walk_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;"> elec_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;"> up_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;"> bord_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;"> b_vector(bord_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;"> ee_distance_rescaled(elec_num,elec_num,walk_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;"> ee_distance_rescaled_gl(4,elec_num,elec_num,walk_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: #a020f0;">value</span> ::<span style="color: #a0522d;"> spin_independent</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;"> factor_ee_gl(elec_num,4,walk_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;"> i, j, k, nw, ii</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, x1, kf</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> denom, invdenom, invdenom2, f</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> grad_c2</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> dx(4)</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> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (bord_num &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> ((spin_independent &lt; 0)<span style="color: #a020f0;">.or.</span>(spin_independent &gt; 1)) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_8
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> nw =1, walk_num
factor_ee_gl(:,:,nw) = 0.0d0
<span style="color: #a020f0;">do</span> j = 1, elec_num
<span style="color: #a020f0;">do</span> i = 1, elec_num
<span style="color: #a020f0;">if</span> (i == j) <span style="color: #a020f0;">cycle</span>
x = ee_distance_rescaled(i,j,nw)
denom = 1.0d0 + b_vector(2) * x
invdenom = 1.0d0 / denom
invdenom2 = invdenom * invdenom
dx(1) = ee_distance_rescaled_gl(1, i, j, nw)
dx(2) = ee_distance_rescaled_gl(2, i, j, nw)
dx(3) = ee_distance_rescaled_gl(3, i, j, nw)
dx(4) = ee_distance_rescaled_gl(4, i, j, nw)
grad_c2 = dx(1)*dx(1) + dx(2)*dx(2) + dx(3)*dx(3)
<span style="color: #a020f0;">if</span> (spin_independent == 1) <span style="color: #a020f0;">then</span>
f = b_vector(1) * invdenom2
<span style="color: #a020f0;">else</span>
<span style="color: #a020f0;">if</span>((i &lt;= up_num <span style="color: #a020f0;">.and.</span> j &lt;= up_num ) <span style="color: #a020f0;">.or.</span> (i &gt; up_num <span style="color: #a020f0;">.and.</span> j &gt; up_num)) <span style="color: #a020f0;">then</span>
f = 0.5d0 * b_vector(1) * invdenom2
<span style="color: #a020f0;">else</span>
f = b_vector(1) * invdenom2
<span style="color: #a020f0;">end if</span>
<span style="color: #a020f0;">end if</span>
factor_ee_gl(i,1,nw) = factor_ee_gl(i,1,nw) + f * dx(1)
factor_ee_gl(i,2,nw) = factor_ee_gl(i,2,nw) + f * dx(2)
factor_ee_gl(i,3,nw) = factor_ee_gl(i,3,nw) + f * dx(3)
factor_ee_gl(i,4,nw) = factor_ee_gl(i,4,nw) <span style="color: #a020f0;">&amp;</span>
+ f * (dx(4) - 2.d0 * b_vector(2) * grad_c2 * invdenom)
kf = 2.d0
x1 = x
x = 1.d0
<span style="color: #a020f0;">do</span> k=2, bord_num
f = b_vector(k+1) * kf * x
factor_ee_gl(i,1,nw) = factor_ee_gl(i,1,nw) + f * x1 * dx(1)
factor_ee_gl(i,2,nw) = factor_ee_gl(i,2,nw) + f * x1 * dx(2)
factor_ee_gl(i,3,nw) = factor_ee_gl(i,3,nw) + f * x1 * dx(3)
factor_ee_gl(i,4,nw) = factor_ee_gl(i,4,nw) <span style="color: #a020f0;">&amp;</span>
+ f * (x1 * dx(4) + (kf-1.d0) * grad_c2)
x = x*x1
kf = kf + 1.d0
<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_jastrow_champ_factor_ee_gl_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_compute_jastrow_champ_factor_ee_gl_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;">int64_t</span> <span style="color: #a0522d;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">up_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">bord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">b_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled_gl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">spin_independent</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_ee_gl</span> )
{
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">return</span> QMCKL_INVALID_CONTEXT;
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_3;
<span style="color: #a020f0;">if</span> (up_num &lt;= 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_4;
<span style="color: #a020f0;">if</span> (bord_num &lt; 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_5;
<span style="color: #a020f0;">if</span> (b_vector == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_6;
<span style="color: #a020f0;">if</span> (ee_distance_rescaled == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_7;
<span style="color: #a020f0;">if</span> (ee_distance_rescaled_gl == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_8;
<span style="color: #a020f0;">if</span> (spin_independent &amp; (<span style="color: #228b22;">int32_t</span>) (-2)) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_8;
<span style="color: #a020f0;">if</span> (factor_ee_gl == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_9;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">kf</span>[bord_num+1];
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span>=0 ; k&lt;=bord_num ; ++k) {
kf[k] = (<span style="color: #228b22;">double</span>) k;
}
<span style="color: #483d8b;">#pragma</span> omp parallel <span style="color: #a020f0;">for</span>
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">nw</span> = 0; nw &lt; walk_num; ++nw) {
memset(&amp;(factor_ee_gl[nw*4*elec_num]), 0, elec_num*4*<span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">j</span> = 0; j &lt; elec_num; ++j) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">dxj</span> = &amp;ee_distance_rescaled_gl[4*elec_num*(j+nw*elec_num)];
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">xj</span> = &amp;ee_distance_rescaled [ elec_num*(j+nw*elec_num)];
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">factor_ee_gl_0</span> = &amp;(factor_ee_gl[nw*elec_num*4]);
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">factor_ee_gl_1</span> = factor_ee_gl_0 + elec_num;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">factor_ee_gl_2</span> = factor_ee_gl_1 + elec_num;
<span style="color: #228b22;">double</span> * <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">factor_ee_gl_3</span> = factor_ee_gl_2 + elec_num;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span> = 0; i &lt; elec_num; ++i) {
<span style="color: #a020f0;">if</span> (j == i) <span style="color: #a020f0;">continue</span>;
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">x</span> = xj[i];
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">denom</span> = 1.0 + b_vector[1]*x;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">invdenom</span> = 1.0 / denom;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">invdenom2</span> = invdenom * invdenom;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a020f0;">restrict</span> <span style="color: #a0522d;">dx</span> = dxj + 4*i;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">grad_c2</span> = dx[0]*dx[0] + dx[1]*dx[1] + dx[2]*dx[2];
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">f</span> = b_vector[0] * invdenom2;
<span style="color: #a020f0;">if</span> ((spin_independent == 0) &amp;&amp; (
((i &lt; up_num) &amp;&amp; (j &lt; up_num)) ||
((i &gt;= up_num) &amp;&amp; (j &gt;= up_num))) ) {
f *= 0.5;
}
factor_ee_gl_0[i] += f*dx[0];
factor_ee_gl_1[i] += f*dx[1];
factor_ee_gl_2[i] += f*dx[2];
factor_ee_gl_3[i] += f*dx[3];
factor_ee_gl_3[i] -= f*grad_c2*invdenom*2.0 * b_vector[1];
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">xk</span>[bord_num+1]; // <span style="color: #b22222;">Nvidia C 23.1-0 compiler crashes here (skylake avx512) nvc nvfoftran --enable-hpc</span>
xk[0] = 1.0;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span>=1 ; k&lt;= bord_num ; ++k) {
xk[k] = xk[k-1]*x;
}
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span>=2 ; k&lt;= bord_num ; ++k) {
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">f1</span> = b_vector[k] * kf[k] * xk[k-2];
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">f2</span> = f1*xk[1];
factor_ee_gl_0[i] += f2*dx[0];
factor_ee_gl_1[i] += f2*dx[1];
factor_ee_gl_2[i] += f2*dx[2];
factor_ee_gl_3[i] += f2*dx[3];
factor_ee_gl_3[i] += f1*kf[k-1]*grad_c2;
}
}
}
}
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
}
</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_compute_jastrow_champ_factor_ee_gl_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;">int64_t</span> <span style="color: #a0522d;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">up_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">bord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">b_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled_gl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">spin_independent</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_ee_gl</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_compute_jastrow_champ_factor_ee_gl_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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">up_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">bord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">b_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled_gl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">spin_independent</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_ee_gl</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_compute_jastrow_champ_factor_ee_gl</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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">up_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">bord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">b_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance_rescaled_gl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">spin_independent</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_ee_gl</span> )
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_ee_gl_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_ee_gl_doc
<span style="color: #483d8b;">#endif</span>
(context, walk_num, elec_num, up_num, bord_num, b_vector,
ee_distance_rescaled, ee_distance_rescaled_gl, spin_independent, factor_ee_gl );
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgb9dc4db" class="outline-5">
<h5 id="orgb9dc4db"><span class="section-number-5">3.1.3.3</span> Test</h5>
<div class="outline-text-5" id="text-3-1-3-3">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Check if Jastrow is properly initialized</span> */
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_jastrow_champ_provided</span>(<span style="color: #a0522d;">context</span>));
// <span style="color: #b22222;">calculate factor_ee_gl</span>
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">factor_ee_gl</span>[walk_num][4][elec_num];
rc = qmckl_get_jastrow_champ_factor_ee_gl(context, &amp;(factor_ee_gl[0][0][0]),walk_num*4*elec_num);
// <span style="color: #b22222;">check factor_ee_gl</span>
printf(<span style="color: #8b2252;">"%f %f\n"</span>, factor_ee_gl[0][0][0], -0.39319353942687446);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">factor_ee_gl</span>[0][0][0]+0.39319353942687446) &lt; 1.e-12);
printf(<span style="color: #8b2252;">"%f %f\n"</span>, factor_ee_gl[0][1][0], 1.0535615450668214);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">factor_ee_gl</span>[0][1][0]-1.0535615450668214) &lt; 1.e-12);
printf(<span style="color: #8b2252;">"%f %f\n"</span>, factor_ee_gl[0][2][0],-0.39098406960784515);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">factor_ee_gl</span>[0][2][0]+0.39098406960784515) &lt; 1.e-12);
printf(<span style="color: #8b2252;">"%f %f\n"</span>, factor_ee_gl[0][3][0],2.8650469630854483);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">factor_ee_gl</span>[0][3][0]-2.8650469630854483) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org45a9862" class="outline-4">
<h4 id="org45a9862"><span class="section-number-4">3.1.4</span> Electron-electron rescaled distances</h4>
<div class="outline-text-4" id="text-3-1-4">
<p>
<code>ee_distance_rescaled</code> stores the matrix of the rescaled distances between all
pairs of electrons:
</p>
<p>
\[
C_{ij} = \frac{ 1 - e^{-\kappa r_{ij}}}{\kappa}
\]
</p>
<p>
where \(r_{ij}\) is the matrix of electron-electron distances.
</p>
</div>
<div id="outline-container-org08e5e79" class="outline-5">
<h5 id="org08e5e79"><span class="section-number-5">3.1.4.1</span> Get</h5>
<div class="outline-text-5" id="text-3-1-4-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_ee_distance_rescaled</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">distance_rescaled</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-org20546a3" class="outline-5">
<h5 id="org20546a3"><span class="section-number-5">3.1.4.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-1-4-2">
<table id="org07b3db5" 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>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_ee</code></td>
<td class="org-left"><code>double</code></td>
<td class="org-left">in</td>
<td class="org-left">Factor to rescale ee distances</td>
</tr>
<tr>
<td class="org-left"><code>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>coord</code></td>
<td class="org-left"><code>double[3][walk_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron coordinates</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance</code></td>
<td class="org-left"><code>double[walk_num][elec_num][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-electron rescaled distances</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_ee_distance_rescaled_doc</span>(context, <span style="color: #a020f0;">&amp;</span>
elec_num, rescale_factor_ee, walk_num, <span style="color: #a020f0;">&amp;</span>
coord, ee_distance_rescaled) <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: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in), <span style="color: #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;"> elec_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: #a020f0;">value</span> ::<span style="color: #a0522d;"> rescale_factor_ee</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;"> walk_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(elec_num,walk_num,3)</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;"> ee_distance_rescaled(elec_num,elec_num,walk_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;"> k</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> k=1,walk_num
info = qmckl_distance_rescaled(context, <span style="color: #8b2252;">'T'</span>, <span style="color: #8b2252;">'T'</span>, elec_num, elec_num, <span style="color: #a020f0;">&amp;</span>
coord(1,k,1), elec_num * walk_num, <span style="color: #a020f0;">&amp;</span>
coord(1,k,1), elec_num * walk_num, <span style="color: #a020f0;">&amp;</span>
ee_distance_rescaled(1,1,k), elec_num, rescale_factor_ee)
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">exit</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_ee_distance_rescaled_doc</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org6bc675b" class="outline-5">
<h5 id="org6bc675b"><span class="section-number-5">3.1.4.3</span> Test</h5>
<div class="outline-text-5" id="text-3-1-4-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">ee_distance_rescaled</span>[walk_num * elec_num * elec_num];
rc = qmckl_get_jastrow_champ_ee_distance_rescaled(context, ee_distance_rescaled);
// <span style="color: #b22222;">(e1,e2,w)</span>
// <span style="color: #b22222;">(0,0,0) == 0.</span>
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">ee_distance_rescaled</span>[0] == 0.);
// <span style="color: #b22222;">(1,0,0) == (0,1,0)</span>
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">ee_distance_rescaled</span>[1] == ee_distance_rescaled[elec_num]);
// <span style="color: #b22222;">value of (1,0,0)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">ee_distance_rescaled</span>[1]-0.6347507420688708) &lt; 1.e-12);
// <span style="color: #b22222;">(0,0,1) == 0.</span>
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">ee_distance_rescaled</span>[5*elec_num + 5] == 0.);
// <span style="color: #b22222;">(1,0,1) == (0,1,1)</span>
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">ee_distance_rescaled</span>[5*elec_num+6] == ee_distance_rescaled[6*elec_num+5]);
// <span style="color: #b22222;">value of (1,0,1)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">ee_distance_rescaled</span>[5*elec_num+6]-0.3941735387855409) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgfbac371" class="outline-4">
<h4 id="orgfbac371"><span class="section-number-4">3.1.5</span> Electron-electron rescaled distance gradients and Laplacian with respect to electron coordinates</h4>
<div class="outline-text-4" id="text-3-1-5">
<p>
The rescaled distances, represented by \(C_{ij} = (1 - e^{-\kappa_\text{e} r_{ij}})/\kappa_\text{e}\)
are differentiated with respect to the electron coordinates.
This information is stored in the tensor
<code>ee_distance_rescaled_gl</code>. The initial three sequential
elements of this three-dimensional tensor provide the \(x\), \(y\), and \(z\)
direction derivatives, while the fourth index corresponds to the Laplacian.
</p>
</div>
<div id="outline-container-org3429775" class="outline-5">
<h5 id="org3429775"><span class="section-number-5">3.1.5.1</span> Get</h5>
<div class="outline-text-5" id="text-3-1-5-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_jastrow_champ_ee_distance_rescaled_gl</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">distance_rescaled_gl</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-org0d0d3b0" class="outline-5">
<h5 id="org0d0d3b0"><span class="section-number-5">3.1.5.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-1-5-2">
<table id="org98dcb1b" 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>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_ee</code></td>
<td class="org-left"><code>double</code></td>
<td class="org-left">in</td>
<td class="org-left">Factor to rescale ee distances</td>
</tr>
<tr>
<td class="org-left"><code>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>coord</code></td>
<td class="org-left"><code>double[3][walk_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron coordinates</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance_rescaled_gl</code></td>
<td class="org-left"><code>double[walk_num][elec_num][elec_num][4]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-electron rescaled distance derivatives</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_ee_distance_rescaled_gl_doc</span>(context, <span style="color: #a020f0;">&amp;</span>
elec_num, rescale_factor_ee, walk_num, coord, ee_distance_rescaled_gl) <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: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in), <span style="color: #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;"> elec_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: #a020f0;">value</span> ::<span style="color: #a0522d;"> rescale_factor_ee</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;"> walk_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(elec_num,walk_num,3)</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;"> ee_distance_rescaled_gl(4,elec_num,elec_num,walk_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;"> k</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> k=1,walk_num
info = qmckl_distance_rescaled_gl(context, <span style="color: #8b2252;">'T'</span>, <span style="color: #8b2252;">'T'</span>, elec_num, elec_num, <span style="color: #a020f0;">&amp;</span>
coord(1,k,1), elec_num*walk_num, <span style="color: #a020f0;">&amp;</span>
coord(1,k,1), elec_num*walk_num, <span style="color: #a020f0;">&amp;</span>
ee_distance_rescaled_gl(1,1,1,k), elec_num, rescale_factor_ee)
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">exit</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_ee_distance_rescaled_gl_doc</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org80ca276" class="outline-5">
<h5 id="org80ca276"><span class="section-number-5">3.1.5.3</span> Test</h5>
<div class="outline-text-5" id="text-3-1-5-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">ee_distance_rescaled_gl</span>[4 * walk_num * elec_num * elec_num];
rc = qmckl_get_jastrow_champ_ee_distance_rescaled_gl(context, ee_distance_rescaled_gl);
// <span style="color: #b22222;">TODO: Get exact values</span>
//// <span style="color: #b22222;">(e1,e2,w)</span>
//// <span style="color: #b22222;">(0,0,0) == 0.</span>
//<span style="color: #b22222;">assert(ee_distance[0] == 0.);</span>
//
//// <span style="color: #b22222;">(1,0,0) == (0,1,0)</span>
//<span style="color: #b22222;">assert(ee_distance[1] == ee_distance[elec_num]);</span>
//
//// <span style="color: #b22222;">value of (1,0,0)</span>
//<span style="color: #b22222;">assert(fabs(ee_distance[1]-7.152322512964209) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(0,0,1) == 0.</span>
//<span style="color: #b22222;">assert(ee_distance[elec_num*elec_num] == 0.);</span>
//
//// <span style="color: #b22222;">(1,0,1) == (0,1,1)</span>
//<span style="color: #b22222;">assert(ee_distance[elec_num*elec_num+1] == ee_distance[elec_num*elec_num+elec_num]);</span>
//
//// <span style="color: #b22222;">value of (1,0,1)</span>
//<span style="color: #b22222;">assert(fabs(ee_distance[elec_num*elec_num+1]-6.5517646321055665) &lt; 1.e-12);</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="outline-container-org482f11a" class="outline-3">
<h3 id="org482f11a"><span class="section-number-3">3.2</span> Electron-nucleus component</h3>
<div class="outline-text-3" id="text-3-2">
</div>
<div id="outline-container-org301126b" class="outline-4">
<h4 id="org301126b"><span class="section-number-4">3.2.1</span> Asymptotic component for</h4>
<div class="outline-text-4" id="text-3-2-1">
<p>
Calculate the asymptotic component <code>asymp_jasa</code> to be subtracted from the final
electron-nucleus jastrow factor \(J_{\text{eN}}\). The asymptotic component is calculated
via the <code>a_vector</code> and the electron-nucleus rescale factors <code>rescale_factor_en</code>.
</p>
<p>
\[
J_{\text{en}}^{\infty \alpha} = -\frac{a_1 \kappa_\alpha^{-1}}{1 + a_2 \kappa_\alpha^{-1}}
\]
</p>
</div>
<div id="outline-container-orgc809d98" class="outline-5">
<h5 id="orgc809d98"><span class="section-number-5">3.2.1.1</span> Get</h5>
<div class="outline-text-5" id="text-3-2-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_jastrow_champ_asymp_jasa</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;">asymp_jasa</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
</div>
<ol class="org-ol">
<li><a id="org906741f"></a>Fortran interface<br />
<div class="outline-text-6" id="text-3-2-1-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_asymp_jasa(context, </span><span style="color: #a020f0;">&amp;</span>
asymp_jasa, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> asymp_jasa(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_asymp_jasa</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</li>
</ol>
</div>
<div id="outline-container-org933040a" class="outline-5">
<h5 id="org933040a"><span class="section-number-5">3.2.1.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-2-1-2">
<table id="org40fd2bd" 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>aord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Order of the polynomial</td>
</tr>
<tr>
<td class="org-left"><code>type_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 nucleus types</td>
</tr>
<tr>
<td class="org-left"><code>a_vector</code></td>
<td class="org-left"><code>double[type_nucl_num][aord_num+1]</code></td>
<td class="org-left">in</td>
<td class="org-left">Values of a</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_en</code></td>
<td class="org-left"><code>double[type_nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron nucleus distances</td>
</tr>
<tr>
<td class="org-left"><code>asymp_jasa</code></td>
<td class="org-left"><code>double[type_nucl_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Asymptotic value</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_asymp_jasa_f(context, aord_num, type_nucl_num, a_vector, </span><span style="color: #a020f0;">&amp;</span>
rescale_factor_en, asymp_jasa) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> aord_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> type_nucl_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> a_vector(aord_num + 1, type_nucl_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_en(type_nucl_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> asymp_jasa(type_nucl_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, j, p</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> kappa_inv, x, asym_one</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> (aord_num &lt; 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> i=1,type_nucl_num
kappa_inv = 1.0d0 / rescale_factor_en(i)
asymp_jasa(i) = a_vector(1,i) * kappa_inv / (1.0d0 + a_vector(2,i) * kappa_inv)
x = kappa_inv
<span style="color: #a020f0;">do</span> p = 2, aord_num
x = x * kappa_inv
asymp_jasa(i) = asymp_jasa(i) + a_vector(p+1, i) * x
<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_jastrow_champ_asymp_jasa_f</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_compute_jastrow_champ_asymp_jasa</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;">aord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">type_nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">a_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">rescale_factor_en</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">asymp_jasa</span> );
</pre>
</div>
</div>
</div>
<div id="outline-container-orga0efa28" class="outline-5">
<h5 id="orga0efa28"><span class="section-number-5">3.2.1.3</span> Test</h5>
<div class="outline-text-5" id="text-3-2-1-3">
<p>
double asymp<sub>jasa</sub>[2];
rc = qmckl<sub>get</sub><sub>jastrow</sub><sub>champ</sub><sub>asymp</sub><sub>jasa</sub>(context, asymp<sub>jasa</sub>, type<sub>nucl</sub><sub>num</sub>);
</p>
<p>
// calculate asymp<sub>jasb</sub>
printf("%e %e\n", asymp<sub>jasa</sub>[0], -1.75529774);
assert(fabs(-1.75529774 - asymp<sub>jasa</sub>[0]) &lt; 1.e-8);
</p>
<p>
#+end<sub>src</sub>
</p>
</div>
</div>
</div>
<div id="outline-container-orge3e35dd" class="outline-4">
<h4 id="orge3e35dd"><span class="section-number-4">3.2.2</span> Electron-nucleus component</h4>
<div class="outline-text-4" id="text-3-2-2">
<p>
Calculate the electron-electron jastrow component <code>factor_en</code> using the <code>a_vector</code>
coeffecients and the electron-nucleus rescaled distances <code>en_distance_rescaled</code>.
</p>
<p>
\[
f_{\alpha}(R_{i\alpha}) = - \sum_{i,j<i} \left[ \frac{ A_0 C_{ij}}{1 - A_1 C_{ij}} + \sum^{N^\alpha_{\text{ord}}}_{k}A_k C_{ij}^k \right]
\]
</p>
</div>
<div id="outline-container-org27938cf" class="outline-5">
<h5 id="org27938cf"><span class="section-number-5">3.2.2.1</span> Get</h5>
<div class="outline-text-5" id="text-3-2-2-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_jastrow_champ_factor_en</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;">factor_en</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
</div>
<ol class="org-ol">
<li><a id="orgbe7e0e6"></a>Fortran interface<br />
<div class="outline-text-6" id="text-3-2-2-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_factor_en (context, </span><span style="color: #a020f0;">&amp;</span>
factor_en, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> factor_en(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_factor_en</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</li>
</ol>
</div>
<div id="outline-container-org56978c3" class="outline-5">
<h5 id="org56978c3"><span class="section-number-5">3.2.2.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-2-2-2">
<table id="org202adba" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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>type_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 unique nuclei</td>
</tr>
<tr>
<td class="org-left"><code>type_nucl_vector</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">IDs of unique nuclei</td>
</tr>
<tr>
<td class="org-left"><code>aord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of coefficients</td>
</tr>
<tr>
<td class="org-left"><code>a_vector</code></td>
<td class="org-left"><code>double[type_nucl_num][aord_num+1]</code></td>
<td class="org-left">in</td>
<td class="org-left">List of coefficients</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled</code></td>
<td class="org-left"><code>double[walk_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus distances</td>
</tr>
<tr>
<td class="org-left"><code>asymp_jasa</code></td>
<td class="org-left"><code>double[type_nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Type of nuclei</td>
</tr>
<tr>
<td class="org-left"><code>factor_en</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-nucleus jastrow</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_jastrow_champ_factor_en_doc</span>( <span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, nucl_num, type_nucl_num, <span style="color: #a020f0;">&amp;</span>
type_nucl_vector, aord_num, a_vector, <span style="color: #a020f0;">&amp;</span>
en_distance_rescaled, asymp_jasa, factor_en) <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: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (qmckl_context), <span style="color: #a020f0;">intent</span>(in), <span style="color: #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;"> walk_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;"> elec_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: #a020f0;">value</span> ::<span style="color: #a0522d;"> type_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;"> type_nucl_vector(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: #a020f0;">value</span> ::<span style="color: #a0522d;"> aord_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;"> a_vector(aord_num+1,type_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;"> en_distance_rescaled(elec_num,nucl_num,walk_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;"> asymp_jasa(type_nucl_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;"> factor_en(walk_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;"> i, a, p, nw</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, power_ser</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> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (nucl_num &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> (type_nucl_num &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> (aord_num &lt; 0) <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> nw =1, walk_num
factor_en(nw) = 0.0d0
<span style="color: #a020f0;">do</span> a = 1, nucl_num
<span style="color: #a020f0;">do</span> i = 1, elec_num
x = en_distance_rescaled(i, a, nw)
factor_en(nw) = factor_en(nw) + a_vector(1, type_nucl_vector(a)+1) * x / <span style="color: #a020f0;">&amp;</span>
(1.0d0 + a_vector(2, type_nucl_vector(a)+1) * x) - asymp_jasa(type_nucl_vector(a)+1)
<span style="color: #a020f0;">do</span> p = 2, aord_num
x = x * en_distance_rescaled(i, a, nw)
factor_en(nw) = factor_en(nw) + a_vector(p + 1, type_nucl_vector(a)+1) * x
<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_jastrow_champ_factor_en_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_compute_jastrow_champ_factor_en_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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_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;">type_nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">type_nucl_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">aord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">a_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">en_distance_rescaled</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">asymp_jasa</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_en</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_compute_jastrow_champ_factor_en</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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_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;">type_nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">type_nucl_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">aord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">a_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">en_distance_rescaled</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">asymp_jasa</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_en</span> )
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_en_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_en_doc
<span style="color: #483d8b;">#endif</span>
(context, walk_num, elec_num, nucl_num, type_nucl_num,
type_nucl_vector, aord_num, a_vector, en_distance_rescaled,
asymp_jasa, factor_en );
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org92df30d" class="outline-5">
<h5 id="org92df30d"><span class="section-number-5">3.2.2.3</span> Test</h5>
<div class="outline-text-5" id="text-3-2-2-3">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Check if Jastrow is properly initialized</span> */
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_jastrow_champ_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">factor_en</span>[walk_num];
rc = qmckl_get_jastrow_champ_factor_en(context, factor_en,walk_num);
// <span style="color: #b22222;">calculate factor_en</span>
printf(<span style="color: #8b2252;">"%f %f\n"</span>, factor_en[0], 22.781375792083587);
<span style="color: #0000ff;">assert</span>(fabs(22.781375792083587 - factor_en[0]) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org647fd84" class="outline-4">
<h4 id="org647fd84"><span class="section-number-4">3.2.3</span> Derivative</h4>
<div class="outline-text-4" id="text-3-2-3">
<p>
Calculate the electron-electron jastrow component <code>factor_en_gl</code> derivative
with respect to the electron coordinates using the <code>en_distance_rescaled</code> and
<code>en_distance_rescaled_gl</code> which are already calculated previously.
</p>
<p>
TODO: write equations.
</p>
</div>
<div id="outline-container-org12f87f4" class="outline-5">
<h5 id="org12f87f4"><span class="section-number-5">3.2.3.1</span> Get</h5>
<div class="outline-text-5" id="text-3-2-3-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_jastrow_champ_factor_en_gl</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;">factor_en_gl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
</div>
<ol class="org-ol">
<li><a id="org1d28d92"></a>Fortran interface<br />
<div class="outline-text-6" id="text-3-2-3-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_factor_en_gl (context, </span><span style="color: #a020f0;">&amp;</span>
factor_en_gl, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> factor_en_gl(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_factor_en_gl</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</li>
</ol>
</div>
<div id="outline-container-org65674a5" class="outline-5">
<h5 id="org65674a5"><span class="section-number-5">3.2.3.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-2-3-2">
<table id="org5cd1528" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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>type_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 unique nuclei</td>
</tr>
<tr>
<td class="org-left"><code>type_nucl_vector</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">IDs of unique nuclei</td>
</tr>
<tr>
<td class="org-left"><code>aord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of coefficients</td>
</tr>
<tr>
<td class="org-left"><code>a_vector</code></td>
<td class="org-left"><code>double[type_nucl_num][aord_num+1]</code></td>
<td class="org-left">in</td>
<td class="org-left">List of coefficients</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled</code></td>
<td class="org-left"><code>double[walk_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus distances</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled_gl</code></td>
<td class="org-left"><code>double[walk_num][nucl_num][elec_num][4]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus distance derivatives</td>
</tr>
<tr>
<td class="org-left"><code>factor_en_gl</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-nucleus jastrow</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_jastrow_champ_factor_en_gl_doc</span>( <span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, nucl_num, type_nucl_num, <span style="color: #a020f0;">&amp;</span>
type_nucl_vector, aord_num, a_vector, <span style="color: #a020f0;">&amp;</span>
en_distance_rescaled, en_distance_rescaled_gl, factor_en_gl) <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: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (qmckl_context), <span style="color: #a020f0;">intent</span>(in), <span style="color: #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;"> walk_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;"> elec_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: #a020f0;">value</span> ::<span style="color: #a0522d;"> type_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;"> type_nucl_vector(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: #a020f0;">value</span> ::<span style="color: #a0522d;"> aord_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;"> a_vector(aord_num+1,type_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;"> en_distance_rescaled(elec_num,nucl_num,walk_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;"> en_distance_rescaled_gl(4, elec_num,nucl_num,walk_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;"> factor_en_gl(elec_num,4,walk_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;"> i, a, k, nw, ii</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, x1, kf</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> denom, invdenom, invdenom2, f</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> grad_c2</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> dx(4)</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> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (nucl_num &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> (aord_num &lt; 0) <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> nw =1, walk_num
factor_en_gl(:,:,nw) = 0.0d0
<span style="color: #a020f0;">do</span> a = 1, nucl_num
<span style="color: #a020f0;">do</span> i = 1, elec_num
x = en_distance_rescaled(i,a,nw)
<span style="color: #a020f0;">if</span>(<span style="color: #a020f0;">abs</span>(x) &lt; 1.d-12) <span style="color: #a020f0;">continue</span>
denom = 1.0d0 + a_vector(2, type_nucl_vector(a)+1) * x
invdenom = 1.0d0 / denom
invdenom2 = invdenom*invdenom
dx(1) = en_distance_rescaled_gl(1,i,a,nw)
dx(2) = en_distance_rescaled_gl(2,i,a,nw)
dx(3) = en_distance_rescaled_gl(3,i,a,nw)
dx(4) = en_distance_rescaled_gl(4,i,a,nw)
f = a_vector(1, type_nucl_vector(a)+1) * invdenom2
grad_c2 = dx(1)*dx(1) + dx(2)*dx(2) + dx(3)*dx(3)
factor_en_gl(i,1,nw) = factor_en_gl(i,1,nw) + f * dx(1)
factor_en_gl(i,2,nw) = factor_en_gl(i,2,nw) + f * dx(2)
factor_en_gl(i,3,nw) = factor_en_gl(i,3,nw) + f * dx(3)
factor_en_gl(i,4,nw) = factor_en_gl(i,4,nw) <span style="color: #a020f0;">&amp;</span>
+ f * (dx(4) - 2.d0 * a_vector(2, type_nucl_vector(a)+1) * grad_c2 * invdenom)
kf = 2.d0
x1 = x
x = 1.d0
<span style="color: #a020f0;">do</span> k=2, aord_num
f = a_vector(k+1,type_nucl_vector(a)+1) * kf * x
factor_en_gl(i,1,nw) = factor_en_gl(i,1,nw) + f * x1 * dx(1)
factor_en_gl(i,2,nw) = factor_en_gl(i,2,nw) + f * x1 * dx(2)
factor_en_gl(i,3,nw) = factor_en_gl(i,3,nw) + f * x1 * dx(3)
factor_en_gl(i,4,nw) = factor_en_gl(i,4,nw) <span style="color: #a020f0;">&amp;</span>
+ f * (x1 * dx(4) + (kf-1.d0) * grad_c2)
x = x*x1
kf = kf + 1.d0
<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_jastrow_champ_factor_en_gl_doc</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgae7161b" class="outline-5">
<h5 id="orgae7161b"><span class="section-number-5">3.2.3.3</span> Test</h5>
<div class="outline-text-5" id="text-3-2-3-3">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Check if Jastrow is properly initialized</span> */
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_jastrow_champ_provided</span>(<span style="color: #a0522d;">context</span>));
// <span style="color: #b22222;">calculate factor_en_gl</span>
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">factor_en_gl</span>[walk_num][4][elec_num];
rc = qmckl_get_jastrow_champ_factor_en_gl(context, &amp;(factor_en_gl[0][0][0]),walk_num*4*elec_num);
// <span style="color: #b22222;">check factor_en_gl</span>
<span style="color: #0000ff;">assert</span>(fabs( 0.19656663796630847 - factor_en_gl[0][0][0]) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs( -0.3945140890522283 - factor_en_gl[0][1][0]) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs( 0.5082964671286118 - factor_en_gl[0][2][0]) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs( -1.8409460670666289 - factor_en_gl[0][3][0]) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org3a15afa" class="outline-4">
<h4 id="org3a15afa"><span class="section-number-4">3.2.4</span> Electron-nucleus rescaled distances</h4>
<div class="outline-text-4" id="text-3-2-4">
<p>
<code>en_distance_rescaled</code> stores the matrix of the rescaled distances between
electrons and nuclei.
</p>
<p>
\[
C_{i\alpha} = \frac{ 1 - e^{-\kappa_\alpha R_{i\alpha}}}{\kappa_\alpha}
\]
</p>
<p>
where \(R_{i\alpha}\) is the matrix of electron-nucleus distances.
</p>
</div>
<div id="outline-container-orgc5b7ffc" class="outline-5">
<h5 id="orgc5b7ffc"><span class="section-number-5">3.2.4.1</span> Get</h5>
<div class="outline-text-5" id="text-3-2-4-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_electron_en_distance_rescaled</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">distance_rescaled</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-org3ef15a6" class="outline-5">
<h5 id="org3ef15a6"><span class="section-number-5">3.2.4.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-2-4-2">
<table id="org4ea7829" 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>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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>type_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 types of nuclei</td>
</tr>
<tr>
<td class="org-left"><code>type_nucl_vector</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 types of nuclei</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_en</code></td>
<td class="org-left"><code>double[type_nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">The factor for rescaled distances</td>
</tr>
<tr>
<td class="org-left"><code>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_coord</code></td>
<td class="org-left"><code>double[3][walk_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucl_coord</code></td>
<td class="org-left"><code>double[3][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Nuclear coordinates</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled</code></td>
<td class="org-left"><code>double[walk_num][nucl_num][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-nucleus distances</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_compute_en_distance_rescaled_doc</span>(context, <span style="color: #a020f0;">&amp;</span>
elec_num, nucl_num, type_nucl_num, <span style="color: #a020f0;">&amp;</span>
type_nucl_vector, rescale_factor_en, walk_num, elec_coord, <span style="color: #a020f0;">&amp;</span>
nucl_coord, en_distance_rescaled) <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: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</span>
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span> (qmckl_context), <span style="color: #a020f0;">intent</span>(in), <span style="color: #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;"> elec_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: #a020f0;">value</span> ::<span style="color: #a0522d;"> type_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;"> type_nucl_vector(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;"> rescale_factor_en(type_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: #a020f0;">value</span> ::<span style="color: #a0522d;"> walk_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;"> elec_coord(elec_num,walk_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>(out) ::<span style="color: #a0522d;"> en_distance_rescaled(elec_num,nucl_num,walk_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;"> i, k</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> coord(3)</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> i=1, nucl_num
coord(1:3) = nucl_coord(i,1:3)
<span style="color: #a020f0;">do</span> k=1,walk_num
info = qmckl_distance_rescaled(context, <span style="color: #8b2252;">'T'</span>, <span style="color: #8b2252;">'N'</span>, elec_num, 1_8, <span style="color: #a020f0;">&amp;</span>
elec_coord(1,k,1), elec_num*walk_num, coord, 3_8, <span style="color: #a020f0;">&amp;</span>
en_distance_rescaled(1,i,k), elec_num, rescale_factor_en(type_nucl_vector(i)+1))
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</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_en_distance_rescaled_doc</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org0fdcbe8" class="outline-5">
<h5 id="org0fdcbe8"><span class="section-number-5">3.2.4.3</span> Test</h5>
<div class="outline-text-5" id="text-3-2-4-3">
<div class="org-src-container">
<pre class="src src-c">
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_nucleus_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">en_distance_rescaled</span>[walk_num][nucl_num][elec_num];
rc = qmckl_check(context,
qmckl_get_electron_en_distance_rescaled(context, &amp;(en_distance_rescaled[0][0][0]))
);
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
// <span style="color: #b22222;">(e,n,w) in Fortran notation</span>
// <span style="color: #b22222;">(1,1,1)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">en_distance_rescaled</span>[0][0][0] - 0.4942158656729477) &lt; 1.e-12);
// <span style="color: #b22222;">(1,2,1)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">en_distance_rescaled</span>[0][1][0] - 1.2464137498005765) &lt; 1.e-12);
// <span style="color: #b22222;">(2,1,1)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">en_distance_rescaled</span>[0][0][1] - 0.5248654474756858) &lt; 1.e-12);
// <span style="color: #b22222;">(1,1,2)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">en_distance_rescaled</span>[0][0][5] - 0.19529459944794733) &lt; 1.e-12);
// <span style="color: #b22222;">(1,2,2)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">en_distance_rescaled</span>[0][1][5] - 1.2091967687767369) &lt; 1.e-12);
// <span style="color: #b22222;">(2,1,2)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">en_distance_rescaled</span>[0][0][6] - 0.4726452953409436) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org11ad976" class="outline-4">
<h4 id="org11ad976"><span class="section-number-4">3.2.5</span> Electron-electron rescaled distance gradients and Laplacian with respect to electron coordinates</h4>
<div class="outline-text-4" id="text-3-2-5">
<p>
The rescaled distances, represented by \(C_{i\alpha} = (1 - e^{-\kappa_\alpha R_{i\alpha}})/\kappa\)
are differentiated with respect to the electron coordinates.
This information is stored in the tensor
<code>en_distance_rescaled_gl</code>. The initial three sequential
elements of this three-index tensor provide the \(x\), \(y\), and \(z\)
direction derivatives, while the fourth index corresponds to the Laplacian.
</p>
</div>
<div id="outline-container-org54196ce" class="outline-5">
<h5 id="org54196ce"><span class="section-number-5">3.2.5.1</span> Get</h5>
<div class="outline-text-5" id="text-3-2-5-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_electron_en_distance_rescaled_gl</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">distance_rescaled_gl</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-org3ae97c6" class="outline-5">
<h5 id="org3ae97c6"><span class="section-number-5">3.2.5.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-2-5-2">
<table id="org39053d8" 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>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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>type_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 nucleus types</td>
</tr>
<tr>
<td class="org-left"><code>type_nucl_vector</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Array of nucleus types</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_en</code></td>
<td class="org-left"><code>double[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">The factors for rescaled distances</td>
</tr>
<tr>
<td class="org-left"><code>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_coord</code></td>
<td class="org-left"><code>double[3][walk_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron coordinates</td>
</tr>
<tr>
<td class="org-left"><code>nucl_coord</code></td>
<td class="org-left"><code>double[3][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Nuclear coordinates</td>
</tr>
<tr>
<td class="org-left"><code>en_distance_rescaled_gl</code></td>
<td class="org-left"><code>double[walk_num][nucl_num][elec_num][4]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-nucleus distance derivatives</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_en_distance_rescaled_gl_doc_f(context, elec_num, nucl_num, </span><span style="color: #a020f0;">&amp;</span>
type_nucl_num, type_nucl_vector, rescale_factor_en, walk_num, elec_coord, <span style="color: #a020f0;">&amp;</span>
nucl_coord, en_distance_rescaled_gl) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> type_nucl_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> type_nucl_vector(nucl_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_en(nucl_num)</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_coord(elec_num,walk_num,3)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_coord(nucl_num,3)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> en_distance_rescaled_gl(4,elec_num,nucl_num,walk_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, k</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> coord(3)</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> i=1, nucl_num
coord(1:3) = nucl_coord(i,1:3)
<span style="color: #a020f0;">do</span> k=1,walk_num
info = qmckl_distance_rescaled_gl(context, <span style="color: #8b2252;">'T'</span>, <span style="color: #8b2252;">'T'</span>, elec_num, 1_8, <span style="color: #a020f0;">&amp;</span>
elec_coord(1,k,1), elec_num*walk_num, coord, 1_8, <span style="color: #a020f0;">&amp;</span>
en_distance_rescaled_gl(1,1,i,k), elec_num, rescale_factor_en(type_nucl_vector(i)+1))
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</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_en_distance_rescaled_gl_doc_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orge131c5c" class="outline-5">
<h5 id="orge131c5c"><span class="section-number-5">3.2.5.3</span> Test</h5>
<div class="outline-text-5" id="text-3-2-5-3">
<div class="org-src-container">
<pre class="src src-c">
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_nucleus_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">en_distance_rescaled_gl</span>[walk_num][4][nucl_num][elec_num];
rc = qmckl_check(context,
qmckl_get_electron_en_distance_rescaled_gl(context, &amp;(en_distance_rescaled_gl[0][0][0][0]))
);
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
// <span style="color: #b22222;">TODO: check exact values</span>
//// <span style="color: #b22222;">(e,n,w) in Fortran notation</span>
//// <span style="color: #b22222;">(1,1,1)</span>
//<span style="color: #b22222;">assert(fabs(en_distance_rescaled[0][0][0] - 7.546738741619978) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(1,2,1)</span>
//<span style="color: #b22222;">assert(fabs(en_distance_rescaled[0][1][0] - 8.77102435246984) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(2,1,1)</span>
//<span style="color: #b22222;">assert(fabs(en_distance_rescaled[0][0][1] - 3.698922010513608) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(1,1,2)</span>
//<span style="color: #b22222;">assert(fabs(en_distance_rescaled[1][0][0] - 5.824059436060509) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(1,2,2)</span>
//<span style="color: #b22222;">assert(fabs(en_distance_rescaled[1][1][0] - 7.080482110317645) &lt; 1.e-12);</span>
//
//// <span style="color: #b22222;">(2,1,2)</span>
//<span style="color: #b22222;">assert(fabs(en_distance_rescaled[1][0][1] - 3.1804527583077356) &lt; 1.e-12);</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="outline-container-org4e6b156" class="outline-3">
<h3 id="org4e6b156"><span class="section-number-3">3.3</span> Electron-electron-nucleus component</h3>
<div class="outline-text-3" id="text-3-3">
</div>
<div id="outline-container-org446b70c" class="outline-4">
<h4 id="org446b70c"><span class="section-number-4">3.3.1</span> Electron-electron rescaled distances in \(J_\text{eeN}\)</h4>
<div class="outline-text-4" id="text-3-3-1">
<p>
<code>een_rescaled_e</code> stores the table of the rescaled distances between all
pairs of electrons and raised to the power \(p\) defined by <code>cord_num</code>:
</p>
<p>
\[
C_{ij,p} = \left[ \exp\left(-\kappa_\text{e}\, r_{ij}\right) \right]^p
\]
</p>
<p>
where \(r_{ij}\) is the matrix of electron-electron distances.
</p>
</div>
<div id="outline-container-org6026b90" class="outline-5">
<h5 id="org6026b90"><span class="section-number-5">3.3.1.1</span> Get</h5>
<div class="outline-text-5" id="text-3-3-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_jastrow_champ_een_rescaled_e</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">distance_rescaled</span>,
<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 id="outline-container-orgc7a572c" class="outline-5">
<h5 id="orgc7a572c"><span class="section-number-5">3.3.1.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-3-1-2">
<table id="org4353c93" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</td>
</tr>
<tr>
<td class="org-left"><code>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_ee</code></td>
<td class="org-left"><code>double</code></td>
<td class="org-left">in</td>
<td class="org-left">Factor to rescale ee distances</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance</code></td>
<td class="org-left"><code>double[walk_num][elec_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-electron distances for each walker</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_e</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][elec_num][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-electron rescaled distances for each walker</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_een_rescaled_e_doc_f( </span><span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, cord_num, rescale_factor_ee, <span style="color: #a020f0;">&amp;</span>
ee_distance, een_rescaled_e) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> cord_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_ee</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> ee_distance(elec_num,elec_num,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> een_rescaled_e(elec_num,elec_num,0:cord_num,walk_num)</span>
<span style="color: #228b22;">double precision</span>,<span style="color: #a020f0;">dimension</span>(:,:),<span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> een_rescaled_e_ij</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, j, k, l, nw</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> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (cord_num &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;">allocate</span>(een_rescaled_e_ij(elec_num * (elec_num - 1) / 2, cord_num + 1))
! <span style="color: #b22222;">Prepare table of exponentiated distances raised to appropriate power</span>
een_rescaled_e = 0.0d0
<span style="color: #a020f0;">do</span> nw = 1, walk_num
een_rescaled_e_ij = 0.0d0
een_rescaled_e_ij(:, 1) = 1.0d0
k = 0
<span style="color: #a020f0;">do</span> j = 1, elec_num
<span style="color: #a020f0;">do</span> i = 1, j - 1
k = k + 1
een_rescaled_e_ij(k, 2) = dexp(-rescale_factor_ee * ee_distance(i, j, nw))
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">do</span> l = 2, cord_num
<span style="color: #a020f0;">do</span> k = 1, elec_num * (elec_num - 1)/2
een_rescaled_e_ij(k, l + 1) = een_rescaled_e_ij(k, l) * een_rescaled_e_ij(k, 2)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
! <span style="color: #b22222;">prepare the actual een table</span>
een_rescaled_e(:, :, 0, nw) = 1.0d0
<span style="color: #a020f0;">do</span> l = 1, cord_num
k = 0
<span style="color: #a020f0;">do</span> j = 1, elec_num
<span style="color: #a020f0;">do</span> i = 1, j - 1
k = k + 1
x = een_rescaled_e_ij(k, l + 1)
een_rescaled_e(i, j, l, nw) = x
een_rescaled_e(j, i, l, nw) = x
<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;">do</span> l = 0, cord_num
<span style="color: #a020f0;">do</span> j = 1, elec_num
een_rescaled_e(j, j, l, nw) = 0.0d0
<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_een_rescaled_e_doc_f</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_compute_een_rescaled_e_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;">int64_t</span> <span style="color: #a0522d;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">een_rescaled_e</span> ) {
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) {
<span style="color: #a020f0;">return</span> QMCKL_INVALID_CONTEXT;
}
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) {
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
}
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) {
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_3;
}
<span style="color: #a020f0;">if</span> (cord_num &lt; 0) {
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_4;
}
// <span style="color: #b22222;">Prepare table of exponentiated distances raised to appropriate power</span>
// <span style="color: #b22222;">init</span>
memset(een_rescaled_e,0,walk_num*(cord_num+1)*elec_num*elec_num*<span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">elec_pairs</span> = (<span style="color: #228b22;">size_t</span>) (elec_num * (elec_num - 1)) / 2;
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">len_een_ij</span> = (<span style="color: #228b22;">size_t</span>) elec_pairs * (cord_num + 1);
// <span style="color: #b22222;">number of elements for the een_rescaled_e_ij[N_e*(N_e-1)/2][cord+1]</span>
// <span style="color: #b22222;">probably in C is better [cord+1, Ne*(Ne-1)/2]</span>
// <span style="color: #b22222;">elec_pairs = (elec_num * (elec_num - 1)) / 2;</span>
// <span style="color: #b22222;">len_een_ij = elec_pairs * (cord_num + 1);</span>
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">e2</span> = elec_num*elec_num;
<span style="color: #483d8b;">#ifdef</span> HAVE_OPENMP
<span style="color: #483d8b;">#pragma</span> omp parallel <span style="color: #a020f0;">for</span>
<span style="color: #483d8b;">#endif</span>
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">nw</span> = 0; nw &lt; (<span style="color: #228b22;">size_t</span>) walk_num; ++nw) {
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_e_ij</span> = malloc(len_een_ij*<span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
memset(&amp;(een_rescaled_e_ij[0]),0,len_een_ij*<span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">kk</span> = 0; kk &lt; elec_pairs ; ++kk) {
een_rescaled_e_ij[kk]= 1.0;
}
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">kk</span> = 0;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">i</span> = 0; i &lt; (<span style="color: #228b22;">size_t</span>) elec_num; ++i) {
<span style="color: #483d8b;">#ifdef</span> HAVE_OPENMP
<span style="color: #483d8b;">#pragma</span> omp simd
<span style="color: #483d8b;">#endif</span>
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">j</span> = 0; j &lt; i; ++j) {
een_rescaled_e_ij[j + kk + elec_pairs] = -rescale_factor_ee * ee_distance[j + i*elec_num + nw*e2];
}
kk += i;
}
<span style="color: #483d8b;">#ifdef</span> HAVE_OPENMP
<span style="color: #483d8b;">#pragma</span> omp simd
<span style="color: #483d8b;">#endif</span>
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">k</span> = elec_pairs; k &lt; 2*elec_pairs; ++k) {
een_rescaled_e_ij[k] = exp(een_rescaled_e_ij[k]);
}
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">l</span> = 2; l &lt; (<span style="color: #228b22;">size_t</span>) (cord_num+1); ++l) {
<span style="color: #483d8b;">#ifdef</span> HAVE_OPENMP
<span style="color: #483d8b;">#pragma</span> omp simd
<span style="color: #483d8b;">#endif</span>
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">k</span> = 0; k &lt; elec_pairs; ++k) {
// <span style="color: #b22222;">een_rescaled_e_ij(k, l + 1) = een_rescaled_e_ij(k, l + 1 - 1) * een_rescaled_e_ij(k, 2)</span>
een_rescaled_e_ij[k+l*elec_pairs] = een_rescaled_e_ij[k + (l - 1)*elec_pairs] * \
een_rescaled_e_ij[k + elec_pairs];
}
}
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">een_rescaled_e_</span> = &amp;(een_rescaled_e[nw*(cord_num+1)*e2]);
// <span style="color: #b22222;">prepare the actual een table</span>
<span style="color: #483d8b;">#ifdef</span> HAVE_OPENMP
<span style="color: #483d8b;">#pragma</span> omp simd
<span style="color: #483d8b;">#endif</span>
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">i</span> = 0; i &lt; e2; ++i){
een_rescaled_e_[i] = 1.0;
}
<span style="color: #a020f0;">for</span> ( <span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">l</span> = 1; l &lt; (<span style="color: #228b22;">size_t</span>) (cord_num+1); ++l) {
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">x</span> = een_rescaled_e_ij + l*elec_pairs;
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">een_rescaled_e__</span> = &amp;(een_rescaled_e_[l*e2]);
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_e_i</span> = een_rescaled_e__;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">i</span> = 0; i &lt; (<span style="color: #228b22;">size_t</span>) elec_num; ++i) {
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">j</span> = 0; j &lt; i; ++j) {
een_rescaled_e_i[j] = *x;
een_rescaled_e__[i + j*elec_num] = *x;
x += 1;
}
een_rescaled_e_i += elec_num;
}
}
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">x0</span> = &amp;(een_rescaled_e[nw*e2*(cord_num+1)]);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">l</span> = 0; l &lt; (<span style="color: #228b22;">size_t</span>) (cord_num + 1); ++l) {
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">x1</span> = &amp;(x0[l*e2]);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">j</span> = 0; j &lt; (<span style="color: #228b22;">size_t</span>) elec_num; ++j) {
*x1 = 0.0;
x1 += 1+elec_num;
}
}
free(een_rescaled_e_ij);
}
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
}
</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_compute_een_rescaled_e_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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">een_rescaled_e</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_compute_een_rescaled_e_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;">int64_t</span> <span style="color: #a0522d;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">een_rescaled_e</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_compute_een_rescaled_e</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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> <span style="color: #a0522d;">rescale_factor_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ee_distance</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">een_rescaled_e</span> ) {
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_een_rescaled_e_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_een_rescaled_e_doc
<span style="color: #483d8b;">#endif</span>
(context, walk_num, elec_num, cord_num, rescale_factor_ee, ee_distance, een_rescaled_e);
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf731f56" class="outline-5">
<h5 id="orgf731f56"><span class="section-number-5">3.3.1.3</span> Test</h5>
<div class="outline-text-5" id="text-3-3-1-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">een_rescaled_e</span>[walk_num][(cord_num + 1)][elec_num][elec_num];
rc = qmckl_get_jastrow_champ_een_rescaled_e(context, &amp;(een_rescaled_e[0][0][0][0]),elec_num*elec_num*(cord_num+1)*walk_num);
// <span style="color: #b22222;">value of (0,2,1)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][1][0][2]- 0.2211015082992776 ) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][1][0][3]- 0.2611178387068169 ) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][1][0][4]- 0.0884012350763747 ) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][2][1][3]- 0.1016685507354656 ) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][2][1][4]- 0.0113118073246869 ) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][2][1][5]- 0.5257156022077619 ) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orga45897e" class="outline-4">
<h4 id="orga45897e"><span class="section-number-4">3.3.2</span> Electron-electron rescaled distances derivatives in \(J_\text{eeN}\)</h4>
<div class="outline-text-4" id="text-3-3-2">
<p>
<code>een_rescaled_e_gl</code> stores the table of the derivatives of the
rescaled distances between all pairs of electrons and raised to the
power \(p\) defined by <code>cord_num</code>. Here we take its derivatives
required for the een jastrow<sub>champ</sub>.
</p>
<p>
\[ \frac{\partial}{\partial x} \left[ {g_\text{e}(r)}\right]^p =
-\frac{x}{r} \kappa_\text{e}\, p\,\left[ {g_\text{e}(r)}\right]^p \]
\[ \Delta \left[ {g_\text{e}(r)}\right]^p = \frac{2}{r} \kappa_\text{e}\, p\,\left[ {g_\text{e}(r)}\right]^p \right] + \left(\frac{\partial}{\partial x}\left[ {g_\text{e}(r)}\right]^p \right)^2 + \left(\frac{\partial}{\partial y}\left[ {g_\text{e}(r)}\right]^p \right)^2 + \left(\frac{\partial}{\partial z}\left[ {g_\text{e}(r)}\right]^p \right)^2 \]
</p>
</div>
<div id="outline-container-orgaadfe77" class="outline-5">
<h5 id="orgaadfe77"><span class="section-number-5">3.3.2.1</span> Get</h5>
<div class="outline-text-5" id="text-3-3-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_jastrow_champ_een_rescaled_e_gl</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">distance_rescaled</span>,
<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 id="outline-container-org89dd503" class="outline-5">
<h5 id="org89dd503"><span class="section-number-5">3.3.2.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-3-2-2">
<table id="orgcbb1075" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</td>
</tr>
<tr>
<td class="org-left"><code>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_ee</code></td>
<td class="org-left"><code>double</code></td>
<td class="org-left">in</td>
<td class="org-left">Factor to rescale ee distances</td>
</tr>
<tr>
<td class="org-left"><code>coord_ee</code></td>
<td class="org-left"><code>double[walk_num][3][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron coordinates</td>
</tr>
<tr>
<td class="org-left"><code>ee_distance</code></td>
<td class="org-left"><code>double[walk_num][elec_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-electron distances</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_e</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][elec_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-electron distances</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_e_gl</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][elec_num][4][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-electron rescaled distances</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_factor_een_rescaled_e_gl_f( </span><span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, cord_num, rescale_factor_ee, <span style="color: #a020f0;">&amp;</span>
coord_ee, ee_distance, een_rescaled_e, een_rescaled_e_gl) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> cord_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_ee</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord_ee(elec_num,3,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> ee_distance(elec_num,elec_num,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_e(elec_num,elec_num,0:cord_num,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> een_rescaled_e_gl(elec_num,4,elec_num,0:cord_num,walk_num)</span>
<span style="color: #228b22;">double precision</span>,<span style="color: #a020f0;">dimension</span>(:,:,:),<span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> elec_dist_gl</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, rij_inv, kappa_l</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, j, k, l, nw, ii</span>
<span style="color: #a020f0;">allocate</span>(elec_dist_gl(elec_num, 4, elec_num))
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> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (cord_num &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: #b22222;">Prepare table of exponentiated distances raised to appropriate power</span>
een_rescaled_e_gl = 0.0d0
<span style="color: #a020f0;">do</span> nw = 1, walk_num
<span style="color: #a020f0;">do</span> j = 1, elec_num
<span style="color: #a020f0;">do</span> i = 1, j-1
rij_inv = 1.0d0 / ee_distance(i, j, nw)
<span style="color: #a020f0;">do</span> ii = 1, 3
elec_dist_gl(i, ii, j) = (coord_ee(i, ii, nw) - coord_ee(j, ii, nw)) * rij_inv
<span style="color: #a020f0;">end do</span>
elec_dist_gl(i, 4, j) = 2.0d0 * rij_inv
<span style="color: #a020f0;">end do</span>
elec_dist_gl(j, :, j) = 0.0d0
<span style="color: #a020f0;">do</span> i = j+1, elec_num
rij_inv = 1.0d0 / ee_distance(i, j, nw)
<span style="color: #a020f0;">do</span> ii = 1, 3
elec_dist_gl(i, ii, j) = (coord_ee(i, ii, nw) - coord_ee(j, ii, nw)) * rij_inv
<span style="color: #a020f0;">end do</span>
elec_dist_gl(i, 4, j) = 2.0d0 * rij_inv
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
! <span style="color: #b22222;">prepare the actual een table</span>
<span style="color: #a020f0;">do</span> l = 1, cord_num
kappa_l = - <span style="color: #a020f0;">dble</span>(l) * rescale_factor_ee
<span style="color: #a020f0;">do</span> j = 1, elec_num
<span style="color: #a020f0;">do</span> i = 1, elec_num
een_rescaled_e_gl(i, 1, j, l, nw) = kappa_l * elec_dist_gl(i, 1, j)
een_rescaled_e_gl(i, 2, j, l, nw) = kappa_l * elec_dist_gl(i, 2, j)
een_rescaled_e_gl(i, 3, j, l, nw) = kappa_l * elec_dist_gl(i, 3, j)
een_rescaled_e_gl(i, 4, j, l, nw) = kappa_l * elec_dist_gl(i, 4, j)
een_rescaled_e_gl(i, 4, j, l, nw) = een_rescaled_e_gl(i, 4, j, l, nw) <span style="color: #a020f0;">&amp;</span>
+ een_rescaled_e_gl(i, 1, j, l, nw) * een_rescaled_e_gl(i, 1, j, l, nw) <span style="color: #a020f0;">&amp;</span>
+ een_rescaled_e_gl(i, 2, j, l, nw) * een_rescaled_e_gl(i, 2, j, l, nw) <span style="color: #a020f0;">&amp;</span>
+ een_rescaled_e_gl(i, 3, j, l, nw) * een_rescaled_e_gl(i, 3, j, l, nw)
een_rescaled_e_gl(i,1,j,l,nw) = een_rescaled_e_gl(i,1,j,l,nw) * een_rescaled_e(i,j,l,nw)
een_rescaled_e_gl(i,2,j,l,nw) = een_rescaled_e_gl(i,2,j,l,nw) * een_rescaled_e(i,j,l,nw)
een_rescaled_e_gl(i,3,j,l,nw) = een_rescaled_e_gl(i,3,j,l,nw) * een_rescaled_e(i,j,l,nw)
een_rescaled_e_gl(i,4,j,l,nw) = een_rescaled_e_gl(i,4,j,l,nw) * een_rescaled_e(i,j,l,nw)
<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_jastrow_champ_factor_een_rescaled_e_gl_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgeb720dd" class="outline-5">
<h5 id="orgeb720dd"><span class="section-number-5">3.3.2.3</span> Test</h5>
<div class="outline-text-5" id="text-3-3-2-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">double</span> <span style="color: #a0522d;">een_rescaled_e_gl</span>[walk_num][(cord_num + 1)][elec_num][4][elec_num];
size_max=walk_num*(cord_num + 1)*elec_num*4*elec_num;
rc = qmckl_get_jastrow_champ_een_rescaled_e_gl(context,
&amp;(een_rescaled_e_gl[0][0][0][0][0]),size_max);
// <span style="color: #b22222;">value of (0,0,0,2,1)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e_gl</span>[0][1][0][0][2] + 0.09831391870751387 ) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e_gl</span>[0][1][0][0][3] + 0.017204157459682526 ) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e_gl</span>[0][1][0][0][4] + 0.013345768421098641 ) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e_gl</span>[0][2][1][0][3] + 0.03733086358273962 ) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e_gl</span>[0][2][1][0][4] + 0.004922634822943517 ) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e_gl</span>[0][2][1][0][5] + 0.5416751547830984 ) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org6e32bed" class="outline-4">
<h4 id="org6e32bed"><span class="section-number-4">3.3.3</span> Electron-nucleus rescaled distances in \(J_\text{eeN}\)</h4>
<div class="outline-text-4" id="text-3-3-3">
<p>
<code>een_rescaled_n</code> stores the table of the rescaled distances between
electrons and nuclei raised to the power \(p\) defined by <code>cord_num</code>:
</p>
<p>
\[
C_{i\alpha,p} = \left[ \exp\left(-\kappa_\alpha\, R_{i\alpha}\right) \right]^p
\]
</p>
<p>
where \(R_{i\alpha}\) is the matrix of electron-nucleus distances.
</p>
</div>
<div id="outline-container-org8499cc6" class="outline-5">
<h5 id="org8499cc6"><span class="section-number-5">3.3.3.1</span> Get</h5>
<div class="outline-text-5" id="text-3-3-3-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_jastrow_champ_een_rescaled_n</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">distance_rescaled</span>,
<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 id="outline-container-org398dc81" class="outline-5">
<h5 id="org398dc81"><span class="section-number-5">3.3.3.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-3-3-2">
<table id="org0d175ad" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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 atoms</td>
</tr>
<tr>
<td class="org-left"><code>type_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 atom types</td>
</tr>
<tr>
<td class="org-left"><code>type_nucl_vector</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Types of atoms</td>
</tr>
<tr>
<td class="org-left"><code>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_en</code></td>
<td class="org-left"><code>double[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Factor to rescale ee distances</td>
</tr>
<tr>
<td class="org-left"><code>en_distance</code></td>
<td class="org-left"><code>double[walk_num][elec_num][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus distances</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-nucleus rescaled distances</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_een_rescaled_n_f( </span><span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, nucl_num, <span style="color: #a020f0;">&amp;</span>
type_nucl_num, type_nucl_vector, cord_num, rescale_factor_en, <span style="color: #a020f0;">&amp;</span>
en_distance, een_rescaled_n) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> type_nucl_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> type_nucl_vector(nucl_num)</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> cord_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_en(type_nucl_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> en_distance(nucl_num,elec_num,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> een_rescaled_n(elec_num,nucl_num,0:cord_num,walk_num)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, a, k, l, nw</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> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (nucl_num &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> (cord_num &lt; 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">Prepare table of exponentiated distances raised to appropriate power</span>
een_rescaled_n = 0.0d0
<span style="color: #a020f0;">do</span> nw = 1, walk_num
! <span style="color: #b22222;">prepare the actual een table</span>
een_rescaled_n(:, :, 0, nw) = 1.0d0
<span style="color: #a020f0;">do</span> a = 1, nucl_num
<span style="color: #a020f0;">do</span> i = 1, elec_num
een_rescaled_n(i, a, 1, nw) = dexp(-rescale_factor_en(type_nucl_vector(a)+1) * en_distance(a, i, nw))
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">do</span> l = 2, cord_num
<span style="color: #a020f0;">do</span> a = 1, nucl_num
<span style="color: #a020f0;">do</span> i = 1, elec_num
een_rescaled_n(i, a, l, nw) = een_rescaled_n(i, a, l - 1, nw) * een_rescaled_n(i, a, 1, nw)
<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_een_rescaled_n_f</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-c">/*
<span style="color: #b22222;">qmckl_exit_code qmckl_compute_een_rescaled_n (</span>
<span style="color: #b22222;"> const qmckl_context context,</span>
<span style="color: #b22222;"> const int64_t walk_num,</span>
<span style="color: #b22222;"> const int64_t elec_num,</span>
<span style="color: #b22222;"> const int64_t nucl_num,</span>
<span style="color: #b22222;"> const int64_t type_nucl_num,</span>
<span style="color: #b22222;"> int64_t* const type_nucl_vector,</span>
<span style="color: #b22222;"> const int64_t cord_num,</span>
<span style="color: #b22222;"> const double* rescale_factor_en,</span>
<span style="color: #b22222;"> const double* en_distance,</span>
<span style="color: #b22222;"> double* const een_rescaled_n ) {</span>
<span style="color: #b22222;"> if (context == QMCKL_NULL_CONTEXT) {</span>
<span style="color: #b22222;"> return QMCKL_INVALID_CONTEXT;</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> if (walk_num &lt;= 0) {</span>
<span style="color: #b22222;"> return QMCKL_INVALID_ARG_2;</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> if (elec_num &lt;= 0) {</span>
<span style="color: #b22222;"> return QMCKL_INVALID_ARG_3;</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> if (nucl_num &lt;= 0) {</span>
<span style="color: #b22222;"> return QMCKL_INVALID_ARG_4;</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> if (cord_num &lt; 0) {</span>
<span style="color: #b22222;"> return QMCKL_INVALID_ARG_5;</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> // Prepare table of exponentiated distances raised to appropriate power</span>
<span style="color: #b22222;"> for (int i = 0; i &lt; (walk_num*(cord_num+1)*nucl_num*elec_num); ++i) {</span>
<span style="color: #b22222;"> een_rescaled_n[i] = 1.0;</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> for (int nw = 0; nw &lt; walk_num; ++nw) {</span>
<span style="color: #b22222;"> for (int a = 0; a &lt; nucl_num; ++a) {</span>
<span style="color: #b22222;"> for (int i = 0; i &lt; elec_num; ++i) {</span>
<span style="color: #b22222;"> een_rescaled_n[i + a*elec_num + nw * elec_num*nucl_num*(cord_num+1)] = 1.0;</span>
<span style="color: #b22222;"> een_rescaled_n[i + a*elec_num + elec_num*nucl_num + nw*elec_num*nucl_num*(cord_num+1)] =</span>
<span style="color: #b22222;"> exp(-rescale_factor_en[type_nucl_vector[a]] * en_distance[a + i*nucl_num + nw*elec_num*nucl_num]);</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> for (int l = 2; l &lt; (cord_num+1); ++l){</span>
<span style="color: #b22222;"> for (int a = 0; a &lt; nucl_num; ++a) {</span>
<span style="color: #b22222;"> for (int i = 0; i &lt; elec_num; ++i) {</span>
<span style="color: #b22222;"> een_rescaled_n[i + a*elec_num + l*elec_num*nucl_num + nw*elec_num*nucl_num*(cord_num+1)] =</span>
<span style="color: #b22222;"> een_rescaled_n[i + a*elec_num + (l-1)*elec_num*nucl_num + nw*elec_num*nucl_num*(cord_num+1)] *</span>
<span style="color: #b22222;"> een_rescaled_n[i + a*elec_num + elec_num*nucl_num + nw*elec_num*nucl_num*(cord_num+1)];</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> }</span>
<span style="color: #b22222;"> return QMCKL_SUCCESS;</span>
<span style="color: #b22222;">}</span>
*/
</pre>
</div>
</div>
</div>
<div id="outline-container-org3ada697" class="outline-5">
<h5 id="org3ada697"><span class="section-number-5">3.3.3.3</span> Test</h5>
<div class="outline-text-5" id="text-3-3-3-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">een_rescaled_n</span>[walk_num][(cord_num + 1)][nucl_num][elec_num];
size_max=walk_num*(cord_num + 1)*nucl_num*elec_num;
rc = qmckl_get_jastrow_champ_een_rescaled_n(context, &amp;(een_rescaled_n[0][0][0][0]),size_max);
// <span style="color: #b22222;">value of (0,2,1)</span>
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][1][0][2]-0.2603169838750542 )&lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][1][0][3]-0.3016180139679065 )&lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][1][0][4]-0.10506023826192266)&lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][2][1][3]-0.9267719759374164 )&lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][2][1][4]-0.11497585238132658)&lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][2][1][5]-0.07534033469115217)&lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org7346415" class="outline-4">
<h4 id="org7346415"><span class="section-number-4">3.3.4</span> Electron-nucleus rescaled distances derivatives in \(J_\text{eeN}\)</h4>
<div class="outline-text-4" id="text-3-3-4">
<p>
<code>een_rescaled_n_gl</code> stores the table of the derivatives of the
rescaled distances between all electron-nucleus pairs and raised to the
power \(p\) defined by <code>cord_num</code>. Here we take its derivatives
required for the een jastrow<sub>champ</sub>.
</p>
<p>
\[ \frac{\partial}{\partial x} \left[ {g_\alpha(R_{i\alpha})}\right]^p =
-\frac{x}{R_{i\alpha}} \kappa_\alpha\, p\,\left[ {g_\alpha(R_{i\alpha})}\right]^p \]
\[ \Delta \left[ {g_\alpha(R_{i\alpha})}\right]^p = \frac{2}{R_{i\alpha}}
\kappa_\alpha\, p\,\left[ {g_\alpha(R_{i\alpha})}\right]^p \right] +
\left(\frac{\partial}{\partial x}\left[ {g_\alpha(R_{i\alpha})}\right]^p
\right)^2 + \left(\frac{\partial}{\partial y}\left[
{g_\alpha(R_{i\alpha})}\right]^p \right)^2 + \left(\frac{\partial}{\partial
z}\left[ {g_\alpha(R_{i\alpha})}\right]^p \right)^2 \]
</p>
</div>
<div id="outline-container-org096fdcb" class="outline-5">
<h5 id="org096fdcb"><span class="section-number-5">3.3.4.1</span> Get</h5>
<div class="outline-text-5" id="text-3-3-4-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_jastrow_champ_een_rescaled_n_gl</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">distance_rescaled</span>,
<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 id="outline-container-org47b366e" class="outline-5">
<h5 id="org47b366e"><span class="section-number-5">3.3.4.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-3-4-2">
<table id="orgcdc0be7" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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 atoms</td>
</tr>
<tr>
<td class="org-left"><code>type_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 atom types</td>
</tr>
<tr>
<td class="org-left"><code>type_nucl_vector</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Types of atoms</td>
</tr>
<tr>
<td class="org-left"><code>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>rescale_factor_en</code></td>
<td class="org-left"><code>double[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Factor to rescale ee distances</td>
</tr>
<tr>
<td class="org-left"><code>coord_ee</code></td>
<td class="org-left"><code>double[walk_num][3][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron coordinates</td>
</tr>
<tr>
<td class="org-left"><code>coord_n</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>en_distance</code></td>
<td class="org-left"><code>double[walk_num][elec_num][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus distances</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus distances</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n_gl</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][4][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-nucleus rescaled distances</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_factor_een_rescaled_n_gl_f( </span><span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, nucl_num, type_nucl_num, type_nucl_vector, <span style="color: #a020f0;">&amp;</span>
cord_num, rescale_factor_en, <span style="color: #a020f0;">&amp;</span>
coord_ee, coord_n, en_distance, een_rescaled_n, een_rescaled_n_gl) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> type_nucl_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> type_nucl_vector(nucl_num)</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> cord_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_en(type_nucl_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord_ee(elec_num,3,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord_n(nucl_num,3)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> en_distance(nucl_num,elec_num,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_n(elec_num,nucl_num,0:cord_num,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> een_rescaled_n_gl(elec_num,4,nucl_num,0:cord_num,walk_num)</span>
<span style="color: #228b22;">double precision</span>,<span style="color: #a020f0;">dimension</span>(:,:,:),<span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> elnuc_dist_gl</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, ria_inv, kappa_l</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, a, k, l, nw, ii</span>
<span style="color: #a020f0;">allocate</span>(elnuc_dist_gl(elec_num, 4, nucl_num))
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> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">if</span> (nucl_num &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> (cord_num &lt; 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
! <span style="color: #b22222;">Prepare table of exponentiated distances raised to appropriate power</span>
een_rescaled_n_gl = 0.0d0
<span style="color: #a020f0;">do</span> nw = 1, walk_num
! <span style="color: #b22222;">prepare the actual een table</span>
<span style="color: #a020f0;">do</span> a = 1, nucl_num
<span style="color: #a020f0;">do</span> i = 1, elec_num
ria_inv = 1.0d0 / en_distance(a, i, nw)
<span style="color: #a020f0;">do</span> ii = 1, 3
elnuc_dist_gl(i, ii, a) = (coord_ee(i, ii, nw) - coord_n(a, ii)) * ria_inv
<span style="color: #a020f0;">end do</span>
elnuc_dist_gl(i, 4, a) = 2.0d0 * ria_inv
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">do</span> l = 0, cord_num
<span style="color: #a020f0;">do</span> a = 1, nucl_num
kappa_l = - <span style="color: #a020f0;">dble</span>(l) * rescale_factor_en(type_nucl_vector(a)+1)
<span style="color: #a020f0;">do</span> i = 1, elec_num
een_rescaled_n_gl(i, 1, a, l, nw) = kappa_l * elnuc_dist_gl(i, 1, a)
een_rescaled_n_gl(i, 2, a, l, nw) = kappa_l * elnuc_dist_gl(i, 2, a)
een_rescaled_n_gl(i, 3, a, l, nw) = kappa_l * elnuc_dist_gl(i, 3, a)
een_rescaled_n_gl(i, 4, a, l, nw) = kappa_l * elnuc_dist_gl(i, 4, a)
een_rescaled_n_gl(i, 4, a, l, nw) = een_rescaled_n_gl(i, 4, a, l, nw) <span style="color: #a020f0;">&amp;</span>
+ een_rescaled_n_gl(i, 1, a, l, nw) * een_rescaled_n_gl(i, 1, a, l, nw) <span style="color: #a020f0;">&amp;</span>
+ een_rescaled_n_gl(i, 2, a, l, nw) * een_rescaled_n_gl(i, 2, a, l, nw) <span style="color: #a020f0;">&amp;</span>
+ een_rescaled_n_gl(i, 3, a, l, nw) * een_rescaled_n_gl(i, 3, a, l, nw)
een_rescaled_n_gl(i, 1, a, l, nw) = een_rescaled_n_gl(i, 1, a, l, nw) * <span style="color: #a020f0;">&amp;</span>
een_rescaled_n(i, a, l, nw)
een_rescaled_n_gl(i, 2, a, l, nw) = een_rescaled_n_gl(i, 2, a, l, nw) * <span style="color: #a020f0;">&amp;</span>
een_rescaled_n(i, a, l, nw)
een_rescaled_n_gl(i, 3, a, l, nw) = een_rescaled_n_gl(i, 3, a, l, nw) * <span style="color: #a020f0;">&amp;</span>
een_rescaled_n(i, a, l, nw)
een_rescaled_n_gl(i, 4, a, l, nw) = een_rescaled_n_gl(i, 4, a, l, nw) * <span style="color: #a020f0;">&amp;</span>
een_rescaled_n(i, a, l, nw)
<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_jastrow_champ_factor_een_rescaled_n_gl_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org2b2d946" class="outline-5">
<h5 id="org2b2d946"><span class="section-number-5">3.3.4.3</span> Test</h5>
<div class="outline-text-5" id="text-3-3-4-3">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">een_rescaled_n_gl</span>[walk_num][(cord_num + 1)][nucl_num][4][elec_num];
size_max=walk_num*(cord_num + 1)*nucl_num*4*elec_num;
rc = qmckl_get_jastrow_champ_een_rescaled_n_gl(context, &amp;(een_rescaled_n_gl[0][0][0][0][0]),size_max);
// <span style="color: #b22222;">value of (0,2,1)</span>
<span style="color: #0000ff;">assert</span>(fabs( -0.11234061209936878 - een_rescaled_n_gl[0][1][0][0][2]) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs( 0.0004440109367151707 - een_rescaled_n_gl[0][1][0][0][3]) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs( -0.012868642597346566 - een_rescaled_n_gl[0][1][0][0][4]) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs( 0.08601122289922644 - een_rescaled_n_gl[0][2][1][0][3]) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs( -0.058681563677207206 - een_rescaled_n_gl[0][2][1][0][4]) &lt; 1.e-12);
<span style="color: #0000ff;">assert</span>(fabs( 0.005359281880312882 - een_rescaled_n_gl[0][2][1][0][5]) &lt; 1.e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org6550285" class="outline-4">
<h4 id="org6550285"><span class="section-number-4">3.3.5</span> Temporary arrays for electron-electron-nucleus Jastrow \(f_{een}\)</h4>
<div class="outline-text-4" id="text-3-3-5">
<p>
Prepare <code>c_vector_full</code> and <code>lkpm_combined_index</code> tables required for the
calculation of the three-body jastrow <code>factor_een</code> and its derivative
<code>factor_een_gl</code>.
</p>
</div>
<div id="outline-container-org4bc235e" class="outline-5">
<h5 id="org4bc235e"><span class="section-number-5">3.3.5.1</span> Compute dim<sub>c</sub><sub>vector</sub></h5>
<div class="outline-text-5" id="text-3-3-5-1">
<p>
Computes the dimension of the vector of parameters.
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-right" />
<col class="org-right" />
</colgroup>
<tbody>
<tr>
<td class="org-right">\(N_{ord}\)</td>
<td class="org-right">Number of parameters</td>
</tr>
<tr>
<td class="org-right">&#xa0;</td>
<td class="org-right">&#xa0;</td>
</tr>
<tr>
<td class="org-right">1</td>
<td class="org-right">0</td>
</tr>
<tr>
<td class="org-right">2</td>
<td class="org-right">2</td>
</tr>
<tr>
<td class="org-right">3</td>
<td class="org-right">6</td>
</tr>
<tr>
<td class="org-right">4</td>
<td class="org-right">13</td>
</tr>
<tr>
<td class="org-right">5</td>
<td class="org-right">23</td>
</tr>
<tr>
<td class="org-right">6</td>
<td class="org-right">37</td>
</tr>
<tr>
<td class="org-right">7</td>
<td class="org-right">55</td>
</tr>
<tr>
<td class="org-right">8</td>
<td class="org-right">78</td>
</tr>
<tr>
<td class="org-right">9</td>
<td class="org-right">106</td>
</tr>
<tr>
<td class="org-right">10</td>
<td class="org-right">140</td>
</tr>
</tbody>
</table>
<table id="org3c6771d" 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>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>dim_c_vector</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">out</td>
<td class="org-left">Number of parameters per atom type</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_dim_c_vector_f( </span><span style="color: #a020f0;">&amp;</span>
context, cord_num, dim_c_vector) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> cord_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> dim_c_vector</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, a, k, l, p, lmax</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> (cord_num &lt; 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
dim_c_vector = 0
<span style="color: #a020f0;">do</span> p = 2, cord_num
<span style="color: #a020f0;">do</span> k = p - 1, 0, -1
<span style="color: #a020f0;">if</span> (k <span style="color: #a020f0;">.ne.</span> 0) <span style="color: #a020f0;">then</span>
lmax = p - k
<span style="color: #a020f0;">else</span>
lmax = p - k - 2
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> l = lmax, 0, -1
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(p - k - l, 1_8) == 1) <span style="color: #a020f0;">cycle</span>
dim_c_vector = dim_c_vector + 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 function</span> <span style="color: #0000ff;">qmckl_compute_dim_c_vector_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org1264e9d" class="outline-5">
<h5 id="org1264e9d"><span class="section-number-5">3.3.5.2</span> Get</h5>
<div class="outline-text-5" id="text-3-3-5-2">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_tmp_c</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;">tmp_c</span>);
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_dtmp_c</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;">dtmp_c</span>);
</pre>
</div>
</div>
</div>
<div id="outline-container-org74981a3" class="outline-5">
<h5 id="org74981a3"><span class="section-number-5">3.3.5.3</span> Compute c<sub>vector</sub><sub>full</sub></h5>
<div class="outline-text-5" id="text-3-3-5-3">
<table id="orgab0ee46" 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>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 atoms</td>
</tr>
<tr>
<td class="org-left"><code>dim_c_vector</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">dimension of cord full table</td>
</tr>
<tr>
<td class="org-left"><code>type_nucl_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">dimension of cord full table</td>
</tr>
<tr>
<td class="org-left"><code>type_nucl_vector</code></td>
<td class="org-left"><code>int64_t[nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">dimension of cord full table</td>
</tr>
<tr>
<td class="org-left"><code>c_vector</code></td>
<td class="org-left"><code>double[dim_c_vector][type_nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">dimension of cord full table</td>
</tr>
<tr>
<td class="org-left"><code>c_vector_full</code></td>
<td class="org-left"><code>double[nucl_num][dim_c_vector]</code></td>
<td class="org-left">out</td>
<td class="org-left">Full list of coefficients</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_c_vector_full_doc_f( </span><span style="color: #a020f0;">&amp;</span>
context, nucl_num, dim_c_vector, type_nucl_num, <span style="color: #a020f0;">&amp;</span>
type_nucl_vector, c_vector, c_vector_full) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> dim_c_vector</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> type_nucl_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> type_nucl_vector(nucl_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> c_vector(dim_c_vector, type_nucl_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> c_vector_full(nucl_num, dim_c_vector)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, a, k, l, nw</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">if</span> (dim_c_vector &lt; 0) info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">if</span> (type_nucl_num &lt;= 0) info = QMCKL_INVALID_ARG_4
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">do</span> a = 1, nucl_num
c_vector_full(a,1:dim_c_vector) = c_vector(1:dim_c_vector, type_nucl_vector(a)+1)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_c_vector_full_doc_f</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_compute_c_vector_full_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;">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;">dim_c_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">type_nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">type_nucl_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">c_vector</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">c_vector_full</span> ) {
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">return</span> QMCKL_INVALID_CONTEXT;
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
<span style="color: #a020f0;">if</span> (dim_c_vector &lt; 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_3;
<span style="color: #a020f0;">if</span> (type_nucl_num &lt;= 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_4;
<span style="color: #a020f0;">if</span> (type_nucl_vector == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_5;
<span style="color: #a020f0;">if</span> (c_vector == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_6;
<span style="color: #a020f0;">if</span> (c_vector_full == <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_7;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0; i &lt; dim_c_vector; ++i) {
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">a</span>=0; a &lt; nucl_num; ++a){
c_vector_full[a + i*nucl_num] = c_vector[i + type_nucl_vector[a]*dim_c_vector];
}
}
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
}
</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_compute_c_vector_full_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;">nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">type_nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">type_nucl_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">c_vector</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">c_vector_full</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_compute_c_vector_full_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;">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;">dim_c_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">type_nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">type_nucl_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">c_vector</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">c_vector_full</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_compute_c_vector_full</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;">nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">type_nucl_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">type_nucl_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">c_vector</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">c_vector_full</span> ) {
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_c_vector_full_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_c_vector_full_doc
<span style="color: #483d8b;">#endif</span>
(context, nucl_num, dim_c_vector, type_nucl_num, type_nucl_vector, c_vector, c_vector_full);
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org7abd768" class="outline-5">
<h5 id="org7abd768"><span class="section-number-5">3.3.5.4</span> Compute lkpm<sub>combined</sub><sub>index</sub></h5>
<div class="outline-text-5" id="text-3-3-5-4">
<table id="orge7999e8" 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>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>dim_c_vector</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">dimension of cord full table</td>
</tr>
<tr>
<td class="org-left"><code>lkpm_combined_index</code></td>
<td class="org-left"><code>int64_t[4][dim_c_vector]</code></td>
<td class="org-left">out</td>
<td class="org-left">Full list of combined indices</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_lkpm_combined_index_doc_f( </span><span style="color: #a020f0;">&amp;</span>
context, cord_num, dim_c_vector, lkpm_combined_index) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> cord_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> dim_c_vector</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> lkpm_combined_index(dim_c_vector, 4)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, a, k, l, kk, p, lmax, m</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">if</span> (cord_num &lt; 0) info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">if</span> (dim_c_vector &lt; 0) info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">return</span>
kk = 0
<span style="color: #a020f0;">do</span> p = 2, cord_num
<span style="color: #a020f0;">do</span> k = p - 1, 0, -1
<span style="color: #a020f0;">if</span> (k /= 0) <span style="color: #a020f0;">then</span>
lmax = p - k
<span style="color: #a020f0;">else</span>
lmax = p - k - 2
<span style="color: #a020f0;">end if</span>
<span style="color: #a020f0;">do</span> l = lmax, 0, -1
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">iand</span>(p - k - l, 1_8) <span style="color: #a020f0;">.eq.</span> 1_8) <span style="color: #a020f0;">cycle</span>
m = (p - k - l)/2
kk = kk + 1
lkpm_combined_index(kk, 1) = l
lkpm_combined_index(kk, 2) = k
lkpm_combined_index(kk, 3) = p
lkpm_combined_index(kk, 4) = m
<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_lkpm_combined_index_doc_f</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_compute_lkpm_combined_index_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;">int64_t</span> <span style="color: #a0522d;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">lkpm_combined_index</span> ) {
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">kk</span>, <span style="color: #a0522d;">lmax</span>, <span style="color: #a0522d;">m</span>;
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">return</span> QMCKL_INVALID_CONTEXT;
<span style="color: #a020f0;">if</span> (cord_num &lt; 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
<span style="color: #a020f0;">if</span> (dim_c_vector &lt; 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_3;
kk = 0;
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">p</span> = 2; p &lt;= cord_num; ++p) {
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span>=(p-1); k &gt;= 0; --k) {
<span style="color: #a020f0;">if</span> (k != 0) {
lmax = p - k;
} <span style="color: #a020f0;">else</span> {
lmax = p - k - 2;
}
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">l</span>=lmax; l &gt;= 0; --l) {
<span style="color: #a020f0;">if</span> (((p - k - l) &amp; 1) == 1) <span style="color: #a020f0;">continue</span>;
m = (p - k - l)/2;
lkpm_combined_index[kk ] = l;
lkpm_combined_index[kk + dim_c_vector] = k;
lkpm_combined_index[kk + 2*dim_c_vector] = p;
lkpm_combined_index[kk + 3*dim_c_vector] = m;
kk = kk + 1;
}
}
}
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
}
</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_compute_lkpm_combined_index</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;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">lkpm_combined_index</span> ) {
<span style="color: #483d8b;"> #ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_lkpm_combined_index_hpc
<span style="color: #483d8b;"> #else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_lkpm_combined_index_doc
<span style="color: #483d8b;"> #endif</span>
(context, cord_num, dim_c_vector, lkpm_combined_index);
}
</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_compute_lkpm_combined_index</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;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">lkpm_combined_index</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_compute_lkpm_combined_index_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;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">lkpm_combined_index</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_compute_lkpm_combined_index_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;">int64_t</span> <span style="color: #a0522d;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">lkpm_combined_index</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_compute_lkpm_combined_index</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;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #228b22;">int64_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">lkpm_combined_index</span> );
</pre>
</div>
</div>
</div>
<div id="outline-container-org2aac1cd" class="outline-5">
<h5 id="org2aac1cd"><span class="section-number-5">3.3.5.5</span> Compute tmp<sub>c</sub></h5>
<div class="outline-text-5" id="text-3-3-5-5">
<table id="orgc5d03f7" 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>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_e</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][elec_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-electron rescaled factor</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus rescaled factor</td>
</tr>
<tr>
<td class="org-left"><code>tmp_c</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">vector of non-zero coefficients</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_tmp_c</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;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_e</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_n</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">tmp_c</span> )
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_tmp_c_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_tmp_c_doc
<span style="color: #483d8b;">#endif</span>
(context, cord_num, elec_num, nucl_num, walk_num,
een_rescaled_e, een_rescaled_n, tmp_c);
}
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_tmp_c_doc_f( </span><span style="color: #a020f0;">&amp;</span>
context, cord_num, elec_num, nucl_num, <span style="color: #a020f0;">&amp;</span>
walk_num, een_rescaled_e, een_rescaled_n, tmp_c) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> cord_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_e(elec_num, elec_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_n(elec_num, nucl_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> tmp_c(elec_num, nucl_num,0:cord_num, 0:cord_num-1, walk_num)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, j, a, l, kk, p, lmax, nw</span>
<span style="color: #228b22;">character</span> ::<span style="color: #a0522d;"> TransA, TransB</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> alpha, beta</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> M, N, K, LDA, LDB, LDC</span>
TransA = <span style="color: #8b2252;">'N'</span>
TransB = <span style="color: #8b2252;">'N'</span>
alpha = 1.0d0
beta = 0.0d0
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">if</span> (cord_num &lt; 0) info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) info = QMCKL_INVALID_ARG_4
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">return</span>
M = elec_num
N = nucl_num*(cord_num + 1)
K = elec_num
LDA = <span style="color: #a020f0;">size</span>(een_rescaled_e,1)
LDB = <span style="color: #a020f0;">size</span>(een_rescaled_n,1)
LDC = <span style="color: #a020f0;">size</span>(tmp_c,1)
<span style="color: #a020f0;">do</span> nw=1, walk_num
<span style="color: #a020f0;">do</span> i=0, cord_num-1
info = qmckl_dgemm(context, TransA, TransB, M, N, K, alpha, <span style="color: #a020f0;">&amp;</span>
een_rescaled_e(1,1,i,nw),LDA*1_8, <span style="color: #a020f0;">&amp;</span>
een_rescaled_n(1,1,0,nw),LDB*1_8, <span style="color: #a020f0;">&amp;</span>
beta, <span style="color: #a020f0;">&amp;</span>
tmp_c(1,1,0,i,nw),LDC)
<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_tmp_c_doc_f</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_compute_tmp_c_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;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_e</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_n</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">tmp_c</span> );
</pre>
</div>
</div>
</div>
<div id="outline-container-org164a2c2" class="outline-5">
<h5 id="org164a2c2"><span class="section-number-5">3.3.5.6</span> Compute dtmp<sub>c</sub></h5>
<div class="outline-text-5" id="text-3-3-5-6">
<table id="org5a2bf8a" 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>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_e_gl</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][elec_num][4][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-electron rescaled factor derivatives</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus rescaled factor</td>
</tr>
<tr>
<td class="org-left"><code>dtmp_c</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">vector of non-zero coefficients</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_dtmp_c</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;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_e_gl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_n</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">dtmp_c</span> )
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_dtmp_c_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_dtmp_c_doc
<span style="color: #483d8b;">#endif</span>
(context, cord_num, elec_num, nucl_num, walk_num, een_rescaled_e_gl,
een_rescaled_n, dtmp_c );
}
</pre>
</div>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_dtmp_c_doc_f( </span><span style="color: #a020f0;">&amp;</span>
context, cord_num, elec_num, nucl_num, <span style="color: #a020f0;">&amp;</span>
walk_num, een_rescaled_e_gl, een_rescaled_n, dtmp_c) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> cord_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nucl_num</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_e_gl(elec_num, 4, elec_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_n(elec_num, nucl_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> dtmp_c(elec_num, 4, nucl_num,0:cord_num, 0:cord_num-1, walk_num)</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, j, a, l, kk, p, lmax, nw, ii</span>
<span style="color: #228b22;">character</span> ::<span style="color: #a0522d;"> TransA, TransB</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> alpha, beta</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> M, N, K, LDA, LDB, LDC</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">if</span> (cord_num &lt; 0) info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) info = QMCKL_INVALID_ARG_4
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">return</span>
TransA = <span style="color: #8b2252;">'N'</span>
TransB = <span style="color: #8b2252;">'N'</span>
alpha = 1.0d0
beta = 0.0d0
M = 4*elec_num
N = nucl_num*(cord_num + 1)
K = elec_num
LDA = 4*<span style="color: #a020f0;">size</span>(een_rescaled_e_gl,1)
LDB = <span style="color: #a020f0;">size</span>(een_rescaled_n,1)
LDC = 4*<span style="color: #a020f0;">size</span>(dtmp_c,1)
<span style="color: #a020f0;">do</span> nw=1, walk_num
<span style="color: #a020f0;">do</span> i=0, cord_num-1
info = qmckl_dgemm(context,TransA, TransB, M, N, K, alpha, <span style="color: #a020f0;">&amp;</span>
een_rescaled_e_gl(1,1,1,i,nw),LDA*1_8, <span style="color: #a020f0;">&amp;</span>
een_rescaled_n(1,1,0,nw),LDB*1_8, <span style="color: #a020f0;">&amp;</span>
beta, <span style="color: #a020f0;">&amp;</span>
dtmp_c(1,1,1,0,i,nw),LDC)
<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_dtmp_c_doc_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org8da2a06" class="outline-5">
<h5 id="org8da2a06"><span class="section-number-5">3.3.5.7</span> Test</h5>
<div class="outline-text-5" id="text-3-3-5-7">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_electron_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">tmp_c</span>[walk_num][cord_num][cord_num+1][nucl_num][elec_num];
rc = qmckl_get_jastrow_champ_tmp_c(context, &amp;(tmp_c[0][0][0][0][0]));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">dtmp_c</span>[walk_num][cord_num][cord_num+1][nucl_num][4][elec_num];
rc = qmckl_get_jastrow_champ_dtmp_c(context, &amp;(dtmp_c[0][0][0][0][0][0]));
printf(<span style="color: #8b2252;">"%e\n%e\n"</span>, tmp_c[0][0][1][0][0], 3.954384);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">tmp_c</span>[0][0][1][0][0] - 3.954384) &lt; 1e-6);
printf(<span style="color: #8b2252;">"%e\n%e\n"</span>, dtmp_c[0][1][0][0][0][0],3.278657e-01);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">dtmp_c</span>[0][1][0][0][0][0] - 3.278657e-01 ) &lt; 1e-6);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org703510f" class="outline-4">
<h4 id="org703510f"><span class="section-number-4">3.3.6</span> Electron-electron-nucleus Jastrow \(f_{een}\)</h4>
<div class="outline-text-4" id="text-3-3-6">
<p>
Calculate the electron-electron-nuclear three-body jastrow component <code>factor_een</code>
using the above prepared tables.
</p>
<p>
TODO: write equations.
</p>
</div>
<div id="outline-container-org697718c" class="outline-5">
<h5 id="org697718c"><span class="section-number-5">3.3.6.1</span> Get</h5>
<div class="outline-text-5" id="text-3-3-6-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_jastrow_champ_factor_een</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;">factor_een</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
</div>
<ol class="org-ol">
<li><a id="org5bb622c"></a>Fortran interface<br />
<div class="outline-text-6" id="text-3-3-6-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_factor_een (context, </span><span style="color: #a020f0;">&amp;</span>
factor_een, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> factor_een(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_factor_een</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</li>
</ol>
</div>
<div id="outline-container-org47e8cc5" class="outline-5">
<h5 id="org47e8cc5"><span class="section-number-5">3.3.6.2</span> Compute naive</h5>
<div class="outline-text-5" id="text-3-3-6-2">
<table id="org570671c" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>dim_c_vector</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">dimension of full coefficient vector</td>
</tr>
<tr>
<td class="org-left"><code>c_vector_full</code></td>
<td class="org-left"><code>double[dim_c_vector][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">full coefficient vector</td>
</tr>
<tr>
<td class="org-left"><code>lkpm_combined_index</code></td>
<td class="org-left"><code>int64_t[4][dim_c_vector]</code></td>
<td class="org-left">in</td>
<td class="org-left">combined indices</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_e</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][elec_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus rescaled</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus rescaled factor</td>
</tr>
<tr>
<td class="org-left"><code>factor_een</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-nucleus jastrow</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_factor_een_naive_f( </span><span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, nucl_num, cord_num,<span style="color: #a020f0;">&amp;</span>
dim_c_vector, c_vector_full, lkpm_combined_index, <span style="color: #a020f0;">&amp;</span>
een_rescaled_e, een_rescaled_n, factor_een) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num, elec_num, cord_num, nucl_num, dim_c_vector</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> lkpm_combined_index(dim_c_vector,4)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> c_vector_full(nucl_num, dim_c_vector)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_e(elec_num, elec_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_n(elec_num, nucl_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> factor_een(walk_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, a, j, l, k, p, m, n, nw</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> accu, accu2, cn</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) info = QMCKL_INVALID_ARG_4
<span style="color: #a020f0;">if</span> (cord_num &lt; 0) info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">return</span>
! <span style="color: #b22222;">do nw =1, walk_num</span>
! <span style="color: #b22222;">factor_een(nw) = 0.0d0</span>
! <span style="color: #b22222;">do n = 1, dim_c_vector</span>
! <span style="color: #b22222;">l = lkpm_combined_index(n, 1)</span>
! <span style="color: #b22222;">k = lkpm_combined_index(n, 2)</span>
! <span style="color: #b22222;">p = lkpm_combined_index(n, 3)</span>
! <span style="color: #b22222;">m = lkpm_combined_index(n, 4)</span>
! <span style="color: #b22222;">do a = 1, nucl_num</span>
! <span style="color: #b22222;">accu2 = 0.0d0</span>
! <span style="color: #b22222;">cn = c_vector_full(a, n)</span>
! <span style="color: #b22222;">do j = 1, elec_num</span>
! <span style="color: #b22222;">accu = 0.0d0</span>
! <span style="color: #b22222;">do i = 1, elec_num</span>
! <span style="color: #b22222;">accu = accu + een_rescaled_e(i,j,k,nw) * &amp;</span>
! <span style="color: #b22222;">een_rescaled_n(i,a,m,nw)</span>
! <span style="color: #b22222;">end do</span>
! <span style="color: #b22222;">accu2 = accu2 + accu * een_rescaled_n(j,a,m + l,nw)</span>
! <span style="color: #b22222;">end do</span>
! <span style="color: #b22222;">factor_een(nw) = factor_een(nw) + accu2 * cn</span>
! <span style="color: #b22222;">end do</span>
! <span style="color: #b22222;">end do</span>
! <span style="color: #b22222;">end do</span>
<span style="color: #a020f0;">do</span> nw =1, walk_num
factor_een(nw) = 0.d0
<span style="color: #a020f0;">do</span> n = 1, dim_c_vector
l = lkpm_combined_index(n, 1)
k = lkpm_combined_index(n, 2)
p = lkpm_combined_index(n, 3)
m = lkpm_combined_index(n, 4)
<span style="color: #a020f0;">do</span> a = 1, nucl_num
accu2 = 0.0d0
cn = c_vector_full(a, n)
<span style="color: #a020f0;">print</span> *, a, l, k, p, cn
<span style="color: #a020f0;">do</span> j = 1, elec_num
accu = 0.0d0
<span style="color: #a020f0;">do</span> i = 1, j-1
accu = accu + een_rescaled_e(i,j,k,nw) * <span style="color: #a020f0;">&amp;</span>
(een_rescaled_n(i,a,l,nw) + een_rescaled_n(j,a,l,nw)) * <span style="color: #a020f0;">&amp;</span>
(een_rescaled_n(i,a,m,nw) * een_rescaled_n(j,a,m,nw))
<span style="color: #a020f0;">end do</span>
accu2 = accu2 + accu
<span style="color: #a020f0;">end do</span>
factor_een(nw) = factor_een(nw) + accu2 * cn
<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_jastrow_champ_factor_een_naive_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org31e6a63" class="outline-5">
<h5 id="org31e6a63"><span class="section-number-5">3.3.6.3</span> Compute</h5>
<div class="outline-text-5" id="text-3-3-6-3">
<table id="orge670eff" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>dim_c_vector</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">dimension of full coefficient vector</td>
</tr>
<tr>
<td class="org-left"><code>c_vector_full</code></td>
<td class="org-left"><code>double[dim_c_vector][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">full coefficient vector</td>
</tr>
<tr>
<td class="org-left"><code>lkpm_combined_index</code></td>
<td class="org-left"><code>int64_t[4][dim_c_vector]</code></td>
<td class="org-left">in</td>
<td class="org-left">combined indices</td>
</tr>
<tr>
<td class="org-left"><code>tmp_c</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">vector of non-zero coefficients</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus rescaled distances</td>
</tr>
<tr>
<td class="org-left"><code>factor_een</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-nucleus jastrow</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_factor_een_doc_f( </span><span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, nucl_num, cord_num, <span style="color: #a020f0;">&amp;</span>
dim_c_vector, c_vector_full, lkpm_combined_index, <span style="color: #a020f0;">&amp;</span>
tmp_c, een_rescaled_n, factor_een) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num, elec_num, cord_num, nucl_num, dim_c_vector</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> lkpm_combined_index(dim_c_vector,4)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> c_vector_full(nucl_num, dim_c_vector)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> tmp_c(elec_num, nucl_num,0:cord_num, 0:cord_num-1, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_n(elec_num, nucl_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> factor_een(walk_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, a, j, l, k, p, m, n, nw</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> accu, accu2, cn</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) info = QMCKL_INVALID_ARG_4
<span style="color: #a020f0;">if</span> (cord_num &lt; 0) info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">return</span>
factor_een = 0.0d0
<span style="color: #a020f0;">if</span> (cord_num == 0) <span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">do</span> nw =1, walk_num
<span style="color: #a020f0;">do</span> n = 1, dim_c_vector
l = lkpm_combined_index(n, 1)
k = lkpm_combined_index(n, 2)
p = lkpm_combined_index(n, 3)
m = lkpm_combined_index(n, 4)
<span style="color: #a020f0;">do</span> a = 1, nucl_num
cn = c_vector_full(a, n)
<span style="color: #a020f0;">if</span>(cn == 0.d0) <span style="color: #a020f0;">cycle</span>
accu = 0.0d0
<span style="color: #a020f0;">do</span> j = 1, elec_num
accu = accu + een_rescaled_n(j,a,m,nw) * tmp_c(j,a,m+l,k,nw)
<span style="color: #a020f0;">end do</span>
factor_een(nw) = factor_een(nw) + accu * cn
<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_jastrow_champ_factor_een_doc_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org044487a" class="outline-5">
<h5 id="org044487a"><span class="section-number-5">3.3.6.4</span> Test</h5>
<div class="outline-text-5" id="text-3-3-6-4">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Check if Jastrow is properly initialized</span> */
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_jastrow_champ_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">factor_een</span>[walk_num];
rc = qmckl_get_jastrow_champ_factor_een(context, &amp;(factor_een[0]),walk_num);
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">factor_een</span>[0] + 0.382580260174321) &lt; 1e-12);
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org3e7eba3" class="outline-4">
<h4 id="org3e7eba3"><span class="section-number-4">3.3.7</span> Electron-electron-nucleus Jastrow \(f_{een}\) derivative</h4>
<div class="outline-text-4" id="text-3-3-7">
<p>
Calculate the electron-electron-nuclear three-body jastrow component <code>factor_een_gl</code>
using the above prepared tables.
</p>
<p>
TODO: write equations.
</p>
</div>
<div id="outline-container-org719485a" class="outline-5">
<h5 id="org719485a"><span class="section-number-5">3.3.7.1</span> Get</h5>
<div class="outline-text-5" id="text-3-3-7-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_jastrow_champ_factor_een_gl</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;">factor_een_gl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
</div>
<ol class="org-ol">
<li><a id="org76b25e2"></a>Fortran interface<br />
<div class="outline-text-6" id="text-3-3-7-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_factor_een_gl (context, </span><span style="color: #a020f0;">&amp;</span>
factor_een_gl, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> factor_een_gl(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_factor_een_gl</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</li>
</ol>
</div>
<div id="outline-container-org67a9338" class="outline-5">
<h5 id="org67a9338"><span class="section-number-5">3.3.7.2</span> Compute Naive</h5>
<div class="outline-text-5" id="text-3-3-7-2">
<table id="orgb6ebb46" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>dim_c_vector</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">dimension of full coefficient vector</td>
</tr>
<tr>
<td class="org-left"><code>c_vector_full</code></td>
<td class="org-left"><code>double[dim_c_vector][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">full coefficient vector</td>
</tr>
<tr>
<td class="org-left"><code>lkpm_combined_index</code></td>
<td class="org-left"><code>int64_t[4][dim_c_vector]</code></td>
<td class="org-left">in</td>
<td class="org-left">combined indices</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_e</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][elec_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus rescaled</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus rescaled factor</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_e_gl</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][elec_num][4][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus rescaled</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n_gl</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][4][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus rescaled factor</td>
</tr>
<tr>
<td class="org-left"><code>factor_een_gl</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Electron-nucleus jastrow</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_factor_een_gl_naive_f( </span><span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, nucl_num, cord_num, dim_c_vector, <span style="color: #a020f0;">&amp;</span>
c_vector_full, lkpm_combined_index, een_rescaled_e, een_rescaled_n, <span style="color: #a020f0;">&amp;</span>
een_rescaled_e_gl, een_rescaled_n_gl, factor_een_gl)<span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num, elec_num, cord_num, nucl_num, dim_c_vector</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> lkpm_combined_index(dim_c_vector, 4)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> c_vector_full(nucl_num, dim_c_vector)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_e(elec_num, elec_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_n(elec_num, nucl_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_e_gl(elec_num, 4, elec_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_n_gl(elec_num, 4, nucl_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> factor_een_gl(elec_num, 4, walk_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, a, j, l, k, p, m, n, nw</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> accu, accu2, cn</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> daccu(1:4), daccu2(1:4)</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) info = QMCKL_INVALID_ARG_4
<span style="color: #a020f0;">if</span> (cord_num &lt; 0) info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">return</span>
factor_een_gl = 0.0d0
<span style="color: #a020f0;">do</span> nw =1, walk_num
<span style="color: #a020f0;">do</span> n = 1, dim_c_vector
l = lkpm_combined_index(n, 1)
k = lkpm_combined_index(n, 2)
p = lkpm_combined_index(n, 3)
m = lkpm_combined_index(n, 4)
<span style="color: #a020f0;">do</span> a = 1, nucl_num
cn = c_vector_full(a, n)
<span style="color: #a020f0;">do</span> j = 1, elec_num
accu = 0.0d0
accu2 = 0.0d0
daccu = 0.0d0
daccu2 = 0.0d0
<span style="color: #a020f0;">do</span> i = 1, elec_num
accu = accu + een_rescaled_e(i, j, k, nw) * een_rescaled_n(i, a, m, nw)
accu2 = accu2 + een_rescaled_e(i, j, k, nw) * een_rescaled_n(i, a, m + l, nw)
daccu(1:4) = daccu(1:4) + een_rescaled_e_gl(j, 1:4, i, k, nw) * <span style="color: #a020f0;">&amp;</span>
een_rescaled_n(i, a, m, nw)
daccu2(1:4) = daccu2(1:4) + een_rescaled_e_gl(j, 1:4, i, k, nw) * <span style="color: #a020f0;">&amp;</span>
een_rescaled_n(i, a, m + l, nw)
<span style="color: #a020f0;">end do</span>
factor_een_gl(j, 1:4, nw) = factor_een_gl(j, 1:4, nw) + <span style="color: #a020f0;">&amp;</span>
(accu * een_rescaled_n_gl(j, 1:4, a, m + l, nw) <span style="color: #a020f0;">&amp;</span>
+ daccu(1:4) * een_rescaled_n(j, a, m + l, nw) <span style="color: #a020f0;">&amp;</span>
+ daccu2(1:4) * een_rescaled_n(j, a, m, nw) <span style="color: #a020f0;">&amp;</span>
+ accu2 * een_rescaled_n_gl(j, 1:4, a, m, nw)) * cn
factor_een_gl(j, 4, nw) = factor_een_gl(j, 4, nw) + 2.0d0 * ( <span style="color: #a020f0;">&amp;</span>
daccu (1) * een_rescaled_n_gl(j, 1, a, m + l, nw) + <span style="color: #a020f0;">&amp;</span>
daccu (2) * een_rescaled_n_gl(j, 2, a, m + l, nw) + <span style="color: #a020f0;">&amp;</span>
daccu (3) * een_rescaled_n_gl(j, 3, a, m + l, nw) + <span style="color: #a020f0;">&amp;</span>
daccu2(1) * een_rescaled_n_gl(j, 1, a, m, nw ) + <span style="color: #a020f0;">&amp;</span>
daccu2(2) * een_rescaled_n_gl(j, 2, a, m, nw ) + <span style="color: #a020f0;">&amp;</span>
daccu2(3) * een_rescaled_n_gl(j, 3, a, m, nw ) ) * cn
<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_jastrow_champ_factor_een_gl_naive_f</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org38d3996" class="outline-5">
<h5 id="org38d3996"><span class="section-number-5">3.3.7.3</span> Compute</h5>
<div class="outline-text-5" id="text-3-3-7-3">
<table id="orga286792" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</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>cord_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">order of polynomials</td>
</tr>
<tr>
<td class="org-left"><code>dim_c_vector</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">dimension of full coefficient vector</td>
</tr>
<tr>
<td class="org-left"><code>c_vector_full</code></td>
<td class="org-left"><code>double[dim_c_vector][nucl_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">full coefficient vector</td>
</tr>
<tr>
<td class="org-left"><code>lkpm_combined_index</code></td>
<td class="org-left"><code>int64_t[4][dim_c_vector]</code></td>
<td class="org-left">in</td>
<td class="org-left">combined indices</td>
</tr>
<tr>
<td class="org-left"><code>tmp_c</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num-1][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Temporary intermediate tensor</td>
</tr>
<tr>
<td class="org-left"><code>dtmp_c</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num-1][0:cord_num][nucl_num][4][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">vector of non-zero coefficients</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Electron-nucleus rescaled factor</td>
</tr>
<tr>
<td class="org-left"><code>een_rescaled_n_gl</code></td>
<td class="org-left"><code>double[walk_num][0:cord_num][nucl_num][4][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Derivative of Electron-nucleus rescaled factor</td>
</tr>
<tr>
<td class="org-left"><code>factor_een_gl</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Derivative of Electron-nucleus jastrow</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_factor_een_gl_doc_f( </span><span style="color: #a020f0;">&amp;</span>
context, walk_num, elec_num, nucl_num, <span style="color: #a020f0;">&amp;</span>
cord_num, dim_c_vector, c_vector_full, lkpm_combined_index, <span style="color: #a020f0;">&amp;</span>
tmp_c, dtmp_c, een_rescaled_n, een_rescaled_n_gl, factor_een_gl)<span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num, elec_num, cord_num, nucl_num, dim_c_vector</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> lkpm_combined_index(dim_c_vector,4)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> c_vector_full(nucl_num, dim_c_vector)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> tmp_c(elec_num, nucl_num,0:cord_num, 0:cord_num-1, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> dtmp_c(elec_num, 4, nucl_num,0:cord_num, 0:cord_num-1, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_n(elec_num, nucl_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> een_rescaled_n_gl(elec_num, 4, nucl_num, 0:cord_num, walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> factor_een_gl(elec_num,4,walk_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, a, j, l, k, m, n, nw, ii</span>
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> accu, accu2, cn</span>
info = QMCKL_SUCCESS
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) info = QMCKL_INVALID_CONTEXT
<span style="color: #a020f0;">if</span> (walk_num &lt;= 0) info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">if</span> (elec_num &lt;= 0) info = QMCKL_INVALID_ARG_3
<span style="color: #a020f0;">if</span> (nucl_num &lt;= 0) info = QMCKL_INVALID_ARG_4
<span style="color: #a020f0;">if</span> (cord_num &lt; 0) info = QMCKL_INVALID_ARG_5
<span style="color: #a020f0;">if</span> (info /= QMCKL_SUCCESS) <span style="color: #a020f0;">return</span>
factor_een_gl = 0.0d0
<span style="color: #a020f0;">if</span> (cord_num == 0) <span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">do</span> nw =1, walk_num
<span style="color: #a020f0;">do</span> n = 1, dim_c_vector
l = lkpm_combined_index(n, 1)
k = lkpm_combined_index(n, 2)
m = lkpm_combined_index(n, 4)
<span style="color: #a020f0;">do</span> a = 1, nucl_num
cn = c_vector_full(a, n)
<span style="color: #a020f0;">if</span>(cn == 0.d0) <span style="color: #a020f0;">cycle</span>
<span style="color: #a020f0;">do</span> ii = 1, 4
<span style="color: #a020f0;">do</span> j = 1, elec_num
factor_een_gl(j,ii,nw) = factor_een_gl(j,ii,nw) + ( <span style="color: #a020f0;">&amp;</span>
tmp_c(j,a,m,k,nw) * een_rescaled_n_gl(j,ii,a,m+l,nw) + <span style="color: #a020f0;">&amp;</span>
(dtmp_c(j,ii,a,m,k,nw)) * een_rescaled_n(j,a,m+l,nw) + <span style="color: #a020f0;">&amp;</span>
(dtmp_c(j,ii,a,m+l,k,nw)) * een_rescaled_n(j,a,m ,nw) + <span style="color: #a020f0;">&amp;</span>
tmp_c(j,a,m+l,k,nw) * een_rescaled_n_gl(j,ii,a,m,nw) <span style="color: #a020f0;">&amp;</span>
) * cn
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
cn = cn + cn
<span style="color: #a020f0;">do</span> j = 1, elec_num
factor_een_gl(j,4,nw) = factor_een_gl(j,4,nw) + ( <span style="color: #a020f0;">&amp;</span>
(dtmp_c(j,1,a,m ,k,nw)) * een_rescaled_n_gl(j,1,a,m+l,nw) + <span style="color: #a020f0;">&amp;</span>
(dtmp_c(j,2,a,m ,k,nw)) * een_rescaled_n_gl(j,2,a,m+l,nw) + <span style="color: #a020f0;">&amp;</span>
(dtmp_c(j,3,a,m ,k,nw)) * een_rescaled_n_gl(j,3,a,m+l,nw) + <span style="color: #a020f0;">&amp;</span>
(dtmp_c(j,1,a,m+l,k,nw)) * een_rescaled_n_gl(j,1,a,m ,nw) + <span style="color: #a020f0;">&amp;</span>
(dtmp_c(j,2,a,m+l,k,nw)) * een_rescaled_n_gl(j,2,a,m ,nw) + <span style="color: #a020f0;">&amp;</span>
(dtmp_c(j,3,a,m+l,k,nw)) * een_rescaled_n_gl(j,3,a,m ,nw) <span style="color: #a020f0;">&amp;</span>
) * cn
<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_jastrow_champ_factor_een_gl_doc_f</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_compute_jastrow_champ_factor_een_gl_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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_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;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">c_vector_full</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">lkpm_combined_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">tmp_c</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">dtmp_c</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_n</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_n_gl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_een_gl</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_compute_jastrow_champ_factor_een_gl</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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_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;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">c_vector_full</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">lkpm_combined_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">tmp_c</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">dtmp_c</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_n</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">een_rescaled_n_gl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_een_gl</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_compute_jastrow_champ_factor_een_gl</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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_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;">cord_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dim_c_vector</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> *<span style="color: #a0522d;">c_vector_full</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> *<span style="color: #a0522d;">lkpm_combined_index</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> *<span style="color: #a0522d;">tmp_c</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> *<span style="color: #a0522d;">dtmp_c</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> *<span style="color: #a0522d;">een_rescaled_n</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span> *<span style="color: #a0522d;">een_rescaled_n_gl</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">factor_een_gl</span>)
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_een_gl_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_een_gl_doc
<span style="color: #483d8b;">#endif</span>
(context, walk_num, elec_num, nucl_num,
cord_num, dim_c_vector, c_vector_full,
lkpm_combined_index, tmp_c, dtmp_c,
een_rescaled_n, een_rescaled_n_gl,
factor_een_gl);
}
</pre>
</div>
</div>
</div>
<div id="outline-container-orgd52cc1e" class="outline-5">
<h5 id="orgd52cc1e"><span class="section-number-5">3.3.7.4</span> Test</h5>
<div class="outline-text-5" id="text-3-3-7-4">
<div class="org-src-container">
<pre class="src src-c">/* <span style="color: #b22222;">Check if Jastrow is properly initialized</span> */
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_jastrow_champ_provided</span>(<span style="color: #a0522d;">context</span>));
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">factor_een_gl</span>[4][walk_num][elec_num];
rc = qmckl_get_jastrow_champ_factor_een_gl(context, &amp;(factor_een_gl[0][0][0]),4*walk_num*elec_num);
printf(<span style="color: #8b2252;">"%20.15e\n"</span>, factor_een_gl[0][0][0]);
<span style="color: #0000ff;">assert</span>(fabs(8.967809309100624e-02 - factor_een_gl[0][0][0]) &lt; 1e-12);
printf(<span style="color: #8b2252;">"%20.15e\n"</span>, factor_een_gl[1][0][1]);
<span style="color: #0000ff;">assert</span>(fabs(3.543090132452453e-02 - factor_een_gl[1][0][1]) &lt; 1e-12);
printf(<span style="color: #8b2252;">"%20.15e\n"</span>, factor_een_gl[2][0][2]);
<span style="color: #0000ff;">assert</span>(fabs(8.996044894431991e-04 - factor_een_gl[2][0][2]) &lt; 1e-12);
printf(<span style="color: #8b2252;">"%20.15e\n"</span>, factor_een_gl[3][0][3]);
<span style="color: #0000ff;">assert</span>(fabs(-1.175028308456619e+00 - factor_een_gl[3][0][3]) &lt; 1e-12);
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="outline-container-org1cd501f" class="outline-3">
<h3 id="org1cd501f"><span class="section-number-3">3.4</span> Total Jastrow</h3>
<div class="outline-text-3" id="text-3-4">
</div>
<div id="outline-container-orgba789c8" class="outline-4">
<h4 id="orgba789c8"><span class="section-number-4">3.4.1</span> Value</h4>
<div class="outline-text-4" id="text-3-4-1">
<p>
Value of the total Jastrow factor: \(\exp(J)\)
</p>
</div>
<div id="outline-container-org4987f8c" class="outline-5">
<h5 id="org4987f8c"><span class="section-number-5">3.4.1.1</span> Get</h5>
<div class="outline-text-5" id="text-3-4-1-1">
<div class="org-src-container">
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
<span style="color: #0000ff;">qmckl_get_jastrow_champ_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;">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>
<ol class="org-ol">
<li><a id="org909245c"></a>Fortran interface<br />
<div class="outline-text-6" id="text-3-4-1-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_value (context, </span><span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">value</span>, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> value(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_value</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</li>
</ol>
</div>
<div id="outline-container-org0d40eb7" class="outline-5">
<h5 id="org0d40eb7"><span class="section-number-5">3.4.1.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-4-1-2">
<table id="orgeb2dc61" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>f_ee</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">ee component</td>
</tr>
<tr>
<td class="org-left"><code>f_en</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">eN component</td>
</tr>
<tr>
<td class="org-left"><code>f_een</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">eeN component</td>
</tr>
<tr>
<td class="org-left"><code>value</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Total Jastrow factor</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_value_doc_f(context, </span><span style="color: #a020f0;">&amp;</span>
walk_num, f_ee, f_en, f_een, <span style="color: #a020f0;">value</span>) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> f_ee(walk_num), f_en(walk_num), f_een(walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> value(walk_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i</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> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> i = 1, walk_num
<span style="color: #a020f0;">value</span>(i) = f_ee(i) + f_en(i) + f_een(i)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">do</span> i = 1, walk_num
! <span style="color: #b22222;">Flush to zero to avoid floating-point exception</span>
<span style="color: #a020f0;">if</span> (<span style="color: #a020f0;">value</span>(i) &lt; -100.d0) <span style="color: #a020f0;">then</span>
<span style="color: #a020f0;">value</span>(i) = 0.d0
<span style="color: #a020f0;">else</span>
<span style="color: #a020f0;">value</span>(i) = dexp(<span style="color: #a020f0;">value</span>(i))
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_jastrow_champ_value_doc_f</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_compute_jastrow_champ_value</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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">f_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">f_en</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">f_een</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">value</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_compute_jastrow_champ_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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">f_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">f_en</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">f_een</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">value</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_compute_jastrow_champ_value_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;">int64_t</span> <span style="color: #a0522d;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">f_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">f_en</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">f_een</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">value</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_compute_jastrow_champ_value</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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">factor_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">factor_en</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">factor_een</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">value</span>)
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_value_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_value_doc
<span style="color: #483d8b;">#endif</span>
(context, walk_num, factor_ee, factor_en, factor_een, value);
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org2e7c995" class="outline-5">
<h5 id="org2e7c995"><span class="section-number-5">3.4.1.3</span> Test</h5>
<div class="outline-text-5" id="text-3-4-1-3">
<div class="org-src-container">
<pre class="src src-c">printf(<span style="color: #8b2252;">"Total Jastrow value\n"</span>);
/* <span style="color: #b22222;">Check if Jastrow is properly initialized</span> */
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_jastrow_champ_provided</span>(<span style="color: #a0522d;">context</span>));
rc = qmckl_check(context,
qmckl_get_jastrow_champ_factor_ee(context, &amp;(factor_ee[0]), walk_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_get_jastrow_champ_factor_en(context, &amp;(factor_en[0]), walk_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_get_jastrow_champ_factor_een(context, &amp;(factor_een[0]), walk_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">total_j</span>[walk_num];
rc = qmckl_check(context,
qmckl_get_jastrow_champ_value(context, &amp;(total_j[0]), walk_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">i</span>=0 ; i&lt; walk_num ; ++i) {
assert (total_j[i] - exp(factor_ee[i] + factor_en[i] + factor_een[i]) &lt; 1.e-12);
}
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-org4eb8a1e" class="outline-4">
<h4 id="org4eb8a1e"><span class="section-number-4">3.4.2</span> Derivatives</h4>
<div class="outline-text-4" id="text-3-4-2">
<p>
Gradients and Laplacian of the total Jastrow factor:
\[
\nabla \left[ e^{J(\mathbf{r})} \right] = e^{J(\mathbf{r})} \nabla J(\mathbf{r})
\]
\[
\Delta \left[ e^{J(\mathbf{r})} \right] = e^{J(\mathbf{r})}
\left[ \Delta J(\mathbf{r}) + \nabla J(\mathbf{r}) \cdot \nabla J(\mathbf{r}) \right]
\]
</p>
</div>
<div id="outline-container-orga055762" class="outline-5">
<h5 id="orga055762"><span class="section-number-5">3.4.2.1</span> Get</h5>
<div class="outline-text-5" id="text-3-4-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_jastrow_champ_gl</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;">gl</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
</pre>
</div>
</div>
<ol class="org-ol">
<li><a id="org12305d8"></a>Fortran interface<br />
<div class="outline-text-6" id="text-3-4-2-1-1">
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
<span style="color: #228b22;">integer</span>(qmckl_exit_code)<span style="color: #a0522d;"> function qmckl_get_jastrow_champ_gl (context, </span><span style="color: #a020f0;">&amp;</span>
gl, size_max) <span style="color: #a020f0;">bind</span>(C)
<span style="color: #a020f0;">use</span>, <span style="color: #a020f0;">intrinsic</span> :: <span style="color: #0000ff;">iso_c_binding</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> (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;"> size_max</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;"> gl(size_max)</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_jastrow_champ_gl</span>
<span style="color: #a020f0;">end interface</span>
</pre>
</div>
</div>
</li>
</ol>
</div>
<div id="outline-container-org546df10" class="outline-5">
<h5 id="org546df10"><span class="section-number-5">3.4.2.2</span> Compute</h5>
<div class="outline-text-5" id="text-3-4-2-2">
<table id="org97b41a7" 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>walk_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of walkers</td>
</tr>
<tr>
<td class="org-left"><code>elec_num</code></td>
<td class="org-left"><code>int64_t</code></td>
<td class="org-left">in</td>
<td class="org-left">Number of electrons</td>
</tr>
<tr>
<td class="org-left"><code>value</code></td>
<td class="org-left"><code>double[walk_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">Total Jastrow</td>
</tr>
<tr>
<td class="org-left"><code>gl_ee</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">ee component</td>
</tr>
<tr>
<td class="org-left"><code>gl_en</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">eN component</td>
</tr>
<tr>
<td class="org-left"><code>gl_een</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">in</td>
<td class="org-left">eeN component</td>
</tr>
<tr>
<td class="org-left"><code>gl</code></td>
<td class="org-left"><code>double[walk_num][4][elec_num]</code></td>
<td class="org-left">out</td>
<td class="org-left">Total Jastrow factor</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-f90"><span style="color: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_gl_doc_f(context, </span><span style="color: #a020f0;">&amp;</span>
walk_num, elec_num, <span style="color: #a020f0;">value</span>, gl_ee, gl_en, gl_een, gl) <span style="color: #a020f0;">&amp;</span>
<span style="color: #a020f0;">result</span>(info)
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num, elec_num</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> value (walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> gl_ee (elec_num,4,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> gl_en (elec_num,4,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> gl_een(elec_num,4,walk_num)</span>
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> gl (elec_num,4,walk_num)</span>
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, j, 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> (walk_num &lt;= 0) <span style="color: #a020f0;">then</span>
info = QMCKL_INVALID_ARG_2
<span style="color: #a020f0;">return</span>
<span style="color: #a020f0;">endif</span>
<span style="color: #a020f0;">do</span> k = 1, walk_num
<span style="color: #a020f0;">do</span> j=1,4
<span style="color: #a020f0;">do</span> i = 1, elec_num
gl(i,j,k) = gl_ee(i,j,k) + gl_en(i,j,k) + gl_een(i,j,k)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">do</span> i = 1, elec_num
gl(i,4,k) = gl(i,4,k) + <span style="color: #a020f0;">&amp;</span>
gl(i,1,k) * gl(i,1,k) + <span style="color: #a020f0;">&amp;</span>
gl(i,2,k) * gl(i,2,k) + <span style="color: #a020f0;">&amp;</span>
gl(i,3,k) * gl(i,3,k)
<span style="color: #a020f0;">end do</span>
gl(:,:,k) = gl(:,:,k) * <span style="color: #a020f0;">value</span>(k)
<span style="color: #a020f0;">end do</span>
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_jastrow_champ_gl_doc_f</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_compute_jastrow_champ_gl</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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">value</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_en</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_een</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">gl</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_compute_jastrow_champ_gl_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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">value</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_en</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_een</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">gl</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_compute_jastrow_champ_gl_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;">int64_t</span> <span style="color: #a0522d;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">value</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_en</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_een</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">gl</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_compute_jastrow_champ_gl</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;">walk_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">elec_num</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">value</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_ee</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_en</span>,
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">gl_een</span>,
<span style="color: #228b22;">double</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">gl</span>)
{
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_gl_hpc
<span style="color: #483d8b;">#else</span>
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_gl_doc
<span style="color: #483d8b;">#endif</span>
(context, walk_num, elec_num, value, gl_ee, gl_en, gl_een, gl);
}
</pre>
</div>
</div>
</div>
<div id="outline-container-org6307068" class="outline-5">
<h5 id="org6307068"><span class="section-number-5">3.4.2.3</span> Test</h5>
<div class="outline-text-5" id="text-3-4-2-3">
<div class="org-src-container">
<pre class="src src-c">printf(<span style="color: #8b2252;">"Total Jastrow derivatives\n"</span>);
/* <span style="color: #b22222;">Check if Jastrow is properly initialized</span> */
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">qmckl_jastrow_champ_provided</span>(<span style="color: #a0522d;">context</span>));
rc = qmckl_check(context,
qmckl_get_jastrow_champ_factor_ee_gl(context, &amp;(factor_ee_gl[0][0][0]), walk_num*elec_num*4)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_get_jastrow_champ_factor_en_gl(context, &amp;(factor_en_gl[0][0][0]), walk_num*elec_num*4)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_get_jastrow_champ_factor_een_gl(context, &amp;(factor_een_gl[0][0][0]), walk_num*elec_num*4)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">total_j_deriv</span>[walk_num][4][elec_num];
rc = qmckl_check(context,
qmckl_get_jastrow_champ_gl(context, &amp;(total_j_deriv[0][0][0]), walk_num*elec_num*4)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
rc = qmckl_check(context,
qmckl_get_jastrow_champ_value(context, &amp;(total_j[0]), walk_num)
);
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">k</span>=0 ; k&lt; walk_num ; ++k) {
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">m</span>=0 ; m&lt;4; ++m) {
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">e</span>=0 ; e&lt;elec_num; ++e) {
<span style="color: #a020f0;">if</span> (m &lt; 3) { /* <span style="color: #b22222;">test only gradients</span> */
assert (total_j_deriv[k][m][e]/total_j[k] - (factor_ee_gl[k][m][e] + factor_en_gl[k][m][e] + factor_een_gl[k][m][e]) &lt; 1.e-12);
}
}
}
}
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX CoE</p>
<p class="date">Created: 2023-10-06 Fri 09:36</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>