2021-10-14 19:50:49 +02:00
|
|
|
<?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-06-11 10:59:32 +02:00
|
|
|
<!-- 2022-06-11 Sat 08:59 -->
|
2021-10-14 19:50:49 +02:00
|
|
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
|
|
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
|
|
|
<title>TREXIO I/O library</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">TREXIO I/O library</h1>
|
|
|
|
<div id="table-of-contents">
|
|
|
|
<h2>Table of Contents</h2>
|
|
|
|
<div id="text-table-of-contents">
|
|
|
|
<ul>
|
2022-06-11 10:59:32 +02:00
|
|
|
<li><a href="#org111051c">1. Local functions</a>
|
2021-10-14 19:50:49 +02:00
|
|
|
<ul>
|
2022-06-11 10:59:32 +02:00
|
|
|
<li><a href="#org0e4efab">1.1. Open file</a></li>
|
|
|
|
<li><a href="#orgf83e99c">1.2. Electron</a></li>
|
|
|
|
<li><a href="#orge2cfdfe">1.3. Nucleus</a>
|
2021-10-14 19:50:49 +02:00
|
|
|
<ul>
|
2022-06-11 10:59:32 +02:00
|
|
|
<li><a href="#org663f63e">1.3.1. Number of nuclei</a></li>
|
|
|
|
<li><a href="#org5b5b9af">1.3.2. Nuclear charges</a></li>
|
|
|
|
<li><a href="#org911e1cb">1.3.3. Nuclear coordinates</a></li>
|
2021-10-14 19:50:49 +02:00
|
|
|
</ul>
|
|
|
|
</li>
|
2022-06-11 10:59:32 +02:00
|
|
|
<li><a href="#org47ab600">1.4. Basis set and AOs</a>
|
2021-10-14 19:50:49 +02:00
|
|
|
<ul>
|
2022-06-11 10:59:32 +02:00
|
|
|
<li><a href="#org03cafa8">1.4.1. Basis set type</a></li>
|
|
|
|
<li><a href="#org28887c9">1.4.2. Number of shells</a></li>
|
|
|
|
<li><a href="#orge48ebfe">1.4.3. Number of primitives</a></li>
|
|
|
|
<li><a href="#org6b1959b">1.4.4. Number of atomic orbitals</a></li>
|
|
|
|
<li><a href="#org3e9bc44">1.4.5. Nucleus<sub>index</sub> array</a></li>
|
|
|
|
<li><a href="#orge5bbb07">1.4.6. Number of shells per nucleus</a></li>
|
|
|
|
<li><a href="#orgf0a6d91">1.4.7. Angular momentum</a></li>
|
|
|
|
<li><a href="#org8f68ed7">1.4.8. Number of primitives per shell</a></li>
|
|
|
|
<li><a href="#org71b92a5">1.4.9. Indices of the primitives</a></li>
|
|
|
|
<li><a href="#orgd2201a9">1.4.10. Normalization of the shells</a></li>
|
|
|
|
<li><a href="#orge84071e">1.4.11. Exponents</a></li>
|
|
|
|
<li><a href="#org38fa96b">1.4.12. Coefficients</a></li>
|
|
|
|
<li><a href="#orga291cd6">1.4.13. Normalization of the primitivies</a></li>
|
|
|
|
<li><a href="#org23406a3">1.4.14. AO Normalization</a></li>
|
2021-10-14 19:50:49 +02:00
|
|
|
</ul>
|
|
|
|
</li>
|
2022-06-11 10:59:32 +02:00
|
|
|
<li><a href="#org0d53d0e">1.5. Molecular orbitals</a>
|
2021-10-14 19:50:49 +02:00
|
|
|
<ul>
|
2022-06-11 10:59:32 +02:00
|
|
|
<li><a href="#orgfe4a464">1.5.1. Number of MOs</a></li>
|
|
|
|
<li><a href="#org4820ebf">1.5.2. MO coefficients</a></li>
|
2021-10-14 19:50:49 +02:00
|
|
|
</ul>
|
|
|
|
</li>
|
2022-06-11 10:59:32 +02:00
|
|
|
<li><a href="#org6413b2e">1.6. <span class="todo TODO">TODO</span> ECP</a></li>
|
2021-10-14 19:50:49 +02:00
|
|
|
</ul>
|
|
|
|
</li>
|
2022-06-11 10:59:32 +02:00
|
|
|
<li><a href="#orge141c13">2. Read everything</a></li>
|
|
|
|
<li><a href="#org83ac57b">3. Test</a>
|
2021-10-14 19:50:49 +02:00
|
|
|
<ul>
|
|
|
|
<li>
|
|
|
|
<ul>
|
2022-06-11 10:59:32 +02:00
|
|
|
<li><a href="#orgd4d31e9">3.0.1. Electrons</a></li>
|
|
|
|
<li><a href="#orgae3d018">3.0.2. Nuclei</a></li>
|
|
|
|
<li><a href="#org724ec01">3.0.3. Atomic basis</a></li>
|
|
|
|
<li><a href="#org31c6213">3.0.4. MO Basis</a></li>
|
2021-10-14 19:50:49 +02:00
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org111051c" class="outline-2">
|
|
|
|
<h2 id="org111051c"><span class="section-number-2">1</span> Local functions</h2>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-2" id="text-1">
|
|
|
|
<p>
|
|
|
|
Functions defined in this section are all local: they should not be
|
|
|
|
exposed in the API. To identify them, we append <code>_X</code> to
|
|
|
|
their name.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
Users are not able to call directly these functions, so by
|
|
|
|
construction the context can't be <code>NULL</code>, hence we can check this
|
|
|
|
with an <code>assert</code> statement.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<p>
|
|
|
|
In the functions defined in this section, we use as local variables
|
|
|
|
</p>
|
|
|
|
<ul class="org-ul">
|
|
|
|
<li><code>rc</code>: the return code for QMCkl functions</li>
|
|
|
|
<li><code>rcio</code>: the return code for TREXIO functions.</li>
|
|
|
|
</ul>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org0e4efab" class="outline-3">
|
|
|
|
<h3 id="org0e4efab"><span class="section-number-3">1.1</span> Open file</h3>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-3" id="text-1-1">
|
|
|
|
<p>
|
|
|
|
We first define a helper function to open a file by first trying to
|
|
|
|
use the TEXT back end, and then the HDF5 back end. If both
|
|
|
|
strategies fail, a <code>NULL</code> pointer is returned. This will allow to
|
|
|
|
open only once the file and call multiple small functions to read
|
|
|
|
groups of data by passing the <code>trexio_t</code> handle.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #483d8b;">#ifdef</span> HAVE_TREXIO
|
|
|
|
<span style="color: #228b22;">trexio_t</span>* <span style="color: #0000ff;">qmckl_trexio_open_X</span>(<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">file_name</span>, <span style="color: #228b22;">qmckl_exit_code</span>* <span style="color: #a0522d;">rc</span>)
|
|
|
|
{
|
|
|
|
*rc = QMCKL_SUCCESS;
|
|
|
|
<span style="color: #228b22;">trexio_t</span>* <span style="color: #a0522d;">file</span> = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
file = trexio_open(file_name, <span style="color: #8b2252;">'r'</span>, TREXIO_TEXT, rc);
|
|
|
|
<span style="color: #a020f0;">if</span> (file != <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> file;
|
|
|
|
|
|
|
|
file = trexio_open(file_name, <span style="color: #8b2252;">'r'</span>, TREXIO_HDF5, rc);
|
|
|
|
<span style="color: #a020f0;">if</span> (file != <span style="color: #008b8b;">NULL</span>) <span style="color: #a020f0;">return</span> file;
|
|
|
|
|
|
|
|
*rc = QMCKL_FAILURE;
|
|
|
|
<span style="color: #a020f0;">return</span> <span style="color: #008b8b;">NULL</span>;
|
|
|
|
}
|
|
|
|
<span style="color: #483d8b;">#endif</span>
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orgf83e99c" class="outline-3">
|
|
|
|
<h3 id="orgf83e99c"><span class="section-number-3">1.2</span> Electron</h3>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-3" id="text-1-2">
|
|
|
|
<p>
|
|
|
|
In this section we read all the data into the electron data structure.
|
|
|
|
We read the number of up-spin and down-spin electrons.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #483d8b;">#ifdef</span> HAVE_TREXIO
|
|
|
|
<span style="color: #228b22;">qmckl_exit_code</span>
|
|
|
|
<span style="color: #0000ff;">qmckl_trexio_read_electron_X</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
|
|
|
|
{
|
|
|
|
assert (context != (<span style="color: #228b22;">qmckl_context</span>) 0);
|
|
|
|
assert (file != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rcio</span> = 0;
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">up_num</span> = 0L;
|
|
|
|
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">dn_num</span> = 0L;
|
|
|
|
|
|
|
|
rcio = trexio_read_electron_up_num_64(file, &up_num);
|
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_electron_up_num"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (up_num >= 0L);
|
|
|
|
|
|
|
|
rcio = trexio_read_electron_dn_num_64(file, &dn_num);
|
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_electron_dn_num"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (dn_num >= 0L);
|
|
|
|
|
|
|
|
|
|
|
|
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
|
|
|
rc = qmckl_set_electron_num(context, up_num, dn_num);
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
<span style="color: #483d8b;">#endif</span>
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orge2cfdfe" class="outline-3">
|
|
|
|
<h3 id="orge2cfdfe"><span class="section-number-3">1.3</span> Nucleus</h3>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-3" id="text-1-3">
|
|
|
|
<p>
|
|
|
|
In this section we read the number of nuclei, the molecular geometry and nuclear charges.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #483d8b;">#ifdef</span> HAVE_TREXIO
|
|
|
|
<span style="color: #228b22;">qmckl_exit_code</span>
|
|
|
|
<span style="color: #0000ff;">qmckl_trexio_read_nucleus_X</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
|
|
|
|
{
|
|
|
|
assert (context != (<span style="color: #228b22;">qmckl_context</span>) 0);
|
|
|
|
assert (file != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
|
|
|
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rcio</span> = 0;
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org663f63e" class="outline-4">
|
|
|
|
<h4 id="org663f63e"><span class="section-number-4">1.3.1</span> Number of nuclei</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-3-1">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucleus_num</span> = 0L;
|
|
|
|
|
|
|
|
rcio = trexio_read_nucleus_num_64(file, &nucleus_num);
|
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_nucleus_num"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #0000ff;">assert</span> (nucleus_num > 0);
|
|
|
|
rc = qmckl_set_nucleus_num(context, nucleus_num);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org5b5b9af" class="outline-4">
|
|
|
|
<h4 id="org5b5b9af"><span class="section-number-4">1.3.2</span> Nuclear charges</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-3-2">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
|
|
|
mem_info.size = nucleus_num * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_charge</span> = (<span style="color: #228b22;">double</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (nucl_charge == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_nucleus_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (nucl_charge != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
rcio = trexio_read_safe_nucleus_charge_64(file, nucl_charge, nucleus_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_nucleus_charge"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-23 19:09:13 +01:00
|
|
|
rc = qmckl_set_nucleus_charge(context, nucl_charge, nucleus_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, nucl_charge);
|
|
|
|
nucl_charge = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org911e1cb" class="outline-4">
|
|
|
|
<h4 id="org911e1cb"><span class="section-number-4">1.3.3</span> Nuclear coordinates</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-3-3">
|
|
|
|
<p>
|
|
|
|
Now, we read the molecular geometry. It is stored in normal format
|
|
|
|
in the TREXIO file (<code>'N'</code>), so it will be automatically transposed internally.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
|
|
|
mem_info.size = nucleus_num * 3 * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">nucl_coord</span> = (<span style="color: #228b22;">double</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (nucl_coord == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_nucleus_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (nucl_coord != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
rcio = trexio_read_safe_nucleus_coord_64(file, nucl_coord, 3*nucleus_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_nucleus_charge"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-23 19:09:13 +01:00
|
|
|
rc = qmckl_set_nucleus_coord(context, <span style="color: #8b2252;">'N'</span>, nucl_coord, 3*nucleus_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, nucl_coord);
|
|
|
|
nucl_coord = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">
|
|
|
|
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
|
|
|
}
|
|
|
|
<span style="color: #483d8b;">#endif</span>
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org47ab600" class="outline-3">
|
|
|
|
<h3 id="org47ab600"><span class="section-number-3">1.4</span> Basis set and AOs</h3>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-3" id="text-1-4">
|
|
|
|
<p>
|
|
|
|
In this section we read the atomic basis set and atomic orbitals.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #483d8b;">#ifdef</span> HAVE_TREXIO
|
|
|
|
<span style="color: #228b22;">qmckl_exit_code</span>
|
|
|
|
<span style="color: #0000ff;">qmckl_trexio_read_ao_X</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
|
|
|
|
{
|
|
|
|
assert (context != (<span style="color: #228b22;">qmckl_context</span>) 0);
|
|
|
|
assert (file != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
|
|
|
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rcio</span> = 0;
|
|
|
|
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucleus_num</span> = 0L;
|
|
|
|
|
|
|
|
rc = qmckl_get_nucleus_num(context, &nucleus_num);
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org03cafa8" class="outline-4">
|
|
|
|
<h4 id="org03cafa8"><span class="section-number-4">1.4.1</span> Basis set type</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-1">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #483d8b;">#define</span> <span style="color: #a0522d;">MAX_STR_LEN</span> 1024
|
|
|
|
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">basis_type</span>[MAX_STR_LEN];
|
|
|
|
|
|
|
|
rcio = trexio_read_basis_type(file, basis_type, MAX_STR_LEN);
|
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_type"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (basis_type[0] == <span style="color: #8b2252;">'G'</span>) {
|
|
|
|
rc = qmckl_set_ao_basis_type(context, basis_type[0]);
|
|
|
|
} <span style="color: #a020f0;">else</span> {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_type"</span>,
|
|
|
|
<span style="color: #8b2252;">"Invalid basis type"</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org28887c9" class="outline-4">
|
|
|
|
<h4 id="org28887c9"><span class="section-number-4">1.4.2</span> Number of shells</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-2">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">shell_num</span> = 0L;
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
rcio = trexio_read_basis_shell_num_64(file, &shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_shell_num"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #0000ff;">assert</span> (shell_num > 0);
|
|
|
|
rc = qmckl_set_ao_basis_shell_num(context, shell_num);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orge48ebfe" class="outline-4">
|
|
|
|
<h4 id="orge48ebfe"><span class="section-number-4">1.4.3</span> Number of primitives</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-3">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">prim_num</span> = 0L;
|
|
|
|
|
|
|
|
rcio = trexio_read_basis_prim_num_64(file, &prim_num);
|
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_prim_num"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #0000ff;">assert</span> (prim_num > 0);
|
|
|
|
rc = qmckl_set_ao_basis_prim_num(context, prim_num);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org6b1959b" class="outline-4">
|
|
|
|
<h4 id="org6b1959b"><span class="section-number-4">1.4.4</span> Number of atomic orbitals</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-4">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ao_num</span> = 0LL;
|
|
|
|
|
|
|
|
rcio = trexio_read_ao_num_64(file, &ao_num);
|
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_ao_num"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #0000ff;">assert</span> (ao_num > 0);
|
|
|
|
rc = qmckl_set_ao_basis_ao_num(context, ao_num);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org3e9bc44" class="outline-4">
|
|
|
|
<h4 id="org3e9bc44"><span class="section-number-4">1.4.5</span> Nucleus<sub>index</sub> array</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-5">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Allocate array for data </span>*/
|
|
|
|
mem_info.size = nucleus_num * <span style="color: #a020f0;">sizeof</span>(int64_t);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_index</span> = (<span style="color: #228b22;">int64_t</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (nucleus_index == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_nucleus_index_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (nucleus_index != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Allocate temporary array </span>*/
|
|
|
|
mem_info.size = shell_num * <span style="color: #a020f0;">sizeof</span>(int64_t);
|
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">tmp_array</span> = (<span style="color: #228b22;">int64_t</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (tmp_array == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
qmckl_free(context, nucleus_index);
|
|
|
|
nucleus_index = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_nucleus_index_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (tmp_array != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Read in the temporary array </span>*/
|
|
|
|
rcio = trexio_read_safe_basis_nucleus_index_64(file, tmp_array, shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
2022-01-06 18:56:24 +01:00
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
qmckl_free(context, nucleus_index);
|
|
|
|
nucleus_index = <span style="color: #008b8b;">NULL</span>;
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_nucleus_index"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Reformat data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_nucleus_index(context, nucleus_index, nucleus_num);
|
2022-02-16 19:41:45 +01:00
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS) {
|
|
|
|
qmckl_free(context, nucleus_index);
|
|
|
|
nucleus_index = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
2022-01-06 18:56:24 +01:00
|
|
|
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=shell_num-1 ; i>=0 ; --i) {
|
|
|
|
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span> = tmp_array[i];
|
|
|
|
<span style="color: #a020f0;">if</span> (k < 0 || k >= nucleus_num) {
|
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
qmckl_free(context, nucleus_index);
|
|
|
|
nucleus_index = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_nucleus_index"</span>,
|
|
|
|
<span style="color: #8b2252;">"Irrelevant data in TREXIO file"</span>);
|
|
|
|
}
|
|
|
|
nucleus_index[k] = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Store data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_nucleus_index(context, nucleus_index, shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, nucleus_index);
|
|
|
|
nucleus_index = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orge5bbb07" class="outline-4">
|
|
|
|
<h4 id="orge5bbb07"><span class="section-number-4">1.4.6</span> Number of shells per nucleus</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-6">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Allocate array for data </span>*/
|
|
|
|
mem_info.size = nucleus_num * <span style="color: #a020f0;">sizeof</span>(int64_t);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_shell_num</span> = (<span style="color: #228b22;">int64_t</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (nucleus_shell_num == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_nucleus_shell_num_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (nucleus_shell_num != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Allocate temporary array </span>*/
|
|
|
|
mem_info.size = shell_num * <span style="color: #a020f0;">sizeof</span>(int64_t);
|
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">tmp_array</span> = (<span style="color: #228b22;">int64_t</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (tmp_array == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
qmckl_free(context, nucleus_shell_num);
|
|
|
|
nucleus_shell_num = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_nucleus_shell_num_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (tmp_array != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Read in the temporary array </span>*/
|
|
|
|
rcio = trexio_read_safe_basis_nucleus_index_64(file, tmp_array, shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
2022-01-06 18:56:24 +01:00
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
qmckl_free(context, nucleus_shell_num);
|
|
|
|
nucleus_shell_num = <span style="color: #008b8b;">NULL</span>;
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_nucleus_shell_num"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Reformat data </span>*/
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<nucleus_num ; ++i) {
|
|
|
|
nucleus_shell_num[i] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<shell_num ; ++i) {
|
|
|
|
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span> = tmp_array[i];
|
|
|
|
<span style="color: #a020f0;">if</span> (k < 0 || k >= nucleus_num) {
|
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
qmckl_free(context, nucleus_shell_num);
|
|
|
|
nucleus_shell_num = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_nucleus_shell_num"</span>,
|
|
|
|
<span style="color: #8b2252;">"Irrelevant data in TREXIO file"</span>);
|
|
|
|
}
|
|
|
|
nucleus_shell_num[k] += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Store data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_nucleus_shell_num(context, nucleus_shell_num, shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, nucleus_shell_num);
|
|
|
|
nucleus_shell_num = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orgf0a6d91" class="outline-4">
|
|
|
|
<h4 id="orgf0a6d91"><span class="section-number-4">1.4.7</span> Angular momentum</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-7">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
2022-01-06 18:56:24 +01:00
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Allocate array for data </span>*/
|
2021-10-14 19:50:49 +02:00
|
|
|
mem_info.size = shell_num * <span style="color: #a020f0;">sizeof</span>(int32_t);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">shell_ang_mom</span> = (<span style="color: #228b22;">int32_t</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (shell_ang_mom == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_shell_ang_mom_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (shell_ang_mom != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Read data </span>*/
|
|
|
|
rcio = trexio_read_safe_basis_shell_ang_mom_32(file, shell_ang_mom, shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
2022-01-06 18:56:24 +01:00
|
|
|
qmckl_free(context, shell_ang_mom);
|
|
|
|
shell_ang_mom = <span style="color: #008b8b;">NULL</span>;
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_shell_ang_mom"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Store data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_shell_ang_mom(context, shell_ang_mom, shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, shell_ang_mom);
|
|
|
|
shell_ang_mom = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org8f68ed7" class="outline-4">
|
|
|
|
<h4 id="org8f68ed7"><span class="section-number-4">1.4.8</span> Number of primitives per shell</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-8">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
2022-01-06 18:56:24 +01:00
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Allocate array for data </span>*/
|
2021-10-14 19:50:49 +02:00
|
|
|
mem_info.size = shell_num * <span style="color: #a020f0;">sizeof</span>(int64_t);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">shell_prim_num</span> = (<span style="color: #228b22;">int64_t</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (shell_prim_num == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_shell_prim_num_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (shell_prim_num != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Allocate temporary array </span>*/
|
|
|
|
mem_info.size = prim_num * <span style="color: #a020f0;">sizeof</span>(int64_t);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">tmp_array</span> = (<span style="color: #228b22;">int64_t</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (tmp_array == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
qmckl_free(context, shell_prim_num);
|
|
|
|
shell_prim_num = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_shell_prim_num_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (tmp_array != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Read data </span>*/
|
|
|
|
rcio = trexio_read_safe_basis_shell_index_64 (file, tmp_array, prim_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
2022-01-06 18:56:24 +01:00
|
|
|
qmckl_free(context, shell_prim_num);
|
|
|
|
shell_prim_num = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_shell_prim_num"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Reformat data </span>*/
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<shell_num ; ++i) {
|
|
|
|
shell_prim_num[i] = 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<prim_num ; ++i) {
|
|
|
|
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span> = tmp_array[i];
|
|
|
|
<span style="color: #a020f0;">if</span> (k < 0 || k >= shell_num) {
|
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
qmckl_free(context, shell_prim_num);
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_shell_prim_num"</span>,
|
|
|
|
<span style="color: #8b2252;">"Irrelevant data in TREXIO file"</span>);
|
|
|
|
}
|
|
|
|
shell_prim_num[k] += 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Store data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_shell_prim_num(context, shell_prim_num, shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, shell_prim_num);
|
|
|
|
shell_prim_num = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org71b92a5" class="outline-4">
|
|
|
|
<h4 id="org71b92a5"><span class="section-number-4">1.4.9</span> Indices of the primitives</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-9">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
2022-01-06 18:56:24 +01:00
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Allocate array for data </span>*/
|
2021-10-14 19:50:49 +02:00
|
|
|
mem_info.size = shell_num * <span style="color: #a020f0;">sizeof</span>(int64_t);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">shell_prim_index</span> = (<span style="color: #228b22;">int64_t</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (shell_prim_index == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_shell_prim_index_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (shell_prim_index != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Allocate temporary array </span>*/
|
|
|
|
mem_info.size = prim_num * <span style="color: #a020f0;">sizeof</span>(int64_t);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">tmp_array</span> = (<span style="color: #228b22;">int64_t</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (tmp_array == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_shell_prim_index_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (tmp_array != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Read data </span>*/
|
|
|
|
rcio = trexio_read_safe_basis_shell_index_64(file, tmp_array, prim_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
2022-01-06 18:56:24 +01:00
|
|
|
qmckl_free(context, shell_prim_index);
|
|
|
|
shell_prim_index = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_shell_prim_index"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Reformat data </span>*/
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=prim_num-1 ; i>=0 ; --i) {
|
|
|
|
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span> = tmp_array[i];
|
|
|
|
<span style="color: #a020f0;">if</span> (k < 0 || k >= shell_num) {
|
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
qmckl_free(context, shell_prim_index);
|
|
|
|
shell_prim_index = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_shell_prim_index"</span>,
|
|
|
|
<span style="color: #8b2252;">"Irrelevant data in TREXIO file"</span>);
|
|
|
|
}
|
|
|
|
shell_prim_index[k] = i;
|
|
|
|
}
|
|
|
|
|
|
|
|
qmckl_free(context, tmp_array);
|
|
|
|
tmp_array = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Store data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_shell_prim_index(context, shell_prim_index, shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, shell_prim_index);
|
|
|
|
shell_prim_index = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orgd2201a9" class="outline-4">
|
|
|
|
<h4 id="orgd2201a9"><span class="section-number-4">1.4.10</span> Normalization of the shells</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-10">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
2022-01-06 18:56:24 +01:00
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Allocate array for data </span>*/
|
2021-10-14 19:50:49 +02:00
|
|
|
mem_info.size = shell_num * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">shell_factor</span> = (<span style="color: #228b22;">double</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (shell_factor == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_shell_factor_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (shell_factor != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Read data </span>*/
|
|
|
|
rcio = trexio_read_safe_basis_shell_factor_64(file, shell_factor, shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
2022-01-06 18:56:24 +01:00
|
|
|
qmckl_free(context, shell_factor);
|
|
|
|
shell_factor = <span style="color: #008b8b;">NULL</span>;
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_shell_factor"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Store data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_shell_factor(context, shell_factor, shell_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, shell_factor);
|
|
|
|
shell_factor = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orge84071e" class="outline-4">
|
|
|
|
<h4 id="orge84071e"><span class="section-number-4">1.4.11</span> Exponents</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-11">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
2022-01-06 18:56:24 +01:00
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Allocate array for data </span>*/
|
2021-10-14 19:50:49 +02:00
|
|
|
mem_info.size = prim_num * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">exponent</span> = (<span style="color: #228b22;">double</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (exponent == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_exponent_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (exponent != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Read data </span>*/
|
|
|
|
rcio = trexio_read_safe_basis_exponent_64(file, exponent, prim_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
2022-01-06 18:56:24 +01:00
|
|
|
qmckl_free(context, exponent);
|
|
|
|
exponent = <span style="color: #008b8b;">NULL</span>;
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_exponent"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Store data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_exponent(context, exponent, prim_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, exponent);
|
|
|
|
exponent = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org38fa96b" class="outline-4">
|
|
|
|
<h4 id="org38fa96b"><span class="section-number-4">1.4.12</span> Coefficients</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-12">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
2022-01-06 18:56:24 +01:00
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Allocate array for data </span>*/
|
2021-10-14 19:50:49 +02:00
|
|
|
mem_info.size = prim_num * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coefficient</span> = (<span style="color: #228b22;">double</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (coefficient == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_coefficient_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (coefficient != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Read data </span>*/
|
|
|
|
rcio = trexio_read_safe_basis_coefficient_64(file, coefficient, prim_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
2022-01-06 18:56:24 +01:00
|
|
|
qmckl_free(context, coefficient);
|
|
|
|
coefficient = <span style="color: #008b8b;">NULL</span>;
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_coefficient"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Store data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_coefficient(context, coefficient, prim_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, coefficient);
|
|
|
|
coefficient = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orga291cd6" class="outline-4">
|
|
|
|
<h4 id="orga291cd6"><span class="section-number-4">1.4.13</span> Normalization of the primitivies</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-4-13">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
2022-01-06 18:56:24 +01:00
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Allocate array for data </span>*/
|
2021-10-14 19:50:49 +02:00
|
|
|
mem_info.size = prim_num * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">prim_factor</span> = (<span style="color: #228b22;">double</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (prim_factor == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_basis_prim_factor_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (prim_factor != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Read data </span>*/
|
|
|
|
rcio = trexio_read_safe_basis_prim_factor_64(file, prim_factor, prim_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
2022-01-06 18:56:24 +01:00
|
|
|
qmckl_free(context, prim_factor);
|
|
|
|
prim_factor = <span style="color: #008b8b;">NULL</span>;
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_basis_prim_factor"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Read data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_prim_factor(context, prim_factor, prim_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
qmckl_free(context, prim_factor);
|
|
|
|
prim_factor = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
2021-11-17 14:09:00 +01:00
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org23406a3" class="outline-4">
|
|
|
|
<h4 id="org23406a3"><span class="section-number-4">1.4.14</span> AO Normalization</h4>
|
2021-11-17 14:09:00 +01:00
|
|
|
<div class="outline-text-4" id="text-1-4-14">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
2022-01-06 18:56:24 +01:00
|
|
|
|
|
|
|
/* <span style="color: #b22222;">Allocate array for data </span>*/
|
2021-11-17 14:09:00 +01:00
|
|
|
mem_info.size = ao_num * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">ao_normalization</span> = (<span style="color: #228b22;">double</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (ao_normalization == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_ao_normalization_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (ao_normalization != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Read data </span>*/
|
|
|
|
rcio = trexio_read_safe_ao_normalization_64(file, ao_normalization, ao_num);
|
2021-11-17 14:09:00 +01:00
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
2022-01-06 18:56:24 +01:00
|
|
|
qmckl_free(context, ao_normalization);
|
|
|
|
ao_normalization = <span style="color: #008b8b;">NULL</span>;
|
2021-11-17 14:09:00 +01:00
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_ao_normalization"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
2022-01-06 18:56:24 +01:00
|
|
|
/* <span style="color: #b22222;">Store data </span>*/
|
|
|
|
rc = qmckl_set_ao_basis_ao_factor(context, ao_normalization, ao_num);
|
2021-11-17 14:09:00 +01:00
|
|
|
|
|
|
|
qmckl_free(context, ao_normalization);
|
|
|
|
ao_normalization = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">
|
|
|
|
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
|
|
|
}
|
|
|
|
<span style="color: #483d8b;">#endif</span>
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org0d53d0e" class="outline-3">
|
|
|
|
<h3 id="org0d53d0e"><span class="section-number-3">1.5</span> Molecular orbitals</h3>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-3" id="text-1-5">
|
|
|
|
<p>
|
|
|
|
In this section we read the MO coefficients.
|
|
|
|
</p>
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #483d8b;">#ifdef</span> HAVE_TREXIO
|
|
|
|
<span style="color: #228b22;">qmckl_exit_code</span>
|
|
|
|
<span style="color: #0000ff;">qmckl_trexio_read_mo_X</span>(<span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #228b22;">trexio_t</span>* <span style="color: #a020f0;">const</span> <span style="color: #a0522d;">file</span>)
|
|
|
|
{
|
|
|
|
assert (context != (<span style="color: #228b22;">qmckl_context</span>) 0);
|
|
|
|
assert (file != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
|
|
|
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">rcio</span> = 0;
|
|
|
|
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ao_num</span> = 0L;
|
|
|
|
|
|
|
|
rc = qmckl_get_ao_basis_ao_num(context, &ao_num);
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orgfe4a464" class="outline-4">
|
|
|
|
<h4 id="orgfe4a464"><span class="section-number-4">1.5.1</span> Number of MOs</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-5-1">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">mo_num</span> = 0L;
|
|
|
|
|
|
|
|
rcio = trexio_read_mo_num_64(file, &mo_num);
|
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_mo_num"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #0000ff;">assert</span> (mo_num > 0);
|
|
|
|
rc = qmckl_set_mo_basis_mo_num(context, mo_num);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org4820ebf" class="outline-4">
|
|
|
|
<h4 id="org4820ebf"><span class="section-number-4">1.5.2</span> MO coefficients</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-1-5-2">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">{
|
|
|
|
<span style="color: #228b22;">qmckl_memory_info_struct</span> <span style="color: #a0522d;">mem_info</span> = qmckl_memory_info_struct_zero;
|
|
|
|
mem_info.size = ao_num * mo_num * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">mo_coef</span> = (<span style="color: #228b22;">double</span>*) qmckl_malloc(context, mem_info);
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (mo_coef == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_ALLOCATION_FAILED,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read_mo_X"</span>,
|
|
|
|
<span style="color: #008b8b;">NULL</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (mo_coef != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
|
|
|
rcio = trexio_read_mo_coefficient_64(file, mo_coef);
|
|
|
|
<span style="color: #a020f0;">if</span> (rcio != TREXIO_SUCCESS) {
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"trexio_read_mo_coefficient"</span>,
|
|
|
|
trexio_string_of_error(rcio));
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = qmckl_set_mo_basis_coefficient(context, mo_coef);
|
|
|
|
|
|
|
|
qmckl_free(context, mo_coef);
|
|
|
|
mo_coef = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS)
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">
|
|
|
|
<span style="color: #a020f0;">return</span> QMCKL_SUCCESS;
|
|
|
|
}
|
|
|
|
<span style="color: #483d8b;">#endif</span>
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org6413b2e" class="outline-3">
|
|
|
|
<h3 id="org6413b2e"><span class="section-number-3">1.6</span> <span class="todo TODO">TODO</span> ECP</h3>
|
2021-10-14 19:50:49 +02:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orge141c13" class="outline-2">
|
|
|
|
<h2 id="orge141c13"><span class="section-number-2">2</span> Read everything</h2>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-2" id="text-2">
|
|
|
|
<div class="org-src-container">
|
2022-02-17 12:38:12 +01:00
|
|
|
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
|
|
|
<span style="color: #0000ff;">qmckl_trexio_read</span>(<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>,
|
2022-02-18 01:57:42 +01:00
|
|
|
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">file_name</span>,
|
|
|
|
<span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>);
|
2021-10-14 19:50:49 +02:00
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #228b22;">qmckl_exit_code</span>
|
2022-02-18 01:57:42 +01:00
|
|
|
<span style="color: #0000ff;">qmckl_trexio_read</span>(<span style="color: #a020f0;">const</span> <span style="color: #228b22;">qmckl_context</span> <span style="color: #a0522d;">context</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">char</span>* <span style="color: #a0522d;">file_name</span>, <span style="color: #a020f0;">const</span> <span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">size_max</span>)
|
2021-10-14 19:50:49 +02:00
|
|
|
{
|
|
|
|
<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_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
2022-02-18 01:57:42 +01:00
|
|
|
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">file_name_new</span>[size_max+1];
|
|
|
|
strncpy(file_name_new, file_name, size_max+1);
|
|
|
|
file_name_new[size_max] = <span style="color: #8b2252;">'\0'</span>;
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
<span style="color: #483d8b;">#ifdef</span> HAVE_TREXIO
|
2022-02-18 01:57:42 +01:00
|
|
|
<span style="color: #228b22;">trexio_t</span>* <span style="color: #a0522d;">file</span> = qmckl_trexio_open_X(file_name_new, &rc);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #a020f0;">if</span> (file == <span style="color: #008b8b;">NULL</span>) {
|
|
|
|
trexio_close(file);
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_INVALID_ARG_2,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read"</span>,
|
|
|
|
trexio_string_of_error(rc));
|
|
|
|
}
|
|
|
|
|
|
|
|
assert (file != <span style="color: #008b8b;">NULL</span>);
|
|
|
|
|
|
|
|
rc = qmckl_trexio_read_electron_X(context, file);
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS) {
|
|
|
|
trexio_close(file);
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read"</span>,
|
|
|
|
<span style="color: #8b2252;">"Error reading electron"</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = qmckl_trexio_read_nucleus_X(context, file);
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS) {
|
|
|
|
trexio_close(file);
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read"</span>,
|
|
|
|
<span style="color: #8b2252;">"Error reading nucleus"</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = qmckl_trexio_read_ao_X(context, file);
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS) {
|
|
|
|
trexio_close(file);
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read"</span>,
|
|
|
|
<span style="color: #8b2252;">"Error reading AOs"</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
rc = qmckl_trexio_read_mo_X(context, file);
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS) {
|
|
|
|
trexio_close(file);
|
|
|
|
<span style="color: #a020f0;">return</span> qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read"</span>,
|
|
|
|
<span style="color: #8b2252;">"Error reading MOs"</span>);
|
|
|
|
}
|
|
|
|
|
|
|
|
trexio_close(file);
|
|
|
|
file = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
<span style="color: #483d8b;">#else</span>
|
|
|
|
|
|
|
|
rc = qmckl_failwith( context,
|
|
|
|
QMCKL_FAILURE,
|
|
|
|
<span style="color: #8b2252;">"qmckl_trexio_read"</span>,
|
|
|
|
<span style="color: #8b2252;">"QMCkl was not compiled without TREXIO"</span>);
|
|
|
|
<span style="color: #483d8b;">#endif</span>
|
|
|
|
<span style="color: #a020f0;">return</span> rc;
|
|
|
|
}
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org83ac57b" class="outline-2">
|
|
|
|
<h2 id="org83ac57b"><span class="section-number-2">3</span> Test</h2>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-2" id="text-3">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c"><span style="color: #483d8b;">#ifdef</span> HAVE_TREXIO
|
2021-11-17 14:09:00 +01:00
|
|
|
<span style="color: #483d8b;">#define</span> <span style="color: #a0522d;">walk_num</span> 2
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
<span style="color: #228b22;">qmckl_exit_code</span> <span style="color: #a0522d;">rc</span>;
|
|
|
|
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">fname</span>[256];
|
|
|
|
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">message</span>[256];
|
|
|
|
|
|
|
|
<span style="color: #483d8b;">#if</span><span style="color: #483d8b;">n</span><span style="color: #483d8b;">def</span> QMCKL_TEST_DIR
|
|
|
|
<span style="color: #483d8b;">#error</span> <span style="color: #8b2252;">"QMCKL_TEST_DIR is not defined"</span>
|
|
|
|
<span style="color: #483d8b;">#endif</span>
|
|
|
|
|
|
|
|
<span style="color: #0000ff;">strncpy</span>(fname, QMCKL_TEST_DIR,255);
|
|
|
|
<span style="color: #0000ff;">strncat</span>(fname, <span style="color: #8b2252;">"/chbrclf"</span>, 255);
|
|
|
|
printf(<span style="color: #8b2252;">"Test file: %s\n"</span>, fname);
|
2021-11-17 14:09:00 +01:00
|
|
|
|
|
|
|
rc = qmckl_set_electron_walk_num(context, walk_num);
|
2022-02-18 01:57:42 +01:00
|
|
|
rc = qmckl_trexio_read(context, fname, 255);
|
2021-10-14 19:50:49 +02:00
|
|
|
|
|
|
|
<span style="color: #a020f0;">if</span> (rc != QMCKL_SUCCESS) {
|
|
|
|
printf(<span style="color: #8b2252;">"%s\n"</span>, qmckl_string_of_error(rc));
|
|
|
|
qmckl_get_error(context, &rc, fname, message);
|
|
|
|
printf(<span style="color: #8b2252;">"%s\n"</span>, fname);
|
|
|
|
printf(<span style="color: #8b2252;">"%s\n"</span>, message);
|
|
|
|
}
|
|
|
|
|
|
|
|
<span style="color: #0000ff;">assert</span> ( rc == QMCKL_SUCCESS );
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orgd4d31e9" class="outline-4">
|
|
|
|
<h4 id="orgd4d31e9"><span class="section-number-4">3.0.1</span> Electrons</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-3-0-1">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">printf(<span style="color: #8b2252;">"Electrons\n"</span>);
|
|
|
|
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">up_num</span>, <span style="color: #a0522d;">dn_num</span>;
|
|
|
|
rc = qmckl_get_electron_up_num(context, &up_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #0000ff;">assert</span> (up_num == chbrclf_elec_up_num);
|
|
|
|
|
|
|
|
rc = qmckl_get_electron_down_num(context, &dn_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #0000ff;">assert</span> (dn_num == chbrclf_elec_dn_num);
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-orgae3d018" class="outline-4">
|
|
|
|
<h4 id="orgae3d018"><span class="section-number-4">3.0.2</span> Nuclei</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-3-0-2">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">printf(<span style="color: #8b2252;">"Nuclei\n"</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">nucl_num</span>;
|
|
|
|
rc = qmckl_get_nucleus_num(context, &nucl_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #0000ff;">assert</span> (nucl_num == chbrclf_nucl_num);
|
|
|
|
|
|
|
|
printf(<span style="color: #8b2252;">"Nuclear charges\n"</span>);
|
|
|
|
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">charge</span> = (<span style="color: #228b22;">double</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">nucl_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
|
2022-01-23 19:09:13 +01:00
|
|
|
rc = qmckl_get_nucleus_charge(context, charge, nucl_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<nucl_num ; i++) {
|
|
|
|
assert (charge[i] == chbrclf_charge[i]);
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(charge);
|
|
|
|
charge = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
printf(<span style="color: #8b2252;">"Nuclear coordinates\n"</span>);
|
|
|
|
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">coord</span> = (<span style="color: #228b22;">double</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">nucl_num</span> * 3 * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
|
2022-01-23 19:09:13 +01:00
|
|
|
rc = qmckl_get_nucleus_coord(context, <span style="color: #8b2252;">'T'</span>, coord, 3*nucl_num);
|
2021-10-14 19:50:49 +02:00
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #228b22;">int</span> <span style="color: #a0522d;">k</span>=0;
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">j</span>=0 ; j<3 ; ++j) {
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<nucl_num ; ++i) {
|
|
|
|
// <span style="color: #b22222;">printf("%f %f\n", coord[k], chbrclf_nucl_coord[j][i]);</span>
|
|
|
|
assert (coord[k] == chbrclf_nucl_coord[j][i]);
|
|
|
|
++k;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(coord);
|
|
|
|
coord = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org724ec01" class="outline-4">
|
|
|
|
<h4 id="org724ec01"><span class="section-number-4">3.0.3</span> Atomic basis</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-3-0-3">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">printf(<span style="color: #8b2252;">"Atomic basis\n"</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">char</span> <span style="color: #a0522d;">basis_type</span>;
|
|
|
|
rc = qmckl_get_ao_basis_type(context, &basis_type);
|
|
|
|
<span style="color: #0000ff;">assert</span> (basis_type == <span style="color: #8b2252;">'G'</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">shell_num</span>;
|
|
|
|
rc = qmckl_get_ao_basis_shell_num(context, &shell_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (shell_num == chbrclf_shell_num);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">prim_num</span>;
|
|
|
|
rc = qmckl_get_ao_basis_prim_num(context, &prim_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (prim_num == chbrclf_prim_num);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">ao_num</span>;
|
|
|
|
rc = qmckl_get_ao_basis_ao_num(context, &ao_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (ao_num == chbrclf_ao_num);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_index</span> = (<span style="color: #228b22;">int64_t</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">nucl_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">int64_t</span>));
|
|
|
|
rc = qmckl_get_ao_basis_nucleus_index(context, nucleus_index, nucl_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<nucl_num ; i++) {
|
|
|
|
assert (nucleus_index[i] == chbrclf_basis_nucleus_index[i]);
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(nucleus_index);
|
|
|
|
nucleus_index = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">nucleus_shell_num</span> = (<span style="color: #228b22;">int64_t</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">nucl_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">int64_t</span>));
|
|
|
|
rc = qmckl_get_ao_basis_nucleus_shell_num(context, nucleus_shell_num, nucl_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<nucl_num ; i++) {
|
|
|
|
assert (nucleus_shell_num[i] == chbrclf_basis_nucleus_shell_num[i]);
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(nucleus_shell_num);
|
|
|
|
nucleus_shell_num = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int32_t</span>* <span style="color: #a0522d;">shell_ang_mom</span> = (<span style="color: #228b22;">int32_t</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">shell_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">int32_t</span>));
|
|
|
|
rc = qmckl_get_ao_basis_shell_ang_mom(context, shell_ang_mom, shell_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<shell_num ; i++) {
|
|
|
|
assert (shell_ang_mom[i] == chbrclf_basis_shell_ang_mom[i]);
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(shell_ang_mom);
|
|
|
|
shell_ang_mom = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">shell_prim_num</span> = (<span style="color: #228b22;">int64_t</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">shell_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">int64_t</span>));
|
|
|
|
rc = qmckl_get_ao_basis_shell_prim_num(context, shell_prim_num, shell_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<shell_num ; i++) {
|
|
|
|
assert (shell_prim_num[i] == chbrclf_basis_shell_prim_num[i]);
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(shell_prim_num);
|
|
|
|
shell_prim_num = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span>* <span style="color: #a0522d;">shell_prim_index</span> = (<span style="color: #228b22;">int64_t</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">shell_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">int64_t</span>));
|
|
|
|
rc = qmckl_get_ao_basis_shell_prim_index(context, shell_prim_index, shell_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<shell_num ; i++) {
|
|
|
|
assert (shell_prim_index[i] == chbrclf_basis_shell_prim_index[i]);
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(shell_prim_index);
|
|
|
|
shell_prim_index = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">shell_factor</span> = (<span style="color: #228b22;">double</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">shell_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
|
|
|
|
rc = qmckl_get_ao_basis_shell_factor(context, shell_factor, shell_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<shell_num ; i++) {
|
|
|
|
assert (fabs(shell_factor[i] - chbrclf_basis_shell_factor[i]) < 1.e-6);
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(shell_factor);
|
|
|
|
shell_factor = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">exponent</span> = (<span style="color: #228b22;">double</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">prim_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
|
|
|
|
rc = qmckl_get_ao_basis_exponent(context, exponent, prim_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<prim_num ; i++) {
|
|
|
|
assert (fabs((exponent[i] - chbrclf_basis_exponent[i])/chbrclf_basis_exponent[i]) < 1.e-7);
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(exponent);
|
|
|
|
exponent = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">coefficient</span> = (<span style="color: #228b22;">double</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">prim_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
|
|
|
|
rc = qmckl_get_ao_basis_coefficient(context, coefficient, prim_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<prim_num ; i++) {
|
|
|
|
assert (fabs((coefficient[i] - chbrclf_basis_coefficient[i])/chbrclf_basis_coefficient[i]) < 1.e-7);
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(coefficient);
|
|
|
|
coefficient = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #228b22;">double</span>* <span style="color: #a0522d;">prim_factor</span> = (<span style="color: #228b22;">double</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">prim_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
|
|
|
|
rc = qmckl_get_ao_basis_prim_factor(context, prim_factor, prim_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<prim_num ; i++) {
|
|
|
|
assert (fabs((prim_factor[i] - chbrclf_basis_prim_factor[i])/chbrclf_basis_prim_factor[i]) < 1.e-7);
|
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(prim_factor);
|
|
|
|
prim_factor = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
<span style="color: #483d8b;">#endif</span>
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
|
2022-06-11 10:59:32 +02:00
|
|
|
<div id="outline-container-org31c6213" class="outline-4">
|
|
|
|
<h4 id="org31c6213"><span class="section-number-4">3.0.4</span> MO Basis</h4>
|
2021-10-14 19:50:49 +02:00
|
|
|
<div class="outline-text-4" id="text-3-0-4">
|
|
|
|
<div class="org-src-container">
|
|
|
|
<pre class="src src-c">printf(<span style="color: #8b2252;">"MOs\n"</span>);
|
|
|
|
|
|
|
|
<span style="color: #228b22;">int64_t</span> <span style="color: #a0522d;">mo_num</span>;
|
|
|
|
rc = qmckl_get_mo_basis_mo_num(context, &mo_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #0000ff;">assert</span> (mo_num == chbrclf_mo_num);
|
|
|
|
|
|
|
|
printf(<span style="color: #8b2252;">"MO coefs\n"</span>);
|
|
|
|
<span style="color: #228b22;">double</span> * <span style="color: #a0522d;">mo_coef</span> = (<span style="color: #228b22;">double</span>*) <span style="color: #0000ff;">malloc</span> (<span style="color: #228b22;">ao_num</span> * <span style="color: #0000ff;">mo_num</span> * <span style="color: #a020f0;">sizeof</span>(<span style="color: #228b22;">double</span>));
|
|
|
|
rc = qmckl_get_mo_basis_coefficient(context, mo_coef, mo_num*ao_num);
|
|
|
|
<span style="color: #0000ff;">assert</span> (rc == QMCKL_SUCCESS);
|
|
|
|
<span style="color: #a020f0;">for</span> (<span style="color: #228b22;">int</span> <span style="color: #a0522d;">i</span>=0 ; i<ao_num * mo_num ; i++) {
|
2022-01-06 18:56:24 +01:00
|
|
|
printf(<span style="color: #8b2252;">"%d %e %e %e\n"</span>, i, mo_coef[i], chbrclf_mo_coef[i],
|
|
|
|
( fabs(mo_coef[i] - chbrclf_mo_coef[i])/fabs(mo_coef[i])) );
|
|
|
|
assert ( fabs(mo_coef[i] - chbrclf_mo_coef[i])/fabs(mo_coef[i]) < 1.e-12 );
|
2021-10-14 19:50:49 +02:00
|
|
|
}
|
|
|
|
<span style="color: #0000ff;">free</span>(mo_coef);
|
|
|
|
charge = <span style="color: #008b8b;">NULL</span>;
|
|
|
|
|
|
|
|
</pre>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
<div id="postamble" class="status">
|
|
|
|
<p class="author">Author: TREX CoE</p>
|
2022-06-11 10:59:32 +02:00
|
|
|
<p class="date">Created: 2022-06-11 Sat 08:59</p>
|
2021-10-14 19:50:49 +02:00
|
|
|
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
|
|
|
|
</div>
|
|
|
|
</body>
|
|
|
|
</html>
|