mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2024-08-24 22:21:46 +02:00
7775 lines
408 KiB
HTML
7775 lines
408 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-09-13 Wed 14:23 -->
|
|
<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="#orga1eef57">1. Introduction</a></li>
|
|
<li><a href="#org5d23d9f">2. Context</a>
|
|
<ul>
|
|
<li><a href="#org63f41f0">2.1. Data structure</a></li>
|
|
<li><a href="#orga3e6d20">2.2. Initialization functions</a>
|
|
<ul>
|
|
<li>
|
|
<ul>
|
|
<li><a href="#org3eae727">2.2.0.1. Fortran interface</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orge1610bb">2.3. Access functions</a>
|
|
<ul>
|
|
<li>
|
|
<ul>
|
|
<li><a href="#org5612ddf">2.3.0.1. Fortran interface</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org664babe">2.4. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org448a303">3. Computation</a>
|
|
<ul>
|
|
<li><a href="#orgc8f6621">3.1. Electron-electron component</a>
|
|
<ul>
|
|
<li><a href="#org2ec5583">3.1.1. Asymptotic component</a>
|
|
<ul>
|
|
<li><a href="#org72c7882">3.1.1.1. Get</a></li>
|
|
<li><a href="#org94e2130">3.1.1.2. Compute</a></li>
|
|
<li><a href="#org87fd358">3.1.1.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orgd7986ac">3.1.2. Electron-electron component</a>
|
|
<ul>
|
|
<li><a href="#org5bed3e2">3.1.2.1. Get</a></li>
|
|
<li><a href="#org9868102">3.1.2.2. Compute</a></li>
|
|
<li><a href="#org002b9b9">3.1.2.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org83835a7">3.1.3. Derivative</a>
|
|
<ul>
|
|
<li><a href="#orgb4135b7">3.1.3.1. Get</a></li>
|
|
<li><a href="#orgf45a96e">3.1.3.2. Compute</a></li>
|
|
<li><a href="#orgad968b9">3.1.3.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orga59a684">3.1.4. Electron-electron rescaled distances</a>
|
|
<ul>
|
|
<li><a href="#orgaa4e349">3.1.4.1. Get</a></li>
|
|
<li><a href="#org22c7ca2">3.1.4.2. Compute</a></li>
|
|
<li><a href="#org0a35743">3.1.4.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orga1f9051">3.1.5. Electron-electron rescaled distance gradients and Laplacian with respect to electron coordinates</a>
|
|
<ul>
|
|
<li><a href="#orgbdfdacc">3.1.5.1. Get</a></li>
|
|
<li><a href="#org522e3c4">3.1.5.2. Compute</a></li>
|
|
<li><a href="#org2ec1a31">3.1.5.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org2b7ae6d">3.2. Electron-nucleus component</a>
|
|
<ul>
|
|
<li><a href="#orge0514d9">3.2.1. Asymptotic component for</a>
|
|
<ul>
|
|
<li><a href="#org14e40dc">3.2.1.1. Get</a></li>
|
|
<li><a href="#org7ba00ea">3.2.1.2. Compute</a></li>
|
|
<li><a href="#org6a24685">3.2.1.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org749c7a6">3.2.2. Electron-nucleus component</a>
|
|
<ul>
|
|
<li><a href="#orgcffd1a6">3.2.2.1. Get</a></li>
|
|
<li><a href="#orgcefceb9">3.2.2.2. Compute</a></li>
|
|
<li><a href="#orgc89563e">3.2.2.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org3fc0df7">3.2.3. Derivative</a>
|
|
<ul>
|
|
<li><a href="#orgdae0016">3.2.3.1. Get</a></li>
|
|
<li><a href="#org6044939">3.2.3.2. Compute</a></li>
|
|
<li><a href="#orgb39d38f">3.2.3.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org76ff88f">3.2.4. Electron-nucleus rescaled distances</a>
|
|
<ul>
|
|
<li><a href="#org22763bb">3.2.4.1. Get</a></li>
|
|
<li><a href="#org094f73b">3.2.4.2. Compute</a></li>
|
|
<li><a href="#org337d925">3.2.4.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org04532a8">3.2.5. Electron-electron rescaled distance gradients and Laplacian with respect to electron coordinates</a>
|
|
<ul>
|
|
<li><a href="#org3b51d65">3.2.5.1. Get</a></li>
|
|
<li><a href="#org6c12322">3.2.5.2. Compute</a></li>
|
|
<li><a href="#org4c952de">3.2.5.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org6add5d0">3.3. Electron-electron-nucleus component</a>
|
|
<ul>
|
|
<li><a href="#orgfb4c07f">3.3.1. Electron-electron rescaled distances in \(J_\text{eeN}\)</a>
|
|
<ul>
|
|
<li><a href="#org86797fd">3.3.1.1. Get</a></li>
|
|
<li><a href="#org3333258">3.3.1.2. Compute</a></li>
|
|
<li><a href="#orgfd3269f">3.3.1.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org7768181">3.3.2. Electron-electron rescaled distances derivatives in \(J_\text{eeN}\)</a>
|
|
<ul>
|
|
<li><a href="#org31118b3">3.3.2.1. Get</a></li>
|
|
<li><a href="#org1a91554">3.3.2.2. Compute</a></li>
|
|
<li><a href="#org6dc4101">3.3.2.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orgae38aa0">3.3.3. Electron-nucleus rescaled distances in \(J_\text{eeN}\)</a>
|
|
<ul>
|
|
<li><a href="#orgbb5f54c">3.3.3.1. Get</a></li>
|
|
<li><a href="#orgc437946">3.3.3.2. Compute</a></li>
|
|
<li><a href="#org9ffe6bb">3.3.3.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orgb4c3e3b">3.3.4. Electron-nucleus rescaled distances derivatives in \(J_\text{eeN}\)</a>
|
|
<ul>
|
|
<li><a href="#org8bf3401">3.3.4.1. Get</a></li>
|
|
<li><a href="#org019abee">3.3.4.2. Compute</a></li>
|
|
<li><a href="#org6559e66">3.3.4.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org304fc0e">3.3.5. Temporary arrays for electron-electron-nucleus Jastrow \(f_{een}\)</a>
|
|
<ul>
|
|
<li><a href="#orgc2d3e02">3.3.5.1. Compute dim<sub>c</sub><sub>vector</sub></a></li>
|
|
<li><a href="#org18ee677">3.3.5.2. Get</a></li>
|
|
<li><a href="#org03e1834">3.3.5.3. Compute c<sub>vector</sub><sub>full</sub></a></li>
|
|
<li><a href="#org462d779">3.3.5.4. Compute lkpm<sub>combined</sub><sub>index</sub></a></li>
|
|
<li><a href="#org9970ce5">3.3.5.5. Compute tmp<sub>c</sub></a></li>
|
|
<li><a href="#org622e703">3.3.5.6. Compute dtmp<sub>c</sub></a></li>
|
|
<li><a href="#orgdd7fc33">3.3.5.7. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orgef92d32">3.3.6. Electron-electron-nucleus Jastrow \(f_{een}\)</a>
|
|
<ul>
|
|
<li><a href="#org8494d6d">3.3.6.1. Get</a></li>
|
|
<li><a href="#org7a09fe9">3.3.6.2. Compute naive</a></li>
|
|
<li><a href="#org011b899">3.3.6.3. Compute</a></li>
|
|
<li><a href="#org4082399">3.3.6.4. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org043c67b">3.3.7. Electron-electron-nucleus Jastrow \(f_{een}\) derivative</a>
|
|
<ul>
|
|
<li><a href="#orgcd9b378">3.3.7.1. Get</a></li>
|
|
<li><a href="#org71e8d0e">3.3.7.2. Compute Naive</a></li>
|
|
<li><a href="#org7a1ad86">3.3.7.3. Compute</a></li>
|
|
<li><a href="#orga8a50eb">3.3.7.4. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org7c4e13c">3.4. Total Jastrow</a>
|
|
<ul>
|
|
<li><a href="#orgddd9dbf">3.4.1. Value</a>
|
|
<ul>
|
|
<li><a href="#orgc6a1f0d">3.4.1.1. Get</a></li>
|
|
<li><a href="#orge1c60f9">3.4.1.2. Compute</a></li>
|
|
<li><a href="#org6d4979f">3.4.1.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org23020a6">3.4.2. Derivatives</a>
|
|
<ul>
|
|
<li><a href="#org180f3d3">3.4.2.1. Get</a></li>
|
|
<li><a href="#org170d7ff">3.4.2.2. Compute</a></li>
|
|
<li><a href="#org016fa1a">3.4.2.3. Test</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orga1eef57" class="outline-2">
|
|
<h2 id="orga1eef57"><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-org5d23d9f" class="outline-2">
|
|
<h2 id="org5d23d9f"><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="orgdd26451" 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>
|
|
</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][4][num][num]</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][4][nucl_num][num]</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-org63f41f0" class="outline-3">
|
|
<h3 id="org63f41f0"><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;">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->jastrow_champ.uninitialized = (1 << 10) - 1;
|
|
|
|
/* <span style="color: #b22222;">Default values</span> */
|
|
ctx->jastrow_champ.aord_num = -1;
|
|
|
|
ctx->jastrow_champ.bord_num = -1;
|
|
|
|
ctx->jastrow_champ.dim_c_vector = -1;
|
|
ctx->jastrow_champ.cord_num = -1;
|
|
|
|
ctx->jastrow_champ.type_nucl_num = -1;
|
|
|
|
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orga3e6d20" class="outline-3">
|
|
<h3 id="orga3e6d20"><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>);
|
|
</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-org3eae727" class="outline-5">
|
|
<h5 id="org3eae727"><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;">&</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;">&</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;">&</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;">&</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;">&</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;">&</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;">&</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;">&</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;">&</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;">&</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: #a020f0;">end interface</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orge1610bb" class="outline-3">
|
|
<h3 id="orge1610bb"><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-org5612ddf" class="outline-5">
|
|
<h5 id="org5612ddf"><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;">&</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;">&</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;">&</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;">&</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;">&</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;">&</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;">&</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;">&</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;">&</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;">&</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: #a020f0;">end interface</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org664babe" class="outline-3">
|
|
<h3 id="org664babe"><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> = &(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> = &(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<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>, &(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<3 ; ++k) {
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">i</span>=0 ; i<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<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<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-org448a303" class="outline-2">
|
|
<h2 id="org448a303"><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-orgc8f6621" class="outline-3">
|
|
<h3 id="orgc8f6621"><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-org2ec5583" class="outline-4">
|
|
<h4 id="org2ec5583"><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 substracted 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.
|
|
</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-org72c7882" class="outline-5">
|
|
<h5 id="org72c7882"><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="org9c478d6"></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;">&</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-org94e2130" class="outline-5">
|
|
<h5 id="org94e2130"><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="org30e4f3d" 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>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: #228b22;">integer </span><span style="color: #a020f0;">function</span><span style="color: #a0522d;"> </span><span style="color: #0000ff;">qmckl_compute_jastrow_champ_asymp_jasb_doc_f</span><span style="color: #000000; background-color: #ffffff;">(context, bord_num, b_vector, rescale_factor_ee, asymp_jasb)</span><span style="color: #a0522d;"> </span><span style="color: #a020f0;">&</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;"> bord_num</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> b_vector(bord_num + 1)</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>(out) ::<span style="color: #a0522d;"> asymp_jasb(2)</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 < 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)
|
|
asymp_jasb(:) = (/0.5d0*asym_one, asym_one/)
|
|
|
|
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_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_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: #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 < 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 <= bord_num; ++k) {
|
|
x *= kappa_inv;
|
|
f += b_vector[k]*x;
|
|
}
|
|
|
|
asymp_jasb[0] = 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: #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 (context,
|
|
bord_num, b_vector, rescale_factor_ee, asymp_jasb);
|
|
<span style="color: #483d8b;">#else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_asymp_jasb_doc (context,
|
|
bord_num, b_vector, rescale_factor_ee, asymp_jasb);
|
|
<span style="color: #483d8b;">#endif</span>
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-org87fd358" class="outline-5">
|
|
<h5 id="org87fd358"><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> = &(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> = &(n2_a_vector[0][0]);
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">b_vector</span> = &(n2_b_vector[0]);
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">c_vector</span> = &(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_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, &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, &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, &(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<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_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) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">asymp_jasb</span>[1]-1.043287918508297 ) < 1.e-12);
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgd7986ac" class="outline-4">
|
|
<h4 id="orgd7986ac"><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>.
|
|
</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-org5bed3e2" class="outline-5">
|
|
<h5 id="org5bed3e2"><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="org78b9493"></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;">&</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-org9868102" class="outline-5">
|
|
<h5 id="org9868102"><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="org7a0d192" 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: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_factor_ee_doc_f(context, walk_num, elec_num, up_num, bord_num, </span><span style="color: #a020f0;">&</span>
|
|
b_vector, ee_distance_rescaled, asymp_jasb, factor_ee) <span style="color: #a020f0;">&</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, bord_num, up_num</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> b_vector(bord_num + 1)</span>
|
|
<span style="color: #228b22;">double precision</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;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> asymp_jasb(2)</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> factor_ee(walk_num)</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 <= 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 <= 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 < 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> ( (j <= up_num)<span style="color: #a020f0;">.or.</span>(i > 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>
|
|
|
|
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_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_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: #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 <= 0) {
|
|
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
|
|
}
|
|
|
|
<span style="color: #a020f0;">if</span> (elec_num <= 0) {
|
|
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_3;
|
|
}
|
|
|
|
<span style="color: #a020f0;">if</span> (bord_num < 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 < 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;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">j</span> = 0; j < up_num; ++j ) {
|
|
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">xj</span> = &(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 < 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 < elec_num; ++j ) {
|
|
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">xj</span> = &(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 < 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 < 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 < elec_num; ++j ) {
|
|
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">xj</span> = &(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 < 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 <= 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: #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(context, walk_num, elec_num,
|
|
up_num, bord_num, b_vector, ee_distance_rescaled, asymp_jasb,
|
|
factor_ee);
|
|
<span style="color: #483d8b;">#else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_ee_doc(context, walk_num, elec_num,
|
|
up_num, bord_num, b_vector, ee_distance_rescaled, asymp_jasb,
|
|
factor_ee);
|
|
<span style="color: #483d8b;">#endif</span>
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-org002b9b9" class="outline-5">
|
|
<h5 id="org002b9b9"><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) < 1.e-12);
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org83835a7" class="outline-4">
|
|
<h4 id="org83835a7"><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-orgb4135b7" class="outline-5">
|
|
<h5 id="orgb4135b7"><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="org94a2583"></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;">&</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-orgf45a96e" class="outline-5">
|
|
<h5 id="orgf45a96e"><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="org36772ca" 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>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: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_factor_ee_gl_doc_f( </span><span style="color: #a020f0;">&</span>
|
|
context, walk_num, elec_num, up_num, bord_num, <span style="color: #a020f0;">&</span>
|
|
b_vector, ee_distance_rescaled, ee_distance_rescaled_gl, <span style="color: #a020f0;">&</span>
|
|
factor_ee_gl) <span style="color: #a020f0;">&</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, bord_num, up_num</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> b_vector(bord_num + 1)</span>
|
|
<span style="color: #228b22;">double precision</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;">double precision</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: #b22222;">TODO</span>
|
|
<span style="color: #228b22;">double precision</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>*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 <= 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 <= 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 < 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_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>((i <= up_num <span style="color: #a020f0;">.and.</span> j <= up_num ) <span style="color: #a020f0;">.or.</span> (i > up_num <span style="color: #a020f0;">.and.</span> j > 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>
|
|
|
|
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;">&</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;">&</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_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_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: #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 <= 0) {
|
|
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
|
|
}
|
|
|
|
<span style="color: #a020f0;">if</span> (elec_num <= 0) {
|
|
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_3;
|
|
}
|
|
|
|
<span style="color: #a020f0;">if</span> (bord_num < 0) {
|
|
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_4;
|
|
}
|
|
|
|
|
|
memset(factor_ee_gl, 0, elec_num*4*walk_num*<span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
|
|
|
|
<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<=bord_num ; ++k) {
|
|
kf[k] = (<span style="color: #228b22;">double</span>) k;
|
|
}
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">nw</span> = 0; nw < walk_num; ++nw) {
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">j</span> = 0; j < elec_num; ++j) {
|
|
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">dxj</span> = &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> = &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> = &(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 < 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> =
|
|
(i < up_num && j < up_num ) || (i >= up_num && j >= up_num) ?
|
|
0.5 * b_vector[0] * invdenom2 : b_vector[0] * invdenom2;
|
|
|
|
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<= 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<= 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: #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: #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: #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(context, walk_num, elec_num, up_num, bord_num, b_vector, ee_distance_rescaled, ee_distance_rescaled_gl, factor_ee_gl );
|
|
<span style="color: #483d8b;"> #else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_ee_gl_doc(context, walk_num, elec_num, up_num, bord_num, b_vector, ee_distance_rescaled, ee_distance_rescaled_gl, factor_ee_gl );
|
|
<span style="color: #483d8b;"> #endif</span>
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgad968b9" class="outline-5">
|
|
<h5 id="orgad968b9"><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, &(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) < 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) < 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) < 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) < 1.e-12);
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orga59a684" class="outline-4">
|
|
<h4 id="orga59a684"><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-orgaa4e349" class="outline-5">
|
|
<h5 id="orgaa4e349"><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-org22c7ca2" class="outline-5">
|
|
<h5 id="org22c7ca2"><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="org457e2cc" 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: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_ee_distance_rescaled_f(context, elec_num, rescale_factor_ee, walk_num, </span><span style="color: #a020f0;">&</span>
|
|
coord, ee_distance_rescaled) <span style="color: #a020f0;">&</span>
|
|
<span style="color: #a020f0;">result</span>(info)
|
|
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
|
|
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
|
|
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
|
|
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_ee</span>
|
|
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord(elec_num,walk_num,3)</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> ee_distance_rescaled(elec_num,elec_num,walk_num)</span>
|
|
|
|
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> k</span>
|
|
|
|
info = QMCKL_SUCCESS
|
|
|
|
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
|
|
info = QMCKL_INVALID_CONTEXT
|
|
<span style="color: #a020f0;">return</span>
|
|
<span style="color: #a020f0;">endif</span>
|
|
|
|
<span style="color: #a020f0;">if</span> (elec_num <= 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 <= 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;">&</span>
|
|
coord(1,k,1), elec_num * walk_num, <span style="color: #a020f0;">&</span>
|
|
coord(1,k,1), elec_num * walk_num, <span style="color: #a020f0;">&</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_f</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org0a35743" class="outline-5">
|
|
<h5 id="org0a35743"><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) < 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) < 1.e-12);
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orga1f9051" class="outline-4">
|
|
<h4 id="orga1f9051"><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-orgbdfdacc" class="outline-5">
|
|
<h5 id="orgbdfdacc"><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-org522e3c4" class="outline-5">
|
|
<h5 id="org522e3c4"><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="orgadba8ef" 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_gl</code></td>
|
|
<td class="org-left"><code>double[walk_num][4][elec_num][elec_num]</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: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_ee_distance_rescaled_gl_f(context, elec_num, rescale_factor_ee, walk_num, </span><span style="color: #a020f0;">&</span>
|
|
coord, ee_distance_rescaled_gl) <span style="color: #a020f0;">&</span>
|
|
<span style="color: #a020f0;">result</span>(info)
|
|
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
|
|
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
|
|
<span style="color: #228b22;">integer</span>(qmckl_context), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> context</span>
|
|
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> elec_num</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rescale_factor_ee</span>
|
|
<span style="color: #228b22;">integer</span>*8 , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> walk_num</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord(elec_num,walk_num,3)</span>
|
|
<span style="color: #228b22;">double precision</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>*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 <= 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 <= 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;">&</span>
|
|
coord(1,k,1), elec_num*walk_num, <span style="color: #a020f0;">&</span>
|
|
coord(1,k,1), elec_num*walk_num, <span style="color: #a020f0;">&</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_f</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org2ec1a31" class="outline-5">
|
|
<h5 id="org2ec1a31"><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) < 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) < 1.e-12);</span>
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org2b7ae6d" class="outline-3">
|
|
<h3 id="org2b7ae6d"><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-orge0514d9" class="outline-4">
|
|
<h4 id="orge0514d9"><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 substracted 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-org14e40dc" class="outline-5">
|
|
<h5 id="org14e40dc"><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="orgd7fdf35"></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;">&</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-org7ba00ea" class="outline-5">
|
|
<h5 id="org7ba00ea"><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="orgf3b0bde" 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;">&</span>
|
|
rescale_factor_en, asymp_jasa) <span style="color: #a020f0;">&</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 < 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-org6a24685" class="outline-5">
|
|
<h5 id="org6a24685"><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]) < 1.e-8);
|
|
</p>
|
|
|
|
<p>
|
|
#+end<sub>src</sub>
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org749c7a6" class="outline-4">
|
|
<h4 id="org749c7a6"><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-orgcffd1a6" class="outline-5">
|
|
<h5 id="orgcffd1a6"><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="org1f71922"></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;">&</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-orgcefceb9" class="outline-5">
|
|
<h5 id="orgcefceb9"><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="orge64f31b" 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[aord_num+1][type_nucl_num]</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: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_factor_en_doc_f( </span><span style="color: #a020f0;">&</span>
|
|
context, walk_num, elec_num, nucl_num, type_nucl_num, <span style="color: #a020f0;">&</span>
|
|
type_nucl_vector, aord_num, a_vector, <span style="color: #a020f0;">&</span>
|
|
en_distance_rescaled, asymp_jasa, factor_en) <span style="color: #a020f0;">&</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, aord_num, nucl_num, 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;"> 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;"> en_distance_rescaled(elec_num, nucl_num, walk_num)</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> asymp_jasa(type_nucl_num)</span>
|
|
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> factor_en(walk_num)</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 <= 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 <= 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 <= 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 <= 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 < 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;">&</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_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_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_doc (context, walk_num, elec_num, nucl_num, type_nucl_num,
|
|
type_nucl_vector, aord_num, a_vector, en_distance_rescaled,
|
|
asymp_jasa, factor_en );
|
|
<span style="color: #483d8b;">#else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_en_doc (context, walk_num, elec_num, nucl_num, type_nucl_num,
|
|
type_nucl_vector, aord_num, a_vector, en_distance_rescaled,
|
|
asymp_jasa, factor_en );
|
|
<span style="color: #483d8b;">#endif</span>
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-orgc89563e" class="outline-5">
|
|
<h5 id="orgc89563e"><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], 2.781375792083587);
|
|
<span style="color: #0000ff;">assert</span>(fabs(22.781375792083587 - factor_en[0]) < 1.e-12);
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org3fc0df7" class="outline-4">
|
|
<h4 id="org3fc0df7"><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-orgdae0016" class="outline-5">
|
|
<h5 id="orgdae0016"><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="org9709991"></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;">&</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-org6044939" class="outline-5">
|
|
<h5 id="org6044939"><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="orge461d81" 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[aord_num+1][type_nucl_num]</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][4][nucl_num][elec_num]</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: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_jastrow_champ_factor_en_gl_f( </span><span style="color: #a020f0;">&</span>
|
|
context, walk_num, elec_num, nucl_num, type_nucl_num, <span style="color: #a020f0;">&</span>
|
|
type_nucl_vector, aord_num, a_vector, <span style="color: #a020f0;">&</span>
|
|
en_distance_rescaled, en_distance_rescaled_gl, factor_en_gl) <span style="color: #a020f0;">&</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, aord_num, nucl_num, 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;"> 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;"> en_distance_rescaled(elec_num, nucl_num, walk_num)</span>
|
|
<span style="color: #228b22;">double precision</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;">double precision</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>*8 ::<span style="color: #a0522d;"> i, a, p, ipar, nw, ii</span>
|
|
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, den, invden, invden2, invden3, xinv</span>
|
|
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> y, lap1, lap2, lap3, third</span>
|
|
<span style="color: #228b22;">double precision</span>, <span style="color: #a020f0;">dimension</span>(3) ::<span style="color: #a0522d;"> power_ser_g</span>
|
|
<span style="color: #228b22;">double precision</span>, <span style="color: #a020f0;">dimension</span>(4) ::<span style="color: #a0522d;"> dx</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 <= 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 <= 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 <= 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 < 0) <span style="color: #a020f0;">then</span>
|
|
info = QMCKL_INVALID_ARG_7
|
|
<span style="color: #a020f0;">return</span>
|
|
<span style="color: #a020f0;">endif</span>
|
|
|
|
factor_en_gl = 0.0d0
|
|
third = 1.0d0 / 3.0d0
|
|
|
|
<span style="color: #a020f0;">do</span> nw =1, walk_num
|
|
<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) < 1.0d-18) <span style="color: #a020f0;">continue</span>
|
|
power_ser_g = 0.0d0
|
|
den = 1.0d0 + a_vector(2, type_nucl_vector(a)+1) * x
|
|
invden = 1.0d0 / den
|
|
invden2 = invden * invden
|
|
invden3 = invden2 * invden
|
|
xinv = 1.0d0 / x
|
|
|
|
<span style="color: #a020f0;">do</span> ii = 1, 4
|
|
dx(ii) = en_distance_rescaled_gl(ii,i,a,nw)
|
|
<span style="color: #a020f0;">end do</span>
|
|
|
|
lap1 = 0.0d0
|
|
lap2 = 0.0d0
|
|
lap3 = 0.0d0
|
|
<span style="color: #a020f0;">do</span> ii = 1, 3
|
|
x = en_distance_rescaled(i, a, nw)
|
|
<span style="color: #a020f0;">do</span> p = 2, aord_num
|
|
y = p * a_vector(p + 1, type_nucl_vector(a)+1) * x
|
|
power_ser_g(ii) = power_ser_g(ii) + y * dx(ii)
|
|
lap1 = lap1 + (p - 1) * y * xinv * dx(ii) * dx(ii)
|
|
lap2 = lap2 + y
|
|
x = x * en_distance_rescaled(i, a, nw)
|
|
<span style="color: #a020f0;">end do</span>
|
|
|
|
lap3 = lap3 - 2.0d0 * a_vector(2, type_nucl_vector(a)+1) * dx(ii) * dx(ii)
|
|
|
|
factor_en_gl(i, ii, nw) = factor_en_gl(i, ii, nw) + a_vector(1, type_nucl_vector(a)+1) <span style="color: #a020f0;">&</span>
|
|
* dx(ii) * invden2 <span style="color: #a020f0;">&</span>
|
|
+ power_ser_g(ii)
|
|
|
|
<span style="color: #a020f0;">end do</span>
|
|
|
|
ii = 4
|
|
lap2 = lap2 * dx(ii) * third
|
|
lap3 = lap3 + den * dx(ii)
|
|
lap3 = lap3 * a_vector(1, type_nucl_vector(a)+1) * invden3
|
|
factor_en_gl(i, ii, nw) = factor_en_gl(i, ii, nw) + lap1 + lap2 + lap3
|
|
|
|
<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_f</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgb39d38f" class="outline-5">
|
|
<h5 id="orgb39d38f"><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, &(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]) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs( -0.3945140890522283 - factor_en_gl[0][1][0]) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs( 0.5082964671286118 - factor_en_gl[0][2][0]) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs( -1.8409460670666289 - factor_en_gl[0][3][0]) < 1.e-12);
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org76ff88f" class="outline-4">
|
|
<h4 id="org76ff88f"><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-org22763bb" class="outline-5">
|
|
<h5 id="org22763bb"><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-org094f73b" class="outline-5">
|
|
<h5 id="org094f73b"><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="orgd0935d1" 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: #228b22;">integer</span><span style="color: #a0522d;"> function qmckl_compute_en_distance_rescaled_f(context, elec_num, nucl_num, type_nucl_num, </span><span style="color: #a020f0;">&</span>
|
|
type_nucl_vector, rescale_factor_en, walk_num, elec_coord, <span style="color: #a020f0;">&</span>
|
|
nucl_coord, en_distance_rescaled) <span style="color: #a020f0;">&</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(type_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(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 <= 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 <= 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 <= 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;">&</span>
|
|
elec_coord(1,k,1), elec_num*walk_num, coord, 3_8, <span style="color: #a020f0;">&</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_f</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org337d925" class="outline-5">
|
|
<h5 id="org337d925"><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, &(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) < 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) < 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) < 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) < 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) < 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) < 1.e-12);
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org04532a8" class="outline-4">
|
|
<h4 id="org04532a8"><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-org3b51d65" class="outline-5">
|
|
<h5 id="org3b51d65"><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-org6c12322" class="outline-5">
|
|
<h5 id="org6c12322"><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="orga518091" 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_f(context, elec_num, nucl_num, </span><span style="color: #a020f0;">&</span>
|
|
type_nucl_num, type_nucl_vector, rescale_factor_en, walk_num, elec_coord, <span style="color: #a020f0;">&</span>
|
|
nucl_coord, en_distance_rescaled_gl) <span style="color: #a020f0;">&</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 <= 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 <= 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 <= 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;">&</span>
|
|
elec_coord(1,k,1), elec_num*walk_num, coord, 1_8, <span style="color: #a020f0;">&</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_f</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org4c952de" class="outline-5">
|
|
<h5 id="org4c952de"><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, &(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) < 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) < 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) < 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) < 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) < 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) < 1.e-12);</span>
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org6add5d0" class="outline-3">
|
|
<h3 id="org6add5d0"><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-orgfb4c07f" class="outline-4">
|
|
<h4 id="orgfb4c07f"><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-org86797fd" class="outline-5">
|
|
<h5 id="org86797fd"><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-org3333258" class="outline-5">
|
|
<h5 id="org3333258"><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="org4965cff" 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;">&</span>
|
|
context, walk_num, elec_num, cord_num, rescale_factor_ee, <span style="color: #a020f0;">&</span>
|
|
ee_distance, een_rescaled_e) <span style="color: #a020f0;">&</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 <= 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 <= 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 < 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 <= 0) {
|
|
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
|
|
}
|
|
|
|
<span style="color: #a020f0;">if</span> (elec_num <= 0) {
|
|
<span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_3;
|
|
}
|
|
|
|
<span style="color: #a020f0;">if</span> (cord_num < 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 < (<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(&(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 < 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 < (<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 < 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 < 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 < (<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 < 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> = &(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 < 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 < (<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> = &(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 < (<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 < 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> = &(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 < (<span style="color: #228b22;">size_t</span>) (cord_num + 1); ++l) {
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">x1</span> = &(x0[l*e2]);
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">j</span> = 0; j < (<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(context, walk_num, elec_num, cord_num, rescale_factor_ee, ee_distance, een_rescaled_e);
|
|
<span style="color: #483d8b;">#else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_een_rescaled_e_doc(context, walk_num, elec_num, cord_num, rescale_factor_ee, ee_distance, een_rescaled_e);
|
|
<span style="color: #483d8b;">#endif</span>
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgfd3269f" class="outline-5">
|
|
<h5 id="orgfd3269f"><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, &(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 ) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][1][0][3]- 0.2611178387068169 ) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][1][0][4]- 0.0884012350763747 ) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][2][1][3]- 0.1016685507354656 ) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][2][1][4]- 0.0113118073246869 ) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_e</span>[0][2][1][5]- 0.5257156022077619 ) < 1.e-12);
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org7768181" class="outline-4">
|
|
<h4 id="org7768181"><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-org31118b3" class="outline-5">
|
|
<h5 id="org31118b3"><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-org1a91554" class="outline-5">
|
|
<h5 id="org1a91554"><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="orgdf6a5ec" 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;">&</span>
|
|
context, walk_num, elec_num, cord_num, rescale_factor_ee, <span style="color: #a020f0;">&</span>
|
|
coord_ee, ee_distance, een_rescaled_e, een_rescaled_e_gl) <span style="color: #a020f0;">&</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 <= 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 <= 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 < 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;">&</span>
|
|
+ een_rescaled_e_gl(i, 1, j, l, nw) * een_rescaled_e_gl(i, 1, j, l, nw) <span style="color: #a020f0;">&</span>
|
|
+ een_rescaled_e_gl(i, 2, j, l, nw) * een_rescaled_e_gl(i, 2, j, l, nw) <span style="color: #a020f0;">&</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-org6dc4101" class="outline-5">
|
|
<h5 id="org6dc4101"><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,
|
|
&(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 ) < 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 ) < 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 ) < 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 ) < 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 ) < 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 ) < 1.e-12);
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgae38aa0" class="outline-4">
|
|
<h4 id="orgae38aa0"><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-orgbb5f54c" class="outline-5">
|
|
<h5 id="orgbb5f54c"><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-orgc437946" class="outline-5">
|
|
<h5 id="orgc437946"><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="org9c1b54c" 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;">&</span>
|
|
context, walk_num, elec_num, nucl_num, <span style="color: #a020f0;">&</span>
|
|
type_nucl_num, type_nucl_vector, cord_num, rescale_factor_en, <span style="color: #a020f0;">&</span>
|
|
en_distance, een_rescaled_n) <span style="color: #a020f0;">&</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 <= 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 <= 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 <= 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 < 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 <= 0) {</span>
|
|
<span style="color: #b22222;"> return QMCKL_INVALID_ARG_2;</span>
|
|
<span style="color: #b22222;"> }</span>
|
|
|
|
<span style="color: #b22222;"> if (elec_num <= 0) {</span>
|
|
<span style="color: #b22222;"> return QMCKL_INVALID_ARG_3;</span>
|
|
<span style="color: #b22222;"> }</span>
|
|
|
|
<span style="color: #b22222;"> if (nucl_num <= 0) {</span>
|
|
<span style="color: #b22222;"> return QMCKL_INVALID_ARG_4;</span>
|
|
<span style="color: #b22222;"> }</span>
|
|
|
|
<span style="color: #b22222;"> if (cord_num < 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 < (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 < walk_num; ++nw) {</span>
|
|
<span style="color: #b22222;"> for (int a = 0; a < nucl_num; ++a) {</span>
|
|
<span style="color: #b22222;"> for (int i = 0; i < 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 < (cord_num+1); ++l){</span>
|
|
<span style="color: #b22222;"> for (int a = 0; a < nucl_num; ++a) {</span>
|
|
<span style="color: #b22222;"> for (int i = 0; i < 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-org9ffe6bb" class="outline-5">
|
|
<h5 id="org9ffe6bb"><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, &(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 )< 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][1][0][3]-0.3016180139679065 )< 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][1][0][4]-0.10506023826192266)< 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][2][1][3]-0.9267719759374164 )< 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][2][1][4]-0.11497585238132658)< 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">een_rescaled_n</span>[0][2][1][5]-0.07534033469115217)< 1.e-12);
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgb4c3e3b" class="outline-4">
|
|
<h4 id="orgb4c3e3b"><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-org8bf3401" class="outline-5">
|
|
<h5 id="org8bf3401"><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-org019abee" class="outline-5">
|
|
<h5 id="org019abee"><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="org736b9f5" 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;">&</span>
|
|
context, walk_num, elec_num, nucl_num, type_nucl_num, type_nucl_vector, <span style="color: #a020f0;">&</span>
|
|
cord_num, rescale_factor_en, <span style="color: #a020f0;">&</span>
|
|
coord_ee, coord_n, en_distance, een_rescaled_n, een_rescaled_n_gl) <span style="color: #a020f0;">&</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 <= 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 <= 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 <= 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 < 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;">&</span>
|
|
+ een_rescaled_n_gl(i, 1, a, l, nw) * een_rescaled_n_gl(i, 1, a, l, nw) <span style="color: #a020f0;">&</span>
|
|
+ een_rescaled_n_gl(i, 2, a, l, nw) * een_rescaled_n_gl(i, 2, a, l, nw) <span style="color: #a020f0;">&</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;">&</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;">&</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;">&</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;">&</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-org6559e66" class="outline-5">
|
|
<h5 id="org6559e66"><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, &(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]) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs( 0.0004440109367151707 - een_rescaled_n_gl[0][1][0][0][3]) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs( -0.012868642597346566 - een_rescaled_n_gl[0][1][0][0][4]) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs( 0.08601122289922644 - een_rescaled_n_gl[0][2][1][0][3]) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs( -0.058681563677207206 - een_rescaled_n_gl[0][2][1][0][4]) < 1.e-12);
|
|
<span style="color: #0000ff;">assert</span>(fabs( 0.005359281880312882 - een_rescaled_n_gl[0][2][1][0][5]) < 1.e-12);
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org304fc0e" class="outline-4">
|
|
<h4 id="org304fc0e"><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-orgc2d3e02" class="outline-5">
|
|
<h5 id="orgc2d3e02"><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"> </td>
|
|
<td class="org-right"> </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="orgd324574" 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;">&</span>
|
|
context, cord_num, dim_c_vector) <span style="color: #a020f0;">&</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 < 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-org18ee677" class="outline-5">
|
|
<h5 id="org18ee677"><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-org03e1834" class="outline-5">
|
|
<h5 id="org03e1834"><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="org5e94f88" 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;">&</span>
|
|
context, nucl_num, dim_c_vector, type_nucl_num, <span style="color: #a020f0;">&</span>
|
|
type_nucl_vector, c_vector, c_vector_full) <span style="color: #a020f0;">&</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 <= 0) info = QMCKL_INVALID_ARG_2
|
|
<span style="color: #a020f0;">if</span> (dim_c_vector < 0) info = QMCKL_INVALID_ARG_3
|
|
<span style="color: #a020f0;">if</span> (type_nucl_num <= 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 <= 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
|
|
<span style="color: #a020f0;">if</span> (dim_c_vector < 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_3;
|
|
<span style="color: #a020f0;">if</span> (type_nucl_num <= 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 < dim_c_vector; ++i) {
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">a</span>=0; a < 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(context, nucl_num, dim_c_vector, type_nucl_num, type_nucl_vector, c_vector, c_vector_full);
|
|
<span style="color: #483d8b;"> #else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_c_vector_full_doc(context, nucl_num, dim_c_vector, type_nucl_num, type_nucl_vector, c_vector, c_vector_full);
|
|
<span style="color: #483d8b;"> #endif</span>
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org462d779" class="outline-5">
|
|
<h5 id="org462d779"><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="org4409116" 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;">&</span>
|
|
context, cord_num, dim_c_vector, lkpm_combined_index) <span style="color: #a020f0;">&</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 < 0) info = QMCKL_INVALID_ARG_2
|
|
<span style="color: #a020f0;">if</span> (dim_c_vector < 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 < 0) <span style="color: #a020f0;">return</span> QMCKL_INVALID_ARG_2;
|
|
<span style="color: #a020f0;">if</span> (dim_c_vector < 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 <= cord_num; ++p) {
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span>=(p-1); k >= 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 >= 0; --l) {
|
|
<span style="color: #a020f0;">if</span> (((p - k - l) & 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(context, cord_num, dim_c_vector, lkpm_combined_index);
|
|
<span style="color: #483d8b;"> #else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_lkpm_combined_index_doc(context, cord_num, dim_c_vector, lkpm_combined_index);
|
|
<span style="color: #483d8b;"> #endif</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 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-org9970ce5" class="outline-5">
|
|
<h5 id="org9970ce5"><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="orgf4002da" 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(context, cord_num, elec_num, nucl_num, walk_num, een_rescaled_e, een_rescaled_n, tmp_c);
|
|
<span style="color: #483d8b;">#else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_tmp_c_doc(context, cord_num, elec_num, nucl_num, walk_num, een_rescaled_e, een_rescaled_n, tmp_c);
|
|
<span style="color: #483d8b;">#endif</span>
|
|
}
|
|
</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;">&</span>
|
|
context, cord_num, elec_num, nucl_num, <span style="color: #a020f0;">&</span>
|
|
walk_num, een_rescaled_e, een_rescaled_n, tmp_c) <span style="color: #a020f0;">&</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 < 0) info = QMCKL_INVALID_ARG_2
|
|
<span style="color: #a020f0;">if</span> (elec_num <= 0) info = QMCKL_INVALID_ARG_3
|
|
<span style="color: #a020f0;">if</span> (nucl_num <= 0) info = QMCKL_INVALID_ARG_4
|
|
<span style="color: #a020f0;">if</span> (walk_num <= 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;">&</span>
|
|
een_rescaled_e(1,1,i,nw),LDA*1_8, <span style="color: #a020f0;">&</span>
|
|
een_rescaled_n(1,1,0,nw),LDB*1_8, <span style="color: #a020f0;">&</span>
|
|
beta, <span style="color: #a020f0;">&</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-org622e703" class="outline-5">
|
|
<h5 id="org622e703"><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="orgc63c85c" 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 (context, cord_num, elec_num, nucl_num, walk_num, een_rescaled_e_gl,
|
|
een_rescaled_n, dtmp_c );
|
|
<span style="color: #483d8b;">#else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_dtmp_c_doc (context, cord_num, elec_num, nucl_num, walk_num, een_rescaled_e_gl,
|
|
een_rescaled_n, dtmp_c );
|
|
<span style="color: #483d8b;">#endif</span>
|
|
}
|
|
</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;">&</span>
|
|
context, cord_num, elec_num, nucl_num, <span style="color: #a020f0;">&</span>
|
|
walk_num, een_rescaled_e_gl, een_rescaled_n, dtmp_c) <span style="color: #a020f0;">&</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 < 0) info = QMCKL_INVALID_ARG_2
|
|
<span style="color: #a020f0;">if</span> (elec_num <= 0) info = QMCKL_INVALID_ARG_3
|
|
<span style="color: #a020f0;">if</span> (nucl_num <= 0) info = QMCKL_INVALID_ARG_4
|
|
<span style="color: #a020f0;">if</span> (walk_num <= 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;">&</span>
|
|
een_rescaled_e_gl(1,1,1,i,nw),LDA*1_8, <span style="color: #a020f0;">&</span>
|
|
een_rescaled_n(1,1,0,nw),LDB*1_8, <span style="color: #a020f0;">&</span>
|
|
beta, <span style="color: #a020f0;">&</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-orgdd7fc33" class="outline-5">
|
|
<h5 id="orgdd7fc33"><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, &(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, &(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) < 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 ) < 1e-6);
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgef92d32" class="outline-4">
|
|
<h4 id="orgef92d32"><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-org8494d6d" class="outline-5">
|
|
<h5 id="org8494d6d"><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="org14aa755"></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;">&</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-org7a09fe9" class="outline-5">
|
|
<h5 id="org7a09fe9"><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="org8c1d060" 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;">&</span>
|
|
context, walk_num, elec_num, nucl_num, cord_num,<span style="color: #a020f0;">&</span>
|
|
dim_c_vector, c_vector_full, lkpm_combined_index, <span style="color: #a020f0;">&</span>
|
|
een_rescaled_e, een_rescaled_n, factor_een) <span style="color: #a020f0;">&</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 <= 0) info = QMCKL_INVALID_ARG_2
|
|
<span style="color: #a020f0;">if</span> (elec_num <= 0) info = QMCKL_INVALID_ARG_3
|
|
<span style="color: #a020f0;">if</span> (nucl_num <= 0) info = QMCKL_INVALID_ARG_4
|
|
<span style="color: #a020f0;">if</span> (cord_num < 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) * &</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;">&</span>
|
|
(een_rescaled_n(i,a,l,nw) + een_rescaled_n(j,a,l,nw)) * <span style="color: #a020f0;">&</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-org011b899" class="outline-5">
|
|
<h5 id="org011b899"><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="org9ab3882" 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;">&</span>
|
|
context, walk_num, elec_num, nucl_num, cord_num, <span style="color: #a020f0;">&</span>
|
|
dim_c_vector, c_vector_full, lkpm_combined_index, <span style="color: #a020f0;">&</span>
|
|
tmp_c, een_rescaled_n, factor_een) <span style="color: #a020f0;">&</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 <= 0) info = QMCKL_INVALID_ARG_2
|
|
<span style="color: #a020f0;">if</span> (elec_num <= 0) info = QMCKL_INVALID_ARG_3
|
|
<span style="color: #a020f0;">if</span> (nucl_num <= 0) info = QMCKL_INVALID_ARG_4
|
|
<span style="color: #a020f0;">if</span> (cord_num < 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-org4082399" class="outline-5">
|
|
<h5 id="org4082399"><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, &(factor_een[0]),walk_num);
|
|
|
|
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">factor_een</span>[0] + 0.382580260174321) < 1e-12);
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org043c67b" class="outline-4">
|
|
<h4 id="org043c67b"><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-orgcd9b378" class="outline-5">
|
|
<h5 id="orgcd9b378"><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="org9096b7d"></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;">&</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-org71e8d0e" class="outline-5">
|
|
<h5 id="org71e8d0e"><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="org77af806" 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;">&</span>
|
|
context, walk_num, elec_num, nucl_num, cord_num, dim_c_vector, <span style="color: #a020f0;">&</span>
|
|
c_vector_full, lkpm_combined_index, een_rescaled_e, een_rescaled_n, <span style="color: #a020f0;">&</span>
|
|
een_rescaled_e_gl, een_rescaled_n_gl, factor_een_gl)<span style="color: #a020f0;">&</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 <= 0) info = QMCKL_INVALID_ARG_2
|
|
<span style="color: #a020f0;">if</span> (elec_num <= 0) info = QMCKL_INVALID_ARG_3
|
|
<span style="color: #a020f0;">if</span> (nucl_num <= 0) info = QMCKL_INVALID_ARG_4
|
|
<span style="color: #a020f0;">if</span> (cord_num < 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;">&</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;">&</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;">&</span>
|
|
(accu * een_rescaled_n_gl(j, 1:4, a, m + l, nw) <span style="color: #a020f0;">&</span>
|
|
+ daccu(1:4) * een_rescaled_n(j, a, m + l, nw) <span style="color: #a020f0;">&</span>
|
|
+ daccu2(1:4) * een_rescaled_n(j, a, m, nw) <span style="color: #a020f0;">&</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;">&</span>
|
|
daccu (1) * een_rescaled_n_gl(j, 1, a, m + l, nw) + <span style="color: #a020f0;">&</span>
|
|
daccu (2) * een_rescaled_n_gl(j, 2, a, m + l, nw) + <span style="color: #a020f0;">&</span>
|
|
daccu (3) * een_rescaled_n_gl(j, 3, a, m + l, nw) + <span style="color: #a020f0;">&</span>
|
|
daccu2(1) * een_rescaled_n_gl(j, 1, a, m, nw ) + <span style="color: #a020f0;">&</span>
|
|
daccu2(2) * een_rescaled_n_gl(j, 2, a, m, nw ) + <span style="color: #a020f0;">&</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-org7a1ad86" class="outline-5">
|
|
<h5 id="org7a1ad86"><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="org9112303" 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;">&</span>
|
|
context, walk_num, elec_num, nucl_num, <span style="color: #a020f0;">&</span>
|
|
cord_num, dim_c_vector, c_vector_full, lkpm_combined_index, <span style="color: #a020f0;">&</span>
|
|
tmp_c, dtmp_c, een_rescaled_n, een_rescaled_n_gl, factor_een_gl)<span style="color: #a020f0;">&</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 <= 0) info = QMCKL_INVALID_ARG_2
|
|
<span style="color: #a020f0;">if</span> (elec_num <= 0) info = QMCKL_INVALID_ARG_3
|
|
<span style="color: #a020f0;">if</span> (nucl_num <= 0) info = QMCKL_INVALID_ARG_4
|
|
<span style="color: #a020f0;">if</span> (cord_num < 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;">&</span>
|
|
tmp_c(j,a,m,k,nw) * een_rescaled_n_gl(j,ii,a,m+l,nw) + <span style="color: #a020f0;">&</span>
|
|
(dtmp_c(j,ii,a,m,k,nw)) * een_rescaled_n(j,a,m+l,nw) + <span style="color: #a020f0;">&</span>
|
|
(dtmp_c(j,ii,a,m+l,k,nw)) * een_rescaled_n(j,a,m ,nw) + <span style="color: #a020f0;">&</span>
|
|
tmp_c(j,a,m+l,k,nw) * een_rescaled_n_gl(j,ii,a,m,nw) <span style="color: #a020f0;">&</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;">&</span>
|
|
(dtmp_c(j,1,a,m ,k,nw)) * een_rescaled_n_gl(j,1,a,m+l,nw) + <span style="color: #a020f0;">&</span>
|
|
(dtmp_c(j,2,a,m ,k,nw)) * een_rescaled_n_gl(j,2,a,m+l,nw) + <span style="color: #a020f0;">&</span>
|
|
(dtmp_c(j,3,a,m ,k,nw)) * een_rescaled_n_gl(j,3,a,m+l,nw) + <span style="color: #a020f0;">&</span>
|
|
(dtmp_c(j,1,a,m+l,k,nw)) * een_rescaled_n_gl(j,1,a,m ,nw) + <span style="color: #a020f0;">&</span>
|
|
(dtmp_c(j,2,a,m+l,k,nw)) * een_rescaled_n_gl(j,2,a,m ,nw) + <span style="color: #a020f0;">&</span>
|
|
(dtmp_c(j,3,a,m+l,k,nw)) * een_rescaled_n_gl(j,3,a,m ,nw) <span style="color: #a020f0;">&</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(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);
|
|
<span style="color: #483d8b;">#else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_factor_een_gl_doc(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);
|
|
<span style="color: #483d8b;">#endif</span>
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="outline-container-orga8a50eb" class="outline-5">
|
|
<h5 id="orga8a50eb"><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, &(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]) < 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]) < 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]) < 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]) < 1e-12);
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org7c4e13c" class="outline-3">
|
|
<h3 id="org7c4e13c"><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-orgddd9dbf" class="outline-4">
|
|
<h4 id="orgddd9dbf"><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-orgc6a1f0d" class="outline-5">
|
|
<h5 id="orgc6a1f0d"><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="org25d75ab"></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;">&</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-orge1c60f9" class="outline-5">
|
|
<h5 id="orge1c60f9"><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="orgb0273b2" 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;">&</span>
|
|
walk_num, f_ee, f_en, f_een, <span style="color: #a020f0;">value</span>) <span style="color: #a020f0;">&</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 <= 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) < -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 (
|
|
context, walk_num, factor_ee, factor_en, factor_een, value);
|
|
<span style="color: #483d8b;">#else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_value_doc (
|
|
context, walk_num, factor_ee, factor_en, factor_een, value);
|
|
<span style="color: #483d8b;">#endif</span>
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org6d4979f" class="outline-5">
|
|
<h5 id="org6d4979f"><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, &(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, &(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, &(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, &(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< walk_num ; ++i) {
|
|
assert (total_j[i] - exp(factor_ee[i] + factor_en[i] + factor_een[i]) < 1.e-12);
|
|
}
|
|
|
|
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org23020a6" class="outline-4">
|
|
<h4 id="org23020a6"><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-org180f3d3" class="outline-5">
|
|
<h5 id="org180f3d3"><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="org2d4ef9d"></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;">&</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-org170d7ff" class="outline-5">
|
|
<h5 id="org170d7ff"><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="org21cd7d4" 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;">&</span>
|
|
walk_num, elec_num, <span style="color: #a020f0;">value</span>, gl_ee, gl_en, gl_een, gl) <span style="color: #a020f0;">&</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 <= 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;">&</span>
|
|
gl(i,1,k) * gl(i,1,k) + <span style="color: #a020f0;">&</span>
|
|
gl(i,2,k) * gl(i,2,k) + <span style="color: #a020f0;">&</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 (context,
|
|
walk_num, elec_num, value, gl_ee, gl_en, gl_een, gl);
|
|
<span style="color: #483d8b;">#else</span>
|
|
<span style="color: #a020f0;">return</span> qmckl_compute_jastrow_champ_gl_doc (context,
|
|
walk_num, elec_num, value, gl_ee, gl_en, gl_een, gl);
|
|
<span style="color: #483d8b;">#endif</span>
|
|
}
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org016fa1a" class="outline-5">
|
|
<h5 id="org016fa1a"><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, &(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, &(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, &(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, &(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, &(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< walk_num ; ++k) {
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">m</span>=0 ; m<4; ++m) {
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">e</span>=0 ; e<elec_num; ++e) {
|
|
<span style="color: #a020f0;">if</span> (m < 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]) < 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-09-13 Wed 14:23</p>
|
|
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
|
</div>
|
|
</body>
|
|
</html>
|