10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-12-22 04:13:33 +01:00

Fixed localization

This commit is contained in:
Anthony Scemama 2021-02-01 16:35:58 +01:00
parent 0b6fe42e55
commit 8e99b4a58c
4 changed files with 71 additions and 71 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-01-30 Sat 19:07 -->
<!-- 2021-02-01 Mon 16:35 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Molecular orbitals</title>
@ -272,46 +272,46 @@ 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="#org5ae1447">1. Summmary</a></li>
<li><a href="#org5d6abfd">2. Frozen core</a>
<li><a href="#org16b987d">1. Summmary</a></li>
<li><a href="#org0177256">2. Frozen core</a>
<ul>
<li><a href="#org6013f02">2.1. Type</a></li>
<li><a href="#orgc66d8bd">2.2. Creation</a></li>
<li><a href="#org7a06aed">2.3. Access</a></li>
<li><a href="#org7d4d0a2">2.4. Printers</a></li>
<li><a href="#org6900aef">2.1. Type</a></li>
<li><a href="#org870a57f">2.2. Creation</a></li>
<li><a href="#org1166d5b">2.3. Access</a></li>
<li><a href="#orge10b2ae">2.4. Printers</a></li>
</ul>
</li>
<li><a href="#org80b59a6">3. Orbital localization</a>
<li><a href="#org2fbb330">3. Orbital localization</a>
<ul>
<li><a href="#org3a774bd">3.1. Type</a></li>
<li><a href="#org3792219">3.2. Edmiston-Rudenberg</a></li>
<li><a href="#org2a12adf">3.3. Boys</a></li>
<li><a href="#org7f7571f">3.4. Access</a></li>
<li><a href="#orgd0fc6f0">3.5. Printers</a></li>
<li><a href="#org93f02d0">3.6. Tests</a></li>
<li><a href="#org03fdc29">3.1. Type</a></li>
<li><a href="#orgb4e9f2d">3.2. Edmiston-Rudenberg</a></li>
<li><a href="#org1896f76">3.3. Boys</a></li>
<li><a href="#org65fcd65">3.4. Access</a></li>
<li><a href="#org23e410d">3.5. Printers</a></li>
<li><a href="#orga62f968">3.6. Tests</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org5ae1447" class="outline-2">
<h2 id="org5ae1447"><span class="section-number-2">1</span> Summmary</h2>
<div id="outline-container-org16b987d" class="outline-2">
<h2 id="org16b987d"><span class="section-number-2">1</span> Summmary</h2>
</div>
<div id="outline-container-org5d6abfd" class="outline-2">
<h2 id="org5d6abfd"><span class="section-number-2">2</span> Frozen core</h2>
<div id="outline-container-org0177256" class="outline-2">
<h2 id="org0177256"><span class="section-number-2">2</span> Frozen core</h2>
<div class="outline-text-2" id="text-2">
<p>
Defines how the core electrons are frozen, for each atom.
</p>
</div>
<div id="outline-container-org6013f02" class="outline-3">
<h3 id="org6013f02"><span class="section-number-3">2.1</span> Type</h3>
<div id="outline-container-org6900aef" class="outline-3">
<h3 id="org6900aef"><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="org7e482ab"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">kind</span> <span class="org-tuareg-font-lock-operator">=</span>
<pre class="src src-ocaml" id="org9eefac4"><span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">kind</span> <span class="org-tuareg-font-lock-operator">=</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">All_electron</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">Small</span>
<span class="org-tuareg-font-lock-operator">|</span> Large
@ -325,8 +325,8 @@ Defines how the core electrons are frozen, for each atom.
</div>
</div>
<div id="outline-container-orgc66d8bd" class="outline-3">
<h3 id="orgc66d8bd"><span class="section-number-3">2.2</span> Creation</h3>
<div id="outline-container-org870a57f" class="outline-3">
<h3 id="org870a57f"><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">val</span> <span class="org-function-name">make</span> <span class="org-tuareg-font-lock-operator">:</span> kind <span class="org-tuareg-font-lock-operator">-&gt;</span> <span class="org-tuareg-font-lock-module">Particles.Nuclei.</span>t <span class="org-tuareg-font-lock-operator">-&gt;</span> t
@ -362,7 +362,7 @@ Defines how the core electrons are frozen, for each atom.
</tbody>
</table>
<pre class="example" id="orgd0bea50">
<pre class="example" id="org983f6d9">
let f = Frozen_core.(make Small nuclei) ;;
val f : Frozen_core.t = [|0; 2; 2; 0|]
@ -372,8 +372,8 @@ val f : Frozen_core.t = [|0; 2; 2; 0|]
</div>
</div>
<div id="outline-container-org7a06aed" class="outline-3">
<h3 id="org7a06aed"><span class="section-number-3">2.3</span> Access</h3>
<div id="outline-container-org1166d5b" class="outline-3">
<h3 id="org1166d5b"><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">num_elec</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> int
@ -402,7 +402,7 @@ val f : Frozen_core.t = [|0; 2; 2; 0|]
</tbody>
</table>
<pre class="example" id="org8a415bd">
<pre class="example" id="org0da2757">
Frozen_core.num_elec f ;;
- : int = 4
@ -412,8 +412,8 @@ Frozen_core.num_mos f ;;
</div>
</div>
<div id="outline-container-org7d4d0a2" class="outline-3">
<h3 id="org7d4d0a2"><span class="section-number-3">2.4</span> Printers</h3>
<div id="outline-container-orge10b2ae" class="outline-3">
<h3 id="orge10b2ae"><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
@ -423,8 +423,8 @@ Frozen_core.num_mos f ;;
</div>
</div>
<div id="outline-container-org80b59a6" class="outline-2">
<h2 id="org80b59a6"><span class="section-number-2">3</span> Orbital localization</h2>
<div id="outline-container-org2fbb330" class="outline-2">
<h2 id="org2fbb330"><span class="section-number-2">3</span> Orbital localization</h2>
<div class="outline-text-2" id="text-3">
<p>
Molecular orbital localization function.
@ -440,11 +440,11 @@ Edmiston-Rudenberg:
</div>
<div id="outline-container-org3a774bd" class="outline-3">
<h3 id="org3a774bd"><span class="section-number-3">3.1</span> Type</h3>
<div id="outline-container-org03fdc29" class="outline-3">
<h3 id="org03fdc29"><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="org7ba3fe2"><span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Linear_algebra</span>
<pre class="src src-ocaml" id="orgf4b2df1"><span class="org-tuareg-font-lock-governing">open </span><span class="org-tuareg-font-lock-module">Linear_algebra</span>
<span class="org-tuareg-font-lock-governing">type</span> <span class="org-type">localization_kind</span> <span class="org-tuareg-font-lock-operator">=</span>
<span class="org-tuareg-font-lock-operator">|</span> <span class="org-tuareg-font-lock-constructor">Edmiston</span>
@ -464,16 +464,16 @@ Edmiston-Rudenberg:
</div>
</div>
<div id="outline-container-org3792219" class="outline-3">
<h3 id="org3792219"><span class="section-number-3">3.2</span> Edmiston-Rudenberg</h3>
<div id="outline-container-orgb4e9f2d" class="outline-3">
<h3 id="orgb4e9f2d"><span class="section-number-3">3.2</span> Edmiston-Rudenberg</h3>
</div>
<div id="outline-container-org2a12adf" class="outline-3">
<h3 id="org2a12adf"><span class="section-number-3">3.3</span> Boys</h3>
<div id="outline-container-org1896f76" class="outline-3">
<h3 id="org1896f76"><span class="section-number-3">3.3</span> Boys</h3>
</div>
<div id="outline-container-org7f7571f" class="outline-3">
<h3 id="org7f7571f"><span class="section-number-3">3.4</span> Access</h3>
<div id="outline-container-org65fcd65" class="outline-3">
<h3 id="org65fcd65"><span class="section-number-3">3.4</span> Access</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">kind</span> <span class="org-tuareg-font-lock-operator">:</span> t <span class="org-tuareg-font-lock-operator">-&gt;</span> localization_kind
@ -522,8 +522,8 @@ Edmiston-Rudenberg:
</div>
</div>
<div id="outline-container-orgd0fc6f0" class="outline-3">
<h3 id="orgd0fc6f0"><span class="section-number-3">3.5</span> Printers</h3>
<div id="outline-container-org23e410d" class="outline-3">
<h3 id="org23e410d"><span class="section-number-3">3.5</span> Printers</h3>
<div class="outline-text-3" id="text-3-5">
<div class="org-src-container">
<pre class="src src-ocaml"><span class="org-comment-delimiter">(*</span>
@ -534,14 +534,14 @@ Edmiston-Rudenberg:
</div>
</div>
<div id="outline-container-org93f02d0" class="outline-3">
<h3 id="org93f02d0"><span class="section-number-3">3.6</span> Tests</h3>
<div id="outline-container-orga62f968" class="outline-3">
<h3 id="orga62f968"><span class="section-number-3">3.6</span> Tests</h3>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Anthony Scemama</p>
<p class="date">Created: 2021-01-30 Sat 19:07</p>
<p class="date">Created: 2021-02-01 Mon 16:35</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-01-30 Sat 19:07 -->
<!-- 2021-02-01 Mon 16:35 -->
<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="#org6d8977c">1. Summmary</a></li>
<li><a href="#orgddd3ddd">1. Summmary</a></li>
</ul>
</div>
</div>
<div id="outline-container-org6d8977c" class="outline-2">
<h2 id="org6d8977c"><span class="section-number-2">1</span> Summmary</h2>
<div id="outline-container-orgddd3ddd" class="outline-2">
<h2 id="orgddd3ddd"><span class="section-number-2">1</span> Summmary</h2>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Anthony Scemama</p>
<p class="date">Created: 2021-01-30 Sat 19:07</p>
<p class="date">Created: 2021-02-01 Mon 16:35</p>
<p class="validation"><a href="https://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>

View File

@ -234,7 +234,6 @@ let ao_basis t = Simulation.ao_basis (simulation t)
*)
let make ~kind ?(max_iter=500) ?(convergence=1.e-8) mo_basis selected_mos =
let kappa_loc = kappa ~kind mo_basis in
@ -245,7 +244,7 @@ let make ~kind ?(max_iter=500) ?(convergence=1.e-8) mo_basis selected_mos =
Matrix.of_col_vecs_list mos_vec_list
in
let next_coef kappa =
let next_coef kappa x =
let r = Matrix.exponential_antisymmetric kappa in
let m_C = Matrix.gemm_nt x r in
m_C
@ -253,21 +252,22 @@ let make ~kind ?(max_iter=500) ?(convergence=1.e-8) mo_basis selected_mos =
let data_initial =
let iteration = 0
and kappa, loc_value = kappa_loc x
and scaling = 1.0
and scaling = 0.5
in
let coefficients = next_coef kappa in
let kappa, loc_value = kappa_loc x in
let kappa = Matrix.scale scaling kappa in
let coefficients = next_coef kappa x in
{ coefficients ; kappa ; scaling ; loc_value ; iteration }
in
let iteration data =
let x = data.coefficients in
let iteration = data.iteration + 1
and kappa, loc_value = kappa_loc x
and scaling = data.scaling
and scaling = data.scaling
and x = data.coefficients
in
let coefficients = next_coef kappa in
Printf.printf "%4d %20f\n" iteration loc_value ;
let kappa, loc_value = kappa_loc x in
let kappa = Matrix.scale scaling kappa in
let coefficients = next_coef kappa x in
{ coefficients ; kappa ; scaling ; loc_value ; iteration }
in

View File

@ -291,8 +291,7 @@ let last_iteration t =
(*
let ao_basis t = Simulation.ao_basis (simulation t)
*)
,*)
let make ~kind ?(max_iter=500) ?(convergence=1.e-8) mo_basis selected_mos =
@ -305,7 +304,7 @@ let make ~kind ?(max_iter=500) ?(convergence=1.e-8) mo_basis selected_mos =
Matrix.of_col_vecs_list mos_vec_list
in
let next_coef kappa =
let next_coef kappa x =
let r = Matrix.exponential_antisymmetric kappa in
let m_C = Matrix.gemm_nt x r in
m_C
@ -313,21 +312,22 @@ let make ~kind ?(max_iter=500) ?(convergence=1.e-8) mo_basis selected_mos =
let data_initial =
let iteration = 0
and kappa, loc_value = kappa_loc x
and scaling = 1.0
and scaling = 0.5
in
let coefficients = next_coef kappa in
let kappa, loc_value = kappa_loc x in
let kappa = Matrix.scale scaling kappa in
let coefficients = next_coef kappa x in
{ coefficients ; kappa ; scaling ; loc_value ; iteration }
in
let iteration data =
let x = data.coefficients in
let iteration = data.iteration + 1
and kappa, loc_value = kappa_loc x
and scaling = data.scaling
and scaling = data.scaling
and x = data.coefficients
in
let coefficients = next_coef kappa in
Printf.printf "%4d %20f\n" iteration loc_value ;
let kappa, loc_value = kappa_loc x in
let kappa = Matrix.scale scaling kappa in
let coefficients = next_coef kappa x in
{ coefficients ; kappa ; scaling ; loc_value ; iteration }
in