10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-13 17:43:41 +01:00

Atomic shell in org

This commit is contained in:
Anthony Scemama 2021-01-06 09:03:26 +01:00
parent 475635cf6c
commit 934d3de77a
6 changed files with 547 additions and 84 deletions

View File

@ -3,7 +3,7 @@
"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-01-04 Mon 23:32 -->
<!-- 2021-01-06 Wed 09:02 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Gaussian</title>
@ -221,18 +221,263 @@
/*]]>*///-->
// @license-end
</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="content">
<h1 class="title">Gaussian</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgab17fb9">1. Atomic shell</a>
<ul>
<li><a href="#org0ac793c">1.1. Type</a></li>
<li><a href="#org25b631d">1.2. Access</a></li>
<li><a href="#org6a770e6">1.3. Creation</a></li>
<li><a href="#orgfd4aeac">1.4. Printers</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div class="org-src-container">
<pre class="src src-ocaml" id="org0a27d10"><span class="org-string">"Gaussian basis sets"</span>
<pre class="src src-ocaml" id="orgbe48c1b"><span class="org-string">"Gaussian basis sets"</span>
</pre>
</div>
<div id="outline-container-orgab17fb9" class="outline-2">
<h2 id="orgab17fb9"><span class="section-number-2">1</span> Atomic shell</h2>
<div class="outline-text-2" id="text-1">
<p>
Set of contracted Gaussians differing only by the powers of \(x\), \(y\) and \(z\), with a
constant <code>Angular_momentum.t</code>, all centered on the same point.
</p>
<p>
In other words, it is the set of all contracted shells sharing the same center.
</p>
\begin{align*}
\chi_{n_x,n_y,n_z}(r) & = f(n_x,n_y,n_z) \sum_{j=1}^{n} \sum_{i=1}^{m} \mathcal{N}_{ij}\, d_{ij}\, g_{ij\,n_x,n_y,n_z}(r) \\
& = (x-X_A)^{n_x} (y-Y_A)^{n_y} (z-Z_A)^{n_z} f(n_x,n_y,n_z) \sum_{j=1}^{n} \sum_{i=1}^{m} \mathcal{N}_{ij}\, d_{ij}\, \exp \left( -\alpha_{ij} |r-R_A|^2 \right)
\end{align*}
<p>
where:
</p>
<ul class="org-ul">
<li>\(g_{ij\,n_x,n_y,n_z}(r)\) is the $i$-th <code>PrimitiveShell.t</code> of the $j$-th <code>Contracted_shell.t</code></li>
<li>\(n_x + n_y + n_z = l\), the total angular momentum</li>
<li>\(\alpha_{ij}\) are the exponents (tabulated) of the $j$-th <code>Contracted_shell.t</code></li>
<li>\(d_{ij}\) are the contraction coefficients of the $j$-th <code>Contracted_shell.t</code></li>
<li>\(\mathcal{N}_{ij}\) is the normalization coefficient of the $i$-th primitive shell
(<code>PrimitiveShell.norm_coef</code>) of the $j$-th <code>Contracted_shell.t</code></li>
<li>\(f(n_x,n_y,n_z)\) is a scaling factor adjusting the normalization coefficient for the
particular powers of \(x,y,z\) (<code>PrimitiveShell.norm_coef_scale</code>)</li>
</ul>
</div>
<div id="outline-container-org0ac793c" class="outline-3">
<h3 id="org0ac793c"><span class="section-number-3">1.1</span> Type</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
<span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Common</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org25b631d" class="outline-3">
<h3 id="org25b631d"><span class="section-number-3">1.2</span> Access</h3>
<div class="outline-text-3" id="text-1-2">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">index</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> int
<span class="org-doc">(** Index in the basis set, represented as an array of contracted shells. *)</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">center</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> <span class="org-tuareg-font-lock-module">Coordinate.</span>t
<span class="org-doc">(** Coordinate of the center {% $\mathbf{A} = (X_A,Y_A,Z_A)$ %}. *)</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">ang_mom</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> <span class="org-tuareg-font-lock-module">Angular_momentum.</span>t
<span class="org-doc">(** Total angular momentum : {% $l = n_x + n_y + n_z$ %}. *)</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">size</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> int
<span class="org-doc">(** Number of contracted functions, {% $n$ %} in the definition. *)</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">contracted_shells</span><span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> <span class="org-tuareg-font-lock-module">Contracted_shell.</span>t array
<span class="org-doc">(** Array of contracted gaussians *)</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">exponents</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> float array array
<span class="org-doc">(** Array of exponents {% $\alpha_{ij}$ %}. The first index is the index of</span>
<span class="org-doc"> the contracted function, and the second index is the index of the primitive.</span>
<span class="org-doc">*)</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">coefficients</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> float array array
<span class="org-doc">(** Array of contraction coefficients {% $d_{ij}$ %}. The first index is the index of</span>
<span class="org-doc"> the contracted function, and the second index is the index of the primitive.</span>
<span class="org-doc">*)</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">normalizations</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> float array array
<span class="org-doc">(** Normalization coefficients {% $\mathcal{N}_{ij}$ %}. The first index is the index of</span>
<span class="org-doc"> the contracted function, and the second index is the index of the primitive.</span>
<span class="org-doc">*)</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">norm_scales</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> float array
<span class="org-doc">(** Scaling factors {% $f(n_x,n_y,n_z)$ %}, given in the same order as</span>
<span class="org-doc"> [Angular_momentum.zkey_array ang_mom]. *)</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">size_of_shell</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> int
<span class="org-doc">(** Number of contracted functions in the shell: length of {!norm_coef_scale}. *)</span>
</pre>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>index</code></td>
<td class="org-left">Index in the basis set, represented as an array of contracted shells.</td>
</tr>
<tr>
<td class="org-left"><code>center</code></td>
<td class="org-left">Coordinate of the center \(\mathbf{A} = (X_A,Y_A,Z_A)\).</td>
</tr>
<tr>
<td class="org-left"><code>ang_mom</code></td>
<td class="org-left">Total angular momentum : \(l = n_x + n_y + n_z\).</td>
</tr>
<tr>
<td class="org-left"><code>size</code></td>
<td class="org-left">Number of contracted functions, \(n\) in the definition.</td>
</tr>
<tr>
<td class="org-left"><code>contracted_shells:</code></td>
<td class="org-left">Array of contracted gaussians</td>
</tr>
<tr>
<td class="org-left"><code>exponents</code></td>
<td class="org-left">Array of exponents \(\alpha_{ij}\). The first index is the index of the contracted function, and the second index is the index of the primitive.</td>
</tr>
<tr>
<td class="org-left"><code>coefficients</code></td>
<td class="org-left">Array of contraction coefficients \(d_{ij}\). The first index is the index of the contracted function, and the second index is the index of the primitive.</td>
</tr>
<tr>
<td class="org-left"><code>normalizations</code></td>
<td class="org-left">Normalization coefficients \(\mathcal{N}_{ij}\). The first index is the index of the contracted function, and the second index is the index of the primitive.</td>
</tr>
<tr>
<td class="org-left"><code>norm_scales</code></td>
<td class="org-left">Scaling factors \(f(n_x,n_y,n_z)\), given in the same order as <code>Angular_momentum.zkey_array ang_mom</code>.</td>
</tr>
<tr>
<td class="org-left"><code>size_of_shell</code></td>
<td class="org-left">Number of contracted functions in the shell: length of <code>norm_coef_scale</code>.</td>
</tr>
</tbody>
</table>
<pre class="example" id="org32dc57a">
</pre>
</div>
</div>
<div id="outline-container-org6a770e6" class="outline-3">
<h3 id="org6a770e6"><span class="section-number-3">1.3</span> Creation</h3>
<div class="outline-text-3" id="text-1-3">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">make</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-label">?index</span><span class="org-tuareg-font-lock-operator">:</span>int <span class="org-tuareg-font-lock-operator">-&gt;</span> <span class="org-tuareg-font-lock-module">Contracted_shell.</span>t array <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-doc">(** Creates a contracted shell from a list of coefficients and primitives. *)</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">with_index</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> int <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-doc">(** Returns a copy of the contracted shell with a modified index. *)</span>
</pre>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-left" />
</colgroup>
<tbody>
<tr>
<td class="org-left"><code>make</code></td>
<td class="org-left">Creates a contracted shell from a list of coefficients and primitives.</td>
</tr>
<tr>
<td class="org-left"><code>with_index</code></td>
<td class="org-left">Returns a copy of the contracted shell with a modified index.</td>
</tr>
</tbody>
</table>
<pre class="example" id="orgcab2544">
</pre>
</div>
</div>
<div id="outline-container-orgfd4aeac" class="outline-3">
<h3 id="orgfd4aeac"><span class="section-number-3">1.4</span> Printers</h3>
<div class="outline-text-3" id="text-1-4">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">pp</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Format.</span>formatter <span class="org-tuareg-font-lock-operator">-&gt;</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> unit
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Anthony Scemama</p>
<p class="date">Created: 2021-01-04 Mon 23:32</p>
<p class="date">Created: 2021-01-06 Wed 09:02</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"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-01-04 Mon 23:51 -->
<!-- 2021-01-06 Wed 09:03 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Top-level</title>
@ -226,13 +226,13 @@
<div id="content">
<h1 class="title">Top-level</h1>
<div class="org-src-container">
<pre class="src src-ocaml" id="org6a155c1"><span class="org-string">"Installs pretty printers for top-level."</span>
<pre class="src src-ocaml" id="org6726456"><span class="org-string">"Installs pretty printers for top-level."</span>
</pre>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Anthony Scemama</p>
<p class="date">Created: 2021-01-04 Mon 23:51</p>
<p class="date">Created: 2021-01-06 Wed 09:03</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

217
gaussian/atomic_shell.org Normal file
View File

@ -0,0 +1,217 @@
#+begin_src elisp tangle: no :results none :exports none
(setq pwd (file-name-directory buffer-file-name))
(setq name (file-name-nondirectory (substring buffer-file-name 0 -4)))
(setq lib (concat pwd "lib/"))
(setq testdir (concat pwd "test/"))
(setq mli (concat lib name ".mli"))
(setq ml (concat lib name ".ml"))
(setq test-ml (concat testdir name ".ml"))
(org-babel-tangle)
#+end_src
* Atomic shell
:PROPERTIES:
:header-args: :noweb yes :comments both
:END:
Set of contracted Gaussians differing only by the powers of $x$, $y$ and $z$, with a
constant ~Angular_momentum.t~, all centered on the same point.
In other words, it is the set of all contracted shells sharing the same center.
\begin{align*}
\chi_{n_x,n_y,n_z}(r) & = f(n_x,n_y,n_z) \sum_{j=1}^{n} \sum_{i=1}^{m} \mathcal{N}_{ij}\, d_{ij}\, g_{ij\,n_x,n_y,n_z}(r) \\
& = (x-X_A)^{n_x} (y-Y_A)^{n_y} (z-Z_A)^{n_z} f(n_x,n_y,n_z) \sum_{j=1}^{n} \sum_{i=1}^{m} \mathcal{N}_{ij}\, d_{ij}\, \exp \left( -\alpha_{ij} |r-R_A|^2 \right)
\end{align*}
where:
- $g_{ij\,n_x,n_y,n_z}(r)$ is the $i$-th ~PrimitiveShell.t~ of the $j$-th ~Contracted_shell.t~
- $n_x + n_y + n_z = l$, the total angular momentum
- $\alpha_{ij}$ are the exponents (tabulated) of the $j$-th ~Contracted_shell.t~
- $d_{ij}$ are the contraction coefficients of the $j$-th ~Contracted_shell.t~
- $\mathcal{N}_{ij}$ is the normalization coefficient of the $i$-th primitive shell
(~PrimitiveShell.norm_coef~) of the $j$-th ~Contracted_shell.t~
- $f(n_x,n_y,n_z)$ is a scaling factor adjusting the normalization coefficient for the
particular powers of $x,y,z$ (~PrimitiveShell.norm_coef_scale~)
** Type
#+begin_src ocaml :tangle (eval mli)
type t
open Common
#+end_src
#+begin_src ocaml :tangle (eval ml) :exports none
open Common
type t = {
expo : float array array;
coef : float array array;
norm_coef : float array array;
norm_coef_scale : float array;
contr : Contracted_shell.t array;
index : int;
center : Coordinate.t;
ang_mom : Angular_momentum.t;
}
module Am = Angular_momentum
module Co = Coordinate
module Cs = Contracted_shell
#+end_src
** Access
#+begin_src ocaml :tangle (eval mli)
val index : t -> int
(** Index in the basis set, represented as an array of contracted shells. *)
val center : t -> Coordinate.t
(** Coordinate of the center {% $\mathbf{A} = (X_A,Y_A,Z_A)$ %}. *)
val ang_mom : t -> Angular_momentum.t
(** Total angular momentum : {% $l = n_x + n_y + n_z$ %}. *)
val size : t -> int
(** Number of contracted functions, {% $n$ %} in the definition. *)
val contracted_shells: t -> Contracted_shell.t array
(** Array of contracted gaussians *)
val exponents : t -> float array array
(** Array of exponents {% $\alpha_{ij}$ %}. The first index is the index of
the contracted function, and the second index is the index of the primitive.
*)
val coefficients : t -> float array array
(** Array of contraction coefficients {% $d_{ij}$ %}. The first index is the index of
the contracted function, and the second index is the index of the primitive.
*)
val normalizations : t -> float array array
(** Normalization coefficients {% $\mathcal{N}_{ij}$ %}. The first index is the index of
the contracted function, and the second index is the index of the primitive.
*)
val norm_scales : t -> float array
(** Scaling factors {% $f(n_x,n_y,n_z)$ %}, given in the same order as
[Angular_momentum.zkey_array ang_mom]. *)
val size_of_shell : t -> int
(** Number of contracted functions in the shell: length of {!norm_coef_scale}. *)
#+end_src
| ~index~ | Index in the basis set, represented as an array of contracted shells. |
| ~center~ | Coordinate of the center $\mathbf{A} = (X_A,Y_A,Z_A)$. |
| ~ang_mom~ | Total angular momentum : $l = n_x + n_y + n_z$. |
| ~size~ | Number of contracted functions, $n$ in the definition. |
| ~contracted_shells:~ | Array of contracted gaussians |
| ~exponents~ | Array of exponents $\alpha_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. |
| ~coefficients~ | Array of contraction coefficients $d_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. |
| ~normalizations~ | Normalization coefficients $\mathcal{N}_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. |
| ~norm_scales~ | Scaling factors $f(n_x,n_y,n_z)$, given in the same order as ~Angular_momentum.zkey_array ang_mom~. |
| ~size_of_shell~ | Number of contracted functions in the shell: length of ~norm_coef_scale~. |
#+begin_example
#+end_example
#+begin_src ocaml :tangle (eval ml) :exports none
let exponents x = x.expo
let coefficients x = x.coef
let center x = x.center
let ang_mom x = x.ang_mom
let size x = Array.length x.contr
let normalizations x = x.norm_coef
let norm_scales x = x.norm_coef_scale
let index x = x.index
let size_of_shell x = Array.length x.norm_coef_scale
let contracted_shells x = x.contr
#+end_src
** Creation
#+begin_src ocaml :tangle (eval mli)
val make : ?index:int -> Contracted_shell.t array -> t
(** Creates a contracted shell from a list of coefficients and primitives. *)
val with_index : t -> int -> t
(** Returns a copy of the contracted shell with a modified index. *)
#+end_src
| ~make~ | Creates a contracted shell from a list of coefficients and primitives. |
| ~with_index~ | Returns a copy of the contracted shell with a modified index. |
#+begin_example
#+end_example
#+begin_src ocaml :tangle (eval ml) :exports none
let make ?(index=0) contr =
assert (Array.length contr > 0);
let coef = Array.map Cs.coefficients contr
and expo = Array.map Cs.exponents contr
in
let center = Cs.center contr.(0) in
let rec unique_center = function
| 0 -> true
| i -> if Cs.center contr.(i) = center then (unique_center [@tailcall]) (i-1) else false
in
if not (unique_center (Array.length contr - 1)) then
invalid_arg "ContractedAtomicShell.make Coordinate.t differ";
let ang_mom = Cs.ang_mom contr.(0) in
let rec unique_angmom = function
| 0 -> true
| i -> if Cs.ang_mom contr.(i) = ang_mom then (unique_angmom [@tailcall]) (i-1) else false
in
if not (unique_angmom (Array.length contr - 1)) then
invalid_arg "Contracted_shell.make: Angular_momentum.t differ";
let norm_coef =
Array.map Cs.normalizations contr
in
let norm_coef_scale = Cs.norm_scales contr.(0)
in
{ index ; expo ; coef ; center ; ang_mom ; norm_coef ;
norm_coef_scale ; contr }
let with_index a i =
{ a with index = i }
#+end_src
** Printers
#+begin_src ocaml :tangle (eval mli)
val pp : Format.formatter -> t -> unit
#+end_src
#+begin_src ocaml :tangle (eval ml) :exports none
let pp ppf s =
let open Format in
fprintf ppf "@[%3d-%-3d@]" (s.index+1) (s.index+ (size_of_shell s)*(size s));
fprintf ppf "@[%a@ %a@] @[" Am.pp_string s.ang_mom Co.pp s.center;
Array.iter2 (fun e_arr c_arr -> fprintf ppf "@[<v>";
Array.iter2 (fun e c -> fprintf ppf "@[%16.8e %16.8e@]@;" e c)
e_arr c_arr;
fprintf ppf "@;@]") s.expo s.coef;
fprintf ppf "@]"
#+end_src

View File

@ -1,3 +1,4 @@
(* [[file:~/QCaml/gaussian/atomic_shell.org::*Type][Type:2]] *)
open Common
type t = {
@ -14,8 +15,59 @@ type t = {
module Am = Angular_momentum
module Co = Coordinate
module Cs = Contracted_shell
(* Type:2 ends here *)
(* | ~index~ | Index in the basis set, represented as an array of contracted shells. |
* | ~center~ | Coordinate of the center $\mathbf{A} = (X_A,Y_A,Z_A)$. |
* | ~ang_mom~ | Total angular momentum : $l = n_x + n_y + n_z$. |
* | ~size~ | Number of contracted functions, $n$ in the definition. |
* | ~contracted_shells:~ | Array of contracted gaussians |
* | ~exponents~ | Array of exponents $\alpha_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. |
* | ~coefficients~ | Array of contraction coefficients $d_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. |
* | ~normalizations~ | Normalization coefficients $\mathcal{N}_{ij}$. The first index is the index of the contracted function, and the second index is the index of the primitive. |
* | ~norm_scales~ | Scaling factors $f(n_x,n_y,n_z)$, given in the same order as ~Angular_momentum.zkey_array ang_mom~. |
* | ~size_of_shell~ | Number of contracted functions in the shell: length of ~norm_coef_scale~. |
*
* #+begin_example
*
* #+end_example *)
(* [[file:~/QCaml/gaussian/atomic_shell.org::*Access][Access:2]] *)
let exponents x = x.expo
let coefficients x = x.coef
let center x = x.center
let ang_mom x = x.ang_mom
let size x = Array.length x.contr
let normalizations x = x.norm_coef
let norm_scales x = x.norm_coef_scale
let index x = x.index
let size_of_shell x = Array.length x.norm_coef_scale
let contracted_shells x = x.contr
(* Access:2 ends here *)
(* | ~make~ | Creates a contracted shell from a list of coefficients and primitives. |
* | ~with_index~ | Returns a copy of the contracted shell with a modified index. |
*
* #+begin_example
*
* #+end_example *)
(* [[file:~/QCaml/gaussian/atomic_shell.org::*Creation][Creation:2]] *)
let make ?(index=0) contr =
assert (Array.length contr > 0);
@ -50,47 +102,11 @@ let make ?(index=0) contr =
let with_index a i =
{ a with index = i }
(* Creation:2 ends here *)
let exponents x = x.expo
let coefficients x = x.coef
let center x = x.center
let ang_mom x = x.ang_mom
let size x = Array.length x.contr
let normalizations x = x.norm_coef
let norm_scales x = x.norm_coef_scale
let index x = x.index
let size_of_shell x = Array.length x.norm_coef_scale
let contracted_shells x = x.contr
(** {2 Printers} *)
open Format
(*
let pp_debug ppf x =
fprintf ppf "@[<2>{@ ";
fprintf ppf "@[<2>expo =@ %a ;@]@ " pp_float_2darray_size x.expo;
fprintf ppf "@[<2>coef =@ %a ;@]@ " pp_float_2darray_size x.coef;
fprintf ppf "@[<2>center =@ %a ;@]@ " Co.pp_angstrom x.center;
fprintf ppf "@[<2>ang_mom =@ %a ;@]@ " Am.pp_string x.ang_mom;
fprintf ppf "@[<2>norm_coef =@ %a ;@]@ " pp_float_2darray_size x.norm_coef;
fprintf ppf "@[<2>norm_coef_scale =@ %a ;@]@ " pp_float_array_size x.norm_coef_scale;
fprintf ppf "@[<2>index =@ %d ;@]@ " x.index;
fprintf ppf "}@,@]"
*)
(* [[file:~/QCaml/gaussian/atomic_shell.org::*Printers][Printers:2]] *)
let pp ppf s =
let open Format in
fprintf ppf "@[%3d-%-3d@]" (s.index+1) (s.index+ (size_of_shell s)*(size s));
fprintf ppf "@[%a@ %a@] @[" Am.pp_string s.ang_mom Co.pp s.center;
Array.iter2 (fun e_arr c_arr -> fprintf ppf "@[<v>";
@ -98,6 +114,4 @@ let pp ppf s =
e_arr c_arr;
fprintf ppf "@;@]") s.expo s.coef;
fprintf ppf "@]"
(* Printers:2 ends here *)

View File

@ -1,43 +1,16 @@
(** Set of contracted Gaussians differing only by the powers of x, y and z, with a
constant {!Angular_momentum.t}, all centered on the same center.
(* Type *)
In other words, it is the set of all contracted shells sharing the same center.
{%
\begin{align*}
\chi_{n_x,n_y,n_z}(r) & = f(n_x,n_y,n_z) \sum_{j=1}^{n} \sum_{i=1}^{m} \mathcal{N}_{ij}\, d_{ij}\, g_{ij\,n_x,n_y,n_z}(r) \\
& = (x-X_A)^{n_x} (y-Y_A)^{n_y} (z-Z_A)^{n_z} f(n_x,n_y,n_z) \sum_{j=1}^{n} \sum_{i=1}^{m} \mathcal{N}_{ij}\, d_{ij}\, \exp \left( -\alpha_{ij} |r-R_A|^2 \right)
\end{align*}
%}
where:
- {% $g_{ij\,n_x,n_y,n_z}(r)$ %} is the i-th {!PrimitiveShell.t} of the j-th {!Contracted_shell.t}
- {% $n_x + n_y + n_z = l$ %}, the total angular momentum
- {% $\alpha_{ij}$ %} are the exponents (tabulated) of the j-th {!Contracted_shell.t}
- {% $d_{ij}$ %} are the contraction coefficients of the j-th {!Contracted_shell.t}
- {% $\mathcal{N}_{ij}$ %} is the normalization coefficient of the i-th primitive shell
({!PrimitiveShell.norm_coef}) of the j-th {!Contracted_shell.t}
- {% $f(n_x,n_y,n_z)$ %} is a scaling factor adjusting the normalization coefficient for the
particular powers of {% $x,y,z$ %} ({!PrimitiveShell.norm_coef_scale})
*)
type t
(* [[file:~/QCaml/gaussian/atomic_shell.org::*Type][Type:1]] *)
type t
open Common
val make : ?index:int -> Contracted_shell.t array -> t
(** Creates a contracted shell from a list of coefficients and primitives. *)
(* Type:1 ends here *)
val with_index : t -> int -> t
(** Returns a copy of the contracted shell with a modified index. *)
(* Access *)
(* [[file:~/QCaml/gaussian/atomic_shell.org::*Access][Access:1]] *)
val index : t -> int
(** Index in the basis set, represented as an array of contracted shells. *)
@ -74,9 +47,22 @@ val norm_scales : t -> float array
val size_of_shell : t -> int
(** Number of contracted functions in the shell: length of {!norm_coef_scale}. *)
(* Access:1 ends here *)
(* Creation *)
(** {2 Printers} *)
(* [[file:~/QCaml/gaussian/atomic_shell.org::*Creation][Creation:1]] *)
val make : ?index:int -> Contracted_shell.t array -> t
(** Creates a contracted shell from a list of coefficients and primitives. *)
val with_index : t -> int -> t
(** Returns a copy of the contracted shell with a modified index. *)
(* Creation:1 ends here *)
(* Printers *)
(* [[file:~/QCaml/gaussian/atomic_shell.org::*Printers][Printers:1]] *)
val pp : Format.formatter -> t -> unit
(* Printers:1 ends here *)

View File

@ -11,6 +11,7 @@ let printers =
"Common.Range.pp" ;
"Common.Spin.pp" ;
"Common.Zkey.pp" ;
"Gaussian.Atomic_shell.pp" ;
"Mo.Frozen_core.pp" ;
"Particles.Electrons.pp" ;
"Particles.Element.pp" ;