10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-22 20:33:36 +01:00
QCaml/docs/particles.html

1087 lines
68 KiB
HTML

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2023-04-24 Mon 14:13 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Common</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Anthony Scemama" />
<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: auto;
padding-top: 1.2em;
}
pre.src:before {
display: none;
position: absolute;
background-color: white;
top: -10px;
right: 10px;
padding: 3px;
border: 1px solid black;
}
pre.src:hover:before { display: inline;}
/* Languages per Org manual */
pre.src-asymptote:before { content: 'Asymptote'; }
pre.src-awk:before { content: 'Awk'; }
pre.src-C:before { content: 'C'; }
/* pre.src-C++ doesn't work in CSS */
pre.src-clojure:before { content: 'Clojure'; }
pre.src-css:before { content: 'CSS'; }
pre.src-D:before { content: 'D'; }
pre.src-ditaa:before { content: 'ditaa'; }
pre.src-dot:before { content: 'Graphviz'; }
pre.src-calc:before { content: 'Emacs Calc'; }
pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
pre.src-fortran:before { content: 'Fortran'; }
pre.src-gnuplot:before { content: 'gnuplot'; }
pre.src-haskell:before { content: 'Haskell'; }
pre.src-hledger:before { content: 'hledger'; }
pre.src-java:before { content: 'Java'; }
pre.src-js:before { content: 'Javascript'; }
pre.src-latex:before { content: 'LaTeX'; }
pre.src-ledger:before { content: 'Ledger'; }
pre.src-lisp:before { content: 'Lisp'; }
pre.src-lilypond:before { content: 'Lilypond'; }
pre.src-lua:before { content: 'Lua'; }
pre.src-matlab:before { content: 'MATLAB'; }
pre.src-mscgen:before { content: 'Mscgen'; }
pre.src-ocaml:before { content: 'Objective Caml'; }
pre.src-octave:before { content: 'Octave'; }
pre.src-org:before { content: 'Org mode'; }
pre.src-oz:before { content: 'OZ'; }
pre.src-plantuml:before { content: 'Plantuml'; }
pre.src-processing:before { content: 'Processing.js'; }
pre.src-python:before { content: 'Python'; }
pre.src-R:before { content: 'R'; }
pre.src-ruby:before { content: 'Ruby'; }
pre.src-sass:before { content: 'Sass'; }
pre.src-scheme:before { content: 'Scheme'; }
pre.src-screen:before { content: 'Gnu Screen'; }
pre.src-sed:before { content: 'Sed'; }
pre.src-sh:before { content: 'shell'; }
pre.src-sql:before { content: 'SQL'; }
pre.src-sqlite:before { content: 'SQLite'; }
/* additional languages in org.el's org-babel-load-languages alist */
pre.src-forth:before { content: 'Forth'; }
pre.src-io:before { content: 'IO'; }
pre.src-J:before { content: 'J'; }
pre.src-makefile:before { content: 'Makefile'; }
pre.src-maxima:before { content: 'Maxima'; }
pre.src-perl:before { content: 'Perl'; }
pre.src-picolisp:before { content: 'Pico Lisp'; }
pre.src-scala:before { content: 'Scala'; }
pre.src-shell:before { content: 'Shell Script'; }
pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
/* additional language identifiers per "defun org-babel-execute"
in ob-*.el */
pre.src-cpp:before { content: 'C++'; }
pre.src-abc:before { content: 'ABC'; }
pre.src-coq:before { content: 'Coq'; }
pre.src-groovy:before { content: 'Groovy'; }
/* additional language identifiers from org-babel-shell-names in
ob-shell.el: ob-shell is the only babel language using a lambda to put
the execution function name together. */
pre.src-bash:before { content: 'bash'; }
pre.src-csh:before { content: 'csh'; }
pre.src-ash:before { content: 'ash'; }
pre.src-dash:before { content: 'dash'; }
pre.src-ksh:before { content: 'ksh'; }
pre.src-mksh:before { content: 'mksh'; }
pre.src-posh:before { content: 'posh'; }
/* Additional Emacs modes also supported by the LaTeX listings package */
pre.src-ada:before { content: 'Ada'; }
pre.src-asm:before { content: 'Assembler'; }
pre.src-caml:before { content: 'Caml'; }
pre.src-delphi:before { content: 'Delphi'; }
pre.src-html:before { content: 'HTML'; }
pre.src-idl:before { content: 'IDL'; }
pre.src-mercury:before { content: 'Mercury'; }
pre.src-metapost:before { content: 'MetaPost'; }
pre.src-modula-2:before { content: 'Modula-2'; }
pre.src-pascal:before { content: 'Pascal'; }
pre.src-ps:before { content: 'PostScript'; }
pre.src-prolog:before { content: 'Prolog'; }
pre.src-simula:before { content: 'Simula'; }
pre.src-tcl:before { content: 'tcl'; }
pre.src-tex:before { content: 'TeX'; }
pre.src-plain-tex:before { content: 'Plain TeX'; }
pre.src-verilog:before { content: 'Verilog'; }
pre.src-vhdl:before { content: 'VHDL'; }
pre.src-xml:before { content: 'XML'; }
pre.src-nxml:before { content: 'XML'; }
/* add a generic configuration mode; LaTeX export needs an additional
(add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
pre.src-conf:before { content: 'Configuration File'; }
table { border-collapse:collapse; }
caption.t-above { caption-side: top; }
caption.t-bottom { caption-side: bottom; }
td, th { vertical-align:top; }
th.org-right { text-align: center; }
th.org-left { text-align: center; }
th.org-center { text-align: center; }
td.org-right { text-align: right; }
td.org-left { text-align: left; }
td.org-center { text-align: center; }
dt { font-weight: bold; }
.footpara { display: inline; }
.footdef { margin-bottom: 1em; }
.figure { padding: 1em; }
.figure p { text-align: center; }
.equation-container {
display: table;
text-align: center;
width: 100%;
}
.equation {
vertical-align: middle;
}
.equation-label {
display: table-cell;
text-align: right;
vertical-align: middle;
}
.inlinetask {
padding: 10px;
border: 2px solid gray;
margin: 10px;
background: #ffffcc;
}
#org-div-home-and-up
{ text-align: right; font-size: 70%; white-space: nowrap; }
textarea { overflow-x: auto; }
.linenr { font-size: smaller }
.code-highlighted { background-color: #ffff00; }
.org-info-js_info-navigation { border-style: none; }
#org-info-js_console-label
{ font-size: 10px; font-weight: bold; white-space: nowrap; }
.org-info-js_search-highlight
{ background-color: #ffff00; color: #000000; font-weight: bold; }
.org-svg { width: 90%; }
/*]]>*/-->
</style>
<link rel="stylesheet" title="Standard" href="qcaml.css" type="text/css" />
<script type="text/javascript" src="org-info.js">
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&amp;dn=gpl-3.0.txt GPL-v3-or-Later
// @license-end
</script>
<script type="text/javascript">
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&amp;dn=gpl-3.0.txt GPL-v3-or-Later
<!--/*--><![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
/*]]>*///-->
// @license-end
</script>
<script type="text/javascript">
// @license magnet:?xt=urn:btih:e95b018ef3580986a04669f1b5879592219e2a7a&dn=public-domain.txt Public Domain
<!--/*--><![CDATA[/*><!--*/
function CodeHighlightOn(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.classList.add("code-highlighted");
target.classList.add("code-highlighted");
}
}
function CodeHighlightOff(elem, id)
{
var target = document.getElementById(id);
if(null != target) {
elem.classList.remove("code-highlighted");
target.classList.remove("code-highlighted");
}
}
/*]]>*///-->
// @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="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">Common</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org92842ff">1. Summary</a></li>
<li><a href="#org95eedad">2. Electrons</a>
<ul>
<li><a href="#orgf75fa70">2.1. Type</a></li>
<li><a href="#org9262d69">2.2. Creation</a></li>
<li><a href="#orgeb0efdb">2.3. Access</a></li>
<li><a href="#orgc5d7da2">2.4. Printers</a></li>
<li><a href="#org01f21a7">2.5. Tests</a></li>
</ul>
</li>
<li><a href="#org7557361">3. Element</a>
<ul>
<li><a href="#orgf4dc2b6">3.1. Type</a></li>
<li><a href="#orgbea9201">3.2. Conversion</a></li>
<li><a href="#orge438c8d">3.3. Database information</a></li>
<li><a href="#org28ea54a">3.4. Printers</a></li>
</ul>
</li>
<li><a href="#org6ec0e5e">4. Atomic mass</a></li>
<li><a href="#org031ab3f">5. Nuclei</a>
<ul>
<li><a href="#org0fe10a2">5.1. Type</a></li>
<li><a href="#org3736125">5.2. xyz file lexer/parser</a>
<ul>
<li><a href="#orgf7fe255">5.2.1. Lexer</a></li>
<li><a href="#orgc547fcc">5.2.2. Parser</a></li>
</ul>
</li>
<li><a href="#orgaff8d5e">5.3. Conversion</a></li>
<li><a href="#org4945fbb">5.4. Query</a></li>
<li><a href="#org07c7257">5.5. Printers</a></li>
<li><a href="#org738de5a">5.6. Tests</a></li>
</ul>
</li>
<li><a href="#orgd367ac4">6. Z-matrix</a>
<ul>
<li><a href="#org80345d7">6.1. Type</a></li>
<li><a href="#org59c1dba">6.2. Conversion</a></li>
<li><a href="#org0bb6924">6.3. Printers</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org92842ff" class="outline-2">
<h2 id="org92842ff"><span class="section-number-2">1</span> Summary</h2>
</div>
<div id="outline-container-org95eedad" class="outline-2">
<h2 id="org95eedad"><span class="section-number-2">2</span> Electrons</h2>
<div class="outline-text-2" id="text-2">
<p>
Data structure which contains the number of &alpha; and &beta; electrons.
</p>
</div>
<div id="outline-container-orgf75fa70" class="outline-3">
<h3 id="orgf75fa70"><span class="section-number-3">2.1</span> Type</h3>
<div class="outline-text-3" id="text-2-1">
<div class="org-src-container">
<pre class="src src-ocaml" id="orgb42d55c"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org9262d69" class="outline-3">
<h3 id="org9262d69"><span class="section-number-3">2.2</span> Creation</h3>
<div class="outline-text-3" id="text-2-2">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Common</span>
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">make</span> <span class="org-tuareg-font-lock-operator">:</span> int <span class="org-tuareg-font-lock-operator">-&gt;</span> int <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_atoms</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-label">?multiplicity</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-label">?charge</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">Nuclei.</span>t <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-comment-delimiter">(* </span><span class="org-comment">@param multiplicity default is 1</span>
<span class="org-comment"> @param charge default is 0</span>
<span class="org-comment"> @raise Invalid_argument if the spin multiplicity is not compatible with</span>
<span class="org-comment"> the molecule and the total charge.</span>
<span class="org-comment-delimiter">*)</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"><code>make n_alfa n_beta</code></td>
</tr>
<tr>
<td class="org-left"><code>of_atoms</code></td>
<td class="org-left">Creates the data relative to electrons for a molecular system described by <a href="#org9b1494e"><code>Nuclei.t</code></a> for a given total charge and spin multiplicity.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-orgeb0efdb" class="outline-3">
<h3 id="orgeb0efdb"><span class="section-number-3">2.3</span> Access</h3>
<div class="outline-text-3" id="text-2-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">charge</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">Charge.</span>t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">n_elec</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-governing">val</span> <span class="org-function-name">n_alfa</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-governing">val</span> <span class="org-function-name">n_beta</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-governing">val</span> <span class="org-function-name">multiplicity</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> int
</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>charge</code></td>
<td class="org-left">Sum of the charges of the electrons</td>
</tr>
<tr>
<td class="org-left"><code>n_elec</code></td>
<td class="org-left">Number of electrons</td>
</tr>
<tr>
<td class="org-left"><code>n_alfa</code></td>
<td class="org-left">Number of alpha electrons</td>
</tr>
<tr>
<td class="org-left"><code>n_beta</code></td>
<td class="org-left">Number of beta electrons</td>
</tr>
<tr>
<td class="org-left"><code>multiplicity</code></td>
<td class="org-left">Spin multiplicity: \(2S+1\)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-orgc5d7da2" class="outline-3">
<h3 id="orgc5d7da2"><span class="section-number-3">2.4</span> Printers</h3>
<div class="outline-text-3" id="text-2-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 id="outline-container-org01f21a7" class="outline-3">
<h3 id="org01f21a7"><span class="section-number-3">2.5</span> Tests</h3>
</div>
</div>
<div id="outline-container-org7557361" class="outline-2">
<h2 id="org7557361"><span class="section-number-2">3</span> Element</h2>
<div class="outline-text-2" id="text-3">
<p>
Chemical elements.
</p>
</div>
<div id="outline-container-orgf4dc2b6" class="outline-3">
<h3 id="orgf4dc2b6"><span class="section-number-3">3.1</span> Type</h3>
<div class="outline-text-3" id="text-3-1">
<div class="org-src-container">
<pre class="src src-ocaml" id="org80a6f80"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span> <span class="org-tuareg-font-lock-operator">=</span>
<span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">X</span>
<span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">H</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">He</span>
<span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Li</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Be</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">B</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">C</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">N</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">O</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">F</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Ne</span>
<span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Na</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Mg</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Al</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Si</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">P</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">S</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Cl</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Ar</span>
<span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">K</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Ca</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Sc</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Ti</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">V</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Cr</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Mn</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Fe</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Co</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Ni</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Cu</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Zn</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Ga</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Ge</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">As</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Se</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Br</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Kr</span>
<span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Rb</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Sr</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Y</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Zr</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Nb</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Mo</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Tc</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Ru</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Rh</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Pd</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Ag</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Cd</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">In</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Sn</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Sb</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Te</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">I</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Xe</span>
<span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Pt</span>
<span class="org-keyword">exception</span> <span class="org-tuareg-font-lock-constructor">ElementError</span> <span class="org-keyword">of</span> string
<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-orgbea9201" class="outline-3">
<h3 id="orgbea9201"><span class="section-number-3">3.2</span> Conversion</h3>
<div class="outline-text-3" id="text-3-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">of_string</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_string</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> string
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_long_string</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> string
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_int</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-governing">val</span> <span class="org-function-name">of_int</span> <span class="org-tuareg-font-lock-operator">:</span> int <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_charge</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">Charge.</span>t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_charge</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Charge.</span>t <span class="org-tuareg-font-lock-operator">-&gt;</span> t
</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>of_string</code></td>
<td class="org-left">Creates an <code>Element.t</code> from a chemical symbol or from the full name of the element (case insensitive)</td>
</tr>
<tr>
<td class="org-left"><code>to_string</code></td>
<td class="org-left">Gets the chemical symbol of the <code>Element.t</code> in a string</td>
</tr>
<tr>
<td class="org-left"><code>to_long_string</code></td>
<td class="org-left">Gets the full name of the <code>Element.t</code> in a string</td>
</tr>
<tr>
<td class="org-left"><code>to_int</code></td>
<td class="org-left">Convert to the atomic charge, with <code>int</code> type</td>
</tr>
<tr>
<td class="org-left"><code>of_int</code></td>
<td class="org-left">Create from the atomic charge, with <code>int</code> type</td>
</tr>
<tr>
<td class="org-left"><code>to_charge</code></td>
<td class="org-left">Convert to the atomic charge, with <code>Charge.t</code> type</td>
</tr>
<tr>
<td class="org-left"><code>of_charge</code></td>
<td class="org-left">Create from the atomic charge, with <code>Charge.t</code> type</td>
</tr>
</tbody>
</table>
<pre class="example" id="orgaeff9b7">
Element.of_string "Fe" ;;
- : Element.t = Particles.Element.Fe
Element.of_string "hydrogen" ;;
- : Element.t = Particles.Element.H
Element.of_string "Kryptonite" ;;
Exception: Particles.Element.ElementError "Element Kryptonite unknown".
Element.(to_long_string Fe) ;;
- : string = "Iron"
Element.(to_string Fe);;
- : string = "Fe"
</pre>
</div>
</div>
<div id="outline-container-orge438c8d" class="outline-3">
<h3 id="orge438c8d"><span class="section-number-3">3.3</span> Database information</h3>
<div class="outline-text-3" id="text-3-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">covalent_radius</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">Non_negative_float.</span>t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">vdw_radius</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">Non_negative_float.</span>t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">mass</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">Mass.</span>t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">small_core</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-governing">val</span> <span class="org-function-name">large_core</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> int
</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>covalent_radius</code></td>
<td class="org-left">Covalent radii of the elements, in atomic units</td>
</tr>
<tr>
<td class="org-left"><code>vdw_radius</code></td>
<td class="org-left">Van der Waals radii of the elements, in atomic units</td>
</tr>
<tr>
<td class="org-left"><code>mass</code></td>
<td class="org-left">Atomic mass of the elements, in atomic units)</td>
</tr>
<tr>
<td class="org-left"><code>small_core</code></td>
<td class="org-left">Number of electrons in the small core model (all except the outermost two shells)</td>
</tr>
<tr>
<td class="org-left"><code>large_core</code></td>
<td class="org-left">Number of electrons in the large core model (all except the outermost shell)</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org28ea54a" class="outline-3">
<h3 id="org28ea54a"><span class="section-number-3">3.4</span> Printers</h3>
<div class="outline-text-3" id="text-3-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
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">pp_long</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 id="outline-container-org6ec0e5e" class="outline-2">
<h2 id="org6ec0e5e"><span class="section-number-2">4</span> Atomic mass</h2>
<div class="outline-text-2" id="text-4">
<p>
Atomic mass, a non-negative float.
</p>
<div class="org-src-container">
<pre class="src src-ocaml" id="orge6ec335"><span class="org-tuareg-font-lock-governing">include</span> <span class="org-tuareg-font-lock-governing">module type of</span> <span class="org-tuareg-font-lock-module">Common.Non_negative_float</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org031ab3f" class="outline-2">
<h2 id="org031ab3f"><span class="section-number-2">5</span> Nuclei</h2>
<div class="outline-text-2" id="text-5">
</div>
<div id="outline-container-org0fe10a2" class="outline-3">
<h3 id="org0fe10a2"><span class="section-number-3">5.1</span> Type</h3>
<div class="outline-text-3" id="text-5-1">
<p>
<a id="org9b1494e"><code>Nuclei.t</code></a>
</p>
<div class="org-src-container">
<pre class="src src-ocaml" id="org39d5b90"><span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Common</span>
<span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span> <span class="org-tuareg-font-lock-operator">=</span> <span class="org-tuareg-font-lock-operator">(</span><span class="org-tuareg-font-lock-module">Element.</span>t <span class="org-tuareg-font-lock-operator">*</span> <span class="org-tuareg-font-lock-module">Coordinate.</span>t<span class="org-tuareg-font-lock-operator">)</span> array
</pre>
</div>
</div>
</div>
<div id="outline-container-org3736125" class="outline-3">
<h3 id="org3736125"><span class="section-number-3">5.2</span> xyz file lexer/parser</h3>
<div class="outline-text-3" id="text-5-2">
</div>
<div id="outline-container-orgf7fe255" class="outline-4">
<h4 id="orgf7fe255"><span class="section-number-4">5.2.1</span> Lexer</h4>
<div class="outline-text-4" id="text-5-2-1">
<p>
<code>nuclei_lexer.mll</code> contains the description of the lexemes used in
an xyz file.
</p>
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-operator">{</span>
<span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Xyz_parser</span>
<span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-variable-name">eol</span> <span class="org-tuareg-font-lock-operator">=</span> <span class="org-tuareg-font-lock-operator">[</span><span class="org-string">'\n'</span><span class="org-tuareg-font-lock-operator">]</span>
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-variable-name">white</span> <span class="org-tuareg-font-lock-operator">=</span> <span class="org-tuareg-font-lock-operator">[</span><span class="org-string">' '</span> <span class="org-string">'\t'</span><span class="org-tuareg-font-lock-operator">]+</span>
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-variable-name">word</span> <span class="org-tuareg-font-lock-operator">=</span> <span class="org-tuareg-font-lock-operator">[^</span><span class="org-string">' '</span> <span class="org-string">'\t'</span> <span class="org-string">'\n'</span><span class="org-tuareg-font-lock-operator">]+</span>
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-variable-name">letter</span> <span class="org-tuareg-font-lock-operator">=</span> <span class="org-tuareg-font-lock-operator">[</span><span class="org-string">'A'</span><span class="org-tuareg-font-lock-operator">-</span><span class="org-string">'Z'</span> <span class="org-string">'a'</span><span class="org-tuareg-font-lock-operator">-</span><span class="org-string">'z'</span><span class="org-tuareg-font-lock-operator">]</span>
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-variable-name">integer</span> <span class="org-tuareg-font-lock-operator">=</span> <span class="org-tuareg-font-lock-operator">[</span><span class="org-string">'0'</span><span class="org-tuareg-font-lock-operator">-</span><span class="org-string">'9'</span><span class="org-tuareg-font-lock-operator">]+</span>
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-variable-name">real</span> <span class="org-tuareg-font-lock-operator">=</span> <span class="org-string">'-'</span><span class="org-tuareg-font-lock-operator">?</span> <span class="org-tuareg-font-lock-operator">(</span>integer <span class="org-string">'.'</span> integer <span class="org-tuareg-font-lock-operator">|</span> integer <span class="org-string">'.'</span> <span class="org-tuareg-font-lock-operator">|</span> <span class="org-string">'.'</span> integer<span class="org-tuareg-font-lock-operator">)</span> <span class="org-tuareg-font-lock-operator">([</span><span class="org-string">'e'</span> <span class="org-string">'E'</span><span class="org-tuareg-font-lock-operator">]</span> <span class="org-tuareg-font-lock-operator">(</span><span class="org-string">'+'</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-string">'-'</span><span class="org-tuareg-font-lock-operator">)?</span> integer<span class="org-tuareg-font-lock-operator">)?</span>
rule read_all <span class="org-tuareg-font-lock-operator">=</span> parse
<span class="org-tuareg-font-lock-operator">|</span> eof <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-constructor">EOF</span> <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> eol <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> white <span class="org-keyword">as</span> w <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> w <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> integer <span class="org-keyword">as</span> i <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-constructor">INTEGER</span> <span class="org-tuareg-font-lock-operator">(</span>int_of_string i<span class="org-tuareg-font-lock-operator">)</span> <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> real <span class="org-keyword">as</span> f <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-operator">(</span>float_of_string f<span class="org-tuareg-font-lock-operator">)</span> <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> word <span class="org-keyword">as</span> w <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-constructor">WORD</span> w <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">{</span>
<span class="org-comment-delimiter">(* </span><span class="org-comment">DEBUG</span>
<span class="org-comment"> let () =</span>
<span class="org-comment"> let ic = open_in "h2o.xyz" in</span>
<span class="org-comment"> let lexbuf = Lexing.from_channel ic in</span>
<span class="org-comment"> while true do</span>
<span class="org-comment"> let s =</span>
<span class="org-comment"> match read_all lexbuf with</span>
<span class="org-comment"> | EOL -&gt; "EOL"</span>
<span class="org-comment"> | SPACE w -&gt; "SPACE("^w^")"</span>
<span class="org-comment"> | INTEGER i -&gt; "INTEGER("^(string_of_int i)^")"</span>
<span class="org-comment"> | FLOAT f -&gt; "FLOAT("^(string_of_float f)^")"</span>
<span class="org-comment"> | WORD w -&gt; "WORD("^w^")"</span>
<span class="org-comment"> | EOF -&gt; "EOF"</span>
<span class="org-comment"> in</span>
<span class="org-comment"> print_endline s</span>
<span class="org-comment"> done;</span>
<span class="org-comment-delimiter">*)</span>
<span class="org-tuareg-font-lock-operator">}</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc547fcc" class="outline-4">
<h4 id="orgc547fcc"><span class="section-number-4">5.2.2</span> Parser</h4>
<div class="outline-text-4" id="text-5-2-2">
<p>
<code>xyz_parser.mly</code> parses nuclear coordinates in xyz format.
</p>
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-operator">%{</span>
<span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Common</span>
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-function-name">make_angstrom</span><span class="org-variable-name"> x y z</span> <span class="org-tuareg-font-lock-operator">=</span>
<span class="org-tuareg-font-lock-module">Coordinate.</span><span class="org-tuareg-font-lock-operator">(</span>make_angstrom <span class="org-tuareg-font-lock-operator">{</span>
x <span class="org-tuareg-font-lock-operator">;</span> y <span class="org-tuareg-font-lock-operator">;</span> z
<span class="org-tuareg-font-lock-operator">})</span>
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-function-name">output_of</span><span class="org-variable-name"> f x y z</span> <span class="org-tuareg-font-lock-operator">=</span>
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-variable-name">a</span> <span class="org-tuareg-font-lock-operator">=</span> make_angstrom x y z <span class="org-tuareg-font-lock-governing">in</span>
<span class="org-keyword">fun</span> <span class="org-variable-name">e</span> <span class="org-tuareg-font-lock-operator">-&gt;</span>
<span class="org-tuareg-font-lock-operator">{</span>
<span class="org-tuareg-font-lock-module">Xyz_ast.</span>
element <span class="org-tuareg-font-lock-operator">=</span> f e<span class="org-tuareg-font-lock-operator">;</span>
coord <span class="org-tuareg-font-lock-operator">=</span> a <span class="org-tuareg-font-lock-operator">;</span>
<span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-variable-name">output_of_string</span> <span class="org-tuareg-font-lock-operator">=</span> output_of <span class="org-tuareg-font-lock-module">Element.</span>of_string
<span class="org-tuareg-font-lock-governing">let</span> <span class="org-variable-name">output_of_int</span> <span class="org-tuareg-font-lock-operator">=</span> output_of <span class="org-tuareg-font-lock-module">Element.</span>of_int
<span class="org-tuareg-font-lock-operator">%}</span>
<span class="org-tuareg-font-lock-operator">%</span>token <span class="org-tuareg-font-lock-constructor">EOL</span>
<span class="org-tuareg-font-lock-operator">%</span>token <span class="org-tuareg-font-lock-operator">&lt;</span>string<span class="org-tuareg-font-lock-operator">&gt;</span> <span class="org-tuareg-font-lock-constructor">SPACE</span>
<span class="org-tuareg-font-lock-operator">%</span>token <span class="org-tuareg-font-lock-operator">&lt;</span>string<span class="org-tuareg-font-lock-operator">&gt;</span> <span class="org-tuareg-font-lock-constructor">WORD</span>
<span class="org-tuareg-font-lock-operator">%</span>token <span class="org-tuareg-font-lock-operator">&lt;</span>int<span class="org-tuareg-font-lock-operator">&gt;</span> <span class="org-tuareg-font-lock-constructor">INTEGER</span>
<span class="org-tuareg-font-lock-operator">%</span>token <span class="org-tuareg-font-lock-operator">&lt;</span>float<span class="org-tuareg-font-lock-operator">&gt;</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span>
<span class="org-tuareg-font-lock-operator">%</span>token <span class="org-tuareg-font-lock-constructor">EOF</span>
<span class="org-tuareg-font-lock-operator">%</span>start input
<span class="org-tuareg-font-lock-operator">%</span><span class="org-tuareg-font-lock-governing">type</span> <span class="org-tuareg-font-lock-operator">&lt;</span><span class="org-tuareg-font-lock-module">Xyz_ast.</span>xyz_file<span class="org-tuareg-font-lock-operator">&gt;</span> input
<span class="org-tuareg-font-lock-operator">%%</span> <span class="org-tuareg-font-lock-operator">/*</span> <span class="org-tuareg-font-lock-constructor">Grammar</span> rules <span class="org-tuareg-font-lock-governing">and</span> <span class="org-function-name">actions</span><span class="org-variable-name"> follow</span> <span class="org-tuareg-font-lock-operator">*/</span>
input<span class="org-tuareg-font-lock-operator">:</span>
<span class="org-tuareg-font-lock-operator">|</span> integer title atoms_xyz <span class="org-tuareg-font-lock-operator">{</span>
<span class="org-tuareg-font-lock-operator">{</span>
number_of_atoms <span class="org-tuareg-font-lock-operator">=</span> $1<span class="org-tuareg-font-lock-operator">;</span>
file_title <span class="org-tuareg-font-lock-operator">=</span> $2<span class="org-tuareg-font-lock-operator">;</span>
nuclei <span class="org-tuareg-font-lock-operator">=</span> $3<span class="org-tuareg-font-lock-operator">;</span>
<span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">;</span>
integer<span class="org-tuareg-font-lock-operator">:</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">INTEGER</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">INTEGER</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">INTEGER</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> $2 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">INTEGER</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> $2 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">;</span>
title<span class="org-tuareg-font-lock-operator">:</span>
<span class="org-tuareg-font-lock-operator">|</span> title_list <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">;</span>
text<span class="org-tuareg-font-lock-operator">:</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">WORD</span> <span class="org-tuareg-font-lock-operator">{</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-operator">{</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-operator">(</span>string_of_float $1<span class="org-tuareg-font-lock-operator">)}</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">INTEGER</span> <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-operator">(</span>string_of_int $1<span class="org-tuareg-font-lock-operator">)}</span>
<span class="org-tuareg-font-lock-operator">;</span>
title_list<span class="org-tuareg-font-lock-operator">:</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-operator">{</span> <span class="org-string">""</span> <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> title_list text <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-operator">(</span>$1 <span class="org-tuareg-font-lock-operator">^</span> $2<span class="org-tuareg-font-lock-operator">)</span> <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">;</span>
atoms_xyz<span class="org-tuareg-font-lock-operator">:</span>
<span class="org-tuareg-font-lock-operator">|</span> atoms_list <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-module">List.</span>rev $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> atoms_list <span class="org-tuareg-font-lock-constructor">EOF</span> <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-module">List.</span>rev $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">;</span>
atoms_list<span class="org-tuareg-font-lock-operator">:</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-operator">{</span> <span class="org-tuareg-font-lock-operator">[]</span> <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> atoms_list <span class="org-tuareg-font-lock-constructor">WORD</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> output_of_string $4 $6 $8 $2 <span class="org-tuareg-font-lock-operator">::</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> atoms_list <span class="org-tuareg-font-lock-constructor">WORD</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> output_of_string $4 $6 $8 $2 <span class="org-tuareg-font-lock-operator">::</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> atoms_list <span class="org-tuareg-font-lock-constructor">INTEGER</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> output_of_int $4 $6 $8 $2 <span class="org-tuareg-font-lock-operator">::</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> atoms_list <span class="org-tuareg-font-lock-constructor">INTEGER</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> output_of_int $4 $6 $8 $2 <span class="org-tuareg-font-lock-operator">::</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> atoms_list <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">WORD</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> output_of_string $5 $7 $9 $3 <span class="org-tuareg-font-lock-operator">::</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> atoms_list <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">WORD</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> output_of_string $5 $7 $9 $3 <span class="org-tuareg-font-lock-operator">::</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> atoms_list <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">INTEGER</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> output_of_int $5 $7 $9 $3 <span class="org-tuareg-font-lock-operator">::</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">|</span> atoms_list <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">INTEGER</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">FLOAT</span> <span class="org-tuareg-font-lock-constructor">SPACE</span> <span class="org-tuareg-font-lock-constructor">EOL</span> <span class="org-tuareg-font-lock-operator">{</span> output_of_int $5 $7 $9 $3 <span class="org-tuareg-font-lock-operator">::</span> $1 <span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-operator">;</span>
</pre>
</div>
<p>
When an xyz file is read by <code>xyz_parser.mly</code>, it is converted into
an <code>xyz_file</code> data structure.
</p>
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Common</span>
<span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">nucleus</span> <span class="org-tuareg-font-lock-operator">=</span>
<span class="org-tuareg-font-lock-operator">{</span>
element<span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Element.</span>t <span class="org-tuareg-font-lock-operator">;</span>
coord <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Coordinate.</span>angstrom <span class="org-tuareg-font-lock-module">Coordinate.</span>point<span class="org-tuareg-font-lock-operator">;</span>
<span class="org-tuareg-font-lock-operator">}</span>
<span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">xyz_file</span> <span class="org-tuareg-font-lock-operator">=</span>
<span class="org-tuareg-font-lock-operator">{</span>
number_of_atoms <span class="org-tuareg-font-lock-operator">:</span> int <span class="org-tuareg-font-lock-operator">;</span>
file_title <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">;</span>
nuclei <span class="org-tuareg-font-lock-operator">:</span> nucleus list <span class="org-tuareg-font-lock-operator">;</span>
<span class="org-tuareg-font-lock-operator">}</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgaff8d5e" class="outline-3">
<h3 id="orgaff8d5e"><span class="section-number-3">5.3</span> Conversion</h3>
<div class="outline-text-3" id="text-5-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">of_xyz_string</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_xyz_string</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> string
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_xyz_file</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_zmt_string</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_zmt_file</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_string</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> string
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_filename</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_trexio</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Trexio.</span>trexio_file <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_trexio</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Trexio.</span>trexio_file <span class="org-tuareg-font-lock-operator">-&gt;</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> unit
</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>of_xyz_string</code></td>
<td class="org-left">Create from a string, in xyz format</td>
</tr>
<tr>
<td class="org-left"><code>of_xyz_file</code></td>
<td class="org-left">Create from a file, in xyz format</td>
</tr>
<tr>
<td class="org-left"><code>of_zmt_string</code></td>
<td class="org-left">Create from a string, in z-matrix format</td>
</tr>
<tr>
<td class="org-left"><code>of_zmt_file</code></td>
<td class="org-left">Create from a file, in z-matrix format</td>
</tr>
<tr>
<td class="org-left"><code>to_string</code></td>
<td class="org-left">Transform to a string, for printing</td>
</tr>
<tr>
<td class="org-left"><code>of_filename</code></td>
<td class="org-left">Detects the type of file (xyz, z-matrix) and reads the file</td>
</tr>
<tr>
<td class="org-left"><code>of_trexio</code></td>
<td class="org-left">Reads the geometry from a TREXIO file</td>
</tr>
<tr>
<td class="org-left"><code>to_trexio</code></td>
<td class="org-left">Writes the geometry in a TREXIO file</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org4945fbb" class="outline-3">
<h3 id="org4945fbb"><span class="section-number-3">5.4</span> Query</h3>
<div class="outline-text-3" id="text-5-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">formula</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> string
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">repulsion</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> float
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">charge</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">Charge.</span>t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">small_core</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-governing">val</span> <span class="org-function-name">large_core</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> int
</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>formula</code></td>
<td class="org-left">Returns the chemical formula</td>
</tr>
<tr>
<td class="org-left"><code>repulsion</code></td>
<td class="org-left">Nuclear repulsion energy, in atomic units</td>
</tr>
<tr>
<td class="org-left"><code>charge</code></td>
<td class="org-left">Sum of the charges of the nuclei</td>
</tr>
<tr>
<td class="org-left"><code>small_core</code></td>
<td class="org-left">Number of core electrons in the small core model</td>
</tr>
<tr>
<td class="org-left"><code>large_core</code></td>
<td class="org-left">Number of core electrons in the large core model</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org07c7257" class="outline-3">
<h3 id="org07c7257"><span class="section-number-3">5.5</span> Printers</h3>
<div class="outline-text-3" id="text-5-5">
<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 id="outline-container-org738de5a" class="outline-3">
<h3 id="org738de5a"><span class="section-number-3">5.6</span> Tests</h3>
</div>
</div>
<div id="outline-container-orgd367ac4" class="outline-2">
<h2 id="orgd367ac4"><span class="section-number-2">6</span> Z-matrix</h2>
<div class="outline-text-2" id="text-6">
<p>
Z-matrix representation of nuclear coordinates.
</p>
</div>
<div id="outline-container-org80345d7" class="outline-3">
<h3 id="org80345d7"><span class="section-number-3">6.1</span> Type</h3>
<div class="outline-text-3" id="text-6-1">
<div class="org-src-container">
<pre class="src src-ocaml" id="org4f1052d"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org59c1dba" class="outline-3">
<h3 id="org59c1dba"><span class="section-number-3">6.2</span> Conversion</h3>
<div class="outline-text-3" id="text-6-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">of_string</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_xyz</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-operator">(</span><span class="org-tuareg-font-lock-module">Element.</span>t <span class="org-tuareg-font-lock-operator">*</span> float <span class="org-tuareg-font-lock-operator">*</span> float <span class="org-tuareg-font-lock-operator">*</span> float<span class="org-tuareg-font-lock-operator">)</span> array
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_xyz_string</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> string
</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>of_string</code></td>
<td class="org-left">Reads a z-matrix from a string</td>
</tr>
<tr>
<td class="org-left"><code>to_xyz</code></td>
<td class="org-left">Converts to xyz format, as in the <code>Nuclei</code> module</td>
</tr>
<tr>
<td class="org-left"><code>to_xyz_string</code></td>
<td class="org-left">Converts to xyz format, as a string</td>
</tr>
</tbody>
</table>
<pre class="example" id="org5705752">
let zmt = Zmatrix.of_string "
n
n 1 nn
h 1 hn 2 hnn
h 2 hn 1 hnn 3 dih4
h 1 hn 2 hnn 4 dih5
h 2 hn 1 hnn 3 dih5
nn 1.446
hn 1.016
hnn 106.0
dih4 -54.38
dih5 54.38
" ;;
- : Zmatrix.t = N
N 1 1.446000
H 1 1.016000 2 106.000000
H 2 1.016000 1 106.000000 3 -54.380000
H 1 1.016000 2 106.000000 4 54.380000
H 2 1.016000 1 106.000000 3 54.380000
Zmatrix.to_xyz zmt ;;
- : (Element.t * float * float * float) array =
[|(N, 0., 0., 0.); (N, 0., 0., 1.446);
(H, -0.976641883073332107, 0., -0.280047553510071046);
(H, -0.568802835186988709, 0.793909757123734683, 1.726047553510071);
(H, 0.314092649983635563, 0.924756819385119, -0.280047553510071101);
(H, -0.568802835186988709, -0.793909757123734683, 1.726047553510071)|]
Zmatrix.to_xyz_string zmt ;;
- : string =
"N 0.000000 0.000000 0.000000
N 0.000000 0.000000 1.446000
H -0.976642 0.000000 -0.280048
H -0.568803 0.793910 1.726048
H 0.314093 0.924757 -0.280048
H -0.568803 -0.793910 1.726048"
</pre>
</div>
</div>
<div id="outline-container-org0bb6924" class="outline-3">
<h3 id="org0bb6924"><span class="section-number-3">6.3</span> Printers</h3>
<div class="outline-text-3" id="text-6-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">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: 2023-04-24 Mon 14:13</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>