1
0
mirror of https://github.com/TREX-CoE/trexio.git synced 2024-12-26 22:34:04 +01:00
trexio/trex.html

1424 lines
48 KiB
HTML
Raw Normal View History

<?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>
<!-- 2021-06-22 Tue 20:32 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>TREX Configuration file</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="trexio.css" type="text/css" />
<script type="text/javascript" src="org-info.js">
/**
*
* @source: org-info.js
*
* @licstart The following is the entire license notice for the
* JavaScript code in org-info.js.
*
* Copyright (C) 2012-2019 Free Software Foundation, Inc.
*
*
* The JavaScript code in this tag is free software: you can
* redistribute it and/or modify it under the terms of the GNU
* General Public License (GNU GPL) as published by the Free Software
* Foundation, either version 3 of the License, or (at your option)
* any later version. The code is distributed WITHOUT ANY WARRANTY;
* without even the implied warranty of MERCHANTABILITY or FITNESS
* FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
*
* As additional permission under GNU GPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* @licend The above is the entire license notice
* for the JavaScript code in org-info.js.
*
*/
</script>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
org_html_manager.set("TOC_DEPTH", "4");
org_html_manager.set("LINK_HOME", "index.html");
org_html_manager.set("LINK_UP", "");
org_html_manager.set("LOCAL_TOC", "1");
org_html_manager.set("VIEW_BUTTONS", "0");
org_html_manager.set("MOUSE_HINT", "underline");
org_html_manager.set("FIXED_TOC", "0");
org_html_manager.set("TOC", "1");
org_html_manager.set("VIEW", "info");
org_html_manager.setup(); // activate after the parameters are set
/*]]>*///-->
</script>
<script type="text/javascript">
/*
@licstart The following is the entire license notice for the
JavaScript code in this tag.
Copyright (C) 2012-2019 Free Software Foundation, Inc.
The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version. The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU GPL for more details.
As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.
@licend The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.cacheClassElem = elem.className;
elem.cacheClassTarget = target.className;
target.className = "code-highlighted";
elem.className = "code-highlighted";
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(elem.cacheClassElem)
elem.className = elem.cacheClassElem;
if(elem.cacheClassTarget)
target.className = elem.cacheClassTarget;
}
/*]]>*///-->
</script>
<script type="text/x-mathjax-config">
MathJax.Hub.Config({
displayAlign: "center",
displayIndent: "0em",
"HTML-CSS": { scale: 100,
linebreaks: { automatic: "false" },
webFont: "TeX"
},
SVG: {scale: 100,
linebreaks: { automatic: "false" },
font: "TeX"},
NativeMML: {scale: 100},
TeX: { equationNumbers: {autoNumber: "AMS"},
MultLineWidth: "85%",
TagSide: "right",
TagIndent: ".8em"
}
});
</script>
<script type="text/javascript"
src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href=""> UP </a>
|
<a accesskey="H" href="index.html"> HOME </a>
</div><div id="content">
<h1 class="title">TREX Configuration file</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgc08a996">1. Metadata</a></li>
<li><a href="#orgfc6802e">2. Electron</a></li>
<li><a href="#org89ad5cd">3. Nucleus</a></li>
<li><a href="#orgb4ac0b7">4. <span class="todo TODO">TODO</span> Effective core potentials</a></li>
<li><a href="#org86016e6">5. Basis set</a></li>
<li><a href="#org96b16b7">6. Atomic orbitals</a>
<ul>
<li><a href="#ao_one_e">6.1. One-electron integrals</a></li>
<li><a href="#ao_two_e">6.2. Two-electron integrals</a></li>
</ul>
</li>
<li><a href="#org2f3ed38">7. Molecular orbitals</a>
<ul>
<li><a href="#org72bc6af">7.1. One-electron integrals</a></li>
<li><a href="#orgd1fde5a">7.2. Two-electron integrals</a></li>
</ul>
</li>
<li><a href="#org22ac68f">8. <span class="todo TODO">TODO</span> Slater determinants</a></li>
<li><a href="#org177ee41">9. <span class="todo TODO">TODO</span> Reduced density matrices</a></li>
<li><a href="#orgbbdb680">10. Appendix</a>
<ul>
<li><a href="#orgca98b95">10.1. Python script from table to json</a></li>
</ul>
</li>
</ul>
</div>
</div>
<p>
All the quantities are saved in atomic units.
The dimensions of the arrays in the tables below are given in
column-major order (as in Fortran), and the ordering of the dimensions
is reversed in the produces JSON configuration file as the library is
written in C.
</p>
<p>
In Fortran, the arrays are 1-based and in most other languages the
arrays are 0-base. Hence, we introduce the <code>index</code> type which is an
1-based <code>int</code> in the Fortran interface and 0-based otherwise.
</p>
<div class="org-src-container">
<pre class="src src-python">{
</pre>
</div>
<div id="outline-container-orgc08a996" class="outline-2">
<h2 id="orgc08a996"><span class="section-number-2">1</span> Metadata</h2>
<div class="outline-text-2" id="text-1">
<p>
As we expect our files to be archived in open-data repositories, we
need to give the possibility to the users to store some metadata
inside the files. We propose to store the list of names of the codes
which have participated to the creation of the file, a list of
authors of the file, and a textual description.
</p>
<table id="orgee436b4" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>code_num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Number of codes used to produce the file</td>
</tr>
<tr>
<td class="org-left"><code>code</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left"><code>(metadata.code_num)</code></td>
<td class="org-left">Names of the codes used</td>
</tr>
<tr>
<td class="org-left"><code>author_num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Number of authors of the file</td>
</tr>
<tr>
<td class="org-left"><code>author</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left"><code>(metadata.author_num)</code></td>
<td class="org-left">Names of the authors of the file</td>
</tr>
<tr>
<td class="org-left"><code>description</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Text describing the content of file</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-orgfc6802e" class="outline-2">
<h2 id="orgfc6802e"><span class="section-number-2">2</span> Electron</h2>
<div class="outline-text-2" id="text-2">
<p>
We consider wave functions expressed in the spin-free formalism, where
the number of &uarr; and &darr; electrons is fixed.
</p>
<table id="orgee69920" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>up_num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Number of &uarr;-spin electrons</td>
</tr>
<tr>
<td class="org-left"><code>dn_num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Number of &darr;-spin electrons</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org89ad5cd" class="outline-2">
<h2 id="org89ad5cd"><span class="section-number-2">3</span> Nucleus</h2>
<div class="outline-text-2" id="text-3">
<p>
The nuclei are considered as fixed point charges. Coordinates are
given in Cartesian \((x,y,z)\) format.
</p>
<table id="org9732f69" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Number of nuclei</td>
</tr>
<tr>
<td class="org-left"><code>charge</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(nucleus.num)</code></td>
<td class="org-left">Charges of the nuclei</td>
</tr>
<tr>
<td class="org-left"><code>coord</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(3,nucleus.num)</code></td>
<td class="org-left">Coordinates of the atoms</td>
</tr>
<tr>
<td class="org-left"><code>label</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left"><code>(nucleus.num)</code></td>
<td class="org-left">Atom labels</td>
</tr>
<tr>
<td class="org-left"><code>point_group</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Symmetry point group</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-orgb4ac0b7" class="outline-2">
<h2 id="orgb4ac0b7"><span class="section-number-2">4</span> <span class="todo TODO">TODO</span> Effective core potentials</h2>
<div class="outline-text-2" id="text-4">
<p>
An effective core potential (ECP) \(V_A^{\text{pp}}\) replacing the
core electrons of atom \(A\) is the sum of a local component
\(V_A^{\text{l}}\) and a non-local component \(V_A^{\text{nl}}\).
The local component is given by
</p>
<p>
\[
\hat{V}_A^{\text{l}}(r) = -\frac{Z_A^{\text{eff}}}{r} +
\frac{Z_A^{\text{eff}}}{r}\, \exp\left( -\alpha_A\, r^2\right) +
Z_{\text{eff}}\, \alpha_A\, r\, \exp\left( -\beta_A\, r^2\right) +
\gamma_A \exp\left( -\delta_A\, r^2\right),
\]
</p>
<p>
and the component obtained after localizing the non-local operator is
</p>
<p>
\[
\hat{V}_A^{\text{nl}}(r) =
\zeta_A\, \exp\left( -\eta_A\, r^2\right) |0\rangle \langle 0| +
\mu_A \, \exp\left( -\nu_A \, r^2\right) |1\rangle \langle 1|
\]
</p>
<p>
where \(r=|\mathbf{r-R}_A|\) is the distance to the nucleus on which the
potential is centered, \(Z_A^{\text{eff}}\) is the effective charge
due to the removed electrons, \(|0\rangle \langle 0|\)
and \(|1\rangle \langle 1|\) are projections over zero and one principal angular
momenta, respectively (generalization to higher angular momenta is
straightforward), and all the parameters labeled by Greek
letters are parameters.
</p>
<ul class="org-ul">
<li>\(\hat{V}_\text{ecp,l} = \sum_A \hat{V}_A^{\text{l}}\) : local component</li>
<li>\(\hat{V}_\text{ecp,nl} = \sum_A \hat{V}_A^{\text{nl}}\) : non-local component</li>
</ul>
<table id="org0701dfb" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>lmax_plus_1</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left"><code>(nucleus.num)</code></td>
<td class="org-left">\(l_{\max} + 1\)</td>
</tr>
<tr>
<td class="org-left"><code>z_core</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(nucleus.num)</code></td>
<td class="org-left">Charges to remove</td>
</tr>
<tr>
<td class="org-left"><code>local_n</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left"><code>(nucleus.num)</code></td>
<td class="org-left">Number of local function</td>
</tr>
<tr>
<td class="org-left"><code>local_num_n_max</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Maximum value of <code>local_n</code></td>
</tr>
<tr>
<td class="org-left"><code>local_exponent</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ecp.local_num_n_max, nucleus.num)</code></td>
<td class="org-left">&#xa0;</td>
</tr>
<tr>
<td class="org-left"><code>local_coef</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ecp.local_num_n_max, nucleus.num)</code></td>
<td class="org-left">&#xa0;</td>
</tr>
<tr>
<td class="org-left"><code>local_power</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left"><code>(ecp.local_num_n_max, nucleus.num)</code></td>
<td class="org-left">&#xa0;</td>
</tr>
<tr>
<td class="org-left"><code>non_local_n</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left"><code>(nucleus.num)</code></td>
<td class="org-left">&#xa0;</td>
</tr>
<tr>
<td class="org-left"><code>non_local_num_n_max</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">&#xa0;</td>
</tr>
<tr>
<td class="org-left"><code>non_local_exponent</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ecp.non_local_num_n_max, nucleus.num)</code></td>
<td class="org-left">&#xa0;</td>
</tr>
<tr>
<td class="org-left"><code>non_local_coef</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ecp.non_local_num_n_max, nucleus.num)</code></td>
<td class="org-left">&#xa0;</td>
</tr>
<tr>
<td class="org-left"><code>non_local_power</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left"><code>(ecp.non_local_num_n_max, nucleus.num)</code></td>
<td class="org-left">&#xa0;</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org86016e6" class="outline-2">
<h2 id="org86016e6"><span class="section-number-2">5</span> Basis set</h2>
<div class="outline-text-2" id="text-5">
<p>
We consider here basis functions centered on nuclei. Hence, we enable
the possibility to define <i>dummy atoms</i> to place basis functions in
random positions.
</p>
<p>
The atomic basis set is defined as a list of shells. Each shell \(s\) is
centered on a center \(A\), possesses a given angular momentum \(l\) and a
radial function \(R_s\). The radial function is a linear combination of
\(N_{\text{prim}}\) <i>primitive</i> functions that can be of type
Slater (\(p=1\)) or Gaussian (\(p=2\)),
parameterized by exponents \(\gamma_{ks}\) and coefficients \(a_{ks}\):
\[
R_s(\mathbf{r}) = \mathcal{N}_s \vert\mathbf{r}-\mathbf{R}_A\vert^{n_s}
\sum_{k=1}^{N_{\text{prim}}} a_{ks}\, f_{ks}(\gamma_{ks},p)\,
\exp \left( - \gamma_{ks}
\vert \mathbf{r}-\mathbf{R}_A \vert ^p \right).
\]
</p>
<p>
In the case of Gaussian functions, \(n_s\) is always zero.
</p>
<p>
Different codes normalize functions at different levels. Computing
normalization factors requires the ability to compute overlap
integrals, so the normalization factors should be written in the
file to ensure that the file is self-contained and does not need the
client program to have the ability to compute such integrals.
</p>
<p>
Some codes assume that the contraction coefficients are for a linear
combination of <i>normalized</i> primitives. This implies that a normalization
constant for the primitive \(ks\) needs to be computed and stored. If
this normalization factor is not required, \(f_{ks}=1\).
</p>
<p>
Some codes assume that the basis function are normalized. This
implies the computation of an extra normalization factor, \(\mathcal{N}_s\).
If the the basis function is not considered normalized, \(\mathcal{N}_s=1\).
</p>
<p>
All the basis set parameters are stored in one-dimensional arrays:
</p>
<table id="org5968aad" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>type</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Type of basis set: "Gaussian" or "Slater"</td>
</tr>
<tr>
<td class="org-left"><code>num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Total Number of shells</td>
</tr>
<tr>
<td class="org-left"><code>prim_num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Total number of primitives</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_index</code></td>
<td class="org-left"><code>index</code></td>
<td class="org-left"><code>(nucleus.num)</code></td>
<td class="org-left">Index of the first shell of each nucleus (\(A\))</td>
</tr>
<tr>
<td class="org-left"><code>nucleus_shell_num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left"><code>(nucleus.num)</code></td>
<td class="org-left">Number of shells for each nucleus</td>
</tr>
<tr>
<td class="org-left"><code>shell_ang_mom</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left"><code>(basis.num)</code></td>
<td class="org-left">Angular momentum <code>0:S, 1:P, 2:D, ...</code></td>
</tr>
<tr>
<td class="org-left"><code>shell_prim_num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left"><code>(basis.num)</code></td>
<td class="org-left">Number of primitives in the shell (\(N_{\text{prim}}\))</td>
</tr>
<tr>
<td class="org-left"><code>shell_factor</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(basis.num)</code></td>
<td class="org-left">Normalization factor of the shell (\(\mathcal{N}_s\))</td>
</tr>
<tr>
<td class="org-left"><code>shell_prim_index</code></td>
<td class="org-left"><code>index</code></td>
<td class="org-left"><code>(basis.num)</code></td>
<td class="org-left">Index of the first primitive in the complete list</td>
</tr>
<tr>
<td class="org-left"><code>exponent</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(basis.prim_num)</code></td>
<td class="org-left">Exponents of the primitives (\(\gamma_{ks}\))</td>
</tr>
<tr>
<td class="org-left"><code>coefficient</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(basis.prim_num)</code></td>
<td class="org-left">Coefficients of the primitives (\(a_{ks}\))</td>
</tr>
<tr>
<td class="org-left"><code>prim_factor</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(basis.prim_num)</code></td>
<td class="org-left">Normalization coefficients for the primitives (\(f_{ks}\))</td>
</tr>
</tbody>
</table>
<p>
For example, consider H<sub>2</sub> with the following basis set (in GAMESS
format), where both the AOs and primitives are considered normalized:
</p>
<pre class="example">
HYDROGEN
S 5
1 3.387000E+01 6.068000E-03
2 5.095000E+00 4.530800E-02
3 1.159000E+00 2.028220E-01
4 3.258000E-01 5.039030E-01
5 1.027000E-01 3.834210E-01
S 1
1 3.258000E-01 1.000000E+00
S 1
1 1.027000E-01 1.000000E+00
P 1
1 1.407000E+00 1.000000E+00
P 1
1 3.880000E-01 1.000000E+00
D 1
1 1.057000E+00 1.0000000
</pre>
<p>
we have:
</p>
<pre class="example">
type = "Gaussian"
num = 12
prim_num = 20
nucleus_index = [0 , 6]
shell_ang_mom = [0 , 0 , 0 , 1 , 1 , 2 , 0 , 0 , 0 , 1 , 1 , 2 ]
shell_prim_num = [5 , 1 , 1 , 1 , 1 , 1 , 5 , 1 , 1 , 1 , 1 , 1 ]
shell_prim_index = [0 , 5 , 6 , 7 , 8 , 9 , 10, 15, 16, 17, 18, 19]
shell_factor = [1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1., 1.]
exponent =
[ 33.87, 5.095, 1.159, 0.3258, 0.1027, 0.3258, 0.1027, 1.407,
0.388, 1.057, 33.87, 5.095, 1.159, 0.3258, 0.1027, 0.3258, 0.1027, 1.407,
0.388, 1.057]
coefficient =
[ 0.006068, 0.045308, 0.202822, 0.503903, 0.383421, 1.0, 1.0,
1.0, 1.0, 1.0, 0.006068, 0.045308, 0.202822, 0.503903, 0.383421, 1.0, 1.0,
1.0, 1.0, 1.0]
prim_factor =
[ 1.0006253235944540e+01, 2.4169531573445120e+00, 7.9610924849766440e-01
3.0734305383061117e-01, 1.2929684417481876e-01, 3.0734305383061117e-01,
1.2929684417481876e-01, 2.1842769845268308e+00, 4.3649547399719840e-01,
1.8135965626177861e+00, 1.0006253235944540e+01, 2.4169531573445120e+00,
7.9610924849766440e-01, 3.0734305383061117e-01, 1.2929684417481876e-01,
3.0734305383061117e-01, 1.2929684417481876e-01, 2.1842769845268308e+00,
4.3649547399719840e-01, 1.8135965626177861e+00 ]
</pre>
</div>
</div>
<div id="outline-container-org96b16b7" class="outline-2">
<h2 id="org96b16b7"><span class="section-number-2">6</span> Atomic orbitals</h2>
<div class="outline-text-2" id="text-6">
<p>
Going from the atomic basis set to AOs implies a systematic
construction of all the angular functions of each shell. We
consider two cases for the angular functions: the real-valued
spherical harmonics, and the polynomials in Cartesian coordinates.
In the case of spherical harmonics, the AOs are ordered in
increasing magnetic quantum number (\(-l \le m \le l\)), and in the case
of polynomials we impose the canonical ordering of the
Libint2 library, i.e
</p>
\begin{eqnarray}
p & : & p_x, p_y, p_z \nonumber \\
d & : & d_{xx}, d_{xy}, d_{xz}, d_{yy}, d_{yz}, d_{zz} \nonumber \\
f & : & f_{xxx}, f_{xxy}, f_{xxz}, f_{xyy}, f_{xyz}, f_{xzz}, f_{yyy}, f_{yyz}, f_{yzz}, …f_{zzz} \nonumber \\
{\rm etc.} \nonumber
\end{eqnarray}
<p>
AOs are defined as
</p>
<p>
\[
\chi_i (\mathbf{r}) = \mathcal{N}_i\, P_{\eta(i)}(\mathbf{r})\, R_{\theta(i)} (\mathbf{r})
\]
</p>
<p>
where \(i\) is the atomic orbital index,
\(P\) encodes for either the
polynomials or the spherical harmonics, \(\theta(i)\) returns the
shell on which the AO is expanded, and \(\eta(i)\) denotes which
angular function is chosen.
\(\mathcal{N}_i\) is a normalization factor that enables the
possibility to have different normalization coefficients within a
shell, as in the GAMESS convention where
\(\mathcal{N}_{x^2} \ne \mathcal{N}_{xy}\) because
\[ \left[ \iiint \left(x-X_A \right)^2 R_{\theta(i)}
(\mathbf{r}) dx\, dy\, dz \right]^{-1/2} \ne
\left[ \iiint \left( x-X_A \right) \left( y-Y_A \right) R_{\theta(i)}
(\mathbf{r}) dx\, dy\, dz \right]^{-1/2}. \]
</p>
<p>
In such a case, one should set the normalization of the shell (in
the <a href="#org86016e6">Basis set</a> section) to \(\mathcal{N}_{z^2}\), which is the
normalization factor of the atomic orbitals in spherical coordinates.
The normalization factor of the \(xy\) function which should be
introduced here should be \(\frac{\mathcal{N}_{xy}}{\mathcal{N}_{z^2}}\).
</p>
<table id="orgba83541" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>cartesian</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left"><code>1</code>: true, <code>0</code>: false</td>
</tr>
<tr>
<td class="org-left"><code>num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Total number of atomic orbitals</td>
</tr>
<tr>
<td class="org-left"><code>shell</code></td>
<td class="org-left"><code>index</code></td>
<td class="org-left"><code>(ao.num)</code></td>
<td class="org-left">basis set shell for each AO</td>
</tr>
<tr>
<td class="org-left"><code>normalization</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ao.num)</code></td>
<td class="org-left">Normalization factors</td>
</tr>
</tbody>
</table>
</div>
<div id="outline-container-orge8be744" class="outline-3">
<h3 id="ao_one_e"><a id="orge8be744"></a><span class="section-number-3">6.1</span> One-electron integrals</h3>
<div class="outline-text-3" id="text-ao_one_e">
<ul class="org-ul">
<li>\[ \hat{V}_{\text{ne}} = \sum_{A=1}^{N_\text{nucl}}
\sum_{i=1}^{N_\text{elec}} \frac{-Z_A }{\vert \mathbf{R}_A -
\mathbf{r}_i \vert} \] : electron-nucleus attractive potential,</li>
<li>\[ \hat{T}_{\text{e}} =
\sum_{i=1}^{N_\text{elec}} -\frac{1}{2}\hat{\Delta}_i \] : electronic kinetic energy</li>
<li>\(\hat{h} = \hat{T}_\text{e} + \hat{V}_\text{ne} +
\hat{V}_\text{ecp,l} + \hat{V}_\text{ecp,nl}\) : core electronic Hamiltonian</li>
</ul>
<p>
The one-electron integrals for a one-electron operator \(\hat{O}\) are
\[ \langle p \vert \hat{O} \vert q \rangle \], returned as a matrix
over atomic orbitals.
</p>
<table id="org8a5916c" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>overlap</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ao.num, ao.num)</code></td>
<td class="org-left">\(\langle p \vert q \rangle\)</td>
</tr>
<tr>
<td class="org-left"><code>kinetic</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ao.num, ao.num)</code></td>
<td class="org-left">\(\langle p \vert \hat{T}_e \vert q \rangle\)</td>
</tr>
<tr>
<td class="org-left"><code>potential_n_e</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ao.num, ao.num)</code></td>
<td class="org-left">\(\langle p \vert \hat{V}_{\text{ne}} \vert q \rangle\)</td>
</tr>
<tr>
<td class="org-left"><code>ecp_local</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ao.num, ao.num)</code></td>
<td class="org-left">\(\langle p \vert \hat{V}_{\text{ecp,l}} \vert q \rangle\)</td>
</tr>
<tr>
<td class="org-left"><code>ecp_non_local</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ao.num, ao.num)</code></td>
<td class="org-left">\(\langle p \vert \hat{V}_{\text{ecp,nl}} \vert q \rangle\)</td>
</tr>
<tr>
<td class="org-left"><code>core_hamiltonian</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ao.num, ao.num)</code></td>
<td class="org-left">\(\langle p \vert \hat{h} \vert q \rangle\)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org1337252" class="outline-3">
<h3 id="ao_two_e"><a id="org1337252"></a><span class="section-number-3">6.2</span> Two-electron integrals</h3>
<div class="outline-text-3" id="text-ao_two_e">
<p>
The two-electron integrals for a two-electron operator \(\hat{O}\) are
\[ \langle p q \vert \hat{O} \vert r s \rangle \] in physicists
notation or \[ ( pr \vert \hat{O} \vert qs ) \] in chemists
notation, where \(p,q,r,s\) are indices over atomic orbitals.
</p>
<p>
Functions are provided to get the indices in physicists or chemists
notation.
</p>
<ul class="org-ul">
<li>\[ \hat{W}_{\text{ee}} = \sum_{i=2}^{N_\text{elec}} \sum_{j=1}^{i-1} \frac{1}{\vert \mathbf{r}_i - \mathbf{r}_j \vert} \] : electron-electron repulsive potential operator.</li>
<li>\[ \hat{W}^{lr}_{\text{ee}} = \sum_{i=2}^{N_\text{elec}}
\sum_{j=1}^{i-1} \frac{\text{erf}(\vert \mathbf{r}_i -
\mathbf{r}_j \vert)}{\vert \mathbf{r}_i - \mathbf{r}_j \vert} \] : electron-electron long range potential</li>
</ul>
<table id="org9db7635" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>eri</code></td>
<td class="org-left"><code>float sparse</code></td>
<td class="org-left"><code>(ao.num, ao.num, ao.num, ao.num)</code></td>
<td class="org-left">Electron repulsion integrals</td>
</tr>
<tr>
<td class="org-left"><code>eri_lr</code></td>
<td class="org-left"><code>float sparse</code></td>
<td class="org-left"><code>(ao.num, ao.num, ao.num, ao.num)</code></td>
<td class="org-left">Long-range Electron repulsion integrals</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="outline-container-org2f3ed38" class="outline-2">
<h2 id="org2f3ed38"><span class="section-number-2">7</span> Molecular orbitals</h2>
<div class="outline-text-2" id="text-7">
<table id="org2e94a16" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>type</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">String identify the set of MOs</td>
</tr>
<tr>
<td class="org-left"><code>num</code></td>
<td class="org-left"><code>int</code></td>
<td class="org-left">&#xa0;</td>
<td class="org-left">Number of MOs</td>
</tr>
<tr>
<td class="org-left"><code>coefficient</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(ao.num, mo.num)</code></td>
<td class="org-left">MO coefficients</td>
</tr>
<tr>
<td class="org-left"><code>class</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left"><code>(mo.num)</code></td>
<td class="org-left">Core, Inactive, Active, Virtual, Deleted</td>
</tr>
<tr>
<td class="org-left"><code>symmetry</code></td>
<td class="org-left"><code>str</code></td>
<td class="org-left"><code>(mo.num)</code></td>
<td class="org-left">Symmetry in the point group</td>
</tr>
<tr>
<td class="org-left"><code>occupation</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(mo.num)</code></td>
<td class="org-left">Occupation number</td>
</tr>
</tbody>
</table>
</div>
<div id="outline-container-org72bc6af" class="outline-3">
<h3 id="org72bc6af"><span class="section-number-3">7.1</span> One-electron integrals</h3>
<div class="outline-text-3" id="text-7-1">
<p>
The operators as the same as those defined in the
<a href="#ao_one_e">AO one-electron integrals section</a>. Here, the integrals are given in
the basis of molecular orbitals.
</p>
<table id="org7bc73bb" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>overlap</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(mo.num, mo.num)</code></td>
<td class="org-left">\(\langle i \vert j \rangle\)</td>
</tr>
<tr>
<td class="org-left"><code>kinetic</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(mo.num, mo.num)</code></td>
<td class="org-left">\(\langle i \vert \hat{T}_e \vert j \rangle\)</td>
</tr>
<tr>
<td class="org-left"><code>potential_n_e</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(mo.num, mo.num)</code></td>
<td class="org-left">\(\langle i \vert \hat{V}_{\text{ne}} \vert j \rangle\)</td>
</tr>
<tr>
<td class="org-left"><code>ecp_local</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(mo.num, mo.num)</code></td>
<td class="org-left">\(\langle i \vert \hat{V}_{\text{ecp,l}} \vert j \rangle\)</td>
</tr>
<tr>
<td class="org-left"><code>ecp_non_local</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(mo.num, mo.num)</code></td>
<td class="org-left">\(\langle i \vert \hat{V}_{\text{ecp,nl}} \vert j \rangle\)</td>
</tr>
<tr>
<td class="org-left"><code>core_hamiltonian</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(mo.num, mo.num)</code></td>
<td class="org-left">\(\langle i \vert \hat{h} \vert j \rangle\)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-orgd1fde5a" class="outline-3">
<h3 id="orgd1fde5a"><span class="section-number-3">7.2</span> Two-electron integrals</h3>
<div class="outline-text-3" id="text-7-2">
<p>
The operators as the same as those defined in the
<a href="#ao_one_e">AO one-electron integrals section</a>. Here, the integrals are given in
the basis of molecular orbitals.
</p>
<table id="org35a9ecf" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>eri</code></td>
<td class="org-left"><code>float sparse</code></td>
<td class="org-left"><code>(mo.num, mo.num, mo.num, mo.num)</code></td>
<td class="org-left">Electron repulsion integrals</td>
</tr>
<tr>
<td class="org-left"><code>eri_lr</code></td>
<td class="org-left"><code>float sparse</code></td>
<td class="org-left"><code>(mo.num, mo.num, mo.num, mo.num)</code></td>
<td class="org-left">Long-range Electron repulsion integrals</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="outline-container-org22ac68f" class="outline-2">
<h2 id="org22ac68f"><span class="section-number-2">8</span> <span class="todo TODO">TODO</span> Slater determinants</h2>
</div>
<div id="outline-container-org177ee41" class="outline-2">
<h2 id="org177ee41"><span class="section-number-2">9</span> <span class="todo TODO">TODO</span> Reduced density matrices</h2>
<div class="outline-text-2" id="text-9">
<table id="orgdbd98ae" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>one_e</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(mo.num, mo.num)</code></td>
</tr>
<tr>
<td class="org-left"><code>one_e_up</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(mo.num, mo.num)</code></td>
</tr>
<tr>
<td class="org-left"><code>one_e_dn</code></td>
<td class="org-left"><code>float</code></td>
<td class="org-left"><code>(mo.num, mo.num)</code></td>
</tr>
<tr>
<td class="org-left"><code>two_e</code></td>
<td class="org-left"><code>float sparse</code></td>
<td class="org-left"><code>(mo.num, mo.num, mo.num, mo.num)</code></td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-orgbbdb680" class="outline-2">
<h2 id="orgbbdb680"><span class="section-number-2">10</span> Appendix</h2>
<div class="outline-text-2" id="text-10">
</div>
<div id="outline-container-orgca98b95" class="outline-3">
<h3 id="orgca98b95"><span class="section-number-3">10.1</span> Python script from table to json</h3>
<div class="outline-text-3" id="text-10-1">
<div class="org-src-container">
<pre class="src src-python" id="org059451c"><span style="color: #a020f0;">print</span>(<span style="color: #8b2252;">"""#+begin_src python :tangle trex.json"""</span>)
<span style="color: #a020f0;">print</span>(<span style="color: #8b2252;">""" "%s": {"""</span>%(title))
<span style="color: #a0522d;">indent</span> = <span style="color: #8b2252;">" "</span>
<span style="color: #a0522d;">f1</span> = 0 ; <span style="color: #a0522d;">f2</span> = 0 ; <span style="color: #a0522d;">f3</span> = 0
<span style="color: #a020f0;">for</span> line <span style="color: #a020f0;">in</span> data:
<span style="color: #a0522d;">line</span> = [ x.replace(<span style="color: #8b2252;">"~"</span>,<span style="color: #8b2252;">""</span>) <span style="color: #a020f0;">for</span> x <span style="color: #a020f0;">in</span> line ]
<span style="color: #a0522d;">name</span> = <span style="color: #8b2252;">'"'</span>+line[0]+<span style="color: #8b2252;">'"'</span>
<span style="color: #a0522d;">typ</span> = <span style="color: #8b2252;">'"'</span>+line[1]+<span style="color: #8b2252;">'"'</span>
<span style="color: #a0522d;">dims</span> = line[2]
<span style="color: #a020f0;">if</span> <span style="color: #8b2252;">'('</span> <span style="color: #a020f0;">in</span> dims:
<span style="color: #a0522d;">dims</span> = dims.strip()[1:-1]
<span style="color: #a0522d;">dims</span> = [ <span style="color: #8b2252;">'"'</span>+x.strip()+<span style="color: #8b2252;">'"'</span> <span style="color: #a020f0;">for</span> x <span style="color: #a020f0;">in</span> dims.split(<span style="color: #8b2252;">','</span>) ]
<span style="color: #a0522d;">dims</span> = <span style="color: #8b2252;">"[ "</span> + <span style="color: #8b2252;">", "</span>.join(dims) + <span style="color: #8b2252;">" ]"</span>
<span style="color: #a020f0;">else</span>:
<span style="color: #a0522d;">dims</span> = <span style="color: #8b2252;">"[ ]"</span>
<span style="color: #a0522d;">f1</span> = <span style="color: #483d8b;">max</span>(f1, <span style="color: #483d8b;">len</span>(name))
<span style="color: #a0522d;">f2</span> = <span style="color: #483d8b;">max</span>(f2, <span style="color: #483d8b;">len</span>(typ))
<span style="color: #a0522d;">f3</span> = <span style="color: #483d8b;">max</span>(f3, <span style="color: #483d8b;">len</span>(dims))
<span style="color: #a0522d;">fmt</span> = <span style="color: #8b2252;">"%%s%%%ds : [ %%%ds, %%%ds ]"</span> % (f1, f2, f3)
<span style="color: #a020f0;">for</span> line <span style="color: #a020f0;">in</span> data:
<span style="color: #a0522d;">line</span> = [ x.replace(<span style="color: #8b2252;">"~"</span>,<span style="color: #8b2252;">""</span>) <span style="color: #a020f0;">for</span> x <span style="color: #a020f0;">in</span> line ]
<span style="color: #a0522d;">name</span> = <span style="color: #8b2252;">'"'</span>+line[0]+<span style="color: #8b2252;">'"'</span>
<span style="color: #a0522d;">typ</span> = <span style="color: #8b2252;">'"'</span>+line[1]+<span style="color: #8b2252;">'"'</span>
<span style="color: #a0522d;">dims</span> = line[2]
<span style="color: #a020f0;">if</span> <span style="color: #8b2252;">'('</span> <span style="color: #a020f0;">in</span> dims:
<span style="color: #a0522d;">dims</span> = dims.strip()[1:-1]
<span style="color: #a0522d;">dims</span> = [ <span style="color: #8b2252;">'"'</span>+x.strip()+<span style="color: #8b2252;">'"'</span> <span style="color: #a020f0;">for</span> x <span style="color: #a020f0;">in</span> dims.split(<span style="color: #8b2252;">','</span>) ]
dims.reverse()
<span style="color: #a0522d;">dims</span> = <span style="color: #8b2252;">"[ "</span> + <span style="color: #8b2252;">", "</span>.join(dims) + <span style="color: #8b2252;">" ]"</span>
<span style="color: #a020f0;">else</span>:
<span style="color: #a020f0;">if</span> dims.strip() != <span style="color: #8b2252;">""</span>:
<span style="color: #a0522d;">dims</span> = <span style="color: #8b2252;">"ERROR"</span>
<span style="color: #a020f0;">else</span>:
<span style="color: #a0522d;">dims</span> = <span style="color: #8b2252;">"[]"</span>
<span style="color: #483d8b;">buffer</span> = fmt % (indent, name, typ.ljust(f2), dims.ljust(f3))
<span style="color: #a0522d;">indent</span> = <span style="color: #8b2252;">" , "</span>
<span style="color: #a020f0;">print</span>(<span style="color: #483d8b;">buffer</span>)
<span style="color: #a020f0;">if</span> last == 0:
<span style="color: #a020f0;">print</span>(<span style="color: #8b2252;">" } ,"</span>)
<span style="color: #a020f0;">else</span>:
<span style="color: #a020f0;">print</span>(<span style="color: #8b2252;">" }"</span>)
<span style="color: #a020f0;">print</span>(<span style="color: #8b2252;">"""#+end_src"""</span>)
</pre>
</div>
<div class="org-src-container">
<pre class="src src-python">}
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: TREX-CoE</p>
<p class="date">Created: 2021-06-22 Tue 20:32</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>