mirror of
https://github.com/TREX-CoE/qmckl.git
synced 2025-04-28 11:24:46 +02:00
Deploying to gh-pages from @ TREX-CoE/qmckl@5c62bc1c71 🚀
This commit is contained in:
parent
bc26ad86a6
commit
a288f5822d
369
README.html
369
README.html
@ -1,369 +0,0 @@
|
||||
<?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>
|
||||
<!-- 2022-09-28 Wed 07:38 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>QMCkl source code documentation</title>
|
||||
<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; }
|
||||
.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-2019 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-2019 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-2019 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>
|
||||
</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">QMCkl source code documentation</h1>
|
||||
<hr />
|
||||
|
||||
|
||||
<ul class="org-ul">
|
||||
<li><a href="./qmckl.html">Introduction</a></li>
|
||||
<li><a href="./qmckl_context.html">Context</a></li>
|
||||
<li><a href="./qmckl_error.html">Error handling</a></li>
|
||||
<li><a href="./qmckl_blas.html">BLAS functions</a></li>
|
||||
<li><a href="./qmckl_memory.html">Memory management</a></li>
|
||||
<li><a href="./qmckl_numprec.html">Numerical precision</a></li>
|
||||
<li><a href="./qmckl_point.html">Point</a></li>
|
||||
<li><a href="./qmckl_nucleus.html">Nucleus</a></li>
|
||||
<li><a href="./qmckl_electron.html">Electrons</a></li>
|
||||
<li><a href="./qmckl_distance.html">Inter-particle distances</a></li>
|
||||
<li><a href="./qmckl_ao.html">Atomic Orbitals</a></li>
|
||||
<li><a href="./qmckl_mo.html">Molecular Orbitals</a></li>
|
||||
<li><a href="./qmckl_determinant.html">Slater Determinant</a></li>
|
||||
<li><a href="./qmckl_sherman_morrison_woodbury.html">Sherman-Morrison-Woodbury</a></li>
|
||||
<li><a href="./qmckl_jastrow.html">Jastrow Factor</a></li>
|
||||
<li><a href="./qmckl_local_energy.html">Local Energy</a></li>
|
||||
<li><a href="./qmckl_trexio.html">TREXIO I/O library</a></li>
|
||||
<li><a href="./qmckl_tests.html">Data for Tests</a></li>
|
||||
<li><a href="./qmckl_verificarlo.html">Verificarlo CI</a></li>
|
||||
<li><a href="./qmckl_examples.html">Code examples</a></li>
|
||||
</ul>
|
||||
|
||||
|
||||
<hr />
|
||||
|
||||
|
||||
<p>
|
||||
The ultimate goal of the QMCkl library is to provide a high-performance
|
||||
implementation of the main kernels of Quantum Monte Carlo
|
||||
methods.
|
||||
In this particular implementation of the library, we focus on the
|
||||
definition of the API and the tests, and on a <i>pedagogical</i>
|
||||
presentation of the algorithms. We expect the HPC experts to use
|
||||
this repository as a reference for re-writing optimized libraries.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The source code of the library is available at
|
||||
<a href="https://github.com/trex-coe/qmckl">https://github.com/trex-coe/qmckl</a>
|
||||
and bug reports should be submitted at
|
||||
<a href="https://github.com/trex-coe/qmckl/issues">https://github.com/trex-coe/qmckl/issues</a>.
|
||||
</p>
|
||||
|
||||
<hr />
|
||||
|
||||
<p>
|
||||
<img src="https://trex-coe.eu/sites/default/files/inline-images/euflag.jpg" alt="euflag.jpg" /> <a href="https://trex-coe.eu">TREX: Targeting Real Chemical Accuracy at the Exascale</a> project has received funding from the European Union’s Horizon 2020 - Research and Innovation program - under grant agreement no. 952165. The content of this document does not represent the opinion of the European Union, and the European Union is not responsible for any use that might be made of such content.
|
||||
</p>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX CoE</p>
|
||||
<p class="date">Created: 2022-09-28 Wed 07:38</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
1864
htmlize.el
1864
htmlize.el
File diff suppressed because it is too large
Load Diff
920
qmckl.html
920
qmckl.html
@ -1,920 +0,0 @@
|
||||
<?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>
|
||||
<!-- 2022-09-28 Wed 07:38 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Introduction</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; }
|
||||
.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-2019 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-2019 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-2019 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">Introduction</h1>
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#org0bfb2f9">1. Installing QMCkl</a>
|
||||
<ul>
|
||||
<li><a href="#org64383b3">1.1. Installing from the released tarball (for end users)</a></li>
|
||||
<li><a href="#org92d2d03">1.2. Installing from the source repository (for developers)</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#orgc05a975">2. Using QMCkl</a></li>
|
||||
<li><a href="#orgce4e581">3. Developing in QMCkl</a>
|
||||
<ul>
|
||||
<li><a href="#org4b55976">3.1. Literate programming</a></li>
|
||||
<li><a href="#orgd262f97">3.2. Source code editing</a></li>
|
||||
<li><a href="#org99d4343">3.3. Choice of the programming language</a></li>
|
||||
<li><a href="#orgdce37bc">3.4. Coding rules</a></li>
|
||||
<li><a href="#org5c5481b">3.5. Design of the library</a></li>
|
||||
<li><a href="#orgee29033">3.6. Naming conventions</a></li>
|
||||
<li><a href="#org31107f5">3.7. Application programming interface</a></li>
|
||||
<li><a href="#org421a76e">3.8. Global state</a></li>
|
||||
<li><a href="#org8f0e733">3.9. Headers</a></li>
|
||||
<li><a href="#org8de6f50">3.10. Low-level functions</a></li>
|
||||
<li><a href="#orgd1458ce">3.11. High-level functions</a></li>
|
||||
<li><a href="#org2d8c78b">3.12. Numerical precision</a></li>
|
||||
<li><a href="#orgcb989ea">3.13. Algorithms</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org0bfb2f9" class="outline-2">
|
||||
<h2 id="org0bfb2f9"><span class="section-number-2">1</span> Installing QMCkl</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<p>
|
||||
The latest version fo QMCkl can be downloaded
|
||||
<a href="https://github.com/TREX-CoE/qmckl/releases/latest">here</a>, and the source code is accessible on the
|
||||
<a href="https://github.com/TREX-CoE/qmckl">GitHub repository</a>.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org64383b3" class="outline-3">
|
||||
<h3 id="org64383b3"><span class="section-number-3">1.1</span> Installing from the released tarball (for end users)</h3>
|
||||
<div class="outline-text-3" id="text-1-1">
|
||||
<p>
|
||||
QMCkl is built with GNU Autotools, so the usual
|
||||
<code>configure ; make ; make check ; make install</code> scheme will be used.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
As usual, the C compiler can be specified with the <code>CC</code> variable
|
||||
and the Fortran compiler with the <code>FC</code> variable. The compiler
|
||||
options are defined using <code>CFLAGS</code> and <code>FCFLAGS</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org92d2d03" class="outline-3">
|
||||
<h3 id="org92d2d03"><span class="section-number-3">1.2</span> Installing from the source repository (for developers)</h3>
|
||||
<div class="outline-text-3" id="text-1-2">
|
||||
<p>
|
||||
To compile from the source repository, additional dependencies are
|
||||
required to generated the source files:
|
||||
</p>
|
||||
<ul class="org-ul">
|
||||
<li>Emacs >= 26</li>
|
||||
<li>Autotools</li>
|
||||
<li>Python3</li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
When the repository is downloaded, the Makefile is not yet
|
||||
generated, as well as the configure script. <code>./autogen.sh</code> has
|
||||
to be executed first.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgc05a975" class="outline-2">
|
||||
<h2 id="orgc05a975"><span class="section-number-2">2</span> Using QMCkl</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
<p>
|
||||
The <code>qmckl.h</code> header file installed in the <code>${prefix}/include</code> directory
|
||||
has to be included in C codes when QMCkl functions are used:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #483d8b;">#include</span> <span style="color: #8b2252;">"qmckl.h"</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
In Fortran programs, the <code>qmckl_f.f90</code> installed in
|
||||
<code>${prefix}/share/qmckl/fortran</code> interface file should be copied in the source
|
||||
code using the library, and the Fortran codes should use the <code>qmckl</code> module as
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"><span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Both files are located in the <code>include/</code> directory.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgce4e581" class="outline-2">
|
||||
<h2 id="orgce4e581"><span class="section-number-2">3</span> Developing in QMCkl</h2>
|
||||
<div class="outline-text-2" id="text-3">
|
||||
</div>
|
||||
<div id="outline-container-org4b55976" class="outline-3">
|
||||
<h3 id="org4b55976"><span class="section-number-3">3.1</span> Literate programming</h3>
|
||||
<div class="outline-text-3" id="text-3-1">
|
||||
<p>
|
||||
In a traditional source code, most of the lines of source files of a program
|
||||
are code, scripts, Makefiles, and only a few lines are comments explaining
|
||||
parts of the code that are non-trivial to understand. The documentation of
|
||||
the prorgam is usually written in a separate directory, and is often outdated
|
||||
compared to the code.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Literate programming is a different approach to programming,
|
||||
where the program is considered as a publishable-quality document. Most of
|
||||
the lines of the source files are text, mathematical formulas, tables,
|
||||
figures, <i>etc</i>, and the lines of code are just the translation in a computer
|
||||
language of the ideas and algorithms expressed in the text. More importantly,
|
||||
the "document" is structured like a text document with sections, subsections,
|
||||
a bibliography, a table of contents <i>etc</i>, and the place where pieces of code
|
||||
appear are the places where they should belong for the reader to understand
|
||||
the logic of the program, not the places where the compiler expects to find
|
||||
them. Both the publishable-quality document and the binary executable are
|
||||
produced from the same source files.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Literate programming is particularly well adapted in this context, as the
|
||||
central part of this project is the documentation of an API. The
|
||||
implementation of the algorithms is just an expression of the algorithms in a
|
||||
language that can be compiled, so that the correctness of the algorithms can
|
||||
be tested.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We have chosen to write the source files in <a href="https://karl-voit.at/2017/09/23/orgmode-as-markup-only/">org-mode</a> format,
|
||||
as any text editor can be used to edit org-mode files. To
|
||||
produce the documentation, there exists multiple possibilities to convert
|
||||
org-mode files into different formats such as HTML or PDF. The source code is
|
||||
easily extracted from the org-mode files invoking the Emacs text editor from
|
||||
the command-line in the <code>Makefile</code>, and then the produced files are compiled.
|
||||
Moreover, within the Emacs text editor the source code blocks can be executed
|
||||
interactively, in the same spirit as Jupyter notebooks.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that Emacs is not needed for end users because the distributed
|
||||
tarball contains the generated source code.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgd262f97" class="outline-3">
|
||||
<h3 id="orgd262f97"><span class="section-number-3">3.2</span> Source code editing</h3>
|
||||
<div class="outline-text-3" id="text-3-2">
|
||||
<p>
|
||||
For a tutorial on literate programming with org-mode, follow <a href="http://www.howardism.org/Technical/Emacs/literate-programming-tutorial.html">this link</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Any text editor can be used to edit org-mode files. For a better
|
||||
user experience Emacs is recommended. For users hating Emacs, it
|
||||
is good to know that Emacs can behave like Vim when switched into
|
||||
``Evil'' mode.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In the <code>tools/init.el</code> file, we provide a minimal Emacs configuration
|
||||
file for vim users. This file should be copied into <code>.emacs.d/init.el</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For users with a preference for Jupyter notebooks, we also provide the
|
||||
<code>tools/nb_to_org.sh</code> script can convert jupyter notebooks into org-mode
|
||||
files.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Note that pandoc can be used to convert multiple markdown formats into
|
||||
org-mode.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org99d4343" class="outline-3">
|
||||
<h3 id="org99d4343"><span class="section-number-3">3.3</span> Choice of the programming language</h3>
|
||||
<div class="outline-text-3" id="text-3-3">
|
||||
<p>
|
||||
Most of the codes of the <a href="https://trex-coe.eu">TREX CoE</a> are written in Fortran with some
|
||||
scripts in Bash and Python. Outside of the CoE, Fortran is also
|
||||
important in QMC codes (Casino, Amolqc), and other important
|
||||
languages used by the community are C and C++ (QMCPack, QWalk),
|
||||
Julia and Rust are gaining in popularity. We want QMCkl to be
|
||||
compatible with all of these languages, so the QMCkl API has to be
|
||||
compatible with the C language since libraries with a C-compatible
|
||||
API can be used in every other language.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
High-performance versions of QMCkl, with the same API, can be
|
||||
rewritten by HPC experts. These optimized libraries will be tuned
|
||||
for specific architectures, among which we can cite x86 based
|
||||
processors, and GPU accelerators. Nowadays, the most efficient
|
||||
software tools to take advantage of low-level features
|
||||
(intrinsics, prefetching, aligned or pinned memory allocation,
|
||||
…) are for C++ developers. It is highly probable that optimized
|
||||
implementations will be written in C++, but as the API is
|
||||
C-compatible this doesn't pose any problem for linking the library
|
||||
in other languages.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Fortran is one of the most common languages used by the community,
|
||||
and is simple enough to make the algorithms readable both by
|
||||
experts in QMC, and experts in HPC. Hence we propose in this
|
||||
pedagogical implementation of QMCkl to use Fortran to express the
|
||||
QMC algorithms. However, for internal functions related to system
|
||||
programming, the C language is more natural than Fortran.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
As QMCkl appears like a C library, for each Fortran function there
|
||||
is an <code>iso_c_binding</code> interface to make the Fortran function
|
||||
callable from C. It is this C interface which is exposed to the
|
||||
user. As a consequence, the Fortran users of the library never
|
||||
call directly the Fortran routines, but call instead the C binding
|
||||
function and an <code>iso_c_binding</code> is still required:
|
||||
</p>
|
||||
|
||||
<pre class="example">
|
||||
ISO_C_BINDING ISO_C_BINDING
|
||||
Fortran ---------------> C ---------------> Fortran
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
The name of the Fortran source files should end with <code>_f.f90</code> to
|
||||
be properly handled by the <code>Makefile</code> and to avoid collision of
|
||||
object files (<code>*.o</code>) with the compiled C source files. The names
|
||||
of the functions defined in Fortran should be the same as those
|
||||
exposed in the API suffixed by <code>_f</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
For more guidelines on using Fortran to generate a C interface, see
|
||||
<a href="http://fortranwiki.org/fortran/show/Generating+C+Interfaces">this link</a>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgdce37bc" class="outline-3">
|
||||
<h3 id="orgdce37bc"><span class="section-number-3">3.4</span> Coding rules</h3>
|
||||
<div class="outline-text-3" id="text-3-4">
|
||||
<p>
|
||||
The authors should follow the recommendations of the C99
|
||||
<a href="https://wiki.sei.cmu.edu/confluence/display/c/SEI+CERT+C+Coding+Standard">SEI+CERT C Coding Standard</a>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Compliance can be checked with <code>cppcheck</code> as:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-bash">cppcheck --addon=cert --enable=all *.c &> cppcheck.out
|
||||
# <span style="color: #b22222;">or</span>
|
||||
make cppcheck ; cat cppcheck.out
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org5c5481b" class="outline-3">
|
||||
<h3 id="org5c5481b"><span class="section-number-3">3.5</span> Design of the library</h3>
|
||||
<div class="outline-text-3" id="text-3-5">
|
||||
<p>
|
||||
The proposed API should allow the library to: deal with memory transfers
|
||||
between CPU and accelerators, and to use different levels of floating-point
|
||||
precision. We chose a multi-layered design with low-level and high-level
|
||||
functions (see below).
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgee29033" class="outline-3">
|
||||
<h3 id="orgee29033"><span class="section-number-3">3.6</span> Naming conventions</h3>
|
||||
<div class="outline-text-3" id="text-3-6">
|
||||
<p>
|
||||
To avoid namespace collisions, we use <code>qmckl_</code> as a prefix for all exported
|
||||
functions and variables. All exported header files should have a file name
|
||||
prefixed with <code>qmckl_</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
If the name of the org-mode file is <code>xxx.org</code>, the name of the
|
||||
produced C files should be <code>xxx.c</code> and <code>xxx.h</code> and the name of the
|
||||
produced Fortran file should be <code>xxx.f90</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In the names of the variables and functions, only the singular
|
||||
form is allowed.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org31107f5" class="outline-3">
|
||||
<h3 id="org31107f5"><span class="section-number-3">3.7</span> Application programming interface</h3>
|
||||
<div class="outline-text-3" id="text-3-7">
|
||||
<p>
|
||||
In the C language, the number of bits used by the integer types can change
|
||||
from one architecture to another one. To circumvent this problem, we choose to
|
||||
use the integer types defined in <code><stdint.h></code> where the number of bits used for
|
||||
the integers are fixed.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To ensure that the library will be easily usable in <i>any</i> other language
|
||||
than C, we restrict the data types in the interfaces to the following:
|
||||
</p>
|
||||
<ul class="org-ul">
|
||||
<li>32-bit and 64-bit integers, scalars and and arrays (<code>int32_t</code> and <code>int64_t</code>)</li>
|
||||
<li>32-bit and 64-bit floats, scalars and and arrays (<code>float</code> and <code>double</code>)</li>
|
||||
<li>Pointers are always casted into 64-bit integers, even on legacy 32-bit architectures</li>
|
||||
<li>ASCII strings are represented as a pointers to character arrays
|
||||
and terminated by a <code>'\0'</code> character (C convention).</li>
|
||||
<li>Complex numbers can be represented by an array of 2 floats.</li>
|
||||
<li>Boolean variables are stored as integers, <code>1</code> for <code>true</code> and <code>0</code> for <code>false</code></li>
|
||||
<li>Floating point variables should be by default <code>double</code> unless explicitly mentioned</li>
|
||||
<li>integers used for counting should always be <code>int64_t</code></li>
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
To facilitate the use in other languages than C, we will provide some
|
||||
bindings in other languages in other repositories.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org421a76e" class="outline-3">
|
||||
<h3 id="org421a76e"><span class="section-number-3">3.8</span> Global state</h3>
|
||||
<div class="outline-text-3" id="text-3-8">
|
||||
<p>
|
||||
Global variables should be avoided in the library, because it is
|
||||
possible that one single program needs to use multiple instances
|
||||
of the library. To solve this problem we propose to use a pointer
|
||||
to a <a href="./qmckl_context.html"><code>context</code></a> variable, built by the library with the
|
||||
<code>qmckl_context_create</code> function. The <a id="org12624f5">=context=</a> contains the global
|
||||
state of the library, and is used as the first argument of many
|
||||
QMCkl functions.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The internal structure of the context is not specified, to give a
|
||||
maximum of freedom to the different implementations. Modifying
|
||||
the state is done by setters and getters, prefixed by
|
||||
<code>qmckl_set_</code> an <code>qmckl_get_</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org8f0e733" class="outline-3">
|
||||
<h3 id="org8f0e733"><span class="section-number-3">3.9</span> Headers</h3>
|
||||
<div class="outline-text-3" id="text-3-9">
|
||||
<p>
|
||||
A single <code>qmckl.h</code> header to be distributed by the library
|
||||
is built by concatenating some of the produced header files.
|
||||
To facilitate building the <code>qmckl.h</code> file, we separate types from
|
||||
function declarations in headers. Types should be defined in header
|
||||
files suffixed by <code>_type.h</code>, and functions in files suffixed by
|
||||
<code>_func.h</code>.
|
||||
As these files will be concatenated in a single file, they should
|
||||
not be guarded by <code>#ifndef *_H</code>, and they should not include other
|
||||
produced headers.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Some particular types that are not exported need to be known by the
|
||||
context, and there are some functions to update instances of these
|
||||
types contained inside the context. For example, a
|
||||
<code>qmckl_numprec_struct</code> is present in the context, and the function
|
||||
<code>qmckl_set_numprec_range</code> takes a context as a parameter, and set a
|
||||
value in the <code>qmckl_numprec_struct</code> contained in the context.
|
||||
Because of these intricate dependencies, a private header is
|
||||
created, containing the <code>qmckl_numprec_struct</code>. This header is
|
||||
included in the private header file which defines the type of the
|
||||
context. Header files for private types are suffixed by <code>_private_type.h</code>
|
||||
and header files for private functions are suffixed by <code>_private_func.h</code>.
|
||||
Fortran interfaces should also be written in the <code>*fh_func.f90</code> file,
|
||||
and the types definitions should be written in the <code>*fh_type.f90</code> file.
|
||||
</p>
|
||||
|
||||
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="org-left">File</th>
|
||||
<th scope="col" class="org-left">Scope</th>
|
||||
<th scope="col" class="org-left">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left"><code>*_type.h</code></td>
|
||||
<td class="org-left">Public</td>
|
||||
<td class="org-left">Type definitions</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>*_func.h</code></td>
|
||||
<td class="org-left">Public</td>
|
||||
<td class="org-left">Function definitions</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>*_private_type.h</code></td>
|
||||
<td class="org-left">Private</td>
|
||||
<td class="org-left">Type definitions</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>*_private_func.h</code></td>
|
||||
<td class="org-left">Private</td>
|
||||
<td class="org-left">Function definitions</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>*fh_type.f90</code></td>
|
||||
<td class="org-left">Public</td>
|
||||
<td class="org-left">Fortran type definitions</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>*fh_func.f90</code></td>
|
||||
<td class="org-left">Public</td>
|
||||
<td class="org-left">Fortran function definitions</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org8de6f50" class="outline-3">
|
||||
<h3 id="org8de6f50"><span class="section-number-3">3.10</span> Low-level functions</h3>
|
||||
<div class="outline-text-3" id="text-3-10">
|
||||
<p>
|
||||
Low-level functions are very simple functions which are leaves of
|
||||
the function call tree (they don't call any other QMCkl function).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
These functions are <i>pure</i>, and unaware of the QMCkl
|
||||
<a href="#org12624f5"><code>context</code></a>. They are not allowed to allocate/deallocate memory, and
|
||||
if they need temporary memory it should be provided in input.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgd1458ce" class="outline-3">
|
||||
<h3 id="orgd1458ce"><span class="section-number-3">3.11</span> High-level functions</h3>
|
||||
<div class="outline-text-3" id="text-3-11">
|
||||
<p>
|
||||
High-level functions are at the top of the function call tree.
|
||||
They are able to choose which lower-level function to call
|
||||
depending on the required precision, and do the corresponding type
|
||||
conversions. These functions are also responsible for allocating
|
||||
temporary storage, to simplify the use of accelerators.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org2d8c78b" class="outline-3">
|
||||
<h3 id="org2d8c78b"><span class="section-number-3">3.12</span> Numerical precision</h3>
|
||||
<div class="outline-text-3" id="text-3-12">
|
||||
<p>
|
||||
The minimal number of bits of precision required for a function
|
||||
should be given as an input of low-level computational
|
||||
functions. This input will be used to define the values of the
|
||||
different thresholds that might be used to avoid computing
|
||||
unnecessary noise. High-level functions will use the precision
|
||||
specified in the <a href="#org12624f5"><code>context</code></a> variable.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
In order to automatize numerical accuracy tests, QMCkl uses
|
||||
<a href="https://github.com/verificarlo/verificarlo">Verificarlo</a> and its CI functionality. You can read Verificarlo CI's
|
||||
documentation at the <a href="https://github.com/verificarlo/verificarlo/blob/master/doc/06-Postprocessing.md#verificarlo-ci">following link</a>. Reading it is advised to
|
||||
understand the remainder of this section.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To enable support for Verificarlo CI tests when building the
|
||||
library, use the following configure command :
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-bash">./configure <span style="color: #a0522d;">CC</span>=verificarlo-f <span style="color: #a0522d;">FC</span>=verificarlo-f --host=x86_64 --enable-vfc_ci
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Note that this does require an install of Verificarlo <b>with
|
||||
Fortran support</b>. Enabling the support for CI will define the
|
||||
<code>VFC_CI</code> preprocessor variable which use will be explained now.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
As explained in the documentation, Verificarlo CI uses a probes
|
||||
system to export variables from test programs to the tools itself.
|
||||
To make tests easier to use, QMCkl has its own interface to the
|
||||
probes system. To make the system very easy to use, these functions
|
||||
are always defined, but will behave differently depending on the
|
||||
<code>VFC_CI</code> preprocessor variable. There are 3 functions at your
|
||||
disposal. When the CI is enabled, they will place a <code>vfc_ci</code> probe
|
||||
as if calling <code>vfc_probes</code> directly. Otherwise, they will either do
|
||||
nothing or perform a check on the tested value and return its result
|
||||
as a boolean that you are free to use or ignore.
|
||||
Here are these 3 functions :
|
||||
</p>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li><code>qmckl_probe</code> : place a normal probe witout any check. Won't do anything when <code>vfc_ci</code> is disabled (false is returned).</li>
|
||||
<li><code>qmckl_probe_check</code> : place a probe with an absolute check. If <code>vfc_ci</code> is disabled, this will return the result of an absolute check (|val - ref| < accuracy target ?). If the check fails, true is returned (false otherwise).</li>
|
||||
<li><code>qmckl_probe_check_relative</code> : place a probe with a relative check. If <code>vfc_ci</code> is disabled, this will return the result of a relative check (|val - ref| / ref < accuracy target?). If the check fails, true is returned (false otherwise).</li>
|
||||
</ul>
|
||||
|
||||
|
||||
<p>
|
||||
If you need more detail on these functions or their Fortran
|
||||
interfaces, have a look at the <code>tools/qmckl_probes</code> files.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Finally, if you need to add a QMCkl kernel to the CI tests
|
||||
or modify an existing one, you should pay attention to the
|
||||
following points :
|
||||
</p>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>you should add the new kernel to the <code>vfc_tests_config.json</code> file, which controls the backends and repetitions for each executable. More details can be found in the <code>vfc_ci</code> documentation.</li>
|
||||
|
||||
<li>in order to call the <code>qmckl_probes</code> functions from Fortran, import the <code>qmckl_probes_f</code> module.</li>
|
||||
|
||||
<li>if your tests include some asserts that rely on accurate FP values, you should probably wrap them inside a <code>#ifndef VFC_CI</code> statement, as the asserts would otherwise risk to fail when executed with the different Verificarlo backends.</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgcb989ea" class="outline-3">
|
||||
<h3 id="orgcb989ea"><span class="section-number-3">3.13</span> Algorithms</h3>
|
||||
<div class="outline-text-3" id="text-3-13">
|
||||
<p>
|
||||
Reducing the scaling of an algorithm usually implies also reducing
|
||||
its arithmetic complexity (number of flops per byte). Therefore,
|
||||
for small sizes \(\mathcal{O}(N^3)\) and \(\mathcal{O}(N^2)\)
|
||||
algorithms are better adapted than linear scaling algorithms. As
|
||||
QMCkl is a general purpose library, multiple algorithms should be
|
||||
implemented adapted to different problem sizes.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX CoE</p>
|
||||
<p class="date">Created: 2022-09-28 Wed 07:38</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
4080
qmckl_ao.html
4080
qmckl_ao.html
File diff suppressed because it is too large
Load Diff
1739
qmckl_blas.html
1739
qmckl_blas.html
File diff suppressed because it is too large
Load Diff
@ -1,476 +0,0 @@
|
||||
<?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>
|
||||
<!-- 2022-09-28 Wed 07:38 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Context</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; }
|
||||
.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-2019 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-2019 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-2019 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>
|
||||
</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">Context</h1>
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#org429a298">1. Context handling</a>
|
||||
<ul>
|
||||
<li><a href="#org9edbe27">1.1. Data structure</a></li>
|
||||
<li><a href="#org37fc2e5">1.2. Creation</a></li>
|
||||
<li><a href="#orgd84508c">1.3. Locking</a></li>
|
||||
<li><a href="#orgf8c8e89">1.4. <span class="todo TODO">TODO</span> Copy</a></li>
|
||||
<li><a href="#org7cacb00">1.5. Destroy</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org429a298" class="outline-2">
|
||||
<h2 id="org429a298"><span class="section-number-2">1</span> Context handling</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<p>
|
||||
The context variable is a handle for the state of the library,
|
||||
and is stored in a data structure which can't be seen outside of
|
||||
the library. To simplify compatibility with other languages, the
|
||||
pointer to the internal data structure is converted into a 64-bit
|
||||
signed integer, defined in the <code>qmckl_context</code> type.
|
||||
A value of <code>QMCKL_NULL_CONTEXT</code> for the context is equivalent to a
|
||||
<code>NULL</code> pointer.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c" id="org1b21272"><span style="color: #a020f0;">typedef</span> <span style="color: #228b22;">int64_t</span> <span style="color: #228b22;">qmckl_context</span> ;
|
||||
<span style="color: #483d8b;">#define</span> <span style="color: #a0522d;">QMCKL_NULL_CONTEXT</span> (qmckl_context) 0
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
An immutable context would have required to implement a garbage
|
||||
collector. To keep the library simple, we have chosen to implement
|
||||
the context as a mutable data structure, so it has to be handled
|
||||
with care.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
By convention, in this file <code>context</code> is a <code>qmckl_context</code> variable
|
||||
and <code>ctx</code> is a <code>qmckl_context_struct*</code> pointer.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org9edbe27" class="outline-3">
|
||||
<h3 id="org9edbe27"><span class="section-number-3">1.1</span> Data structure</h3>
|
||||
<div class="outline-text-3" id="text-1-1">
|
||||
<p>
|
||||
A tag is used internally to check if the memory domain pointed
|
||||
by a pointer is a valid context. This allows to check that even if
|
||||
the pointer associated with a context is non-null, we can still
|
||||
verify that it points to the expected data structure.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The <code>qmckl_context_check</code> function checks if the domain pointed by
|
||||
the pointer is a valid context. It returns the input <code>qmckl_context</code>
|
||||
if the context is valid, <code>QMCKL_NULL_CONTEXT</code> otherwise.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_context</span>
|
||||
<span style="color: #0000ff;">qmckl_context_check</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>) ;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The context keeps a <i>date</i> that allows to check which data needs
|
||||
to be recomputed. The date is incremented when the context is touched.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When a new element is added to the context, the functions
|
||||
<a href="#org37fc2e5"><code>qmckl_context_create</code></a> <a href="#org7cacb00"><code>qmckl_context_destroy</code></a> and <a href="#orgf8c8e89"><code>qmckl_context_copy</code></a>
|
||||
should be updated in order to make deep copies.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
When the electron coordinates have changed, the context is touched
|
||||
using the following function.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
||||
<span style="color: #0000ff;">qmckl_context_touch</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
This has the effect to increment the date of the context.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org37fc2e5" class="outline-3">
|
||||
<h3 id="org37fc2e5"><span class="section-number-3">1.2</span> Creation</h3>
|
||||
<div class="outline-text-3" id="text-1-2">
|
||||
<p>
|
||||
To create a new context, <code>qmckl_context_create()</code> should be used.
|
||||
</p>
|
||||
<ul class="org-ul">
|
||||
<li>Upon success, it returns a pointer to a new context with the <code>qmckl_context</code> type</li>
|
||||
<li>It returns <code>QMCKL_NULL_CONTEXT</code> upon failure to allocate the internal data structure</li>
|
||||
<li>A new context always has all its members initialized with a NULL value</li>
|
||||
</ul>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_context</span> <span style="color: #0000ff;">qmckl_context_create</span>();
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgd84508c" class="outline-3">
|
||||
<h3 id="orgd84508c"><span class="section-number-3">1.3</span> Locking</h3>
|
||||
<div class="outline-text-3" id="text-1-3">
|
||||
<p>
|
||||
For thread safety, the context may be locked/unlocked. The lock is
|
||||
initialized with the <code>PTHREAD_MUTEX_RECURSIVE</code> attribute, and the
|
||||
number of times the thread has locked it is saved in the
|
||||
<code>lock_count</code> attribute.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">void</span> <span style="color: #0000ff;">qmckl_lock</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>);
|
||||
<span style="color: #228b22;">void</span> <span style="color: #0000ff;">qmckl_unlock</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>);
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgf8c8e89" class="outline-3">
|
||||
<h3 id="orgf8c8e89"><span class="section-number-3">1.4</span> <span class="todo TODO">TODO</span> Copy</h3>
|
||||
<div class="outline-text-3" id="text-1-4">
|
||||
<p>
|
||||
<code>qmckl_context_copy</code> makes a deep copy of a context. It returns
|
||||
<code>QMCKL_NULL_CONTEXT</code> upon failure.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org7cacb00" class="outline-3">
|
||||
<h3 id="org7cacb00"><span class="section-number-3">1.5</span> Destroy</h3>
|
||||
<div class="outline-text-3" id="text-1-5">
|
||||
<p>
|
||||
The context is destroyed with <code>qmckl_context_destroy</code>, leaving the ancestors untouched.
|
||||
It frees the context, and returns the previous context.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
||||
<span style="color: #0000ff;">qmckl_context_destroy</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>);
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX CoE</p>
|
||||
<p class="date">Created: 2022-09-28 Wed 07:38</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
1783
qmckl_distance.html
1783
qmckl_distance.html
File diff suppressed because it is too large
Load Diff
1545
qmckl_electron.html
1545
qmckl_electron.html
File diff suppressed because it is too large
Load Diff
749
qmckl_error.html
749
qmckl_error.html
@ -1,749 +0,0 @@
|
||||
<?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>
|
||||
<!-- 2022-09-28 Wed 07:38 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Error handling</title>
|
||||
<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; }
|
||||
.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-2019 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-2019 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-2019 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>
|
||||
</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">Error handling</h1>
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#org9878496">-</a></li>
|
||||
<li><a href="#org517196d">1. Decoding errors</a></li>
|
||||
<li><a href="#org17a9059">2. Data structure in context</a></li>
|
||||
<li><a href="#org1ec1d92">3. Updating errors in the context</a></li>
|
||||
<li><a href="#orgad336d9">4. Get the error</a></li>
|
||||
<li><a href="#orgd933d72">5. Failing</a></li>
|
||||
<li><a href="#orga3e1848">6. Last error</a>
|
||||
<ul>
|
||||
<li><a href="#org5b1b87f">6.1. Fortran inteface</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org0894d71">7. Helper functions for debugging</a>
|
||||
<ul>
|
||||
<li><a href="#orge0dbafd">7.1. Fortran inteface</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org9878496" class="outline-2">
|
||||
<h2 id="org9878496">-</h2>
|
||||
<div class="outline-text-2" id="text-org9878496">
|
||||
<p>
|
||||
The library should never make the calling programs abort, nor
|
||||
perform any input/output operations. This decision has to be taken
|
||||
by the developer of the code calling the library.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
All the functions return with an exit code, defined as
|
||||
</p>
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c" id="org57cadec"><span style="color: #a020f0;">typedef</span> <span style="color: #228b22;">int32_t</span> <span style="color: #228b22;">qmckl_exit_code</span>;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<p>
|
||||
The exit code returns the completion status of the function to the
|
||||
calling program. When a function call completed successfully,
|
||||
<code>QMCKL_SUCCESS</code> is returned. If one of the functions of
|
||||
the library fails to complete the requested task, an appropriate
|
||||
error code is returned to the program.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Here is the complete list of exit codes.
|
||||
</p>
|
||||
|
||||
<table id="org6a79c88" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-right" />
|
||||
|
||||
<col class="org-left" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="org-left">Macro</th>
|
||||
<th scope="col" class="org-right">Code</th>
|
||||
<th scope="col" class="org-left">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_SUCCESS</code></td>
|
||||
<td class="org-right">0</td>
|
||||
<td class="org-left">'Success'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_1</code></td>
|
||||
<td class="org-right">1</td>
|
||||
<td class="org-left">'Invalid argument 1'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_2</code></td>
|
||||
<td class="org-right">2</td>
|
||||
<td class="org-left">'Invalid argument 2'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_3</code></td>
|
||||
<td class="org-right">3</td>
|
||||
<td class="org-left">'Invalid argument 3'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_4</code></td>
|
||||
<td class="org-right">4</td>
|
||||
<td class="org-left">'Invalid argument 4'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_5</code></td>
|
||||
<td class="org-right">5</td>
|
||||
<td class="org-left">'Invalid argument 5'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_6</code></td>
|
||||
<td class="org-right">6</td>
|
||||
<td class="org-left">'Invalid argument 6'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_7</code></td>
|
||||
<td class="org-right">7</td>
|
||||
<td class="org-left">'Invalid argument 7'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_8</code></td>
|
||||
<td class="org-right">8</td>
|
||||
<td class="org-left">'Invalid argument 8'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_9</code></td>
|
||||
<td class="org-right">9</td>
|
||||
<td class="org-left">'Invalid argument 9'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_10</code></td>
|
||||
<td class="org-right">10</td>
|
||||
<td class="org-left">'Invalid argument 10'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_11</code></td>
|
||||
<td class="org-right">11</td>
|
||||
<td class="org-left">'Invalid argument 11'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_12</code></td>
|
||||
<td class="org-right">12</td>
|
||||
<td class="org-left">'Invalid argument 12'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_13</code></td>
|
||||
<td class="org-right">13</td>
|
||||
<td class="org-left">'Invalid argument 13'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_14</code></td>
|
||||
<td class="org-right">14</td>
|
||||
<td class="org-left">'Invalid argument 14'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_15</code></td>
|
||||
<td class="org-right">15</td>
|
||||
<td class="org-left">'Invalid argument 15'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_16</code></td>
|
||||
<td class="org-right">16</td>
|
||||
<td class="org-left">'Invalid argument 16'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_17</code></td>
|
||||
<td class="org-right">17</td>
|
||||
<td class="org-left">'Invalid argument 17'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_18</code></td>
|
||||
<td class="org-right">18</td>
|
||||
<td class="org-left">'Invalid argument 18'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_19</code></td>
|
||||
<td class="org-right">19</td>
|
||||
<td class="org-left">'Invalid argument 19'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_ARG_20</code></td>
|
||||
<td class="org-right">20</td>
|
||||
<td class="org-left">'Invalid argument 20'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_FAILURE</code></td>
|
||||
<td class="org-right">101</td>
|
||||
<td class="org-left">'Failure'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_ERRNO</code></td>
|
||||
<td class="org-right">102</td>
|
||||
<td class="org-left">strerror(errno)</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_CONTEXT</code></td>
|
||||
<td class="org-right">103</td>
|
||||
<td class="org-left">'Invalid context'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_ALLOCATION_FAILED</code></td>
|
||||
<td class="org-right">104</td>
|
||||
<td class="org-left">'Allocation failed'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_DEALLOCATION_FAILED</code></td>
|
||||
<td class="org-right">105</td>
|
||||
<td class="org-left">'De-allocation failed'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_NOT_PROVIDED</code></td>
|
||||
<td class="org-right">106</td>
|
||||
<td class="org-left">'Not provided'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_OUT_OF_BOUNDS</code></td>
|
||||
<td class="org-right">107</td>
|
||||
<td class="org-left">'Index out of bounds'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_ALREADY_SET</code></td>
|
||||
<td class="org-right">108</td>
|
||||
<td class="org-left">'Already set'</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_INVALID_EXIT_CODE</code></td>
|
||||
<td class="org-right">109</td>
|
||||
<td class="org-left">'Invalid exit code'</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
The <code>qmckl_string_of_error</code> converts an exit code into a string. The
|
||||
string is assumed to be large enough to contain the error message
|
||||
(typically 128 characters).
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org517196d" class="outline-2">
|
||||
<h2 id="org517196d"><span class="section-number-2">1</span> Decoding errors</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<p>
|
||||
To decode the error messages, <code>qmckl_string_of_error</code> converts an
|
||||
error code into a string.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>*
|
||||
<span style="color: #0000ff;">qmckl_string_of_error</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">error</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The text strings are extracted from the previous table.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org17a9059" class="outline-2">
|
||||
<h2 id="org17a9059"><span class="section-number-2">2</span> Data structure in context</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
<p>
|
||||
The strings are declared internally with a maximum fixed size to avoid
|
||||
dynamic memory allocation.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #483d8b;">#define</span> <span style="color: #a0522d;">QMCKL_MAX_FUN_LEN</span> 256
|
||||
<span style="color: #483d8b;">#define</span> <span style="color: #a0522d;">QMCKL_MAX_MSG_LEN</span> 1024
|
||||
|
||||
<span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">qmckl_error_struct</span> {
|
||||
|
||||
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">exit_code</span>;
|
||||
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">function</span>[QMCKL_MAX_FUN_LEN];
|
||||
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">message</span> [QMCKL_MAX_MSG_LEN];
|
||||
|
||||
} <span style="color: #228b22;">qmckl_error_struct</span>;
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org1ec1d92" class="outline-2">
|
||||
<h2 id="org1ec1d92"><span class="section-number-2">3</span> Updating errors in the context</h2>
|
||||
<div class="outline-text-2" id="text-3">
|
||||
<p>
|
||||
The error is updated in the context using <code>qmckl_set_error</code>.
|
||||
When the error is set in the context, it is mandatory to specify
|
||||
from which function the error is triggered, and a message
|
||||
explaining the error. The exit code can't be <code>QMCKL_SUCCESS</code>.
|
||||
</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_error</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">exit_code</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">function_name</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">message</span>);
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgad336d9" class="outline-2">
|
||||
<h2 id="orgad336d9"><span class="section-number-2">4</span> Get the error</h2>
|
||||
<div class="outline-text-2" id="text-4">
|
||||
<p>
|
||||
Upon error, the error type and message can be obtained from the
|
||||
context using <code>qmckl_get_error</code>. The message and function name
|
||||
is returned in the variables provided. Therefore, passing a
|
||||
function name and message is mandatory.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
||||
<span style="color: #0000ff;">qmckl_get_error</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #228b22;">qmckl_exit_code</span> *<span style="color: #a0522d;">exit_code</span>,
|
||||
<span style="color: #228b22;">char</span>* <span style="color: #a0522d;">function_name</span>,
|
||||
<span style="color: #228b22;">char</span>* <span style="color: #a0522d;">message</span>);
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgd933d72" class="outline-2">
|
||||
<h2 id="orgd933d72"><span class="section-number-2">5</span> Failing</h2>
|
||||
<div class="outline-text-2" id="text-5">
|
||||
<p>
|
||||
To make a function fail, the <code>qmckl_failwith</code> function should be
|
||||
called, such that information about the failure is stored in
|
||||
the context. The desired exit code is given as an argument, as
|
||||
well as the name of the function and an error message. If the
|
||||
message is <code>NULL</code>, then the default message obtained by
|
||||
<code>qmckl_string_of_error</code> is used. The return code of the function is
|
||||
the desired return code.
|
||||
Upon failure, a <code>QMCKL_NULL_CONTEXT</code> is returned.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
||||
<span style="color: #0000ff;">qmckl_failwith</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">exit_code</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">function</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">message</span>) ;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
For example, this function can be used as
|
||||
</p>
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #a020f0;">if</span> (x < 0) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
<span style="color: #8b2252;">"qmckl_function"</span>,
|
||||
<span style="color: #8b2252;">"Expected x >= 0"</span>);
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orga3e1848" class="outline-2">
|
||||
<h2 id="orga3e1848"><span class="section-number-2">6</span> Last error</h2>
|
||||
<div class="outline-text-2" id="text-6">
|
||||
<p>
|
||||
Returns a string describing the last error, using <code>qmckl_get_error</code>.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
||||
<span style="color: #0000ff;">qmckl_last_error</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">buffer</span>);
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org5b1b87f" class="outline-3">
|
||||
<h3 id="org5b1b87f"><span class="section-number-3">6.1</span> Fortran inteface</h3>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org0894d71" class="outline-2">
|
||||
<h2 id="org0894d71"><span class="section-number-2">7</span> Helper functions for debugging</h2>
|
||||
<div class="outline-text-2" id="text-7">
|
||||
<p>
|
||||
The following function prints to <code>stderr</code> an error message is the return code is
|
||||
not <code>QMCKL_SUCCESS</code>.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
||||
<span style="color: #0000ff;">qmckl_check</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">rc</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
It should be used as:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c">rc = qmckl_check(context,
|
||||
qmckl_...(context, ...)
|
||||
);
|
||||
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orge0dbafd" class="outline-3">
|
||||
<h3 id="orge0dbafd"><span class="section-number-3">7.1</span> Fortran inteface</h3>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX CoE</p>
|
||||
<p class="date">Created: 2022-09-28 Wed 07:38</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,788 +0,0 @@
|
||||
<?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>
|
||||
<!-- 2022-09-28 Wed 07:38 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Code examples</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; }
|
||||
.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-2019 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-2019 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-2019 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">Code examples</h1>
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#orgf20830e">1. Python</a>
|
||||
<ul>
|
||||
<li><a href="#orgdda3bb3">1.1. Check numerically that MOs are orthonormal</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org4304791">2. Fortran</a>
|
||||
<ul>
|
||||
<li><a href="#org80ef8f3">2.1. Checking errors</a></li>
|
||||
<li><a href="#org92e4374">2.2. Computing an atomic orbital on a grid</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgf20830e" class="outline-2">
|
||||
<h2 id="orgf20830e"><span class="section-number-2">1</span> Python</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
</div>
|
||||
<div id="outline-container-orgdda3bb3" class="outline-3">
|
||||
<h3 id="orgdda3bb3"><span class="section-number-3">1.1</span> Check numerically that MOs are orthonormal</h3>
|
||||
<div class="outline-text-3" id="text-1-1">
|
||||
<p>
|
||||
In this example, we will compute numerically the overlap
|
||||
between the molecular orbitals:
|
||||
</p>
|
||||
|
||||
<p>
|
||||
\[
|
||||
S_{ij} = \int \phi_i(\mathbf{r}) \phi_j(\mathbf{r})
|
||||
\text{d}\mathbf{r} \sim \sum_{k=1}^{N} \phi_i(\mathbf{r}_k)
|
||||
\phi_j(\mathbf{r}_k) \delta \mathbf{r}
|
||||
\]
|
||||
\[
|
||||
S_{ij} = \langle \phi_i | \phi_j \rangle
|
||||
\sim \sum_{k=1}^{N} \langle \phi_i | \mathbf{r}_k \rangle
|
||||
\langle \mathbf{r}_k | \phi_j \rangle
|
||||
\]
|
||||
</p>
|
||||
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-python"><span style="color: #a020f0;">import</span> numpy <span style="color: #a020f0;">as</span> np
|
||||
<span style="color: #a020f0;">import</span> qmckl
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
First, we create a context for the QMCkl calculation, and load the
|
||||
wave function stored in <code>h2o_5z.h5</code> inside it. It is a Hartree-Fock
|
||||
determinant for the water molecule in the cc-pV5Z basis set.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-python"><span style="color: #a0522d;">trexio_filename</span> = <span style="color: #8b2252;">"..//share/qmckl/test_data/h2o_5z.h5"</span>
|
||||
|
||||
<span style="color: #a0522d;">context</span> = qmckl.context_create()
|
||||
qmckl.trexio_read(context, trexio_filename)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
We now define the grid points \(\mathbf{r}_k\) as a regular grid around the
|
||||
molecule.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
We fetch the nuclear coordinates from the context,
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-python"><span style="color: #a0522d;">nucl_num</span> = qmckl.get_nucleus_num(context)
|
||||
|
||||
<span style="color: #a0522d;">nucl_charge</span> = qmckl.get_nucleus_charge(context, nucl_num)
|
||||
|
||||
<span style="color: #a0522d;">nucl_coord</span> = qmckl.get_nucleus_coord(context, <span style="color: #8b2252;">'N'</span>, nucl_num*3)
|
||||
<span style="color: #a0522d;">nucl_coord</span> = np.reshape(nucl_coord, (3, nucl_num))
|
||||
|
||||
<span style="color: #a020f0;">for</span> i <span style="color: #a020f0;">in</span> <span style="color: #483d8b;">range</span>(nucl_num):
|
||||
<span style="color: #a020f0;">print</span>(<span style="color: #8b2252;">"%d %+f %+f %+f"</span>%(<span style="color: #483d8b;">int</span>(nucl_charge[i]),
|
||||
nucl_coord[i,0],
|
||||
nucl_coord[i,1],
|
||||
nucl_coord[i,2]) )
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<pre class="example">
|
||||
8 +0.000000 +0.000000 +0.000000
|
||||
1 -1.430429 +0.000000 -1.107157
|
||||
1 +1.430429 +0.000000 -1.107157
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
and compute the coordinates of the grid points:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-python"><span style="color: #a0522d;">nx</span> = ( 120, 120, 120 )
|
||||
<span style="color: #a0522d;">shift</span> = np.array([5.,5.,5.])
|
||||
<span style="color: #a0522d;">point_num</span> = nx[0] * nx[1] * nx[2]
|
||||
|
||||
<span style="color: #a0522d;">rmin</span> = np.array( <span style="color: #483d8b;">list</span>([ np.<span style="color: #483d8b;">min</span>(nucl_coord[:,a]) <span style="color: #a020f0;">for</span> a <span style="color: #a020f0;">in</span> <span style="color: #483d8b;">range</span>(3) ]) )
|
||||
<span style="color: #a0522d;">rmax</span> = np.array( <span style="color: #483d8b;">list</span>([ np.<span style="color: #483d8b;">max</span>(nucl_coord[:,a]) <span style="color: #a020f0;">for</span> a <span style="color: #a020f0;">in</span> <span style="color: #483d8b;">range</span>(3) ]) )
|
||||
|
||||
|
||||
<span style="color: #a0522d;">linspace</span> = [ <span style="color: #008b8b;">None</span> <span style="color: #a020f0;">for</span> i <span style="color: #a020f0;">in</span> <span style="color: #483d8b;">range</span>(3) ]
|
||||
<span style="color: #a0522d;">step</span> = [ <span style="color: #008b8b;">None</span> <span style="color: #a020f0;">for</span> i <span style="color: #a020f0;">in</span> <span style="color: #483d8b;">range</span>(3) ]
|
||||
<span style="color: #a020f0;">for</span> a <span style="color: #a020f0;">in</span> <span style="color: #483d8b;">range</span>(3):
|
||||
linspace[a], <span style="color: #a0522d;">step</span>[a] = np.linspace(rmin[a]-shift[a],
|
||||
rmax[a]+shift[a],
|
||||
num=nx[a],
|
||||
retstep=<span style="color: #008b8b;">True</span>)
|
||||
|
||||
<span style="color: #a0522d;">dr</span> = step[0] * step[1] * step[2]
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Now the grid is ready, we can create the list of grid points
|
||||
\(\mathbf{r}_k\) on which the MOs \(\phi_i\) will be evaluated, and
|
||||
transfer them to the QMCkl context:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-python"><span style="color: #a0522d;">point</span> = []
|
||||
<span style="color: #a020f0;">for</span> x <span style="color: #a020f0;">in</span> linspace[0]:
|
||||
<span style="color: #a020f0;">for</span> y <span style="color: #a020f0;">in</span> linspace[1]:
|
||||
<span style="color: #a020f0;">for</span> z <span style="color: #a020f0;">in</span> linspace[2]:
|
||||
<span style="color: #a0522d;">point</span> += [ [x, y, z] ]
|
||||
|
||||
<span style="color: #a0522d;">point</span> = np.array(point)
|
||||
<span style="color: #a0522d;">point_num</span> = <span style="color: #483d8b;">len</span>(point)
|
||||
qmckl.set_point(context, <span style="color: #8b2252;">'N'</span>, point_num, np.reshape(point, (point_num*3)))
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Then, we evaluate all the MOs at the grid points (and time the execution),
|
||||
and thus obtain the matrix \(M_{ki} = \langle \mathbf{r}_k | \phi_i \rangle =
|
||||
\phi_i(\mathbf{r}_k)\).
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-python"><span style="color: #a020f0;">import</span> time
|
||||
|
||||
<span style="color: #a0522d;">mo_num</span> = qmckl.get_mo_basis_mo_num(context)
|
||||
|
||||
<span style="color: #a0522d;">before</span> = time.time()
|
||||
<span style="color: #a0522d;">mo_value</span> = qmckl.get_mo_basis_mo_value(context, point_num*mo_num)
|
||||
<span style="color: #a0522d;">after</span> = time.time()
|
||||
|
||||
<span style="color: #a0522d;">mo_value</span> = np.reshape( mo_value, (point_num, mo_num) )
|
||||
|
||||
<span style="color: #a020f0;">print</span>(<span style="color: #8b2252;">"Number of MOs: "</span>, mo_num)
|
||||
<span style="color: #a020f0;">print</span>(<span style="color: #8b2252;">"Number of grid points: "</span>, point_num)
|
||||
<span style="color: #a020f0;">print</span>(<span style="color: #8b2252;">"Execution time : "</span>, (after - before), <span style="color: #8b2252;">"seconds"</span>)
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<pre class="example">
|
||||
Number of MOs: 201
|
||||
Number of grid points: 1728000
|
||||
Execution time : 3.511528968811035 seconds
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
and finally we compute the overlap between all the MOs as
|
||||
\(M^\dagger M\).
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-python"><span style="color: #a0522d;">overlap</span> = mo_value.T @ mo_value * dr
|
||||
<span style="color: #a020f0;">print</span> (overlap)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<pre class="example">
|
||||
[[ 9.88693941e-01 2.34719693e-03 -1.50518232e-08 ... 3.12084178e-09
|
||||
-5.81064929e-10 3.70130091e-02]
|
||||
[ 2.34719693e-03 9.99509628e-01 3.18930040e-09 ... -2.46888958e-10
|
||||
-1.06064273e-09 -7.65567973e-03]
|
||||
[-1.50518232e-08 3.18930040e-09 9.99995073e-01 ... -5.84882580e-06
|
||||
-1.21598117e-06 4.59036468e-08]
|
||||
...
|
||||
[ 3.12084178e-09 -2.46888958e-10 -5.84882580e-06 ... 1.00019107e+00
|
||||
-2.03342837e-04 -1.36954855e-08]
|
||||
[-5.81064929e-10 -1.06064273e-09 -1.21598117e-06 ... -2.03342837e-04
|
||||
9.99262427e-01 1.18264754e-09]
|
||||
[ 3.70130091e-02 -7.65567973e-03 4.59036468e-08 ... -1.36954855e-08
|
||||
1.18264754e-09 8.97215950e-01]]
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org4304791" class="outline-2">
|
||||
<h2 id="org4304791"><span class="section-number-2">2</span> Fortran</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
</div>
|
||||
<div id="outline-container-org80ef8f3" class="outline-3">
|
||||
<h3 id="org80ef8f3"><span class="section-number-3">2.1</span> Checking errors</h3>
|
||||
<div class="outline-text-3" id="text-2-1">
|
||||
<p>
|
||||
All QMCkl functions return an error code. A convenient way to handle
|
||||
errors is to write an error-checking function that displays the
|
||||
error in text format and exits the program.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90" id="org6e1dae0"><span style="color: #a020f0;">subroutine</span> <span style="color: #0000ff;">qmckl_check_error</span>(rc, message)
|
||||
<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_exit_code), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rc</span>
|
||||
<span style="color: #228b22;">character</span>(len=*) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> message</span>
|
||||
<span style="color: #228b22;">character</span>(len=128) ::<span style="color: #a0522d;"> str_buffer</span>
|
||||
<span style="color: #a020f0;">if</span> (rc /= QMCKL_SUCCESS) <span style="color: #a020f0;">then</span>
|
||||
<span style="color: #a020f0;">print</span> *, message
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">qmckl_string_of_error</span>(rc, str_buffer)
|
||||
<span style="color: #a020f0;">print</span> *, str_buffer
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">exit</span>(rc)
|
||||
<span style="color: #a020f0;">end if</span>
|
||||
<span style="color: #a020f0;">end subroutine</span> <span style="color: #0000ff;">qmckl_check_error</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org92e4374" class="outline-3">
|
||||
<h3 id="org92e4374"><span class="section-number-3">2.2</span> Computing an atomic orbital on a grid</h3>
|
||||
<div class="outline-text-3" id="text-2-2">
|
||||
<p>
|
||||
The following program, in Fortran, computes the values of an atomic
|
||||
orbital on a regular 3-dimensional grid. The 100<sup>3</sup> grid points are
|
||||
automatically defined, such that the molecule fits in a box with 5
|
||||
atomic units in the borders.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
This program uses the <code>qmckl_check_error</code> function defined above.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To use this program, run
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-bash">$ ao_grid <trexio_file> <AO_id> <point_num>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"><span style="color: #a020f0;">subroutine</span> <span style="color: #0000ff;">qmckl_check_error</span>(rc, message)
|
||||
<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_exit_code), <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> rc</span>
|
||||
<span style="color: #228b22;">character</span>(len=*) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> message</span>
|
||||
<span style="color: #228b22;">character</span>(len=128) ::<span style="color: #a0522d;"> str_buffer</span>
|
||||
<span style="color: #a020f0;">if</span> (rc /= QMCKL_SUCCESS) <span style="color: #a020f0;">then</span>
|
||||
<span style="color: #a020f0;">print</span> *, message
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">qmckl_string_of_error</span>(rc, str_buffer)
|
||||
<span style="color: #a020f0;">print</span> *, str_buffer
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">exit</span>(rc)
|
||||
<span style="color: #a020f0;">end if</span>
|
||||
<span style="color: #a020f0;">end subroutine</span> <span style="color: #0000ff;">qmckl_check_error</span>
|
||||
|
||||
<span style="color: #a020f0;">program</span> <span style="color: #0000ff;">ao_grid</span>
|
||||
<span style="color: #a020f0;">use</span> <span style="color: #0000ff;">qmckl</span>
|
||||
<span style="color: #a020f0;">implicit</span> <span style="color: #228b22;">none</span>
|
||||
|
||||
<span style="color: #228b22;">integer</span>(qmckl_context) ::<span style="color: #a0522d;"> qmckl_ctx </span>! <span style="color: #b22222;">QMCkl context</span>
|
||||
<span style="color: #228b22;">integer</span>(qmckl_exit_code) ::<span style="color: #a0522d;"> rc </span>! <span style="color: #b22222;">Exit code of QMCkl functions</span>
|
||||
|
||||
<span style="color: #228b22;">character</span>(len=128) ::<span style="color: #a0522d;"> trexio_filename</span>
|
||||
<span style="color: #228b22;">character</span>(len=128) ::<span style="color: #a0522d;"> str_buffer</span>
|
||||
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> ao_id</span>
|
||||
<span style="color: #228b22;">integer</span> ::<span style="color: #a0522d;"> point_num_x</span>
|
||||
|
||||
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int64_t</span>) ::<span style="color: #a0522d;"> nucl_num</span>
|
||||
<span style="color: #228b22;">double precision</span>, <span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> nucl_coord(:,:)</span>
|
||||
|
||||
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int64_t</span>) ::<span style="color: #a0522d;"> point_num</span>
|
||||
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int64_t</span>) ::<span style="color: #a0522d;"> ao_num</span>
|
||||
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int64_t</span>) ::<span style="color: #a0522d;"> ipoint, i, j, k</span>
|
||||
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> x, y, z, dr(3)</span>
|
||||
<span style="color: #228b22;">double precision</span> ::<span style="color: #a0522d;"> rmin(3), rmax(3)</span>
|
||||
<span style="color: #228b22;">double precision</span>, <span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> points(:,:)</span>
|
||||
<span style="color: #228b22;">double precision</span>, <span style="color: #a020f0;">allocatable</span> ::<span style="color: #a0522d;"> ao_vgl(:,:,:)</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Start by fetching the command-line arguments:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"><span style="color: #a020f0;">if</span> (iargc() /= 3) <span style="color: #a020f0;">then</span>
|
||||
<span style="color: #a020f0;">print</span> *, <span style="color: #8b2252;">'Syntax: ao_grid <trexio_file> <AO_id> <point_num>'</span>
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">exit</span>(-1)
|
||||
<span style="color: #a020f0;">end if</span>
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">getarg</span>(1, trexio_filename)
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">getarg</span>(2, str_buffer)
|
||||
<span style="color: #a020f0;">read</span>(str_buffer, *) ao_id
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">getarg</span>(3, str_buffer)
|
||||
<span style="color: #a020f0;">read</span>(str_buffer, *) point_num_x
|
||||
|
||||
<span style="color: #a020f0;">if</span> (point_num_x < 0 <span style="color: #a020f0;">.or.</span> point_num_x > 300) <span style="color: #a020f0;">then</span>
|
||||
<span style="color: #a020f0;">print</span> *, <span style="color: #8b2252;">'Error: 0 < point_num < 300'</span>
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">exit</span>(-1)
|
||||
<span style="color: #a020f0;">end if</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Create the QMCkl context and initialize it with the wave function
|
||||
present in the TREXIO file:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90">qmckl_ctx = qmckl_context_create()
|
||||
rc = qmckl_trexio_read(qmckl_ctx, trexio_filename, 1_8*<span style="color: #a020f0;">len</span>(<span style="color: #a020f0;">trim</span>(trexio_filename)))
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">qmckl_check_error</span>(rc, <span style="color: #8b2252;">'Read TREXIO'</span>)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
We need to check that <code>ao_id</code> is in the range, so we get the total
|
||||
number of AOs from QMCkl:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90">rc = qmckl_get_ao_basis_ao_num(qmckl_ctx, ao_num)
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">qmckl_check_error</span>(rc, <span style="color: #8b2252;">'Getting ao_num'</span>)
|
||||
|
||||
<span style="color: #a020f0;">if</span> (ao_id < 0 <span style="color: #a020f0;">.or.</span> ao_id > ao_num) <span style="color: #a020f0;">then</span>
|
||||
<span style="color: #a020f0;">print</span> *, <span style="color: #8b2252;">'Error: 0 < ao_id < '</span>, ao_num
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">exit</span>(-1)
|
||||
<span style="color: #a020f0;">end if</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Now we will compute the limits of the box in which the molecule fits.
|
||||
For that, we first need to ask QMCkl the coordinates of nuclei.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90">rc = qmckl_get_nucleus_num(qmckl_ctx, nucl_num)
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">qmckl_check_error</span>(rc, <span style="color: #8b2252;">'Get nucleus num'</span>)
|
||||
|
||||
<span style="color: #a020f0;">allocate</span>( nucl_coord(3, nucl_num) )
|
||||
rc = qmckl_get_nucleus_coord(qmckl_ctx, <span style="color: #8b2252;">'N'</span>, nucl_coord, 3_8*nucl_num)
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">qmckl_check_error</span>(rc, <span style="color: #8b2252;">'Get nucleus coord'</span>)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
We now compute the coordinates of opposite points of the box, and
|
||||
the distance between points along the 3 directions:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90">rmin(1) = <span style="color: #a020f0;">minval</span>( nucl_coord(1,:) ) - 5.d0
|
||||
rmin(2) = <span style="color: #a020f0;">minval</span>( nucl_coord(2,:) ) - 5.d0
|
||||
rmin(3) = <span style="color: #a020f0;">minval</span>( nucl_coord(3,:) ) - 5.d0
|
||||
|
||||
rmax(1) = <span style="color: #a020f0;">maxval</span>( nucl_coord(1,:) ) + 5.d0
|
||||
rmax(2) = <span style="color: #a020f0;">maxval</span>( nucl_coord(2,:) ) + 5.d0
|
||||
rmax(3) = <span style="color: #a020f0;">maxval</span>( nucl_coord(3,:) ) + 5.d0
|
||||
|
||||
dr(1:3) = (rmax(1:3) - rmin(1:3)) / <span style="color: #a020f0;">dble</span>(point_num_x-1)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
We now produce the list of point coordinates where the AO will be
|
||||
evaluated:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90">point_num = point_num_x**3
|
||||
<span style="color: #a020f0;">allocate</span>( points(point_num, 3) )
|
||||
ipoint=0
|
||||
z = rmin(3)
|
||||
<span style="color: #a020f0;">do</span> k=1,point_num_x
|
||||
y = rmin(2)
|
||||
<span style="color: #a020f0;">do</span> j=1,point_num_x
|
||||
x = rmin(1)
|
||||
<span style="color: #a020f0;">do</span> i=1,point_num_x
|
||||
ipoint = ipoint+1
|
||||
points(ipoint,1) = x
|
||||
points(ipoint,2) = y
|
||||
points(ipoint,3) = z
|
||||
x = x + dr(1)
|
||||
<span style="color: #a020f0;">end do</span>
|
||||
y = y + dr(2)
|
||||
<span style="color: #a020f0;">end do</span>
|
||||
z = z + dr(3)
|
||||
<span style="color: #a020f0;">end do</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
We give the points to QMCkl:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90">rc = qmckl_set_point(qmckl_ctx, <span style="color: #8b2252;">'T'</span>, point_num, points, <span style="color: #a020f0;">size</span>(points)*1_8 )
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">qmckl_check_error</span>(rc, <span style="color: #8b2252;">'Setting points'</span>)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
We allocate the space required to retrieve the values, gradients and
|
||||
Laplacian of all AOs, and ask to retrieve the values of the
|
||||
AOs computed at the point positions.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"><span style="color: #a020f0;">allocate</span>( ao_vgl(ao_num, 5, point_num) )
|
||||
rc = qmckl_get_ao_basis_ao_vgl(qmckl_ctx, ao_vgl, ao_num*5_8*point_num)
|
||||
<span style="color: #a020f0;">call</span> <span style="color: #0000ff;">qmckl_check_error</span>(rc, <span style="color: #8b2252;">'Setting points'</span>)
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
We finally print the value and Laplacian of the AO:
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"><span style="color: #a020f0;">do</span> ipoint=1, point_num
|
||||
<span style="color: #a020f0;">print</span> <span style="color: #8b2252;">'(3(F10.6,X),2(E20.10,X))'</span>, points(ipoint, 1:3), ao_vgl(ao_id,1,ipoint), ao_vgl(ao_id,5,ipoint)
|
||||
<span style="color: #a020f0;">end do</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"> <span style="color: #a020f0;">deallocate</span>( nucl_coord, points, ao_vgl )
|
||||
<span style="color: #a020f0;">end program</span> <span style="color: #0000ff;">ao_grid</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX CoE</p>
|
||||
<p class="date">Created: 2022-09-28 Wed 07:38</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
6418
qmckl_jastrow.html
6418
qmckl_jastrow.html
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,640 +0,0 @@
|
||||
<?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>
|
||||
<!-- 2022-09-28 Wed 07:38 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Memory management</title>
|
||||
<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; }
|
||||
.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-2019 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-2019 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-2019 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>
|
||||
</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">Memory management</h1>
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#org56c7c38">1. Memory data structure for the context</a></li>
|
||||
<li><a href="#orgd960113">2. Passing info to allocation routines</a></li>
|
||||
<li><a href="#org7a2ef46">3. Allocation/deallocation functions</a></li>
|
||||
<li><a href="#orgf322461">4. Get the size of a memory block</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org56c7c38" class="outline-2">
|
||||
<h2 id="org56c7c38"><span class="section-number-2">1</span> Memory data structure for the context</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<p>
|
||||
Every time a new block of memory is allocated, the information
|
||||
relative to the allocation is stored in a new <code>qmckl_memory_info_struct</code>.
|
||||
A <code>qmckl_memory_info_struct</code> contains the pointer to the memory block,
|
||||
its size in bytes, and extra implementation-specific information such as
|
||||
alignment, pinning, if the memory should be allocated on CPU or GPU
|
||||
<i>etc</i>.
|
||||
</p>
|
||||
|
||||
<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_memory_info_struct</span> {
|
||||
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">size</span>;
|
||||
<span style="color: #228b22;">void</span>* <span style="color: #a0522d;">pointer</span>;
|
||||
} <span style="color: #228b22;">qmckl_memory_info_struct</span>;
|
||||
|
||||
<span style="color: #a020f0;">static</span> <span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">qmckl_memory_info_struct_zero</span> =
|
||||
{
|
||||
.size = (<span style="color: #228b22;">size_t</span>) 0,
|
||||
.pointer = <span style="color: #008b8b;">NULL</span>
|
||||
};
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The <code>memory</code> element of the context is a data structure which
|
||||
contains an array of <code>qmckl_memory_info_struct</code>, the size of the
|
||||
array, and the number of allocated blocks.
|
||||
</p>
|
||||
|
||||
<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_memory_struct</span> {
|
||||
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">n_allocated</span>;
|
||||
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">array_size</span>;
|
||||
<span style="color: #228b22;">qmckl_memory_info_struct</span>* <span style="color: #a0522d;">element</span>;
|
||||
} <span style="color: #228b22;">qmckl_memory_struct</span>;
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgd960113" class="outline-2">
|
||||
<h2 id="orgd960113"><span class="section-number-2">2</span> Passing info to allocation routines</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
<p>
|
||||
Passing information to the allocation routine should be done by
|
||||
passing an instance of a <code>qmckl_memory_info_struct</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org7a2ef46" class="outline-2">
|
||||
<h2 id="org7a2ef46"><span class="section-number-2">3</span> Allocation/deallocation functions</h2>
|
||||
<div class="outline-text-2" id="text-3">
|
||||
<p>
|
||||
Memory allocation inside the library should be done with
|
||||
<code>qmckl_malloc</code>. It lets the library choose how the memory will be
|
||||
allocated, and a pointer is returned to the user. The context is
|
||||
passed to let the library store data related to the allocation
|
||||
inside the context. In this particular implementation of the library,
|
||||
we store a list of allocated pointers so that all the memory can be
|
||||
properly freed when the library is de-initialized.
|
||||
If the allocation failed, the <code>NULL</code> pointer is returned.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">void</span>* <span style="color: #0000ff;">qmckl_malloc</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">info</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">void</span>* <span style="color: #0000ff;">qmckl_malloc</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">info</span>) {
|
||||
|
||||
assert (qmckl_context_check(context) != QMCKL_NULL_CONTEXT);
|
||||
|
||||
<span style="color: #228b22;">qmckl_context_struct</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ctx</span> = (<span style="color: #228b22;">qmckl_context_struct</span>*) context;
|
||||
|
||||
/* <span style="color: #b22222;">Allocate memory and zero it </span>*/
|
||||
<span style="color: #483d8b;">#ifdef</span> HAVE_HPC
|
||||
<span style="color: #228b22;">void</span> * <span style="color: #a0522d;">pointer</span> = aligned_alloc(64, ((info.size+64) >> 6) << 6 );
|
||||
<span style="color: #483d8b;">#else</span>
|
||||
<span style="color: #228b22;">void</span> * <span style="color: #a0522d;">pointer</span> = malloc(info.size);
|
||||
<span style="color: #483d8b;">#endif</span>
|
||||
<span style="color: #a020f0;">if</span> (pointer == <span style="color: #008b8b;">NULL</span>) {
|
||||
<span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
|
||||
}
|
||||
memset(pointer, 0, info.size);
|
||||
|
||||
qmckl_lock(context);
|
||||
{
|
||||
/* <span style="color: #b22222;">If qmckl_memory_struct is full, reallocate a larger one </span>*/
|
||||
<span style="color: #a020f0;">if</span> (ctx->memory.n_allocated == ctx->memory.array_size) {
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">old_size</span> = ctx->memory.array_size;
|
||||
<span style="color: #228b22;">qmckl_memory_info_struct</span> * <span style="color: #a0522d;">new_array</span> = realloc(ctx->memory.element,
|
||||
2L * old_size *
|
||||
<span style="color: #a020f0;">sizeof</span>(qmckl_memory_info_struct));
|
||||
<span style="color: #a020f0;">if</span> (new_array == <span style="color: #008b8b;">NULL</span>) {
|
||||
qmckl_unlock(context);
|
||||
free(pointer);
|
||||
<span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
|
||||
}
|
||||
|
||||
memset( &(new_array[old_size]), 0, <span style="color: #228b22;">old_size</span> * <span style="color: #a020f0;">sizeof</span>(qmckl_memory_info_struct) );
|
||||
ctx->memory.element = new_array;
|
||||
ctx->memory.array_size = 2L * old_size;
|
||||
}
|
||||
|
||||
/* <span style="color: #b22222;">Find first NULL entry </span>*/
|
||||
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">pos</span> = (<span style="color: #228b22;">size_t</span>) 0;
|
||||
<span style="color: #a020f0;">while</span> ( pos < ctx->memory.array_size && ctx->memory.element[pos].size > (<span style="color: #228b22;">size_t</span>) 0) {
|
||||
pos += (<span style="color: #228b22;">size_t</span>) 1;
|
||||
}
|
||||
assert (ctx->memory.element[pos].size == (<span style="color: #228b22;">size_t</span>) 0);
|
||||
|
||||
/* <span style="color: #b22222;">Copy info at the new location </span>*/
|
||||
memcpy(&(ctx->memory.element[pos]), &info, <span style="color: #a020f0;">sizeof</span>(qmckl_memory_info_struct));
|
||||
ctx->memory.element[pos].pointer = pointer;
|
||||
ctx->memory.n_allocated += (<span style="color: #228b22;">size_t</span>) 1;
|
||||
}
|
||||
qmckl_unlock(context);
|
||||
|
||||
<span style="color: #a020f0;">return</span> pointer;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c">/* <span style="color: #b22222;">Create a context </span>*/
|
||||
<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span> = qmckl_context_create();
|
||||
|
||||
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">info</span> = qmckl_memory_info_struct_zero;
|
||||
info.size = (<span style="color: #228b22;">size_t</span>) 3*<span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">int</span>);
|
||||
|
||||
/* <span style="color: #b22222;">Allocate an array of ints </span>*/
|
||||
<span style="color: #228b22;">int</span> *<span style="color: #a0522d;">a</span> = (<span style="color: #228b22;">int</span>*) <span style="color: #0000ff;">qmckl_malloc</span>(context, info);
|
||||
|
||||
/* <span style="color: #b22222;">Check that array of ints is OK </span>*/
|
||||
<span style="color: #0000ff;">assert</span>(a != <span style="color: #008b8b;">NULL</span>);
|
||||
<span style="color: #228b22;">a</span>[0] = 1; <span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">a</span>[0] == 1);
|
||||
<span style="color: #228b22;">a</span>[1] = 2; <span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">a</span>[1] == 2);
|
||||
<span style="color: #228b22;">a</span>[2] = 3; <span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">a</span>[2] == 3);
|
||||
|
||||
/* <span style="color: #b22222;">Allocate another array of ints </span>*/
|
||||
<span style="color: #228b22;">int</span> *<span style="color: #a0522d;">b</span> = (<span style="color: #228b22;">int</span>*) <span style="color: #0000ff;">qmckl_malloc</span>(context, info);
|
||||
|
||||
/* <span style="color: #b22222;">Check that array of ints is OK </span>*/
|
||||
<span style="color: #0000ff;">assert</span>(b != <span style="color: #008b8b;">NULL</span>);
|
||||
<span style="color: #228b22;">b</span>[0] = 1; <span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">b</span>[0] == 1);
|
||||
<span style="color: #228b22;">b</span>[1] = 2; <span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">b</span>[1] == 2);
|
||||
<span style="color: #228b22;">b</span>[2] = 3; <span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">b</span>[2] == 3);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
When freeing the memory with <code>qmckl_free</code>, the context is passed, in
|
||||
case some important information has been stored related to memory
|
||||
allocation and needs to be updated.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_free</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #228b22;">void</span> * <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ptr</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_free</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">void</span> * <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ptr</span>) {
|
||||
|
||||
<span style="color: #a020f0;">if</span> (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_CONTEXT,
|
||||
<span style="color: #8b2252;">"qmckl_free"</span>,
|
||||
<span style="color: #008b8b;">NULL</span>);
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">if</span> (ptr == <span style="color: #008b8b;">NULL</span>) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
<span style="color: #8b2252;">"qmckl_free"</span>,
|
||||
<span style="color: #8b2252;">"NULL pointer"</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;
|
||||
|
||||
qmckl_lock(context);
|
||||
{
|
||||
/* <span style="color: #b22222;">Find pointer in array of saved pointers </span>*/
|
||||
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">pos</span> = (<span style="color: #228b22;">size_t</span>) 0;
|
||||
<span style="color: #a020f0;">while</span> ( pos < ctx->memory.array_size && ctx->memory.element[pos].pointer != ptr) {
|
||||
pos += (<span style="color: #228b22;">size_t</span>) 1;
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">if</span> (pos >= ctx->memory.array_size) {
|
||||
/* <span style="color: #b22222;">Not found </span>*/
|
||||
qmckl_unlock(context);
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
<span style="color: #8b2252;">"qmckl_free"</span>,
|
||||
<span style="color: #8b2252;">"Pointer not found in context"</span>);
|
||||
}
|
||||
|
||||
free(ptr);
|
||||
|
||||
memset( &(ctx->memory.element[pos]), 0, <span style="color: #a020f0;">sizeof</span>(qmckl_memory_info_struct) );
|
||||
ctx->memory.n_allocated -= (<span style="color: #228b22;">size_t</span>) 1;
|
||||
}
|
||||
qmckl_unlock(context);
|
||||
|
||||
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-orgf322461" class="outline-2">
|
||||
<h2 id="orgf322461"><span class="section-number-2">4</span> Get the size of a memory block</h2>
|
||||
<div class="outline-text-2" id="text-4">
|
||||
<p>
|
||||
All the blocks allocated with <code>qmckl_malloc</code> keep track of how many
|
||||
bytes were allocated. Using <code>qmckl_malloc_size</code> allows to get this information.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
||||
<span style="color: #0000ff;">qmckl_get_malloc_info</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">void</span>* <span style="color: #a0522d;">pointer</span>,
|
||||
<span style="color: #228b22;">qmckl_memory_info_struct</span>* <span style="color: #a0522d;">info</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
||||
<span style="color: #0000ff;">qmckl_get_malloc_info</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">void</span>* <span style="color: #a0522d;">ptr</span>,
|
||||
<span style="color: #228b22;">qmckl_memory_info_struct</span>* <span style="color: #a0522d;">info</span>)
|
||||
{
|
||||
|
||||
assert (qmckl_context_check(context) != QMCKL_NULL_CONTEXT);
|
||||
|
||||
<span style="color: #228b22;">qmckl_context_struct</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">ctx</span> = (<span style="color: #228b22;">qmckl_context_struct</span>*) context;
|
||||
|
||||
<span style="color: #a020f0;">if</span> (ptr == <span style="color: #008b8b;">NULL</span>) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
<span style="color: #8b2252;">"qmckl_get_malloc_info"</span>,
|
||||
<span style="color: #8b2252;">"Null pointer"</span>);
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">if</span> (info == <span style="color: #008b8b;">NULL</span>) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_ARG_3,
|
||||
<span style="color: #8b2252;">"qmckl_get_malloc_info"</span>,
|
||||
<span style="color: #8b2252;">"Null pointer"</span>);
|
||||
}
|
||||
|
||||
qmckl_lock(context);
|
||||
{
|
||||
/* <span style="color: #b22222;">Find the pointer entry </span>*/
|
||||
<span style="color: #228b22;">size_t</span> <span style="color: #a0522d;">pos</span> = (<span style="color: #228b22;">size_t</span>) 0;
|
||||
<span style="color: #a020f0;">while</span> ( pos < ctx->memory.array_size && ctx->memory.element[pos].pointer != ptr) {
|
||||
pos += (<span style="color: #228b22;">size_t</span>) 1;
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">if</span> (pos >= ctx->memory.array_size) {
|
||||
/* <span style="color: #b22222;">Not found </span>*/
|
||||
qmckl_unlock(context);
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
<span style="color: #8b2252;">"qmckl_get_malloc_info"</span>,
|
||||
<span style="color: #8b2252;">"Pointer not found in context"</span>);
|
||||
}
|
||||
|
||||
/* <span style="color: #b22222;">Copy info </span>*/
|
||||
memcpy(info, &(ctx->memory.element[pos]), <span style="color: #a020f0;">sizeof</span>(qmckl_memory_info_struct));
|
||||
}
|
||||
qmckl_unlock(context);
|
||||
|
||||
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c">/* <span style="color: #b22222;">Create a context </span>*/
|
||||
context = qmckl_context_create();
|
||||
|
||||
info = qmckl_memory_info_struct_zero;
|
||||
info.size = (<span style="color: #228b22;">size_t</span>) 3*<span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">int</span>);
|
||||
|
||||
/* <span style="color: #b22222;">Allocate an array of ints </span>*/
|
||||
a = (<span style="color: #228b22;">int</span>*) <span style="color: #0000ff;">qmckl_malloc</span>(context, info);
|
||||
|
||||
/* <span style="color: #b22222;">Check that the size of a is 3*sizeof(int) </span>*/
|
||||
info = qmckl_memory_info_struct_zero;
|
||||
rc = qmckl_get_malloc_info(context, <span style="color: #008b8b;">NULL</span>, &info);
|
||||
<span style="color: #0000ff;">assert</span> (rc == QMCKL_INVALID_ARG_2);
|
||||
rc = qmckl_get_malloc_info(context, &rc, &info);
|
||||
<span style="color: #0000ff;">assert</span> (rc == QMCKL_INVALID_ARG_2);
|
||||
rc = qmckl_get_malloc_info(context, a, &info);
|
||||
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
||||
<span style="color: #0000ff;">assert</span> (info.size == 3*<span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">int</span>));
|
||||
rc = qmckl_context_destroy(context);
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX CoE</p>
|
||||
<p class="date">Created: 2022-09-28 Wed 07:38</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
1394
qmckl_mo.html
1394
qmckl_mo.html
File diff suppressed because it is too large
Load Diff
@ -1,921 +0,0 @@
|
||||
<?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>
|
||||
<!-- 2022-09-28 Wed 07:38 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Nucleus</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; }
|
||||
.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-2019 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-2019 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-2019 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">Nucleus</h1>
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#org4e4e61d">1. Context</a>
|
||||
<ul>
|
||||
<li><a href="#org0bb92fe">1.1. Data structure</a></li>
|
||||
<li><a href="#org18b31ac">1.2. Access functions</a></li>
|
||||
<li><a href="#org30b5271">1.3. Initialization functions</a></li>
|
||||
<li><a href="#orgd901e8e">1.4. Test</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org5bb9686">2. Computation</a>
|
||||
<ul>
|
||||
<li><a href="#org219e48b">2.1. Nucleus-nucleus distances</a>
|
||||
<ul>
|
||||
<li><a href="#orge7ade5f">2.1.1. Get</a></li>
|
||||
<li><a href="#org118d97f">2.1.2. Compute</a></li>
|
||||
<li><a href="#orgf564aa6">2.1.3. Test</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org882dd52">2.2. Nuclear repulsion energy</a>
|
||||
<ul>
|
||||
<li><a href="#orgef22d29">2.2.1. Get</a></li>
|
||||
<li><a href="#orgfa8e103">2.2.2. Compute</a></li>
|
||||
<li><a href="#orgba6fa87">2.2.3. Test</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org4e4e61d" class="outline-2">
|
||||
<h2 id="org4e4e61d"><span class="section-number-2">1</span> Context</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<p>
|
||||
The following data stored in the context:
|
||||
</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>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left"><code>uninitialized</code></td>
|
||||
<td class="org-left">int32<sub>t</sub></td>
|
||||
<td class="org-left">Keeps bit set for uninitialized data</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>num</code></td>
|
||||
<td class="org-left">int64<sub>t</sub></td>
|
||||
<td class="org-left">Total number of nuclei</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>provided</code></td>
|
||||
<td class="org-left">bool</td>
|
||||
<td class="org-left">If true, <code>nucleus</code> is valid</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>charge</code></td>
|
||||
<td class="org-left">qmckl<sub>vector</sub></td>
|
||||
<td class="org-left">Nuclear charges</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>coord</code></td>
|
||||
<td class="org-left">qmckl<sub>matrix</sub></td>
|
||||
<td class="org-left">Nuclear coordinates, in transposed format</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>coord_date</code></td>
|
||||
<td class="org-left">int64<sub>t</sub></td>
|
||||
<td class="org-left">Nuclear coordinates, date if modified</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>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left"><code>nn_distance</code></td>
|
||||
<td class="org-left">qmckl<sub>matrix</sub></td>
|
||||
<td class="org-left">Nucleus-nucleus distances</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>nn_distance_date</code></td>
|
||||
<td class="org-left">int64<sub>t</sub></td>
|
||||
<td class="org-left">Date when Nucleus-nucleus distances were computed</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>repulsion</code></td>
|
||||
<td class="org-left">double</td>
|
||||
<td class="org-left">Nuclear repulsion energy</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>repulsion_date</code></td>
|
||||
<td class="org-left">int64<sub>t</sub></td>
|
||||
<td class="org-left">Date when the nuclear repulsion energy was computed</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org0bb92fe" class="outline-3">
|
||||
<h3 id="org0bb92fe"><span class="section-number-3">1.1</span> Data structure</h3>
|
||||
<div class="outline-text-3" id="text-1-1">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">qmckl_nucleus_struct</span> {
|
||||
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">num</span>;
|
||||
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">repulsion_date</span>;
|
||||
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nn_distance_date</span>;
|
||||
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">coord_date</span>;
|
||||
<span style="color: #228b22;">qmckl_vector</span> <span style="color: #a0522d;">charge</span>;
|
||||
<span style="color: #228b22;">qmckl_matrix</span> <span style="color: #a0522d;">coord</span>;
|
||||
<span style="color: #228b22;">qmckl_matrix</span> <span style="color: #a0522d;">nn_distance</span>;
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">repulsion</span>;
|
||||
<span style="color: #228b22;">int32_t</span> <span style="color: #a0522d;">uninitialized</span>;
|
||||
<span style="color: #228b22;">bool</span> <span style="color: #a0522d;">provided</span>;
|
||||
} <span style="color: #228b22;">qmckl_nucleus_struct</span>;
|
||||
|
||||
</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_nucleus</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_nucleus</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->nucleus.uninitialized = (1 << 3) - 1;
|
||||
|
||||
/* <span style="color: #b22222;">Default values </span>*/
|
||||
|
||||
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org18b31ac" class="outline-3">
|
||||
<h3 id="org18b31ac"><span class="section-number-3">1.2</span> Access functions</h3>
|
||||
<div class="outline-text-3" id="text-1-2">
|
||||
<p>
|
||||
When all the data relative to nuclei have been set, the following
|
||||
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_nucleus_provided</span> (<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>);
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org30b5271" class="outline-3">
|
||||
<h3 id="org30b5271"><span class="section-number-3">1.3</span> Initialization functions</h3>
|
||||
<div class="outline-text-3" id="text-1-3">
|
||||
<p>
|
||||
To set the data relative to the nuclei in the context, the
|
||||
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_nucleus_num</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">num</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Sets the number of nuclei.
|
||||
</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_nucleus_charge</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">charge</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Sets the nuclear charges of all the atoms.
|
||||
</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_nucleus_coord</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transp</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Sets the nuclear coordinates of all the atoms. The coordinates
|
||||
are be given in atomic units.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgd901e8e" class="outline-3">
|
||||
<h3 id="orgd901e8e"><span class="section-number-3">1.4</span> Test</h3>
|
||||
<div class="outline-text-3" id="text-1-4">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_charge</span> = chbrclf_charge;
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span> = &(chbrclf_nucl_coord[0][0]);
|
||||
|
||||
/* <span style="color: #b22222;">--- </span>*/
|
||||
|
||||
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
||||
|
||||
assert(!qmckl_nucleus_provided(context));
|
||||
|
||||
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">n</span>;
|
||||
rc = qmckl_get_nucleus_num (context, &n);
|
||||
<span style="color: #0000ff;">assert</span>(rc == QMCKL_NOT_PROVIDED);
|
||||
|
||||
|
||||
rc = qmckl_set_nucleus_num (context, chbrclf_nucl_num);
|
||||
<span style="color: #0000ff;">qmckl_check</span>(context, rc);
|
||||
assert(!qmckl_nucleus_provided(context));
|
||||
|
||||
rc = qmckl_get_nucleus_num (context, &n);
|
||||
<span style="color: #0000ff;">qmckl_check</span>(context, rc);
|
||||
<span style="color: #0000ff;">assert</span>(n == chbrclf_nucl_num);
|
||||
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">nucl_coord2</span>[3*chbrclf_nucl_num];
|
||||
|
||||
rc = qmckl_get_nucleus_coord (context, <span style="color: #8b2252;">'T'</span>, nucl_coord2, 3*chbrclf_nucl_num);
|
||||
<span style="color: #0000ff;">assert</span>(rc == QMCKL_NOT_PROVIDED);
|
||||
|
||||
rc = qmckl_set_nucleus_coord (context, <span style="color: #8b2252;">'T'</span>, &(nucl_coord[0]), 3*chbrclf_nucl_num);
|
||||
<span style="color: #0000ff;">qmckl_check</span>(context, rc);
|
||||
|
||||
assert(!qmckl_nucleus_provided(context));
|
||||
|
||||
rc = qmckl_get_nucleus_coord (context, <span style="color: #8b2252;">'N'</span>, nucl_coord2, 3*chbrclf_nucl_num);
|
||||
<span style="color: #0000ff;">qmckl_check</span>(context, rc);
|
||||
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">size_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<chbrclf_nucl_num ; ++i) {
|
||||
assert( nucl_coord[chbrclf_nucl_num*k+i] == nucl_coord2[3*i+k] );
|
||||
}
|
||||
}
|
||||
|
||||
rc = qmckl_get_nucleus_coord (context, <span style="color: #8b2252;">'T'</span>, nucl_coord2, 3*chbrclf_nucl_num);
|
||||
<span style="color: #0000ff;">qmckl_check</span>(context, rc);
|
||||
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">i</span>=0 ; i<3*chbrclf_nucl_num ; ++i) {
|
||||
assert( nucl_coord[i] == nucl_coord2[i] );
|
||||
}
|
||||
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">nucl_charge2</span>[chbrclf_nucl_num];
|
||||
|
||||
rc = qmckl_get_nucleus_charge(context, nucl_charge2, chbrclf_nucl_num);
|
||||
<span style="color: #0000ff;">assert</span>(rc == QMCKL_NOT_PROVIDED);
|
||||
|
||||
rc = qmckl_set_nucleus_charge(context, nucl_charge, chbrclf_nucl_num);
|
||||
<span style="color: #0000ff;">qmckl_check</span>(context, rc);
|
||||
|
||||
rc = qmckl_get_nucleus_charge(context, nucl_charge2, chbrclf_nucl_num);
|
||||
<span style="color: #0000ff;">qmckl_check</span>(context, rc);
|
||||
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">i</span>=0 ; i<chbrclf_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-org5bb9686" class="outline-2">
|
||||
<h2 id="org5bb9686"><span class="section-number-2">2</span> Computation</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
<p>
|
||||
The computed data is stored in the context so that it can be reused
|
||||
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-org219e48b" class="outline-3">
|
||||
<h3 id="org219e48b"><span class="section-number-3">2.1</span> Nucleus-nucleus distances</h3>
|
||||
<div class="outline-text-3" id="text-2-1">
|
||||
</div>
|
||||
<div id="outline-container-orge7ade5f" class="outline-4">
|
||||
<h4 id="orge7ade5f"><span class="section-number-4">2.1.1</span> Get</h4>
|
||||
<div class="outline-text-4" id="text-2-1-1">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
||||
<span style="color: #0000ff;">qmckl_get_nucleus_nn_distance</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">distance</span>,
|
||||
<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-org118d97f" class="outline-4">
|
||||
<h4 id="org118d97f"><span class="section-number-4">2.1.2</span> Compute</h4>
|
||||
<div class="outline-text-4" id="text-2-1-2">
|
||||
<table id="org03a2e58" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left">qmckl<sub>context</sub></td>
|
||||
<td class="org-left">context</td>
|
||||
<td class="org-left">in</td>
|
||||
<td class="org-left">Global state</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left">int64<sub>t</sub></td>
|
||||
<td class="org-left">nucl<sub>num</sub></td>
|
||||
<td class="org-left">in</td>
|
||||
<td class="org-left">Number of nuclei</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left">double</td>
|
||||
<td class="org-left">coord[3][nucl<sub>num</sub>]</td>
|
||||
<td class="org-left">in</td>
|
||||
<td class="org-left">Nuclear coordinates (au)</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left">double</td>
|
||||
<td class="org-left">nn<sub>distance</sub>[nucl<sub>num</sub>][nucl<sub>num</sub>]</td>
|
||||
<td class="org-left">out</td>
|
||||
<td class="org-left">Nucleus-nucleus distances (au)</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"><span style="color: #228b22;">integer </span><span style="color: #a020f0;">function</span><span style="color: #a0522d;"> </span><span style="color: #0000ff;">qmckl_compute_nn_distance_f</span><span style="color: #000000; background-color: #ffffff;">(context, nucl_num, coord, nn_distance)</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;"> nucl_num</span>
|
||||
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord(nucl_num,3)</span>
|
||||
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> nn_distance(nucl_num,nucl_num)</span>
|
||||
|
||||
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> k</span>
|
||||
|
||||
info = QMCKL_SUCCESS
|
||||
|
||||
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
|
||||
info = QMCKL_INVALID_CONTEXT
|
||||
<span style="color: #a020f0;">return</span>
|
||||
<span style="color: #a020f0;">endif</span>
|
||||
|
||||
<span style="color: #a020f0;">if</span> (nucl_num <= 0) <span style="color: #a020f0;">then</span>
|
||||
info = QMCKL_INVALID_ARG_2
|
||||
<span style="color: #a020f0;">return</span>
|
||||
<span style="color: #a020f0;">endif</span>
|
||||
|
||||
info = qmckl_distance(context, <span style="color: #8b2252;">'T'</span>, <span style="color: #8b2252;">'T'</span>, nucl_num, nucl_num, <span style="color: #a020f0;">&</span>
|
||||
coord, nucl_num, <span style="color: #a020f0;">&</span>
|
||||
coord, nucl_num, <span style="color: #a020f0;">&</span>
|
||||
nn_distance, nucl_num)
|
||||
|
||||
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_compute_nn_distance_f</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgf564aa6" class="outline-4">
|
||||
<h4 id="orgf564aa6"><span class="section-number-4">2.1.3</span> Test</h4>
|
||||
<div class="outline-text-4" id="text-2-1-3">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c">/* <span style="color: #b22222;">Reference input data </span>*/
|
||||
|
||||
<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;">distance</span>[chbrclf_nucl_num*chbrclf_nucl_num];
|
||||
rc = qmckl_get_nucleus_nn_distance(context, distance, chbrclf_nucl_num*chbrclf_nucl_num);
|
||||
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">distance</span>[0] == 0.);
|
||||
<span style="color: #0000ff;">assert</span>(<span style="color: #228b22;">distance</span>[1] == distance[chbrclf_nucl_num]);
|
||||
<span style="color: #0000ff;">assert</span>(fabs(<span style="color: #228b22;">distance</span>[1]-2.070304721365169) < 1.e-12);
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org882dd52" class="outline-3">
|
||||
<h3 id="org882dd52"><span class="section-number-3">2.2</span> Nuclear repulsion energy</h3>
|
||||
<div class="outline-text-3" id="text-2-2">
|
||||
<p>
|
||||
\[
|
||||
V_{NN} = \sum_{A=1}^{N-1} \sum_{B>A}^N \frac{Q_A Q_B}{R_{AB}}
|
||||
\]
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgef22d29" class="outline-4">
|
||||
<h4 id="orgef22d29"><span class="section-number-4">2.2.1</span> Get</h4>
|
||||
<div class="outline-text-4" id="text-2-2-1">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #0000ff;">qmckl_get_nucleus_repulsion</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;">energy</span>);
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgfa8e103" class="outline-4">
|
||||
<h4 id="orgfa8e103"><span class="section-number-4">2.2.2</span> Compute</h4>
|
||||
<div class="outline-text-4" id="text-2-2-2">
|
||||
<table id="org6a72853" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left">qmckl<sub>context</sub></td>
|
||||
<td class="org-left">context</td>
|
||||
<td class="org-left">in</td>
|
||||
<td class="org-left">Global state</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left">int64<sub>t</sub></td>
|
||||
<td class="org-left">nucl<sub>num</sub></td>
|
||||
<td class="org-left">in</td>
|
||||
<td class="org-left">Number of nuclei</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left">double</td>
|
||||
<td class="org-left">charge[nucl<sub>num</sub>]</td>
|
||||
<td class="org-left">in</td>
|
||||
<td class="org-left">Nuclear charges (au)</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left">double</td>
|
||||
<td class="org-left">nn<sub>distance</sub>[nucl<sub>num</sub>][nucl<sub>num</sub>]</td>
|
||||
<td class="org-left">in</td>
|
||||
<td class="org-left">Nucleus-nucleus distances (au)</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left">double</td>
|
||||
<td class="org-left">energy</td>
|
||||
<td class="org-left">out</td>
|
||||
<td class="org-left">Nuclear repulsion energy</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_nucleus_repulsion_f</span><span style="color: #000000; background-color: #ffffff;">(context, nucl_num, charge, nn_distance, energy)</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;"> nucl_num</span>
|
||||
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> charge(nucl_num)</span>
|
||||
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> nn_distance(nucl_num,nucl_num)</span>
|
||||
<span style="color: #228b22;">double precision</span> , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> energy</span>
|
||||
|
||||
<span style="color: #228b22;">integer</span>*8 ::<span style="color: #a0522d;"> i, j</span>
|
||||
|
||||
info = QMCKL_SUCCESS
|
||||
|
||||
<span style="color: #a020f0;">if</span> (context == QMCKL_NULL_CONTEXT) <span style="color: #a020f0;">then</span>
|
||||
info = QMCKL_INVALID_CONTEXT
|
||||
<span style="color: #a020f0;">return</span>
|
||||
<span style="color: #a020f0;">endif</span>
|
||||
|
||||
<span style="color: #a020f0;">if</span> (nucl_num <= 0) <span style="color: #a020f0;">then</span>
|
||||
info = QMCKL_INVALID_ARG_2
|
||||
<span style="color: #a020f0;">return</span>
|
||||
<span style="color: #a020f0;">endif</span>
|
||||
|
||||
energy = 0.d0
|
||||
<span style="color: #a020f0;">do</span> j=2, nucl_num
|
||||
<span style="color: #a020f0;">do</span> i=1, j-1
|
||||
<span style="color: #a020f0;">if</span> (dabs(nn_distance(i,j)) > 1e-5) <span style="color: #a020f0;">then</span>
|
||||
energy = energy + charge(i) * charge(j) / nn_distance(i,j)
|
||||
<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_nucleus_repulsion_f</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgba6fa87" class="outline-4">
|
||||
<h4 id="orgba6fa87"><span class="section-number-4">2.2.3</span> Test</h4>
|
||||
<div class="outline-text-4" id="text-2-2-3">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c">/* <span style="color: #b22222;">Reference input data </span>*/
|
||||
|
||||
<span style="color: #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;">rep</span>;
|
||||
rc = qmckl_get_nucleus_repulsion(context, &rep);
|
||||
<span style="color: #0000ff;">assert</span>(rep - 318.2309879436158 < 1.e-10);
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX CoE</p>
|
||||
<p class="date">Created: 2022-09-28 Wed 07:38</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
@ -1,588 +0,0 @@
|
||||
<?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>
|
||||
<!-- 2022-09-28 Wed 07:38 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Numerical precision</title>
|
||||
<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; }
|
||||
.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-2019 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-2019 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-2019 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">Numerical precision</h1>
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#orgf0e1cb5">1. Control of the numerical precision</a></li>
|
||||
<li><a href="#org1d5f010">2. Precision</a></li>
|
||||
<li><a href="#org7617f8f">3. Range</a></li>
|
||||
<li><a href="#org1632bf3">4. Helper functions</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgf0e1cb5" class="outline-2">
|
||||
<h2 id="orgf0e1cb5"><span class="section-number-2">1</span> Control of the numerical precision</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<p>
|
||||
Controlling numerical precision enables optimizations. Here, the
|
||||
default parameters determining the target numerical precision and
|
||||
range are defined. Following the IEEE Standard for Floating-Point
|
||||
Arithmetic (IEEE 754),
|
||||
<i>precision</i> refers to the number of significand bits and <i>range</i>
|
||||
refers to the number of exponent bits.
|
||||
</p>
|
||||
|
||||
<table id="org93b33e0" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-right" />
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_DEFAULT_PRECISION</code></td>
|
||||
<td class="org-right">53</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>QMCKL_DEFAULT_RANGE</code></td>
|
||||
<td class="org-right">11</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<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_numprec_struct</span> {
|
||||
<span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">precision</span>;
|
||||
<span style="color: #228b22;">uint32_t</span> <span style="color: #a0522d;">range</span>;
|
||||
} <span style="color: #228b22;">qmckl_numprec_struct</span>;
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
The following functions set and get the required precision and
|
||||
range. <code>precision</code> is an integer between 2 and 53, and <code>range</code> is an
|
||||
integer between 2 and 11.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
The setter functions functions return a new context as a 64-bit
|
||||
integer. The getter functions return the value, as a 32-bit
|
||||
integer. The update functions return <code>QMCKL_SUCCESS</code> or
|
||||
<code>QMCKL_FAILURE</code>.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org1d5f010" class="outline-2">
|
||||
<h2 id="org1d5f010"><span class="section-number-2">2</span> Precision</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
<p>
|
||||
<code>qmckl_context_set_numprec_precision</code> modifies the parameter for the
|
||||
numerical precision in the context.
|
||||
</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_numprec_precision</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;">int</span> <span style="color: #a0522d;">precision</span>) {
|
||||
|
||||
<span style="color: #a020f0;">if</span> (qmckl_context_check(context) == QMCKL_NULL_CONTEXT)
|
||||
<span style="color: #a020f0;">return</span> QMCKL_INVALID_CONTEXT;
|
||||
|
||||
<span style="color: #a020f0;">if</span> (precision < 2) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
<span style="color: #8b2252;">"qmckl_update_numprec_precision"</span>,
|
||||
<span style="color: #8b2252;">"precision < 2"</span>);
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">if</span> (precision > 53) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
<span style="color: #8b2252;">"qmckl_update_numprec_precision"</span>,
|
||||
<span style="color: #8b2252;">"precision > 53"</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;
|
||||
|
||||
/* <span style="color: #b22222;">This should be always true because the context is valid </span>*/
|
||||
assert (ctx != <span style="color: #008b8b;">NULL</span>);
|
||||
|
||||
qmckl_lock(context);
|
||||
{
|
||||
ctx->numprec.precision = (<span style="color: #228b22;">uint32_t</span>) precision;
|
||||
}
|
||||
qmckl_unlock(context);
|
||||
|
||||
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<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: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_set_numprec_precision</span>(context, precision) <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: #228b22;">integer</span> (qmckl_context), <span style="color: #a020f0;">intent</span>(in), <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
|
||||
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>), <span style="color: #a020f0;">intent</span>(in), <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> precision</span>
|
||||
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_numprec_precision</span>
|
||||
<span style="color: #a020f0;">end interface</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<code>qmckl_get_numprec_precision</code> returns the value of the numerical precision in the context.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">int</span> <span style="color: #0000ff;">qmckl_get_numprec_precision</span>(<span style="color: #a020f0;">const</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> qmckl_failwith(context,
|
||||
QMCKL_INVALID_CONTEXT,
|
||||
<span style="color: #8b2252;">"qmckl_get_numprec_precision"</span>,
|
||||
<span style="color: #8b2252;">""</span>);
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">const</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;
|
||||
<span style="color: #a020f0;">return</span> ctx->numprec.precision;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<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: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_get_numprec_precision</span>(context) <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: #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: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_get_numprec_precision</span>
|
||||
<span style="color: #a020f0;">end interface</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org7617f8f" class="outline-2">
|
||||
<h2 id="org7617f8f"><span class="section-number-2">3</span> Range</h2>
|
||||
<div class="outline-text-2" id="text-3">
|
||||
<p>
|
||||
<code>qmckl_set_numprec_range</code> modifies the parameter for the numerical
|
||||
range in a given context.
|
||||
</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_numprec_range</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;">int</span> <span style="color: #a0522d;">range</span>) {
|
||||
|
||||
<span style="color: #a020f0;">if</span> (qmckl_context_check(context) == QMCKL_NULL_CONTEXT)
|
||||
<span style="color: #a020f0;">return</span> QMCKL_INVALID_CONTEXT;
|
||||
|
||||
<span style="color: #a020f0;">if</span> (range < 2) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
<span style="color: #8b2252;">"qmckl_set_numprec_range"</span>,
|
||||
<span style="color: #8b2252;">"range < 2"</span>);
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">if</span> (range > 11) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith(context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
<span style="color: #8b2252;">"qmckl_set_numprec_range"</span>,
|
||||
<span style="color: #8b2252;">"range > 11"</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;
|
||||
|
||||
/* <span style="color: #b22222;">This should be always true because the context is valid </span>*/
|
||||
assert (ctx != <span style="color: #008b8b;">NULL</span>);
|
||||
|
||||
qmckl_lock(context);
|
||||
{
|
||||
ctx->numprec.range = (<span style="color: #228b22;">uint32_t</span>) range;
|
||||
}
|
||||
qmckl_unlock(context);
|
||||
|
||||
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<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: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_set_numprec_range</span>(context, range) <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: #228b22;">integer</span> (qmckl_context), <span style="color: #a020f0;">intent</span>(in), <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
|
||||
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int32_t</span>), <span style="color: #a020f0;">intent</span>(in), <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> range</span>
|
||||
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_set_numprec_range</span>
|
||||
<span style="color: #a020f0;">end interface</span>
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<code>qmckl_get_numprec_range</code> returns the value of the numerical range in the context.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">int</span> <span style="color: #0000ff;">qmckl_get_numprec_range</span>(<span style="color: #a020f0;">const</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> qmckl_failwith(context,
|
||||
QMCKL_INVALID_CONTEXT,
|
||||
<span style="color: #8b2252;">"qmckl_get_numprec_range"</span>,
|
||||
<span style="color: #8b2252;">""</span>);
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">const</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;
|
||||
<span style="color: #a020f0;">return</span> ctx->numprec.range;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="outline-container-org1632bf3" class="outline-2">
|
||||
<h2 id="org1632bf3"><span class="section-number-2">4</span> Helper functions</h2>
|
||||
<div class="outline-text-2" id="text-4">
|
||||
<p>
|
||||
<code>qmckl_get_numprec_epsilon</code> returns \(\epsilon = 2^{1-n}\) where <code>n</code> is the precision.
|
||||
We need to remove the sign bit from the precision.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">double</span> <span style="color: #0000ff;">qmckl_get_numprec_epsilon</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;">int</span> <span style="color: #a0522d;">precision</span> = qmckl_get_numprec_precision(context);
|
||||
<span style="color: #a020f0;">return</span> 1. / (<span style="color: #228b22;">double</span>) (1L << (precision-2));
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX CoE</p>
|
||||
<p class="date">Created: 2022-09-28 Wed 07:38</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
702
qmckl_point.html
702
qmckl_point.html
@ -1,702 +0,0 @@
|
||||
<?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>
|
||||
<!-- 2022-09-28 Wed 07:38 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Point</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; }
|
||||
.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-2019 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-2019 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-2019 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">Point</h1>
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#orgc75c6ad">1. Context</a>
|
||||
<ul>
|
||||
<li><a href="#orgf29ec54">1.1. Data structure</a></li>
|
||||
<li><a href="#org66ce541">1.2. Access functions</a>
|
||||
<ul>
|
||||
<li><a href="#org5679c4f">1.2.1. Number of points</a></li>
|
||||
<li><a href="#org1cf6288">1.2.2. Point coordinates</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org6f7289a">1.3. Initialization functions</a></li>
|
||||
<li><a href="#org8c2cf05">1.4. Test</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgc75c6ad" class="outline-2">
|
||||
<h2 id="orgc75c6ad"><span class="section-number-2">1</span> Context</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<p>
|
||||
The following data stored in the context:
|
||||
</p>
|
||||
|
||||
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
|
||||
|
||||
|
||||
<colgroup>
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
|
||||
<col class="org-left" />
|
||||
</colgroup>
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="org-left">Variable</th>
|
||||
<th scope="col" class="org-left">Type</th>
|
||||
<th scope="col" class="org-left">Description</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td class="org-left"><code>num</code></td>
|
||||
<td class="org-left"><code>int64_t</code></td>
|
||||
<td class="org-left">Total number of points</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>date</code></td>
|
||||
<td class="org-left"><code>uint64_t</code></td>
|
||||
<td class="org-left">Last modification date of the coordinates</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td class="org-left"><code>coord</code></td>
|
||||
<td class="org-left"><code>qmckl_matrix</code></td>
|
||||
<td class="org-left"><code>num</code> × 3 matrix</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p>
|
||||
We consider that the matrix is stored 'transposed' and 'normal'
|
||||
corresponds to the 3 × <code>num</code> matrix.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgf29ec54" class="outline-3">
|
||||
<h3 id="orgf29ec54"><span class="section-number-3">1.1</span> Data structure</h3>
|
||||
<div class="outline-text-3" id="text-1-1">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #a020f0;">typedef</span> <span style="color: #a020f0;">struct</span> <span style="color: #228b22;">qmckl_point_struct</span> {
|
||||
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">num</span>;
|
||||
<span style="color: #228b22;">uint64_t</span> <span style="color: #a0522d;">date</span>;
|
||||
<span style="color: #228b22;">qmckl_matrix</span> <span style="color: #a0522d;">coord</span>;
|
||||
} <span style="color: #228b22;">qmckl_point_struct</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_point</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_point</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>);
|
||||
|
||||
memset(&(ctx->point), 0, <span style="color: #a020f0;">sizeof</span>(qmckl_point_struct));
|
||||
|
||||
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org66ce541" class="outline-3">
|
||||
<h3 id="org66ce541"><span class="section-number-3">1.2</span> Access functions</h3>
|
||||
<div class="outline-text-3" id="text-1-2">
|
||||
<p>
|
||||
Access functions return <code>QMCKL_SUCCESS</code> when the data has been
|
||||
successfully retrieved. They return <code>QMCKL_INVALID_CONTEXT</code> when
|
||||
the context is not a valid context. If the function returns
|
||||
successfully, the variable pointed by the pointer given in argument
|
||||
contains the requested data. Otherwise, this variable is untouched.
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org5679c4f" class="outline-4">
|
||||
<h4 id="org5679c4f"><span class="section-number-4">1.2.1</span> Number of points</h4>
|
||||
<div class="outline-text-4" id="text-1-2-1">
|
||||
<p>
|
||||
Returns the number of points stored in the context.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
|
||||
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>) <span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_get_point_num</span>(context, 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> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
|
||||
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(out) ::<span style="color: #a0522d;"> num</span>
|
||||
<span style="color: #a020f0;">end function</span>
|
||||
<span style="color: #a020f0;">end interface</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org1cf6288" class="outline-4">
|
||||
<h4 id="org1cf6288"><span class="section-number-4">1.2.2</span> Point coordinates</h4>
|
||||
<div class="outline-text-4" id="text-1-2-2">
|
||||
<p>
|
||||
Returns the point coordinates as sequences of (x,y,z).
|
||||
The pointer is assumed to point on a memory block of size
|
||||
<code>size_max</code> ≥ <code>3 * point_num</code>.
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
|
||||
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>) <span style="color: #a020f0;">function</span> <span style="color: #0000ff;">qmckl_get_point</span>(context, transp, coord, 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> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
|
||||
<span style="color: #228b22;">character</span>(<span style="color: #008b8b;">c_char</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> transp</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;"> coord(*)</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;"> size_max</span>
|
||||
<span style="color: #a020f0;">end function</span>
|
||||
<span style="color: #a020f0;">end interface</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="outline-container-org6f7289a" class="outline-3">
|
||||
<h3 id="org6f7289a"><span class="section-number-3">1.3</span> Initialization functions</h3>
|
||||
<div class="outline-text-3" id="text-1-3">
|
||||
<p>
|
||||
When the data is set in the context, if the arrays are large
|
||||
enough, we overwrite the data contained in them.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To set the data relative to the points in the context, one of the
|
||||
following functions need to be called. Here, <code>num</code> is the number of
|
||||
points to set.
|
||||
</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_point</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transp</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">num</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Copy a sequence of <code>num</code> points \((x,y,z)\) into the context.
|
||||
</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_point</span> (<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span> <span style="color: #a0522d;">transp</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">num</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span>,
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>)
|
||||
{
|
||||
|
||||
<span style="color: #a020f0;">if</span> (qmckl_context_check(context) == QMCKL_NULL_CONTEXT) {
|
||||
<span style="color: #a020f0;">return</span> QMCKL_NULL_CONTEXT;
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">if</span> (size_max < 3*num) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_4,
|
||||
<span style="color: #8b2252;">"qmckl_set_point"</span>,
|
||||
<span style="color: #8b2252;">"Array too small"</span>);
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">if</span> (transp != <span style="color: #8b2252;">'N'</span> && transp != <span style="color: #8b2252;">'T'</span>) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_2,
|
||||
<span style="color: #8b2252;">"qmckl_set_point"</span>,
|
||||
<span style="color: #8b2252;">"transp should be 'N' or 'T'"</span>);
|
||||
}
|
||||
|
||||
<span style="color: #a020f0;">if</span> (coord == <span style="color: #008b8b;">NULL</span>) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
||||
QMCKL_INVALID_ARG_3,
|
||||
<span style="color: #8b2252;">"qmckl_set_point"</span>,
|
||||
<span style="color: #8b2252;">"coord is a NULL pointer"</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>);
|
||||
|
||||
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
||||
<span style="color: #a020f0;">if</span> (num != ctx->point.num) {
|
||||
|
||||
<span style="color: #a020f0;">if</span> (ctx->point.coord.data != <span style="color: #008b8b;">NULL</span>) {
|
||||
rc = qmckl_matrix_free(context, &(ctx->point.coord));
|
||||
assert (rc == QMCKL_SUCCESS);
|
||||
}
|
||||
|
||||
ctx->point.coord = qmckl_matrix_alloc(context, num, 3);
|
||||
<span style="color: #a020f0;">if</span> (ctx->point.coord.data == <span style="color: #008b8b;">NULL</span>) {
|
||||
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
||||
QMCKL_ALLOCATION_FAILED,
|
||||
<span style="color: #8b2252;">"qmckl_set_point"</span>,
|
||||
<span style="color: #008b8b;">NULL</span>);
|
||||
}
|
||||
};
|
||||
|
||||
ctx->point.num = num;
|
||||
|
||||
<span style="color: #a020f0;">if</span> (transp == <span style="color: #8b2252;">'T'</span>) {
|
||||
<span style="color: #228b22;">double</span> *<span style="color: #a0522d;">a</span> = ctx->point.coord.data;
|
||||
<span style="color: #483d8b;">#ifdef</span> HAVE_OPENMP
|
||||
<span style="color: #483d8b;"> #pragma</span> omp <span style="color: #a020f0;">for</span>
|
||||
<span style="color: #483d8b;">#endif</span>
|
||||
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">i</span>=0 ; i<3*num ; ++i) {
|
||||
a[i] = coord[i];
|
||||
}
|
||||
} <span style="color: #a020f0;">else</span> {
|
||||
<span style="color: #483d8b;">#ifdef</span> HAVE_OPENMP
|
||||
<span style="color: #483d8b;"> #pragma</span> omp <span style="color: #a020f0;">for</span>
|
||||
<span style="color: #483d8b;">#endif</span>
|
||||
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">i</span>=0 ; i<num ; ++i) {
|
||||
qmckl_mat(ctx->point.coord, i, 0) = coord[3*i ];
|
||||
qmckl_mat(ctx->point.coord, i, 1) = coord[3*i+1];
|
||||
qmckl_mat(ctx->point.coord, i, 2) = coord[3*i+2];
|
||||
}
|
||||
}
|
||||
|
||||
/* <span style="color: #b22222;">Increment the date of the context </span>*/
|
||||
rc = qmckl_context_touch(context);
|
||||
assert (rc == QMCKL_SUCCESS);
|
||||
|
||||
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
||||
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"><span style="color: #a020f0;">interface</span>
|
||||
<span style="color: #228b22;">integer</span>(<span style="color: #008b8b;">c_int32_t</span>)<span style="color: #a0522d;"> function qmckl_set_point(context, </span><span style="color: #a020f0;">&</span>
|
||||
transp, num, coord, 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> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> context</span>
|
||||
<span style="color: #228b22;">character</span>(<span style="color: #008b8b;">c_char</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> transp</span>
|
||||
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> num</span>
|
||||
<span style="color: #228b22;">real</span> (<span style="color: #008b8b;">c_double</span> ) , <span style="color: #a020f0;">intent</span>(in) ::<span style="color: #a0522d;"> coord(*)</span>
|
||||
<span style="color: #228b22;">integer</span> (<span style="color: #008b8b;">c_int64_t</span>) , <span style="color: #a020f0;">intent</span>(in) , <span style="color: #a020f0;">value</span> ::<span style="color: #a0522d;"> size_max</span>
|
||||
<span style="color: #a020f0;">end function</span>
|
||||
<span style="color: #a020f0;">end interface</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="outline-container-org8c2cf05" class="outline-3">
|
||||
<h3 id="org8c2cf05"><span class="section-number-3">1.4</span> Test</h3>
|
||||
<div class="outline-text-3" id="text-1-4">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c">/* <span style="color: #b22222;">Reference input data </span>*/
|
||||
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">point_num</span> = chbrclf_elec_num;
|
||||
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coord</span> = &(chbrclf_elec_coord[0][0][0]);
|
||||
|
||||
/* <span style="color: #b22222;">--- </span>*/
|
||||
|
||||
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">coord2</span>[point_num*3];
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">coord3</span>[point_num*3];
|
||||
|
||||
|
||||
rc = qmckl_get_point (context, <span style="color: #8b2252;">'N'</span>, coord2, (point_num*3));
|
||||
<span style="color: #0000ff;">assert</span>(rc == QMCKL_NOT_PROVIDED);
|
||||
|
||||
rc = qmckl_set_point (context, <span style="color: #8b2252;">'N'</span>, point_num, coord, (point_num*3));
|
||||
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
|
||||
|
||||
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">n</span>;
|
||||
rc = qmckl_get_point_num (context, &n);
|
||||
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
|
||||
<span style="color: #0000ff;">assert</span>(n == point_num);
|
||||
|
||||
rc = qmckl_get_point (context, <span style="color: #8b2252;">'N'</span>, coord2, (point_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*point_num ; ++i) {
|
||||
assert( coord[i] == coord2[i] );
|
||||
}
|
||||
|
||||
rc = qmckl_get_point (context, <span style="color: #8b2252;">'T'</span>, coord2, (point_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<point_num ; ++i) {
|
||||
assert( coord[3*i+0] == coord2[i] );
|
||||
assert( coord[3*i+1] == coord2[i+point_num] );
|
||||
assert( coord[3*i+2] == coord2[i+point_num*2] );
|
||||
}
|
||||
|
||||
rc = qmckl_set_point (context, <span style="color: #8b2252;">'T'</span>, point_num, coord2, (point_num*3));
|
||||
<span style="color: #0000ff;">assert</span>(rc == QMCKL_SUCCESS);
|
||||
|
||||
rc = qmckl_get_point (context, <span style="color: #8b2252;">'N'</span>, coord3, (point_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*point_num ; ++i) {
|
||||
assert( coord[i] == coord3[i] );
|
||||
}
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX CoE</p>
|
||||
<p class="date">Created: 2022-09-28 Wed 07:38</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
File diff suppressed because it is too large
Load Diff
60580
qmckl_tests.html
60580
qmckl_tests.html
File diff suppressed because it is too large
Load Diff
1784
qmckl_trexio.html
1784
qmckl_trexio.html
File diff suppressed because it is too large
Load Diff
@ -1,666 +0,0 @@
|
||||
<?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>
|
||||
<!-- 2022-09-28 Wed 07:38 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Verificarlo CI</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; }
|
||||
.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-2019 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-2019 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-2019 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>
|
||||
</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">Verificarlo CI</h1>
|
||||
<div id="table-of-contents">
|
||||
<h2>Table of Contents</h2>
|
||||
<div id="text-table-of-contents">
|
||||
<ul>
|
||||
<li><a href="#org1c5cd12">1. Verificarlo probes</a>
|
||||
<ul>
|
||||
<li><a href="#org37289c3">1.1. Automatically initialize the <code>vfc_probe</code> object if <code>VFC_CI</code> is defined</a></li>
|
||||
<li><a href="#org9cf505d">1.2. Standard probe, without check</a></li>
|
||||
<li><a href="#org9859c43">1.3. Probe with absolute check</a></li>
|
||||
<li><a href="#org52a61ea">1.4. Probe with relative check</a></li>
|
||||
<li><a href="#org215a494">1.5. Automatically delete and dump the vfc<sub>probe</sub> object if <code>VFC_CI</code> is defined</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org67e0f90">2. Fortran wrappers</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org1c5cd12" class="outline-2">
|
||||
<h2 id="org1c5cd12"><span class="section-number-2">1</span> Verificarlo probes</h2>
|
||||
<div class="outline-text-2" id="text-1">
|
||||
<p>
|
||||
This file contains utility functions to enable the Verificarlo
|
||||
Continuous Integration system (<code>VFC_CI</code>).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
It is a wrapper to Verificarlo's <code>vfc_probes</code> system. The goal of QMCkl
|
||||
probes is to simplify the use of <code>vfc_probes</code>, and to provide functions that
|
||||
can be called either with or without <code>VFC_CI</code> support by using <code>#ifndef</code>
|
||||
statements :
|
||||
</p>
|
||||
|
||||
<ul class="org-ul">
|
||||
<li>when <code>VFC_CI</code> is disabled, the functions will either return <code>false</code>
|
||||
(no error) or perform a check based on a reference value</li>
|
||||
|
||||
<li>when <code>VFC_CI</code> is enabled, the functions will simply encapsulate</li>
|
||||
</ul>
|
||||
<p>
|
||||
calls to <code>vfc_probe</code>.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
Moreover, one does not have to worry about the life cycle of the probes
|
||||
structure, as it is automatically created, dumped and freed by this wrapper.
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<code>VFC_CI</code> support can be enabled by using the following configure command :
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-bash"><span style="color: #a0522d;">QMCKL_DEVEL</span>=1 ./configure --prefix=$<span style="color: #a0522d;">PWD</span>/_install --enable-silent-rules <span style="color: #8b2252;">\</span>
|
||||
--enable-maintainer-mode <span style="color: #a0522d;">CC</span>=verificarlo-f <span style="color: #a0522d;">FC</span>=verificarlo-f --host=x86_64
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<p>
|
||||
Finally, this wrapper also comes with a Fortran interface (in its dedicated
|
||||
file).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
To learn more about Verificarlo CI :
|
||||
<a href="https://github.com/verificarlo/verificarlo/blob/master/doc/06-Postprocessing.md#verificarlo-ci">https://github.com/verificarlo/verificarlo/blob/master/doc/06-Postprocessing.md#verificarlo-ci</a>
|
||||
</p>
|
||||
</div>
|
||||
|
||||
|
||||
<div id="outline-container-org37289c3" class="outline-3">
|
||||
<h3 id="org37289c3"><span class="section-number-3">1.1</span> Automatically initialize the <code>vfc_probe</code> object if <code>VFC_CI</code> is defined</h3>
|
||||
<div class="outline-text-3" id="text-1-1">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">void</span> <span style="color: #0000ff;">qmckl_init_probes</span>();
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">void</span> <span style="color: #0000ff;">qmckl_init_probes</span>(){
|
||||
<span style="color: #483d8b;">#ifdef</span> VFC_CI
|
||||
probes = vfc_init_probes();
|
||||
<span style="color: #483d8b;">#endif</span>
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org9cf505d" class="outline-3">
|
||||
<h3 id="org9cf505d"><span class="section-number-3">1.2</span> Standard probe, without check</h3>
|
||||
<div class="outline-text-3" id="text-1-2">
|
||||
<ul class="org-ul">
|
||||
<li>if <code>VFC_CI</code> is defined, place a standard probe</li>
|
||||
<li><p>
|
||||
if <code>VFC_CI</code> is undefined, return <code>false</code> (no error)
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">value</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">value</span>)
|
||||
{
|
||||
<span style="color: #483d8b;">#ifdef</span> VFC_CI
|
||||
<span style="color: #a020f0;">return</span> vfc_probe(&probes, testName, varName, value);
|
||||
<span style="color: #483d8b;">#else</span>
|
||||
<span style="color: #a020f0;">return</span> <span style="color: #008b8b;">false</span>;
|
||||
<span style="color: #483d8b;">#endif</span>
|
||||
}
|
||||
</pre>
|
||||
</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org9859c43" class="outline-3">
|
||||
<h3 id="org9859c43"><span class="section-number-3">1.3</span> Probe with absolute check</h3>
|
||||
<div class="outline-text-3" id="text-1-3">
|
||||
<ul class="org-ul">
|
||||
<li>if <code>VFC_CI</code> is defined, place a probe with an absolute check</li>
|
||||
<li><p>
|
||||
if <code>VFC_CI</code> is undefined, perform an absolute check based on target value
|
||||
and accuracy
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe_check</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">value</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">expectedValue</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">accuracyTarget</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe_check</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">value</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">expectedValue</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">accuracyTarget</span>)
|
||||
{
|
||||
<span style="color: #483d8b;">#ifdef</span> VFC_CI
|
||||
<span style="color: #a020f0;">return</span> vfc_probe_check(&probes, testName, varName, value, accuracyTarget);
|
||||
<span style="color: #483d8b;">#else</span>
|
||||
<span style="color: #a020f0;">return</span> !(fabs(value - expectedValue) < accuracyTarget);
|
||||
<span style="color: #483d8b;">#endif</span>
|
||||
}
|
||||
</pre>
|
||||
</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org52a61ea" class="outline-3">
|
||||
<h3 id="org52a61ea"><span class="section-number-3">1.4</span> Probe with relative check</h3>
|
||||
<div class="outline-text-3" id="text-1-4">
|
||||
<ul class="org-ul">
|
||||
<li>if <code>VFC_CI</code> is defined, place a probe with a relative check</li>
|
||||
<li><p>
|
||||
if <code>VFC_CI</code> is undefined, perform a relative check based on target value
|
||||
and accuracy
|
||||
</p>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe_check_relative</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">value</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">expectedValue</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">accuracyTarget</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe_check_relative</span> (
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">value</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">expectedValue</span>,
|
||||
<span style="color: #228b22;">double</span> <span style="color: #a0522d;">accuracyTarget</span>)
|
||||
{
|
||||
<span style="color: #483d8b;">#ifdef</span> VFC_CI
|
||||
<span style="color: #a020f0;">return</span> vfc_probe_check_relative(&probes, testName, varName, value, accuracyTarget);
|
||||
<span style="color: #483d8b;">#else</span>
|
||||
<span style="color: #a020f0;">return</span> !(fabs(value - expectedValue) / fabs(expectedValue) < accuracyTarget);
|
||||
<span style="color: #483d8b;">#endif</span>
|
||||
}
|
||||
</pre>
|
||||
</div></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org215a494" class="outline-3">
|
||||
<h3 id="org215a494"><span class="section-number-3">1.5</span> Automatically delete and dump the vfc<sub>probe</sub> object if <code>VFC_CI</code> is defined</h3>
|
||||
<div class="outline-text-3" id="text-1-5">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">void</span> <span style="color: #0000ff;">qmckl_dump_probes</span>();
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">void</span> <span style="color: #0000ff;">qmckl_dump_probes</span>(){
|
||||
<span style="color: #483d8b;">#ifdef</span> VFC_CI
|
||||
vfc_dump_probes(&probes);
|
||||
<span style="color: #483d8b;">#endif</span>
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org67e0f90" class="outline-2">
|
||||
<h2 id="org67e0f90"><span class="section-number-2">2</span> Fortran wrappers</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe_f</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">value</span>
|
||||
);
|
||||
|
||||
<span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe_check_f</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">value</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">expectedValue</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">accuracyTarget</span>
|
||||
);
|
||||
|
||||
|
||||
<span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe_check_relative_f</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">value</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">expectedValue</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">accuracyTarget</span>
|
||||
);
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-c"><span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe_f</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">value</span>)
|
||||
{
|
||||
<span style="color: #a020f0;">return</span> qmckl_probe(testName, varName, *value);
|
||||
}
|
||||
|
||||
|
||||
<span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe_check_f</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">value</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">expectedValue</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">accuracyTarget</span>)
|
||||
{
|
||||
<span style="color: #a020f0;">return</span> qmckl_probe_check(
|
||||
testName, varName,
|
||||
*value, *expectedValue, *accuracyTarget
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
<span style="color: #228b22;">bool</span> <span style="color: #0000ff;">qmckl_probe_check_relative_f</span>(
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">testName</span>,
|
||||
<span style="color: #228b22;">char</span> * <span style="color: #a0522d;">varName</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">value</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">expectedValue</span>,
|
||||
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">accuracyTarget</span>)
|
||||
{
|
||||
<span style="color: #a020f0;">return</span> qmckl_probe_check_relative(
|
||||
testName, varName,
|
||||
*value, *expectedValue, *accuracyTarget
|
||||
);
|
||||
}
|
||||
</pre>
|
||||
</div>
|
||||
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-f90"><span style="color: #a020f0;">module</span> <span style="color: #0000ff;">qmckl_verificarlo_f</span>
|
||||
<span style="color: #a020f0;">interface</span>
|
||||
<span style="color: #228b22;">logical</span>(<span style="color: #008b8b;">c_bool</span>)<span style="color: #a0522d;"> function qmckl_probe </span><span style="color: #a020f0;">&</span>
|
||||
(testName, varName, val) <span style="color: #a020f0;">&</span>
|
||||
<span style="color: #a020f0;">bind</span>(C, name=<span style="color: #8b2252;">"qmckl_probe_f"</span>)
|
||||
|
||||
<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;">character</span>(<span style="color: #008b8b;">C_CHAR</span>), <span style="color: #a020f0;">dimension</span>(*) ::<span style="color: #a0522d;"> testName</span>
|
||||
<span style="color: #228b22;">character</span>(<span style="color: #008b8b;">C_CHAR</span>), <span style="color: #a020f0;">dimension</span>(*) ::<span style="color: #a0522d;"> varName</span>
|
||||
|
||||
<span style="color: #228b22;">real</span>(<span style="color: #008b8b;">C_DOUBLE</span>) ::<span style="color: #a0522d;"> val</span>
|
||||
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_probe</span>
|
||||
|
||||
<span style="color: #228b22;">logical</span>(<span style="color: #008b8b;">c_bool</span>)<span style="color: #a0522d;"> function qmckl_probe_check </span><span style="color: #a020f0;">&</span>
|
||||
(testName, varName, val, expectedValue, accuracyTarget) <span style="color: #a020f0;">&</span>
|
||||
<span style="color: #a020f0;">bind</span>(C, name=<span style="color: #8b2252;">"qmckl_probe_check_f"</span>)
|
||||
|
||||
<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;">character</span>(<span style="color: #008b8b;">C_CHAR</span>), <span style="color: #a020f0;">dimension</span>(*) ::<span style="color: #a0522d;"> testName</span>
|
||||
<span style="color: #228b22;">character</span>(<span style="color: #008b8b;">C_CHAR</span>), <span style="color: #a020f0;">dimension</span>(*) ::<span style="color: #a0522d;"> varName</span>
|
||||
|
||||
<span style="color: #228b22;">real</span>(<span style="color: #008b8b;">C_DOUBLE</span>) ::<span style="color: #a0522d;"> val</span>
|
||||
<span style="color: #228b22;">real</span>(<span style="color: #008b8b;">C_DOUBLE</span>) ::<span style="color: #a0522d;"> expectedValue</span>
|
||||
<span style="color: #228b22;">real</span>(<span style="color: #008b8b;">C_DOUBLE</span>) ::<span style="color: #a0522d;"> accuracyTarget</span>
|
||||
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_probe_check</span>
|
||||
|
||||
<span style="color: #228b22;">logical</span>(<span style="color: #008b8b;">c_bool</span>)<span style="color: #a0522d;"> function qmckl_probe_check_relative </span><span style="color: #a020f0;">&</span>
|
||||
(testName, varName, val, expectedValue, accuracyTarget) <span style="color: #a020f0;">&</span>
|
||||
<span style="color: #a020f0;">bind</span>(C, name=<span style="color: #8b2252;">"qmckl_probe_check_relative_f"</span>)
|
||||
|
||||
<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;">character</span>(<span style="color: #008b8b;">C_CHAR</span>), <span style="color: #a020f0;">dimension</span>(*) ::<span style="color: #a0522d;"> testName</span>
|
||||
<span style="color: #228b22;">character</span>(<span style="color: #008b8b;">C_CHAR</span>), <span style="color: #a020f0;">dimension</span>(*) ::<span style="color: #a0522d;"> varName</span>
|
||||
|
||||
<span style="color: #228b22;">real</span>(<span style="color: #008b8b;">C_DOUBLE</span>) ::<span style="color: #a0522d;"> val</span>
|
||||
<span style="color: #228b22;">real</span>(<span style="color: #008b8b;">C_DOUBLE</span>) ::<span style="color: #a0522d;"> expectedValue</span>
|
||||
<span style="color: #228b22;">real</span>(<span style="color: #008b8b;">C_DOUBLE</span>) ::<span style="color: #a0522d;"> accuracyTarget</span>
|
||||
<span style="color: #a020f0;">end function</span> <span style="color: #0000ff;">qmckl_probe_check_relative</span>
|
||||
<span style="color: #a020f0;">end interface</span>
|
||||
<span style="color: #a020f0;">end module</span> <span style="color: #0000ff;">qmckl_verificarlo_f</span>
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: TREX CoE</p>
|
||||
<p class="date">Created: 2022-09-28 Wed 07:38</p>
|
||||
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
Loading…
x
Reference in New Issue
Block a user