10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-18 12:03:40 +01:00

Added trexio write for nuclei

This commit is contained in:
Anthony Scemama 2023-04-24 14:13:36 +02:00
parent 919a8cbdd5
commit 2e835550b7
11 changed files with 208 additions and 105 deletions

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-10-19 Tue 16:20 -->
<!-- 2023-04-24 Mon 13:50 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Gaussian integrals</title>
@ -250,18 +250,18 @@ org_html_manager.setup(); // activate after the parameters are set
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org3f35417">1. Summary</a></li>
<li><a href="#orgdc976ae">1. Summary</a></li>
</ul>
</div>
</div>
<div id="outline-container-org3f35417" class="outline-2">
<h2 id="org3f35417"><span class="section-number-2">1</span> Summary</h2>
<div id="outline-container-orgdc976ae" class="outline-2">
<h2 id="orgdc976ae"><span class="section-number-2">1</span> Summary</h2>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Anthony Scemama</p>
<p class="date">Created: 2021-10-19 Tue 16:20</p>
<p class="date">Created: 2023-04-24 Mon 13:50</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2021-10-19 Tue 16:20 -->
<!-- 2023-04-24 Mon 14:13 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Common</title>
@ -272,75 +272,75 @@ org_html_manager.setup(); // activate after the parameters are set
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org16377b0">1. Summary</a></li>
<li><a href="#orga526d51">2. Electrons</a>
<li><a href="#org92842ff">1. Summary</a></li>
<li><a href="#org95eedad">2. Electrons</a>
<ul>
<li><a href="#org0f89435">2.1. Type</a></li>
<li><a href="#org19a0b2f">2.2. Creation</a></li>
<li><a href="#orge91e3a6">2.3. Access</a></li>
<li><a href="#orgda16d90">2.4. Printers</a></li>
<li><a href="#orgfd02552">2.5. Tests</a></li>
<li><a href="#orgf75fa70">2.1. Type</a></li>
<li><a href="#org9262d69">2.2. Creation</a></li>
<li><a href="#orgeb0efdb">2.3. Access</a></li>
<li><a href="#orgc5d7da2">2.4. Printers</a></li>
<li><a href="#org01f21a7">2.5. Tests</a></li>
</ul>
</li>
<li><a href="#org725a06a">3. Element</a>
<li><a href="#org7557361">3. Element</a>
<ul>
<li><a href="#orgcb66a4e">3.1. Type</a></li>
<li><a href="#org69ad620">3.2. Conversion</a></li>
<li><a href="#orge6b6575">3.3. Database information</a></li>
<li><a href="#orgb858483">3.4. Printers</a></li>
<li><a href="#orgf4dc2b6">3.1. Type</a></li>
<li><a href="#orgbea9201">3.2. Conversion</a></li>
<li><a href="#orge438c8d">3.3. Database information</a></li>
<li><a href="#org28ea54a">3.4. Printers</a></li>
</ul>
</li>
<li><a href="#orgd76ed1c">4. Atomic mass</a></li>
<li><a href="#orgc35a790">5. Nuclei</a>
<li><a href="#org6ec0e5e">4. Atomic mass</a></li>
<li><a href="#org031ab3f">5. Nuclei</a>
<ul>
<li><a href="#org171da4c">5.1. Type</a></li>
<li><a href="#orge62900d">5.2. xyz file lexer/parser</a>
<li><a href="#org0fe10a2">5.1. Type</a></li>
<li><a href="#org3736125">5.2. xyz file lexer/parser</a>
<ul>
<li><a href="#orgd09795d">5.2.1. Lexer</a></li>
<li><a href="#orgba2987d">5.2.2. Parser</a></li>
<li><a href="#orgf7fe255">5.2.1. Lexer</a></li>
<li><a href="#orgc547fcc">5.2.2. Parser</a></li>
</ul>
</li>
<li><a href="#orgf02e81a">5.3. Conversion</a></li>
<li><a href="#orgc2f2524">5.4. <span class="todo TODO">TODO</span> Query</a></li>
<li><a href="#orgfd12c55">5.5. Printers</a></li>
<li><a href="#org4030958">5.6. Tests</a></li>
<li><a href="#orgaff8d5e">5.3. Conversion</a></li>
<li><a href="#org4945fbb">5.4. Query</a></li>
<li><a href="#org07c7257">5.5. Printers</a></li>
<li><a href="#org738de5a">5.6. Tests</a></li>
</ul>
</li>
<li><a href="#org278d5c2">6. Z-matrix</a>
<li><a href="#orgd367ac4">6. Z-matrix</a>
<ul>
<li><a href="#org4594ad5">6.1. Type</a></li>
<li><a href="#org917cb80">6.2. Conversion</a></li>
<li><a href="#orge01b8a9">6.3. Printers</a></li>
<li><a href="#org80345d7">6.1. Type</a></li>
<li><a href="#org59c1dba">6.2. Conversion</a></li>
<li><a href="#org0bb6924">6.3. Printers</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org16377b0" class="outline-2">
<h2 id="org16377b0"><span class="section-number-2">1</span> Summary</h2>
<div id="outline-container-org92842ff" class="outline-2">
<h2 id="org92842ff"><span class="section-number-2">1</span> Summary</h2>
</div>
<div id="outline-container-orga526d51" class="outline-2">
<h2 id="orga526d51"><span class="section-number-2">2</span> Electrons</h2>
<div id="outline-container-org95eedad" class="outline-2">
<h2 id="org95eedad"><span class="section-number-2">2</span> Electrons</h2>
<div class="outline-text-2" id="text-2">
<p>
Data structure which contains the number of &alpha; and &beta; electrons.
</p>
</div>
<div id="outline-container-org0f89435" class="outline-3">
<h3 id="org0f89435"><span class="section-number-3">2.1</span> Type</h3>
<div id="outline-container-orgf75fa70" class="outline-3">
<h3 id="orgf75fa70"><span class="section-number-3">2.1</span> Type</h3>
<div class="outline-text-3" id="text-2-1">
<div class="org-src-container">
<pre class="src src-ocaml" id="org49290f9"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
<pre class="src src-ocaml" id="orgb42d55c"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org19a0b2f" class="outline-3">
<h3 id="org19a0b2f"><span class="section-number-3">2.2</span> Creation</h3>
<div id="outline-container-org9262d69" class="outline-3">
<h3 id="org9262d69"><span class="section-number-3">2.2</span> Creation</h3>
<div class="outline-text-3" id="text-2-2">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Common</span>
@ -372,15 +372,15 @@ Data structure which contains the number of &alpha; and &beta; electrons.
<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="#org206e0b6"><code>Nuclei.t</code></a> for a given total charge and spin multiplicity.</td>
<td class="org-left">Creates the data relative to electrons for a molecular system described by <a href="#org9b1494e"><code>Nuclei.t</code></a> for a given total charge and spin multiplicity.</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-orge91e3a6" class="outline-3">
<h3 id="orge91e3a6"><span class="section-number-3">2.3</span> Access</h3>
<div id="outline-container-orgeb0efdb" class="outline-3">
<h3 id="orgeb0efdb"><span class="section-number-3">2.3</span> Access</h3>
<div class="outline-text-3" id="text-2-3">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">charge</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> <span class="org-tuareg-font-lock-module">Charge.</span>t
@ -429,8 +429,8 @@ Data structure which contains the number of &alpha; and &beta; electrons.
</div>
</div>
<div id="outline-container-orgda16d90" class="outline-3">
<h3 id="orgda16d90"><span class="section-number-3">2.4</span> Printers</h3>
<div id="outline-container-orgc5d7da2" class="outline-3">
<h3 id="orgc5d7da2"><span class="section-number-3">2.4</span> Printers</h3>
<div class="outline-text-3" id="text-2-4">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">pp</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Format.</span>formatter <span class="org-tuareg-font-lock-operator">-&gt;</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> unit
@ -439,24 +439,24 @@ Data structure which contains the number of &alpha; and &beta; electrons.
</div>
</div>
<div id="outline-container-orgfd02552" class="outline-3">
<h3 id="orgfd02552"><span class="section-number-3">2.5</span> Tests</h3>
<div id="outline-container-org01f21a7" class="outline-3">
<h3 id="org01f21a7"><span class="section-number-3">2.5</span> Tests</h3>
</div>
</div>
<div id="outline-container-org725a06a" class="outline-2">
<h2 id="org725a06a"><span class="section-number-2">3</span> Element</h2>
<div id="outline-container-org7557361" class="outline-2">
<h2 id="org7557361"><span class="section-number-2">3</span> Element</h2>
<div class="outline-text-2" id="text-3">
<p>
Chemical elements.
</p>
</div>
<div id="outline-container-orgcb66a4e" class="outline-3">
<h3 id="orgcb66a4e"><span class="section-number-3">3.1</span> Type</h3>
<div id="outline-container-orgf4dc2b6" class="outline-3">
<h3 id="orgf4dc2b6"><span class="section-number-3">3.1</span> Type</h3>
<div class="outline-text-3" id="text-3-1">
<div class="org-src-container">
<pre class="src src-ocaml" id="orgd93555e"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span> <span class="org-tuareg-font-lock-operator">=</span>
<pre class="src src-ocaml" id="org80a6f80"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span> <span class="org-tuareg-font-lock-operator">=</span>
<span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">X</span>
<span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">H</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">He</span>
<span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Li</span><span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Be</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">B</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">C</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">N</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">O</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">F</span> <span class="org-tuareg-font-lock-operator">|</span><span class="org-tuareg-font-lock-constructor">Ne</span>
@ -473,8 +473,8 @@ Chemical elements.
</div>
</div>
<div id="outline-container-org69ad620" class="outline-3">
<h3 id="org69ad620"><span class="section-number-3">3.2</span> Conversion</h3>
<div id="outline-container-orgbea9201" class="outline-3">
<h3 id="orgbea9201"><span class="section-number-3">3.2</span> Conversion</h3>
<div class="outline-text-3" id="text-3-2">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_string</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
@ -535,7 +535,7 @@ Chemical elements.
</tbody>
</table>
<pre class="example" id="orge0cc4ce">
<pre class="example" id="orgaeff9b7">
Element.of_string "Fe" ;;
- : Element.t = Particles.Element.Fe
@ -554,8 +554,8 @@ Element.(to_string Fe);;
</div>
</div>
<div id="outline-container-orge6b6575" class="outline-3">
<h3 id="orge6b6575"><span class="section-number-3">3.3</span> Database information</h3>
<div id="outline-container-orge438c8d" class="outline-3">
<h3 id="orge438c8d"><span class="section-number-3">3.3</span> Database information</h3>
<div class="outline-text-3" id="text-3-3">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">covalent_radius</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> <span class="org-tuareg-font-lock-module">Non_negative_float.</span>t
@ -604,8 +604,8 @@ Element.(to_string Fe);;
</div>
</div>
<div id="outline-container-orgb858483" class="outline-3">
<h3 id="orgb858483"><span class="section-number-3">3.4</span> Printers</h3>
<div id="outline-container-org28ea54a" class="outline-3">
<h3 id="org28ea54a"><span class="section-number-3">3.4</span> Printers</h3>
<div class="outline-text-3" id="text-3-4">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">pp</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Format.</span>formatter <span class="org-tuareg-font-lock-operator">-&gt;</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> unit
@ -616,34 +616,34 @@ Element.(to_string Fe);;
</div>
</div>
<div id="outline-container-orgd76ed1c" class="outline-2">
<h2 id="orgd76ed1c"><span class="section-number-2">4</span> Atomic mass</h2>
<div id="outline-container-org6ec0e5e" class="outline-2">
<h2 id="org6ec0e5e"><span class="section-number-2">4</span> Atomic mass</h2>
<div class="outline-text-2" id="text-4">
<p>
Atomic mass, a non-negative float.
</p>
<div class="org-src-container">
<pre class="src src-ocaml" id="orgba2cdaa"><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 class="src src-ocaml" id="orge6ec335"><span class="org-tuareg-font-lock-governing">include</span> <span class="org-tuareg-font-lock-governing">module type of</span> <span class="org-tuareg-font-lock-module">Common.Non_negative_float</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orgc35a790" class="outline-2">
<h2 id="orgc35a790"><span class="section-number-2">5</span> Nuclei</h2>
<div id="outline-container-org031ab3f" class="outline-2">
<h2 id="org031ab3f"><span class="section-number-2">5</span> Nuclei</h2>
<div class="outline-text-2" id="text-5">
</div>
<div id="outline-container-org171da4c" class="outline-3">
<h3 id="org171da4c"><span class="section-number-3">5.1</span> Type</h3>
<div id="outline-container-org0fe10a2" class="outline-3">
<h3 id="org0fe10a2"><span class="section-number-3">5.1</span> Type</h3>
<div class="outline-text-3" id="text-5-1">
<p>
<a id="org206e0b6"><code>Nuclei.t</code></a>
<a id="org9b1494e"><code>Nuclei.t</code></a>
</p>
<div class="org-src-container">
<pre class="src src-ocaml" id="orgb9e1e3d"><span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Common</span>
<pre class="src src-ocaml" id="org39d5b90"><span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Common</span>
<span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span> <span class="org-tuareg-font-lock-operator">=</span> <span class="org-tuareg-font-lock-operator">(</span><span class="org-tuareg-font-lock-module">Element.</span>t <span class="org-tuareg-font-lock-operator">*</span> <span class="org-tuareg-font-lock-module">Coordinate.</span>t<span class="org-tuareg-font-lock-operator">)</span> array
</pre>
@ -651,12 +651,12 @@ Atomic mass, a non-negative float.
</div>
</div>
<div id="outline-container-orge62900d" class="outline-3">
<h3 id="orge62900d"><span class="section-number-3">5.2</span> xyz file lexer/parser</h3>
<div id="outline-container-org3736125" class="outline-3">
<h3 id="org3736125"><span class="section-number-3">5.2</span> xyz file lexer/parser</h3>
<div class="outline-text-3" id="text-5-2">
</div>
<div id="outline-container-orgd09795d" class="outline-4">
<h4 id="orgd09795d"><span class="section-number-4">5.2.1</span> Lexer</h4>
<div id="outline-container-orgf7fe255" class="outline-4">
<h4 id="orgf7fe255"><span class="section-number-4">5.2.1</span> Lexer</h4>
<div class="outline-text-4" id="text-5-2-1">
<p>
<code>nuclei_lexer.mll</code> contains the description of the lexemes used in
@ -709,8 +709,8 @@ rule read_all <span class="org-tuareg-font-lock-operator">=</span> parse
</div>
</div>
<div id="outline-container-orgba2987d" class="outline-4">
<h4 id="orgba2987d"><span class="section-number-4">5.2.2</span> Parser</h4>
<div id="outline-container-orgc547fcc" class="outline-4">
<h4 id="orgc547fcc"><span class="section-number-4">5.2.2</span> Parser</h4>
<div class="outline-text-4" id="text-5-2-2">
<p>
<code>xyz_parser.mly</code> parses nuclear coordinates in xyz format.
@ -829,8 +829,8 @@ an <code>xyz_file</code> data structure.
</div>
</div>
<div id="outline-container-orgf02e81a" class="outline-3">
<h3 id="orgf02e81a"><span class="section-number-3">5.3</span> Conversion</h3>
<div id="outline-container-orgaff8d5e" class="outline-3">
<h3 id="orgaff8d5e"><span class="section-number-3">5.3</span> Conversion</h3>
<div class="outline-text-3" id="text-5-3">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_xyz_string</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
@ -843,6 +843,9 @@ an <code>xyz_file</code> data structure.
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_string</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> string
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_filename</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_trexio</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Trexio.</span>trexio_file <span class="org-tuareg-font-lock-operator">-&gt;</span> t
<span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">to_trexio</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Trexio.</span>trexio_file <span class="org-tuareg-font-lock-operator">-&gt;</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> unit
</pre>
</div>
@ -884,13 +887,23 @@ an <code>xyz_file</code> data structure.
<td class="org-left"><code>of_filename</code></td>
<td class="org-left">Detects the type of file (xyz, z-matrix) and reads the file</td>
</tr>
<tr>
<td class="org-left"><code>of_trexio</code></td>
<td class="org-left">Reads the geometry from a TREXIO file</td>
</tr>
<tr>
<td class="org-left"><code>to_trexio</code></td>
<td class="org-left">Writes the geometry in a TREXIO file</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-orgc2f2524" class="outline-3">
<h3 id="orgc2f2524"><span class="section-number-3">5.4</span> <span class="todo TODO">TODO</span> Query</h3>
<div id="outline-container-org4945fbb" class="outline-3">
<h3 id="org4945fbb"><span class="section-number-3">5.4</span> Query</h3>
<div class="outline-text-3" id="text-5-4">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">formula</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> string
@ -939,8 +952,8 @@ an <code>xyz_file</code> data structure.
</div>
</div>
<div id="outline-container-orgfd12c55" class="outline-3">
<h3 id="orgfd12c55"><span class="section-number-3">5.5</span> Printers</h3>
<div id="outline-container-org07c7257" class="outline-3">
<h3 id="org07c7257"><span class="section-number-3">5.5</span> Printers</h3>
<div class="outline-text-3" id="text-5-5">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">pp</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Format.</span>formatter <span class="org-tuareg-font-lock-operator">-&gt;</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> unit
@ -949,31 +962,31 @@ an <code>xyz_file</code> data structure.
</div>
</div>
<div id="outline-container-org4030958" class="outline-3">
<h3 id="org4030958"><span class="section-number-3">5.6</span> Tests</h3>
<div id="outline-container-org738de5a" class="outline-3">
<h3 id="org738de5a"><span class="section-number-3">5.6</span> Tests</h3>
</div>
</div>
<div id="outline-container-org278d5c2" class="outline-2">
<h2 id="org278d5c2"><span class="section-number-2">6</span> Z-matrix</h2>
<div id="outline-container-orgd367ac4" class="outline-2">
<h2 id="orgd367ac4"><span class="section-number-2">6</span> Z-matrix</h2>
<div class="outline-text-2" id="text-6">
<p>
Z-matrix representation of nuclear coordinates.
</p>
</div>
<div id="outline-container-org4594ad5" class="outline-3">
<h3 id="org4594ad5"><span class="section-number-3">6.1</span> Type</h3>
<div id="outline-container-org80345d7" class="outline-3">
<h3 id="org80345d7"><span class="section-number-3">6.1</span> Type</h3>
<div class="outline-text-3" id="text-6-1">
<div class="org-src-container">
<pre class="src src-ocaml" id="org7586df6"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
<pre class="src src-ocaml" id="org4f1052d"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org917cb80" class="outline-3">
<h3 id="org917cb80"><span class="section-number-3">6.2</span> Conversion</h3>
<div id="outline-container-org59c1dba" class="outline-3">
<h3 id="org59c1dba"><span class="section-number-3">6.2</span> Conversion</h3>
<div class="outline-text-3" id="text-6-2">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">of_string</span> <span class="org-tuareg-font-lock-operator">:</span> string <span class="org-tuareg-font-lock-operator">-&gt;</span> t
@ -1008,7 +1021,7 @@ Z-matrix representation of nuclear coordinates.
</tbody>
</table>
<pre class="example" id="org8bd7049">
<pre class="example" id="org5705752">
let zmt = Zmatrix.of_string "
n
n 1 nn
@ -1053,8 +1066,8 @@ H -0.568803 -0.793910 1.726048"
</div>
<div id="outline-container-orge01b8a9" class="outline-3">
<h3 id="orge01b8a9"><span class="section-number-3">6.3</span> Printers</h3>
<div id="outline-container-org0bb6924" class="outline-3">
<h3 id="org0bb6924"><span class="section-number-3">6.3</span> Printers</h3>
<div class="outline-text-3" id="text-6-3">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">pp</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Format.</span>formatter <span class="org-tuareg-font-lock-operator">-&gt;</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> unit
@ -1066,7 +1079,7 @@ H -0.568803 -0.793910 1.726048"
</div>
<div id="postamble" class="status">
<p class="author">Author: Anthony Scemama</p>
<p class="date">Created: 2021-10-19 Tue 16:20</p>
<p class="date">Created: 2023-04-24 Mon 14:13</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -3,7 +3,7 @@
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2023-04-24 Mon 12:58 -->
<!-- 2023-04-24 Mon 14:13 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Top-level</title>
@ -250,18 +250,18 @@ org_html_manager.setup(); // activate after the parameters are set
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org3f2d407">1. Summary</a></li>
<li><a href="#orgf7c1e66">1. Summary</a></li>
</ul>
</div>
</div>
<div id="outline-container-org3f2d407" class="outline-2">
<h2 id="org3f2d407"><span class="section-number-2">1</span> Summary</h2>
<div id="outline-container-orgf7c1e66" class="outline-2">
<h2 id="orgf7c1e66"><span class="section-number-2">1</span> Summary</h2>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Anthony Scemama</p>
<p class="date">Created: 2023-04-24 Mon 12:58</p>
<p class="date">Created: 2023-04-24 Mon 14:13</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -48,6 +48,8 @@ with open(dunetest,'w') as f:
(synopsis "Test for {name} library")
(libraries
alcotest
unix
trexio
qcaml.{name}
)
)

View File

@ -48,6 +48,7 @@ with open(dunetest,'w') as f:
(synopsis "Test for {name} library")
(libraries
alcotest
trexio
qcaml.{name}
)
)
@ -59,6 +60,7 @@ with open(dunetest,'w') as f:
#+name: dependencies
#+begin_src elisp
(libraries
trexio
qcaml.common
)
#+end_src

View File

@ -3,9 +3,10 @@
(name particles)
(public_name qcaml.particles)
(synopsis
"Information relative to particles (electrons and nuclei)."
"Information relative to particles (electrons and nuclei)"
)
(libraries
trexio
qcaml.common
)
(modules_without_implementation

View File

@ -1,3 +1,3 @@
(* [[file:~/QCaml/particles/mass.org::*Atomic%20mass][Atomic mass:2]] *)
(* [[file:~/QCaml/particles/mass.org::*Atomic mass][Atomic mass:2]] *)
include Common.Non_negative_float
(* Atomic mass:2 ends here *)

View File

@ -12,7 +12,9 @@ open Xyz_ast
* | ~of_zmt_string~ | Create from a string, in z-matrix format |
* | ~of_zmt_file~ | Create from a file, in z-matrix format |
* | ~to_string~ | Transform to a string, for printing |
* | ~of_filename~ | Detects the type of file (xyz, z-matrix) and reads the file | *)
* | ~of_filename~ | Detects the type of file (xyz, z-matrix) and reads the file |
* | ~of_trexio~ | Reads the geometry from a TREXIO file |
* | ~to_trexio~ | Writes the geometry in a TREXIO file | *)
(* [[file:~/QCaml/particles/nuclei.org::*Conversion][Conversion:2]] *)
@ -115,6 +117,19 @@ let to_xyz_string t =
) t
|> Array.to_list )
|> String.concat "\n"
let of_trexio f =
let num = Trexio.read_nucleus_num f in
let charge = Trexio.read_nucleus_charge f
|> Array.map Charge.of_float in
let coord = Trexio.read_nucleus_coord f in
Array.init num (fun i ->
let coord = Coordinate.{ x = coord.(3*i) ;
y = coord.(3*i+1) ;
z = coord.(3*i+2) } in
(Element.of_charge charge.(i), Coordinate.make coord)
)
(* Conversion:2 ends here *)
@ -174,6 +189,26 @@ let small_core a =
let large_core a =
Array.fold_left (fun accu (e,_) -> accu + (Element.large_core e)) 0 a
let to_trexio f t =
let num = Array.length t in
Trexio.write_nucleus_num f num;
Array.map (fun (e, _) -> Element.to_charge e |> Charge.to_float) t
|> Trexio.write_nucleus_charge f;
Array.map (fun (e, _) -> Element.to_string e) t
|> Trexio.write_nucleus_label f;
let coord = Array.init (num*3) (fun _ -> 0.) in
Array.iteri (fun i (_, xyz) ->
coord.(3*i) <- Coordinate.(get X xyz) ;
coord.(3*i+1) <- Coordinate.(get Y xyz) ;
coord.(3*i+2) <- Coordinate.(get Z xyz) ) t;
Trexio.write_nucleus_coord f coord;
repulsion t
|> Trexio.write_nucleus_repulsion f
(* Query:2 ends here *)
(* [[file:~/QCaml/particles/nuclei.org::*Printers][Printers:2]] *)

View File

@ -23,9 +23,12 @@ val of_zmt_file : string -> t
val to_string : t -> string
val of_filename : string -> t
val of_trexio : Trexio.trexio_file -> t
val to_trexio : Trexio.trexio_file -> t -> unit
(* Conversion:1 ends here *)
(* TODO Query *)
(* Query *)
(* [[file:~/QCaml/particles/nuclei.org::*Query][Query:1]] *)

View File

@ -204,6 +204,9 @@ val of_zmt_file : string -> t
val to_string : t -> string
val of_filename : string -> t
val of_trexio : Trexio.trexio_file -> t
val to_trexio : Trexio.trexio_file -> t -> unit
#+end_src
| ~of_xyz_string~ | Create from a string, in xyz format |
@ -212,6 +215,8 @@ val of_filename : string -> t
| ~of_zmt_file~ | Create from a file, in z-matrix format |
| ~to_string~ | Transform to a string, for printing |
| ~of_filename~ | Detects the type of file (xyz, z-matrix) and reads the file |
| ~of_trexio~ | Reads the geometry from a TREXIO file |
| ~to_trexio~ | Writes the geometry in a TREXIO file |
#+begin_src ocaml :tangle (eval ml) :exports none
let of_xyz_lexbuf lexbuf =
@ -313,9 +318,48 @@ let to_xyz_string t =
) t
|> Array.to_list )
|> String.concat "\n"
let of_trexio f =
let num = Trexio.read_nucleus_num f in
let charge = Trexio.read_nucleus_charge f
|> Array.map Charge.of_float in
let coord = Trexio.read_nucleus_coord f in
Array.init num (fun i ->
let coord = Coordinate.{ x = coord.(3*i) ;
y = coord.(3*i+1) ;
z = coord.(3*i+2) } in
(Element.of_charge charge.(i), Coordinate.make coord)
)
#+end_src
** TODO Query
#+NAME: trexio_export
#+begin_src ocaml :tangle no :exports none
let to_trexio f t =
let num = Array.length t in
Trexio.write_nucleus_num f num;
Array.map (fun (e, _) -> Element.to_charge e |> Charge.to_float) t
|> Trexio.write_nucleus_charge f;
Array.map (fun (e, _) -> Element.to_string e) t
|> Trexio.write_nucleus_label f;
let coord = Array.init (num*3) (fun _ -> 0.) in
Array.iteri (fun i (_, xyz) ->
coord.(3*i) <- Coordinate.(get X xyz) ;
coord.(3*i+1) <- Coordinate.(get Y xyz) ;
coord.(3*i+2) <- Coordinate.(get Z xyz) ) t;
Trexio.write_nucleus_coord f coord;
repulsion t
|> Trexio.write_nucleus_repulsion f
#+end_src
** Query
#+begin_src ocaml :tangle (eval mli)
val formula : t -> string
@ -331,7 +375,7 @@ val large_core : t -> int
| ~small_core~ | Number of core electrons in the small core model |
| ~large_core~ | Number of core electrons in the large core model |
#+begin_src ocaml :tangle (eval ml) :exports none
#+begin_src ocaml :tangle (eval ml) :exports none :noweb yes
let formula t =
let dict = Hashtbl.create 67 in
Array.iter (fun (e,_) ->
@ -379,6 +423,8 @@ let small_core a =
let large_core a =
Array.fold_left (fun accu (e,_) -> accu + (Element.large_core e)) 0 a
<<trexio_export>>
#+end_src
** Printers

View File

@ -4,6 +4,7 @@
(synopsis "Test for particles library")
(libraries
alcotest
trexio
qcaml.particles
)
)