mirror of
https://gitlab.com/scemama/QCaml.git
synced 2024-11-07 06:33:39 +01:00
1105 lines
68 KiB
HTML
1105 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 18:07 -->
|
|
<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&dn=gpl-3.0.txt GPL-v3-or-Later
|
|
// @license-end
|
|
</script>
|
|
|
|
<script type="text/javascript">
|
|
// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&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="#org6df3964">1. Summary</a></li>
|
|
<li><a href="#org5753373">2. Electrons</a>
|
|
<ul>
|
|
<li><a href="#org25fbdd2">2.1. Type</a></li>
|
|
<li><a href="#org5d0f6c5">2.2. Creation</a></li>
|
|
<li><a href="#org6c90a8b">2.3. Access</a></li>
|
|
<li><a href="#orgd40dbf2">2.4. Printers</a></li>
|
|
<li><a href="#org20072b6">2.5. Tests</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orgb411aa8">3. Element</a>
|
|
<ul>
|
|
<li><a href="#org7b29939">3.1. Type</a></li>
|
|
<li><a href="#org46b8b47">3.2. Conversion</a></li>
|
|
<li><a href="#org1d70546">3.3. Database information</a></li>
|
|
<li><a href="#orgd5738cc">3.4. Printers</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org61359db">4. Atomic mass</a></li>
|
|
<li><a href="#org3653358">5. Nuclei</a>
|
|
<ul>
|
|
<li><a href="#orgdc5c638">5.1. Type</a></li>
|
|
<li><a href="#org795558e">5.2. xyz file lexer/parser</a>
|
|
<ul>
|
|
<li><a href="#orgfa3e0b9">5.2.1. Lexer</a></li>
|
|
<li><a href="#orge4240df">5.2.2. Parser</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#orgfe57c35">5.3. Conversion</a></li>
|
|
<li><a href="#org14de381">5.4. Query</a></li>
|
|
<li><a href="#org9224cc6">5.5. TREXIO</a>
|
|
<ul>
|
|
<li><a href="#org7046b2a">5.5.1. Read</a></li>
|
|
<li><a href="#orgd1b3675">5.5.2. Write</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org3ece660">5.6. Printers</a></li>
|
|
<li><a href="#org6a90479">5.7. Tests</a></li>
|
|
</ul>
|
|
</li>
|
|
<li><a href="#org46003da">6. Z-matrix</a>
|
|
<ul>
|
|
<li><a href="#org5fcb7ed">6.1. Type</a></li>
|
|
<li><a href="#orga6c6d0e">6.2. Conversion</a></li>
|
|
<li><a href="#org37a7c2e">6.3. Printers</a></li>
|
|
</ul>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org6df3964" class="outline-2">
|
|
<h2 id="org6df3964"><span class="section-number-2">1</span> Summary</h2>
|
|
</div>
|
|
|
|
<div id="outline-container-org5753373" class="outline-2">
|
|
<h2 id="org5753373"><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 α and β electrons.
|
|
</p>
|
|
</div>
|
|
|
|
<div id="outline-container-org25fbdd2" class="outline-3">
|
|
<h3 id="org25fbdd2"><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="org59c86ec"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org5d0f6c5" class="outline-3">
|
|
<h3 id="org5d0f6c5"><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">-></span> int <span class="org-tuareg-font-lock-operator">-></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">-></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">-></span> <span class="org-tuareg-font-lock-module">Nuclei.</span>t <span class="org-tuareg-font-lock-operator">-></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="#org1056889"><code>Nuclei.t</code></a> for a given total charge and spin multiplicity.</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org6c90a8b" class="outline-3">
|
|
<h3 id="org6c90a8b"><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">-></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">-></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">-></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">-></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">-></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-orgd40dbf2" class="outline-3">
|
|
<h3 id="orgd40dbf2"><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">-></span> t <span class="org-tuareg-font-lock-operator">-></span> unit
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org20072b6" class="outline-3">
|
|
<h3 id="org20072b6"><span class="section-number-3">2.5</span> Tests</h3>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgb411aa8" class="outline-2">
|
|
<h2 id="orgb411aa8"><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-org7b29939" class="outline-3">
|
|
<h3 id="org7b29939"><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="org088d0e5"><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-org46b8b47" class="outline-3">
|
|
<h3 id="org46b8b47"><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">-></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">-></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">-></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">-></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">-></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">-></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">-></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="org3545bb2">
|
|
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-org1d70546" class="outline-3">
|
|
<h3 id="org1d70546"><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">-></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">-></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">-></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">-></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">-></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-orgd5738cc" class="outline-3">
|
|
<h3 id="orgd5738cc"><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">-></span> t <span class="org-tuareg-font-lock-operator">-></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">-></span> t <span class="org-tuareg-font-lock-operator">-></span> unit
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org61359db" class="outline-2">
|
|
<h2 id="org61359db"><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="orgff86835"><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-org3653358" class="outline-2">
|
|
<h2 id="org3653358"><span class="section-number-2">5</span> Nuclei</h2>
|
|
<div class="outline-text-2" id="text-5">
|
|
</div>
|
|
|
|
<div id="outline-container-orgdc5c638" class="outline-3">
|
|
<h3 id="orgdc5c638"><span class="section-number-3">5.1</span> Type</h3>
|
|
<div class="outline-text-3" id="text-5-1">
|
|
<p>
|
|
<a id="org1056889"><code>Nuclei.t</code></a>
|
|
</p>
|
|
|
|
<div class="org-src-container">
|
|
<pre class="src src-ocaml" id="org5d75f82"><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-org795558e" class="outline-3">
|
|
<h3 id="org795558e"><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-orgfa3e0b9" class="outline-4">
|
|
<h4 id="orgfa3e0b9"><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 -> "EOL"</span>
|
|
<span class="org-comment"> | SPACE w -> "SPACE("^w^")"</span>
|
|
<span class="org-comment"> | INTEGER i -> "INTEGER("^(string_of_int i)^")"</span>
|
|
<span class="org-comment"> | FLOAT f -> "FLOAT("^(string_of_float f)^")"</span>
|
|
<span class="org-comment"> | WORD w -> "WORD("^w^")"</span>
|
|
<span class="org-comment"> | EOF -> "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-orge4240df" class="outline-4">
|
|
<h4 id="orge4240df"><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">-></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"><</span>string<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>token <span class="org-tuareg-font-lock-operator"><</span>string<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>token <span class="org-tuareg-font-lock-operator"><</span>int<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>token <span class="org-tuareg-font-lock-operator"><</span>float<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>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"><</span><span class="org-tuareg-font-lock-module">Xyz_ast.</span>xyz_file<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> <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-orgfe57c35" class="outline-3">
|
|
<h3 id="orgfe57c35"><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">-></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">-></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">-></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">-></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">-></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">-></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">-></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_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>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org14de381" class="outline-3">
|
|
<h3 id="org14de381"><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">-></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">-></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">-></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">-></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">-></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-org9224cc6" class="outline-3">
|
|
<h3 id="org9224cc6"><span class="section-number-3">5.5</span> TREXIO</h3>
|
|
<div class="outline-text-3" id="text-5-5">
|
|
</div>
|
|
<div id="outline-container-org7046b2a" class="outline-4">
|
|
<h4 id="org7046b2a"><span class="section-number-4">5.5.1</span> Read</h4>
|
|
<div class="outline-text-4" id="text-5-5-1">
|
|
<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_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">-></span> t
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orgd1b3675" class="outline-4">
|
|
<h4 id="orgd1b3675"><span class="section-number-4">5.5.2</span> Write</h4>
|
|
<div class="outline-text-4" id="text-5-5-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">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">-></span> t <span class="org-tuareg-font-lock-operator">-></span> unit
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org3ece660" class="outline-3">
|
|
<h3 id="org3ece660"><span class="section-number-3">5.6</span> Printers</h3>
|
|
<div class="outline-text-3" id="text-5-6">
|
|
<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">-></span> t <span class="org-tuareg-font-lock-operator">-></span> unit
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org6a90479" class="outline-3">
|
|
<h3 id="org6a90479"><span class="section-number-3">5.7</span> Tests</h3>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-org46003da" class="outline-2">
|
|
<h2 id="org46003da"><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-org5fcb7ed" class="outline-3">
|
|
<h3 id="org5fcb7ed"><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="orgf9db5fa"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
|
|
</pre>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div id="outline-container-orga6c6d0e" class="outline-3">
|
|
<h3 id="orga6c6d0e"><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">-></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">-></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">-></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="org7e18520">
|
|
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-org37a7c2e" class="outline-3">
|
|
<h3 id="org37a7c2e"><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">-></span> t <span class="org-tuareg-font-lock-operator">-></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 18:07</p>
|
|
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
|
|
</div>
|
|
</body>
|
|
</html>
|