mirror of https://gitlab.com/scemama/QCaml.git
Changed streams to seq
This commit is contained in:
parent
3c77e8267d
commit
919a8cbdd5
|
@ -314,47 +314,27 @@ let array_product a =
|
|||
|
||||
|
||||
|
||||
(* | ~stream_range~ | Creates a stream returning consecutive integers |
|
||||
* | ~stream_to_list~ | Read a stream and put items in a list |
|
||||
* | ~stream_fold~ | Apply a fold to the elements of the stream | *)
|
||||
(* | ~seq_range~ | Creates a sequence returning consecutive integers |
|
||||
* | ~seq_to_list~ | Read a sequence and put items in a list |
|
||||
* | ~seq_fold~ | Apply a fold to the elements of the sequence | *)
|
||||
|
||||
|
||||
(* [[file:~/QCaml/common/util.org::*Stream functions][Stream functions:2]] *)
|
||||
let stream_range first last =
|
||||
Stream.from (fun i ->
|
||||
let result = i+first in
|
||||
if result <= last then
|
||||
Some result
|
||||
else None
|
||||
)
|
||||
(* [[file:~/QCaml/common/util.org::*Seq functions][Seq functions:2]] *)
|
||||
let seq_range first last =
|
||||
Seq.init (last-first) (fun i -> i+first)
|
||||
|
||||
let stream_to_list stream =
|
||||
let rec aux accu =
|
||||
let new_accu =
|
||||
try
|
||||
Some (Stream.next stream :: accu)
|
||||
with Stream.Failure -> None
|
||||
in
|
||||
match new_accu with
|
||||
| Some new_accu -> (aux [@tailcall]) new_accu
|
||||
| None -> accu
|
||||
in List.rev @@ aux []
|
||||
|
||||
|
||||
let stream_fold f init stream =
|
||||
let rec aux accu =
|
||||
let new_accu =
|
||||
try
|
||||
let element = Stream.next stream in
|
||||
Some (f accu element)
|
||||
with Stream.Failure -> None
|
||||
in
|
||||
match new_accu with
|
||||
| Some new_accu -> (aux [@tailcall]) new_accu
|
||||
| None -> accu
|
||||
let seq_to_list seq =
|
||||
let rec aux accu xs =
|
||||
match Seq.uncons xs with
|
||||
| Some (x, xs) -> aux (x::accu) xs
|
||||
| None -> List.rev accu
|
||||
in
|
||||
aux init
|
||||
(* Stream functions:2 ends here *)
|
||||
aux [] seq
|
||||
|
||||
|
||||
let seq_fold f init seq =
|
||||
Seq.fold_left f init seq
|
||||
(* Seq functions:2 ends here *)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -75,14 +75,14 @@ val array_sum : float array -> float
|
|||
val array_product : float array -> float
|
||||
(* Array functions:1 ends here *)
|
||||
|
||||
(* Stream functions *)
|
||||
(* Seq functions *)
|
||||
|
||||
|
||||
(* [[file:~/QCaml/common/util.org::*Stream functions][Stream functions:1]] *)
|
||||
val stream_range : int -> int -> int Stream.t
|
||||
val stream_to_list : 'a Stream.t -> 'a list
|
||||
val stream_fold : ('a -> 'b -> 'a) -> 'a -> 'b Stream.t -> 'a
|
||||
(* Stream functions:1 ends here *)
|
||||
(* [[file:~/QCaml/common/util.org::*Seq functions][Seq functions:1]] *)
|
||||
val seq_range : int -> int -> int Seq.t
|
||||
val seq_to_list : 'a Seq.t -> 'a list
|
||||
val seq_fold : ('a -> 'b -> 'a) -> 'a -> 'b Seq.t -> 'a
|
||||
(* Seq functions:1 ends here *)
|
||||
|
||||
(* Printers *)
|
||||
|
||||
|
|
|
@ -566,54 +566,33 @@ let test_array () =
|
|||
()
|
||||
#+end_src
|
||||
|
||||
** Stream functions
|
||||
** Seq functions
|
||||
|
||||
#+begin_src ocaml :tangle (eval mli)
|
||||
val stream_range : int -> int -> int Stream.t
|
||||
val stream_to_list : 'a Stream.t -> 'a list
|
||||
val stream_fold : ('a -> 'b -> 'a) -> 'a -> 'b Stream.t -> 'a
|
||||
val seq_range : int -> int -> int Seq.t
|
||||
val seq_to_list : 'a Seq.t -> 'a list
|
||||
val seq_fold : ('a -> 'b -> 'a) -> 'a -> 'b Seq.t -> 'a
|
||||
#+end_src
|
||||
|
||||
| ~stream_range~ | Creates a stream returning consecutive integers |
|
||||
| ~stream_to_list~ | Read a stream and put items in a list |
|
||||
| ~stream_fold~ | Apply a fold to the elements of the stream |
|
||||
| ~seq_range~ | Creates a sequence returning consecutive integers |
|
||||
| ~seq_to_list~ | Read a sequence and put items in a list |
|
||||
| ~seq_fold~ | Apply a fold to the elements of the sequence |
|
||||
|
||||
#+begin_src ocaml :tangle (eval ml) :exports none
|
||||
let stream_range first last =
|
||||
Stream.from (fun i ->
|
||||
let result = i+first in
|
||||
if result <= last then
|
||||
Some result
|
||||
else None
|
||||
)
|
||||
let seq_range first last =
|
||||
Seq.init (last-first) (fun i -> i+first)
|
||||
|
||||
let stream_to_list stream =
|
||||
let rec aux accu =
|
||||
let new_accu =
|
||||
try
|
||||
Some (Stream.next stream :: accu)
|
||||
with Stream.Failure -> None
|
||||
in
|
||||
match new_accu with
|
||||
| Some new_accu -> (aux [@tailcall]) new_accu
|
||||
| None -> accu
|
||||
in List.rev @@ aux []
|
||||
|
||||
|
||||
let stream_fold f init stream =
|
||||
let rec aux accu =
|
||||
let new_accu =
|
||||
try
|
||||
let element = Stream.next stream in
|
||||
Some (f accu element)
|
||||
with Stream.Failure -> None
|
||||
in
|
||||
match new_accu with
|
||||
| Some new_accu -> (aux [@tailcall]) new_accu
|
||||
| None -> accu
|
||||
let seq_to_list seq =
|
||||
let rec aux accu xs =
|
||||
match Seq.uncons xs with
|
||||
| Some (x, xs) -> aux (x::accu) xs
|
||||
| None -> List.rev accu
|
||||
in
|
||||
aux init
|
||||
aux [] seq
|
||||
|
||||
|
||||
let seq_fold f init seq =
|
||||
Seq.fold_left f init seq
|
||||
#+end_src
|
||||
|
||||
** Printers
|
||||
|
|
534
docs/common.html
534
docs/common.html
File diff suppressed because it is too large
Load Diff
|
@ -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>
|
||||
<!-- 2022-11-07 Mon 11:28 -->
|
||||
<!-- 2023-04-20 Thu 12:08 -->
|
||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||
<title>Gaussian</title>
|
||||
|
@ -272,41 +272,41 @@ 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="#org573b439">1. Summary</a></li>
|
||||
<li><a href="#org20f831d">2. Atomic shell</a>
|
||||
<li><a href="#org00fe9a7">1. Summary</a></li>
|
||||
<li><a href="#org31b1458">2. Atomic shell</a>
|
||||
<ul>
|
||||
<li><a href="#org56e4f66">2.1. Type</a></li>
|
||||
<li><a href="#org40ad070">2.2. Access</a></li>
|
||||
<li><a href="#org62b2450">2.3. Creation</a></li>
|
||||
<li><a href="#org8b146e2">2.4. Printers</a></li>
|
||||
<li><a href="#org15c8121">2.1. Type</a></li>
|
||||
<li><a href="#org027f81e">2.2. Access</a></li>
|
||||
<li><a href="#org13bea39">2.3. Creation</a></li>
|
||||
<li><a href="#org108fb3f">2.4. Printers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#orge593280">3. Atomic shell pair couple</a>
|
||||
<li><a href="#orgaf2dfc2">3. Atomic shell pair couple</a>
|
||||
<ul>
|
||||
<li><a href="#orgb99cd3b">3.1. Type</a></li>
|
||||
<li><a href="#org6cba6ba">3.2. Access</a></li>
|
||||
<li><a href="#orgafdde1e">3.3. Creation</a></li>
|
||||
<li><a href="#org6ac533e">3.4. Printers</a></li>
|
||||
<li><a href="#org0916a22">3.1. Type</a></li>
|
||||
<li><a href="#orgc512c60">3.2. Access</a></li>
|
||||
<li><a href="#org2d070ca">3.3. Creation</a></li>
|
||||
<li><a href="#org2ee4957">3.4. Printers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><a href="#org230e186">4. Atomic shell pair</a>
|
||||
<li><a href="#org9e877d7">4. Atomic shell pair</a>
|
||||
<ul>
|
||||
<li><a href="#orgb93d9e9">4.1. Type</a></li>
|
||||
<li><a href="#org74b9b4a">4.2. Access</a></li>
|
||||
<li><a href="#org0b5ef37">4.3. Creation</a></li>
|
||||
<li><a href="#orgfa1afa2">4.4. Printers</a></li>
|
||||
<li><a href="#org5c399ad">4.1. Type</a></li>
|
||||
<li><a href="#orgaa52bf1">4.2. Access</a></li>
|
||||
<li><a href="#orgbc5c6ac">4.3. Creation</a></li>
|
||||
<li><a href="#orgbbed8e3">4.4. Printers</a></li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org573b439" class="outline-2">
|
||||
<h2 id="org573b439"><span class="section-number-2">1</span> Summary</h2>
|
||||
<div id="outline-container-org00fe9a7" class="outline-2">
|
||||
<h2 id="org00fe9a7"><span class="section-number-2">1</span> Summary</h2>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org20f831d" class="outline-2">
|
||||
<h2 id="org20f831d"><span class="section-number-2">2</span> Atomic shell</h2>
|
||||
<div id="outline-container-org31b1458" class="outline-2">
|
||||
<h2 id="org31b1458"><span class="section-number-2">2</span> Atomic shell</h2>
|
||||
<div class="outline-text-2" id="text-2">
|
||||
<p>
|
||||
Set of contracted Gaussians differing only by the powers of \(x\), \(y\) and \(z\), with a
|
||||
|
@ -339,8 +339,8 @@ particular powers of \(x,y,z\) (<code>PrimitiveShell.norm_coef_scale</code>)</li
|
|||
</div>
|
||||
|
||||
|
||||
<div id="outline-container-org56e4f66" class="outline-3">
|
||||
<h3 id="org56e4f66"><span class="section-number-3">2.1</span> Type</h3>
|
||||
<div id="outline-container-org15c8121" class="outline-3">
|
||||
<h3 id="org15c8121"><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"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
|
||||
|
@ -351,8 +351,8 @@ particular powers of \(x,y,z\) (<code>PrimitiveShell.norm_coef_scale</code>)</li
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org40ad070" class="outline-3">
|
||||
<h3 id="org40ad070"><span class="section-number-3">2.2</span> Access</h3>
|
||||
<div id="outline-container-org027f81e" class="outline-3">
|
||||
<h3 id="org027f81e"><span class="section-number-3">2.2</span> Access</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">val</span> <span class="org-function-name">ang_mom</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-></span> <span class="org-tuareg-font-lock-module">Angular_momentum.</span>t
|
||||
|
@ -429,14 +429,14 @@ particular powers of \(x,y,z\) (<code>PrimitiveShell.norm_coef_scale</code>)</li
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<pre class="example" id="org88d8b42">
|
||||
<pre class="example" id="orgbb6756e">
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org62b2450" class="outline-3">
|
||||
<h3 id="org62b2450"><span class="section-number-3">2.3</span> Creation</h3>
|
||||
<div id="outline-container-org13bea39" class="outline-3">
|
||||
<h3 id="org13bea39"><span class="section-number-3">2.3</span> Creation</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">make</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-label">?index</span><span class="org-tuareg-font-lock-operator">:</span>int <span class="org-tuareg-font-lock-operator">-></span> <span class="org-tuareg-font-lock-module">Contracted_shell.</span>t array <span class="org-tuareg-font-lock-operator">-></span> t
|
||||
|
@ -468,8 +468,8 @@ particular powers of \(x,y,z\) (<code>PrimitiveShell.norm_coef_scale</code>)</li
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org8b146e2" class="outline-3">
|
||||
<h3 id="org8b146e2"><span class="section-number-3">2.4</span> Printers</h3>
|
||||
<div id="outline-container-org108fb3f" class="outline-3">
|
||||
<h3 id="org108fb3f"><span class="section-number-3">2.4</span> Printers</h3>
|
||||
<div class="outline-text-3" id="text-2-4">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">pp</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Format.</span>formatter <span class="org-tuareg-font-lock-operator">-></span> t <span class="org-tuareg-font-lock-operator">-></span> unit
|
||||
|
@ -479,8 +479,8 @@ particular powers of \(x,y,z\) (<code>PrimitiveShell.norm_coef_scale</code>)</li
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orge593280" class="outline-2">
|
||||
<h2 id="orge593280"><span class="section-number-2">3</span> Atomic shell pair couple</h2>
|
||||
<div id="outline-container-orgaf2dfc2" class="outline-2">
|
||||
<h2 id="orgaf2dfc2"><span class="section-number-2">3</span> Atomic shell pair couple</h2>
|
||||
<div class="outline-text-2" id="text-3">
|
||||
<p>
|
||||
An atomic shell pair couple is the cartesian product between two sets of functions, one
|
||||
|
@ -496,8 +496,8 @@ acting on different electrons, since they will be coupled by a two-electron oper
|
|||
</div>
|
||||
|
||||
|
||||
<div id="outline-container-orgb99cd3b" class="outline-3">
|
||||
<h3 id="orgb99cd3b"><span class="section-number-3">3.1</span> Type</h3>
|
||||
<div id="outline-container-org0916a22" class="outline-3">
|
||||
<h3 id="org0916a22"><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"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
|
||||
|
@ -508,8 +508,8 @@ acting on different electrons, since they will be coupled by a two-electron oper
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org6cba6ba" class="outline-3">
|
||||
<h3 id="org6cba6ba"><span class="section-number-3">3.2</span> Access</h3>
|
||||
<div id="outline-container-orgc512c60" class="outline-3">
|
||||
<h3 id="orgc512c60"><span class="section-number-3">3.2</span> Access</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">ang_mom</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">Angular_momentum.</span>t
|
||||
|
@ -594,8 +594,8 @@ acting on different electrons, since they will be coupled by a two-electron oper
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgafdde1e" class="outline-3">
|
||||
<h3 id="orgafdde1e"><span class="section-number-3">3.3</span> Creation</h3>
|
||||
<div id="outline-container-org2d070ca" class="outline-3">
|
||||
<h3 id="org2d070ca"><span class="section-number-3">3.3</span> Creation</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">make</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-label">?cutoff</span><span class="org-tuareg-font-lock-operator">:</span>float <span class="org-tuareg-font-lock-operator">-></span> <span class="org-tuareg-font-lock-module">Atomic_shell_pair.</span>t <span class="org-tuareg-font-lock-operator">-></span> <span class="org-tuareg-font-lock-module">Atomic_shell_pair.</span>t <span class="org-tuareg-font-lock-operator">-></span> t option
|
||||
|
@ -621,14 +621,14 @@ Default cutoff is \(\epsilon\).
|
|||
</tbody>
|
||||
</table>
|
||||
|
||||
<pre class="example" id="org4638f8b">
|
||||
<pre class="example" id="org3be7e29">
|
||||
|
||||
</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org6ac533e" class="outline-3">
|
||||
<h3 id="org6ac533e"><span class="section-number-3">3.4</span> Printers</h3>
|
||||
<div id="outline-container-org2ee4957" class="outline-3">
|
||||
<h3 id="org2ee4957"><span class="section-number-3">3.4</span> Printers</h3>
|
||||
<div class="outline-text-3" id="text-3-4">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">val</span> <span class="org-function-name">pp</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-module">Format.</span>formatter <span class="org-tuareg-font-lock-operator">-></span> t <span class="org-tuareg-font-lock-operator">-></span> unit
|
||||
|
@ -638,8 +638,8 @@ Default cutoff is \(\epsilon\).
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org230e186" class="outline-2">
|
||||
<h2 id="org230e186"><span class="section-number-2">4</span> Atomic shell pair</h2>
|
||||
<div id="outline-container-org9e877d7" class="outline-2">
|
||||
<h2 id="org9e877d7"><span class="section-number-2">4</span> Atomic shell pair</h2>
|
||||
<div class="outline-text-2" id="text-4">
|
||||
<p>
|
||||
Data structure to represent pairs of atomic shells. The products of
|
||||
|
@ -651,8 +651,8 @@ An atomic shell pair is an array of pairs of contracted shells.
|
|||
</p>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgb93d9e9" class="outline-3">
|
||||
<h3 id="orgb93d9e9"><span class="section-number-3">4.1</span> Type</h3>
|
||||
<div id="outline-container-org5c399ad" class="outline-3">
|
||||
<h3 id="org5c399ad"><span class="section-number-3">4.1</span> Type</h3>
|
||||
<div class="outline-text-3" id="text-4-1">
|
||||
<div class="org-src-container">
|
||||
<pre class="src src-ocaml"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">t</span>
|
||||
|
@ -663,8 +663,8 @@ An atomic shell pair is an array of pairs of contracted shells.
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org74b9b4a" class="outline-3">
|
||||
<h3 id="org74b9b4a"><span class="section-number-3">4.2</span> Access</h3>
|
||||
<div id="outline-container-orgaa52bf1" class="outline-3">
|
||||
<h3 id="orgaa52bf1"><span class="section-number-3">4.2</span> Access</h3>
|
||||
<div class="outline-text-3" id="text-4-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">atomic_shell_a</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">Atomic_shell.</span>t
|
||||
|
@ -731,8 +731,8 @@ An atomic shell pair is an array of pairs of contracted shells.
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-org0b5ef37" class="outline-3">
|
||||
<h3 id="org0b5ef37"><span class="section-number-3">4.3</span> Creation</h3>
|
||||
<div id="outline-container-orgbc5c6ac" class="outline-3">
|
||||
<h3 id="orgbc5c6ac"><span class="section-number-3">4.3</span> Creation</h3>
|
||||
<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">make</span> <span class="org-tuareg-font-lock-operator">:</span> <span class="org-tuareg-font-lock-label">?cutoff</span><span class="org-tuareg-font-lock-operator">:</span>float <span class="org-tuareg-font-lock-operator">-></span> <span class="org-tuareg-font-lock-module">Atomic_shell.</span>t <span class="org-tuareg-font-lock-operator">-></span> <span class="org-tuareg-font-lock-module">Atomic_shell.</span>t <span class="org-tuareg-font-lock-operator">-></span> t option
|
||||
|
@ -765,8 +765,8 @@ If an atomic shell pair is not significant, sets the value to <code>None</code>.
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgfa1afa2" class="outline-3">
|
||||
<h3 id="orgfa1afa2"><span class="section-number-3">4.4</span> Printers</h3>
|
||||
<div id="outline-container-orgbbed8e3" class="outline-3">
|
||||
<h3 id="orgbbed8e3"><span class="section-number-3">4.4</span> Printers</h3>
|
||||
<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">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
|
||||
|
@ -778,7 +778,7 @@ If an atomic shell pair is not significant, sets the value to <code>None</code>.
|
|||
</div>
|
||||
<div id="postamble" class="status">
|
||||
<p class="author">Author: Anthony Scemama</p>
|
||||
<p class="date">Created: 2022-11-07 Mon 11:28</p>
|
||||
<p class="date">Created: 2023-04-20 Thu 12:08</p>
|
||||
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -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-20 Thu 10:54 -->
|
||||
<!-- 2023-04-24 Mon 12:58 -->
|
||||
<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="#orgd03da44">1. Summary</a></li>
|
||||
<li><a href="#org3f2d407">1. Summary</a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="outline-container-orgd03da44" class="outline-2">
|
||||
<h2 id="orgd03da44"><span class="section-number-2">1</span> Summary</h2>
|
||||
<div id="outline-container-org3f2d407" class="outline-2">
|
||||
<h2 id="org3f2d407"><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-20 Thu 10:54</p>
|
||||
<p class="date">Created: 2023-04-24 Mon 12:58</p>
|
||||
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
@ -4,5 +4,8 @@
|
|||
ex_hartree_fock
|
||||
ex_localization
|
||||
)
|
||||
(libraries qcaml))
|
||||
(libraries
|
||||
qcaml
|
||||
unix
|
||||
))
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ let () =
|
|||
(* [[file:~/QCaml/examples/ex_hartree_fock.org::*Definition][Definition:1]] *)
|
||||
let open Command_line in
|
||||
begin
|
||||
set_header_doc (Sys.argv.(0) ^ " - QuAcK command");
|
||||
set_header_doc (Sys.argv.(0));
|
||||
set_description_doc "Computes the one- and two-electron hartree_fock on the Gaussian atomic basis set.";
|
||||
set_specs
|
||||
[ { short='b' ; long="basis" ; opt=Mandatory;
|
||||
|
|
|
@ -29,7 +29,7 @@ let () =
|
|||
#+BEGIN_SRC ocaml :comments link :exports code :tangle ex_hartree_fock.ml
|
||||
let open Command_line in
|
||||
begin
|
||||
set_header_doc (Sys.argv.(0) ^ " - QuAcK command");
|
||||
set_header_doc (Sys.argv.(0));
|
||||
set_description_doc "Computes the one- and two-electron hartree_fock on the Gaussian atomic basis set.";
|
||||
set_specs
|
||||
[ { short='b' ; long="basis" ; opt=Mandatory;
|
||||
|
|
|
@ -32,7 +32,7 @@ let () =
|
|||
#+BEGIN_SRC ocaml :comments link :exports code :tangle ex_integrals.ml
|
||||
let open Command_line in
|
||||
begin
|
||||
set_header_doc (Sys.argv.(0) ^ " - QuAcK command");
|
||||
set_header_doc (Sys.argv.(0));
|
||||
set_description_doc "Computes the one- and two-electron integrals on the Gaussian atomic basis set.";
|
||||
set_specs
|
||||
[ { short='b' ; long="basis" ; opt=Mandatory;
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
open Common
|
||||
open Particles
|
||||
|
||||
|
||||
type primitive =
|
||||
{
|
||||
exponent : float ;
|
||||
|
@ -36,11 +36,11 @@ let read_shell ?element line_stream =
|
|||
|
||||
let rec loop = function
|
||||
| 0 -> []
|
||||
| i -> let contraction =
|
||||
| i -> let contraction =
|
||||
let line = Stream.next line_stream in
|
||||
try Scanf.sscanf line " %_d %f %f "
|
||||
(fun exponent coefficient -> { exponent ; coefficient })
|
||||
with _ -> raise (Malformed_shell
|
||||
with _ -> raise (Malformed_shell
|
||||
(match element with
|
||||
| Some element -> Printf.sprintf
|
||||
"In %s: Expected %d %c contractions.\nError at contraction %d:\n%s"
|
||||
|
@ -83,9 +83,9 @@ let rec read_element line_stream =
|
|||
|
||||
with
|
||||
| Stream.Failure -> None
|
||||
|
||||
|
||||
let read_stream line_stream =
|
||||
|
||||
let read_stream line_stream =
|
||||
let rec loop accu =
|
||||
try
|
||||
match read_element line_stream with
|
||||
|
@ -94,12 +94,12 @@ let read_stream line_stream =
|
|||
with
|
||||
Element.ElementError _ -> loop accu
|
||||
in
|
||||
loop []
|
||||
loop []
|
||||
|
||||
let read filename =
|
||||
let ic = open_in filename in
|
||||
let line_stream =
|
||||
Stream.from (fun _ ->
|
||||
Stream.from (fun _ ->
|
||||
try Some (input_line ic)
|
||||
with End_of_file -> None )
|
||||
in
|
||||
|
@ -122,7 +122,7 @@ let read_many filenames =
|
|||
List.map read filenames
|
||||
|> combine
|
||||
|
||||
|
||||
|
||||
let string_of_primitive ?id prim =
|
||||
match id with
|
||||
| None -> (string_of_float prim.exponent)^" "^(string_of_float prim.coefficient)
|
||||
|
@ -130,7 +130,7 @@ let string_of_primitive ?id prim =
|
|||
|
||||
|
||||
let string_of_contracted_shell (angular_momentum, prim_array) =
|
||||
let n =
|
||||
let n =
|
||||
Array.length prim_array
|
||||
in
|
||||
Printf.sprintf "%s %d\n%s"
|
||||
|
@ -150,7 +150,7 @@ let to_string (name, contracted_shell_array) =
|
|||
Printf.sprintf "%s\n%s" name (string_of_contracted_shell_array contracted_shell_array)
|
||||
|
||||
|
||||
let of_string input_string =
|
||||
let of_string input_string =
|
||||
String.split_on_char '\n' input_string
|
||||
|> Stream.of_list
|
||||
|> read_stream
|
||||
|
@ -158,7 +158,7 @@ let of_string input_string =
|
|||
|
||||
let pp_primitive ppf prim =
|
||||
Format.fprintf ppf "@[%17.10e %17.10e@]" prim.exponent prim.coefficient
|
||||
|
||||
|
||||
|
||||
let pp_gcs ppf gcs =
|
||||
let (angular_momentum, prim_array) = gcs in
|
||||
|
@ -169,7 +169,7 @@ let pp_gcs ppf gcs =
|
|||
Array.iteri (fun i prim -> Format.fprintf ppf "@[%3d %a@]@."
|
||||
(i+1) pp_primitive prim) prim_array
|
||||
|
||||
|
||||
|
||||
let pp_element_basis ppf eb =
|
||||
let (element, basis) = eb in
|
||||
Format.fprintf ppf "@[%s@]@." (String.uppercase_ascii @@ Element.to_long_string element);
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
qcaml.linear_algebra
|
||||
qcaml.gaussian
|
||||
qcaml.operators
|
||||
unix
|
||||
)
|
||||
(modules_without_implementation matrix_on_basis)
|
||||
|
||||
|
|
Loading…
Reference in New Issue