2021-01-01 16:39:33 +01:00
<?xml version="1.0" encoding="utf-8"?>
< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
< html xmlns = "http://www.w3.org/1999/xhtml" lang = "en" xml:lang = "en" >
< head >
2021-01-01 17:05:25 +01:00
<!-- 2021 - 01 - 01 Fri 17:04 -->
2021-01-01 16:39:33 +01:00
< 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" type = "text/css" href = "https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/htmlize.css" / >
< link rel = "stylesheet" type = "text/css" href = "https://fniessen.github.io/org-html-themes/src/readtheorg_theme/css/readtheorg.css" / >
< script src = "https://ajax.googleapis.com/ajax/libs/jquery/2.1.3/jquery.min.js" > < / script >
< script src = "https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js" > < / script >
< script type = "text/javascript" src = "https://fniessen.github.io/org-html-themes/src/lib/js/jquery.stickytableheaders.min.js" > < / script >
< script type = "text/javascript" src = "https://fniessen.github.io/org-html-themes/src/readtheorg_theme/js/readtheorg.js" > < / 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 = "content" >
< h1 class = "title" > Common< / h1 >
< div id = "table-of-contents" >
< h2 > Table of Contents< / h2 >
< div id = "text-table-of-contents" >
< ul >
2021-01-01 17:05:25 +01:00
< li > < a href = "#orgd29e276" > 1. Electrons< / a >
2021-01-01 16:39:33 +01:00
< ul >
2021-01-01 17:05:25 +01:00
< li > < a href = "#org797cc3a" > 1.1. Type< / a > < / li >
< li > < a href = "#org2bed657" > 1.2. Creation< / a > < / li >
< li > < a href = "#org2672eeb" > 1.3. Access< / a > < / li >
< li > < a href = "#org8f61c62" > 1.4. Printers< / a > < / li >
< li > < a href = "#org0d76e84" > 1.5. Tests< / a > < / li >
2021-01-01 16:39:33 +01:00
< / ul >
< / li >
2021-01-01 17:05:25 +01:00
< li > < a href = "#org904d88b" > 2. Element< / a >
2021-01-01 16:39:33 +01:00
< ul >
2021-01-01 17:05:25 +01:00
< li > < a href = "#org0f44138" > 2.1. Type< / a > < / li >
< li > < a href = "#org3260b21" > 2.2. Conversion< / a > < / li >
< li > < a href = "#orgecbb559" > 2.3. Database information< / a > < / li >
< li > < a href = "#org4204ce9" > 2.4. Printers< / a > < / li >
2021-01-01 16:39:33 +01:00
< / ul >
< / li >
2021-01-01 17:05:25 +01:00
< li > < a href = "#orgc37ce9d" > 3. Atomic mass< / a > < / li >
< li > < a href = "#org485ac9f" > 4. Nuclei< / a >
2021-01-01 16:39:33 +01:00
< ul >
2021-01-01 17:05:25 +01:00
< li > < a href = "#org02f7836" > 4.1. Type< / a > < / li >
< li > < a href = "#orgfdafdd0" > 4.2. xyz file lexer/parser< / a >
2021-01-01 16:39:33 +01:00
< ul >
2021-01-01 17:05:25 +01:00
< li > < a href = "#orgeddfd39" > 4.2.1. Lexer< / a > < / li >
< li > < a href = "#orgb1e9400" > 4.2.2. Parser< / a > < / li >
2021-01-01 16:39:33 +01:00
< / ul >
< / li >
2021-01-01 17:05:25 +01:00
< li > < a href = "#org19995b8" > 4.3. Conversion< / a > < / li >
< li > < a href = "#org57fb733" > 4.4. < span class = "todo TODO" > TODO< / span > Query< / a > < / li >
< li > < a href = "#org87456a6" > 4.5. Printers< / a > < / li >
< li > < a href = "#org60012a5" > 4.6. Tests< / a > < / li >
2021-01-01 16:39:33 +01:00
< / ul >
< / li >
2021-01-01 17:05:25 +01:00
< li > < a href = "#org72daeec" > 5. Z-matrix< / a >
2021-01-01 16:39:33 +01:00
< ul >
2021-01-01 17:05:25 +01:00
< li > < a href = "#org0859680" > 5.1. Type< / a > < / li >
< li > < a href = "#org9ab67d9" > 5.2. Conversion< / a > < / li >
< li > < a href = "#org442f12d" > 5.3. Printers< / a > < / li >
2021-01-01 16:39:33 +01:00
< / ul >
< / li >
< / ul >
< / div >
< / div >
< div class = "org-src-container" >
2021-01-01 17:05:25 +01:00
< pre class = "src src-ocaml" id = "orgb5cf5bb" > < span class = "org-string" > "Information relative to particles (electrons and nuclei)."< / span >
2021-01-01 16:39:33 +01:00
< / pre >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-orgd29e276" class = "outline-2" >
< h2 id = "orgd29e276" > < span class = "section-number-2" > 1< / span > Electrons< / h2 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-2" id = "text-1" >
< p >
Data structure which contains the number of α and β electrons.
< / p >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org797cc3a" class = "outline-3" >
< h3 id = "org797cc3a" > < span class = "section-number-3" > 1.1< / span > Type< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-1-1" >
< div class = "org-src-container" >
2021-01-01 17:05:25 +01:00
< pre class = "src src-ocaml" id = "org86ddc6e" > < span class = "org-tuareg-font-lock-governing" > type< / span > < span class = "org-type" > t< / span >
2021-01-01 16:39:33 +01:00
< / pre >
< / div >
< / div >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org2bed657" class = "outline-3" >
< h3 id = "org2bed657" > < span class = "section-number-3" > 1.2< / span > Creation< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-1-2" >
< div class = "org-src-container" >
< pre class = "src src-ocaml" > < span class = "org-tuareg-font-lock-governing" > 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 < code > Nuclei.t< / code > for a given total charge and spin multiplicity.< / td >
< / tr >
< / tbody >
< / table >
< / div >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org2672eeb" class = "outline-3" >
< h3 id = "org2672eeb" > < span class = "section-number-3" > 1.3< / span > Access< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-1-3" >
< div class = "org-src-container" >
< pre class = "src src-ocaml" > < span class = "org-tuareg-font-lock-governing" > val< / span > < span class = "org-function-name" > 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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org8f61c62" class = "outline-3" >
< h3 id = "org8f61c62" > < span class = "section-number-3" > 1.4< / span > Printers< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-1-4" >
< div class = "org-src-container" >
< pre class = "src src-ocaml" > < span class = "org-tuareg-font-lock-governing" > val< / span > < span class = "org-function-name" > pp< / span > < span class = "org-tuareg-font-lock-operator" > :< / span > < span class = "org-tuareg-font-lock-module" > Format.< / span > formatter < span class = "org-tuareg-font-lock-operator" > -> < / span > t < span class = "org-tuareg-font-lock-operator" > -> < / span > unit
< / pre >
< / div >
< / div >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org0d76e84" class = "outline-3" >
< h3 id = "org0d76e84" > < span class = "section-number-3" > 1.5< / span > Tests< / h3 >
2021-01-01 16:39:33 +01:00
< / div >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org904d88b" class = "outline-2" >
< h2 id = "org904d88b" > < span class = "section-number-2" > 2< / span > Element< / h2 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-2" id = "text-2" >
< p >
Chemical elements.
< / p >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org0f44138" class = "outline-3" >
< h3 id = "org0f44138" > < span class = "section-number-3" > 2.1< / span > Type< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-2-1" >
< div class = "org-src-container" >
2021-01-01 17:05:25 +01:00
< pre class = "src src-ocaml" id = "org5259e68" > < span class = "org-tuareg-font-lock-governing" > type< / span > < span class = "org-type" > t< / span > < span class = "org-tuareg-font-lock-operator" > =< / span >
2021-01-01 16:39:33 +01:00
< 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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org3260b21" class = "outline-3" >
< h3 id = "org3260b21" > < span class = "section-number-3" > 2.2< / span > Conversion< / h3 >
2021-01-01 16:39:33 +01:00
< 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" > 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 >
2021-01-01 17:05:25 +01:00
< pre class = "example" id = "org5a57380" >
2021-01-01 16:39:33 +01:00
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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-orgecbb559" class = "outline-3" >
< h3 id = "orgecbb559" > < span class = "section-number-3" > 2.3< / span > Database information< / h3 >
2021-01-01 16:39:33 +01:00
< 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" > 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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org4204ce9" class = "outline-3" >
< h3 id = "org4204ce9" > < span class = "section-number-3" > 2.4< / span > Printers< / h3 >
2021-01-01 16:39:33 +01:00
< 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
< 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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-orgc37ce9d" class = "outline-2" >
< h2 id = "orgc37ce9d" > < span class = "section-number-2" > 3< / span > Atomic mass< / h2 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-2" id = "text-3" >
< p >
Atomic mass, a non-negative float.
< / p >
< div class = "org-src-container" >
2021-01-01 17:05:25 +01:00
< pre class = "src src-ocaml" id = "org0e1101a" > < 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 >
2021-01-01 16:39:33 +01:00
< / pre >
< / div >
< / div >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org485ac9f" class = "outline-2" >
< h2 id = "org485ac9f" > < span class = "section-number-2" > 4< / span > Nuclei< / h2 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-2" id = "text-4" >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org02f7836" class = "outline-3" >
< h3 id = "org02f7836" > < span class = "section-number-3" > 4.1< / span > Type< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-4-1" >
< div class = "org-src-container" >
2021-01-01 17:05:25 +01:00
< pre class = "src src-ocaml" id = "org29d788e" > < span class = "org-tuareg-font-lock-governing" > open < / span > < span class = "org-tuareg-font-lock-module" > Common< / span >
2021-01-01 16:39:33 +01:00
< 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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-orgfdafdd0" class = "outline-3" >
< h3 id = "orgfdafdd0" > < span class = "section-number-3" > 4.2< / span > xyz file lexer/parser< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-4-2" >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-orgeddfd39" class = "outline-4" >
< h4 id = "orgeddfd39" > < span class = "section-number-4" > 4.2.1< / span > Lexer< / h4 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-4" id = "text-4-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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-orgb1e9400" class = "outline-4" >
< h4 id = "orgb1e9400" > < span class = "section-number-4" > 4.2.2< / span > Parser< / h4 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-4" id = "text-4-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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org19995b8" class = "outline-3" >
< h3 id = "org19995b8" > < span class = "section-number-3" > 4.3< / span > Conversion< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-4-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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org57fb733" class = "outline-3" >
< h3 id = "org57fb733" > < span class = "section-number-3" > 4.4< / span > < span class = "todo TODO" > TODO< / span > Query< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-4-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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org87456a6" class = "outline-3" >
< h3 id = "org87456a6" > < span class = "section-number-3" > 4.5< / span > Printers< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-4-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" > -> < / span > t < span class = "org-tuareg-font-lock-operator" > -> < / span > unit
< / pre >
< / div >
< / div >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org60012a5" class = "outline-3" >
< h3 id = "org60012a5" > < span class = "section-number-3" > 4.6< / span > Tests< / h3 >
2021-01-01 16:39:33 +01:00
< / div >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org72daeec" class = "outline-2" >
< h2 id = "org72daeec" > < span class = "section-number-2" > 5< / span > Z-matrix< / h2 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-2" id = "text-5" >
< p >
Z-matrix representation of nuclear coordinates.
< / p >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org0859680" class = "outline-3" >
< h3 id = "org0859680" > < span class = "section-number-3" > 5.1< / span > Type< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-5-1" >
< div class = "org-src-container" >
2021-01-01 17:05:25 +01:00
< pre class = "src src-ocaml" id = "org45ef285" > < span class = "org-tuareg-font-lock-governing" > type< / span > < span class = "org-type" > t< / span >
2021-01-01 16:39:33 +01:00
< / pre >
< / div >
< / div >
< / div >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org9ab67d9" class = "outline-3" >
< h3 id = "org9ab67d9" > < span class = "section-number-3" > 5.2< / span > Conversion< / h3 >
2021-01-01 16:39:33 +01:00
< div class = "outline-text-3" id = "text-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" > 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 >
2021-01-01 17:05:25 +01:00
< pre class = "example" id = "org802a2a2" >
2021-01-01 16:39:33 +01:00
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 >
2021-01-01 17:05:25 +01:00
< div id = "outline-container-org442f12d" class = "outline-3" >
< h3 id = "org442f12d" > < span class = "section-number-3" > 5.3< / span > Printers< / h3 >
2021-01-01 16:39:33 +01:00
< 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" > 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 >
2021-01-01 17:05:25 +01:00
< p class = "date" > Created: 2021-01-01 Fri 17:04< / p >
2021-01-01 16:39:33 +01:00
< p class = "validation" > < a href = "https://validator.w3.org/check?uri=referer" > Validate< / a > < / p >
< / div >
< / body >
< / html >