Commit 5bd1c97e authored by Davison's avatar Davison
Browse files

reorganized files. want oop_imsrg to be module

parent ad4d2312
This diff is collapsed.
This diff is collapsed.
......@@ -41,10 +41,15 @@
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="flow.html#Flow_IMSRG2">Flow_IMSRG2</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="flow.html#Flow_IMSRG3">Flow_IMSRG3</a>
</font></dt></dl>
</dd>
</dl>
</dd>
</dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
......@@ -105,6 +110,54 @@ Returns:<br>
&nbsp;df,&nbsp;--&nbsp;one-body&nbsp;tensor<br>
&nbsp;dG)&nbsp;--&nbsp;two-body&nbsp;tensor</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="flow.html#Flow">Flow</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="Flow_IMSRG3">class <strong>Flow_IMSRG3</strong></a>(<a href="flow.html#Flow_IMSRG2">Flow_IMSRG2</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#Flow_IMSRG3">Flow_IMSRG3</a>(gen)<br>
&nbsp;<br>
Calculates&nbsp;the&nbsp;flow&nbsp;equations&nbsp;for&nbsp;the&nbsp;IMSRG(2).<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="flow.html#Flow_IMSRG3">Flow_IMSRG3</a></dd>
<dd><a href="flow.html#Flow_IMSRG2">Flow_IMSRG2</a></dd>
<dd><a href="flow.html#Flow">Flow</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="Flow_IMSRG3-__init__"><strong>__init__</strong></a>(self, gen)</dt><dd><tt>Class&nbsp;constructor.&nbsp;Instantiates&nbsp;<a href="#Flow_IMSRG2">Flow_IMSRG2</a>&nbsp;<a href="builtins.html#object">object</a>.<br>
&nbsp;<br>
Arguments:<br>
&nbsp;<br>
h&nbsp;--&nbsp;Hamiltonian&nbsp;<a href="builtins.html#object">object</a><br>
occ_t&nbsp;--&nbsp;OccupationTensors&nbsp;<a href="builtins.html#object">object</a></tt></dd></dl>
<hr>
Methods inherited from <a href="flow.html#Flow_IMSRG2">Flow_IMSRG2</a>:<br>
<dl><dt><a name="Flow_IMSRG3-flow"><strong>flow</strong></a>(self, gen)</dt><dd><tt>Iterates&nbsp;the&nbsp;IMSRG2&nbsp;flow&nbsp;equations&nbsp;once.<br>
&nbsp;<br>
Arugments:<br>
&nbsp;<br>
gen&nbsp;--&nbsp;Generator&nbsp;<a href="builtins.html#object">object</a>;&nbsp;generator&nbsp;produces&nbsp;the&nbsp;flow<br>
&nbsp;<br>
Returns:<br>
&nbsp;<br>
(dE,&nbsp;--&nbsp;zero-body&nbsp;tensor<br>
&nbsp;df,&nbsp;--&nbsp;one-body&nbsp;tensor<br>
&nbsp;dG)&nbsp;--&nbsp;two-body&nbsp;tensor</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="flow.html#Flow">Flow</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
......
......@@ -41,15 +41,10 @@
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="hamiltonian.html#PairingHamiltonian2B">PairingHamiltonian2B</a>
</font></dt><dd>
<dl>
<dt><font face="helvetica, arial"><a href="hamiltonian.html#PairingHamiltonian3B">PairingHamiltonian3B</a>
</font></dt></dl>
</dd>
</dl>
</dd>
</dl>
</dd>
</dl>
<p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
......@@ -62,7 +57,13 @@
classes&nbsp;should&nbsp;inherit&nbsp;from&nbsp;this&nbsp;class.&nbsp;In&nbsp;this&nbsp;way,&nbsp;AssertionErrors<br>
can&nbsp;be&nbsp;handled&nbsp;in&nbsp;a&nbsp;general&nbsp;way.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%">Data descriptors defined here:<br>
<td width="100%">Methods defined here:<br>
<dl><dt><a name="Hamiltonian-construct"><strong>construct</strong></a>()</dt></dl>
<dl><dt><a name="Hamiltonian-normal_order"><strong>normal_order</strong></a>()</dt></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
......@@ -76,7 +77,7 @@ can&nbsp;be&nbsp;handled&nbsp;in&nbsp;a&nbsp;general&nbsp;way.<br>&nbsp;</tt></t
<font color="#000000" face="helvetica, arial"><a name="PairingHamiltonian2B">class <strong>PairingHamiltonian2B</strong></a>(<a href="hamiltonian.html#Hamiltonian">Hamiltonian</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#PairingHamiltonian2B">PairingHamiltonian2B</a>(n_hole_states,&nbsp;n_particle_states,&nbsp;d=1.0,&nbsp;g=0.5,&nbsp;pb=0.0)<br>
<td colspan=2><tt><a href="#PairingHamiltonian2B">PairingHamiltonian2B</a>(n_hole_states,&nbsp;n_particle_states,&nbsp;ref=None,&nbsp;d=1.0,&nbsp;g=0.5,&nbsp;pb=0.0)<br>
&nbsp;<br>
Generate&nbsp;the&nbsp;two-body&nbsp;pairing&nbsp;<a href="#Hamiltonian">Hamiltonian</a>.&nbsp;Inherits&nbsp;from&nbsp;<a href="#Hamiltonian">Hamiltonian</a>.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
......@@ -87,7 +88,7 @@ Generate&nbsp;the&nbsp;two-body&nbsp;pairing&nbsp;<a href="#Hamiltonian">Hamilto
</dl>
<hr>
Methods defined here:<br>
<dl><dt><a name="PairingHamiltonian2B-__init__"><strong>__init__</strong></a>(self, n_hole_states, n_particle_states, d=1.0, g=0.5, pb=0.0)</dt><dd><tt>Class&nbsp;constructor.&nbsp;Instantiate&nbsp;<a href="#PairingHamiltonian2B">PairingHamiltonian2B</a>&nbsp;<a href="builtins.html#object">object</a>.<br>
<dl><dt><a name="PairingHamiltonian2B-__init__"><strong>__init__</strong></a>(self, n_hole_states, n_particle_states, ref=None, d=1.0, g=0.5, pb=0.0)</dt><dd><tt>Class&nbsp;constructor.&nbsp;Instantiate&nbsp;<a href="#PairingHamiltonian2B">PairingHamiltonian2B</a>&nbsp;<a href="builtins.html#object">object</a>.<br>
&nbsp;<br>
Arguments:<br>
&nbsp;<br>
......@@ -100,177 +101,102 @@ d&nbsp;--&nbsp;the&nbsp;energy&nbsp;level&nbsp;spacing&nbsp;(default:&nbsp;1.0)<
g&nbsp;--&nbsp;the&nbsp;pairing&nbsp;strength&nbsp;(default:&nbsp;0.5)<br>
pb&nbsp;--&nbsp;strength&nbsp;of&nbsp;the&nbsp;pair-breaking&nbsp;term&nbsp;(operates&nbsp;in&nbsp;double&nbsp;particle&nbsp;basis)&nbsp;(default:&nbsp;0.0)</tt></dd></dl>
<hr>
Data descriptors defined here:<br>
<dl><dt><strong>E</strong></dt>
<dd><tt>Returns:&nbsp;<br>
&nbsp;<br>
E&nbsp;--&nbsp;zero-body&nbsp;(rank&nbsp;0)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;__normal_order().</tt></dd>
</dl>
<dl><dt><strong>G</strong></dt>
<dd><tt>Returns:&nbsp;<br>
&nbsp;<br>
G&nbsp;--&nbsp;two-body&nbsp;(rank&nbsp;4)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;__normal_order().</tt></dd>
</dl>
<dl><dt><strong>H1B</strong></dt>
<dd><tt>Returns:&nbsp;<br>
&nbsp;<br>
H1B&nbsp;--&nbsp;one-body&nbsp;(rank&nbsp;2)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;__construct().</tt></dd>
</dl>
<dl><dt><strong>H2B</strong></dt>
<dd><tt>Returns:&nbsp;<br>
&nbsp;<br>
H2B&nbsp;--&nbsp;two-body&nbsp;(rank&nbsp;4)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;__construct().</tt></dd>
</dl>
<dl><dt><strong>d</strong></dt>
<dd><tt>Returns:&nbsp;<br>
&nbsp;<br>
d&nbsp;--&nbsp;energy&nbsp;level&nbsp;spacing.</tt></dd>
</dl>
<dl><dt><strong>f</strong></dt>
<dd><tt>Returns:&nbsp;<br>
&nbsp;<br>
f&nbsp;--&nbsp;one-body&nbsp;(rank&nbsp;2)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;__normal_order().</tt></dd>
</dl>
<dl><dt><strong>g</strong></dt>
<dd><tt>Returns:&nbsp;<br>
&nbsp;<br>
g&nbsp;--&nbsp;pairing&nbsp;strength.</tt></dd>
</dl>
<dl><dt><strong>holes</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dl><dt><a name="PairingHamiltonian2B-construct"><strong>construct</strong></a>(self)</dt><dd><tt>Constructs&nbsp;the&nbsp;one-&nbsp;and&nbsp;two-body&nbsp;pieces&nbsp;of&nbsp;the&nbsp;pairing<br>
<a href="#Hamiltonian">Hamiltonian</a>.<br>
&nbsp;<br>
holes&nbsp;--&nbsp;indices&nbsp;of&nbsp;hole&nbsp;states&nbsp;in&nbsp;single&nbsp;particle&nbsp;basis.</tt></dd>
</dl>
<dl><dt><strong>n_sp_states</strong></dt>
<dd><tt>Returns:&nbsp;<br>
Returns:<br>
&nbsp;<br>
n_sp_states&nbsp;--&nbsp;size&nbsp;of&nbsp;single-particle&nbsp;basis.</tt></dd>
</dl>
<dl><dt><strong>particles</strong></dt>
<dd><tt>Returns:&nbsp;<br>
&nbsp;<br>
particles&nbsp;--&nbsp;indices&nbsp;of&nbsp;particle&nbsp;states&nbsp;in&nbsp;single&nbsp;particle&nbsp;basis.</tt></dd>
</dl>
<dl><dt><strong>pb</strong></dt>
<dd><tt>Returns:&nbsp;<br>
&nbsp;<br>
pb&nbsp;--&nbsp;pair-breaking&nbsp;strength.</tt></dd>
</dl>
<dl><dt><strong>reference</strong></dt>
<dd><tt>Returns:&nbsp;<br>
&nbsp;<br>
reference&nbsp;--&nbsp;reference&nbsp;state&nbsp;(ground&nbsp;state).</tt></dd>
</dl>
<dl><dt><strong>sp_basis</strong></dt>
<dd><tt>Returns:&nbsp;<br>
(H1B,&nbsp;--&nbsp;one-body&nbsp;tensor&nbsp;elements&nbsp;(defined&nbsp;by&nbsp;one-body&nbsp;operator)<br>
&nbsp;H2B)&nbsp;--&nbsp;two-body&nbsp;tensor&nbsp;elements&nbsp;(defined&nbsp;by&nbsp;two-body&nbsp;operator)</tt></dd></dl>
<dl><dt><a name="PairingHamiltonian2B-delta2B"><strong>delta2B</strong></a>(self, p, q, r, s)</dt><dd><tt>Determines&nbsp;if&nbsp;a&nbsp;two-body&nbsp;tensor&nbsp;elements&nbsp;should&nbsp;be&nbsp;zero,<br>
positive,&nbsp;or&nbsp;negative.&nbsp;This&nbsp;behavior&nbsp;is&nbsp;dictated&nbsp;by&nbsp;the&nbsp;pairing<br>
term&nbsp;in&nbsp;pairing&nbsp;<a href="#Hamiltonian">Hamiltonian</a>.<br>
&nbsp;<br>
sp_basis&nbsp;--&nbsp;indices&nbsp;of&nbsp;full&nbsp;single&nbsp;particle&nbsp;basis.</tt></dd>
</dl>
<hr>
Data descriptors inherited from <a href="hamiltonian.html#Hamiltonian">Hamiltonian</a>:<br>
<dl><dt><strong>__dict__</strong></dt>
<dd><tt>dictionary&nbsp;for&nbsp;instance&nbsp;variables&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
<dl><dt><strong>__weakref__</strong></dt>
<dd><tt>list&nbsp;of&nbsp;weak&nbsp;references&nbsp;to&nbsp;the&nbsp;object&nbsp;(if&nbsp;defined)</tt></dd>
</dl>
</td></tr></table> <p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#ffc8d8">
<td colspan=3 valign=bottom>&nbsp;<br>
<font color="#000000" face="helvetica, arial"><a name="PairingHamiltonian3B">class <strong>PairingHamiltonian3B</strong></a>(<a href="hamiltonian.html#PairingHamiltonian2B">PairingHamiltonian2B</a>)</font></td></tr>
<tr bgcolor="#ffc8d8"><td rowspan=2><tt>&nbsp;&nbsp;&nbsp;</tt></td>
<td colspan=2><tt><a href="#PairingHamiltonian3B">PairingHamiltonian3B</a>(n_hole_states,&nbsp;n_particle_states,&nbsp;d=1.0,&nbsp;g=0.5,&nbsp;pb=0.0)<br>
Arguments:<br>
&nbsp;<br>
Generate&nbsp;the&nbsp;two-body&nbsp;pairing&nbsp;<a href="#Hamiltonian">Hamiltonian</a>.&nbsp;Inherits&nbsp;from&nbsp;<a href="#Hamiltonian">Hamiltonian</a>.<br>&nbsp;</tt></td></tr>
<tr><td>&nbsp;</td>
<td width="100%"><dl><dt>Method resolution order:</dt>
<dd><a href="hamiltonian.html#PairingHamiltonian3B">PairingHamiltonian3B</a></dd>
<dd><a href="hamiltonian.html#PairingHamiltonian2B">PairingHamiltonian2B</a></dd>
<dd><a href="hamiltonian.html#Hamiltonian">Hamiltonian</a></dd>
<dd><a href="builtins.html#object">builtins.object</a></dd>
</dl>
<hr>
Methods inherited from <a href="hamiltonian.html#PairingHamiltonian2B">PairingHamiltonian2B</a>:<br>
<dl><dt><a name="PairingHamiltonian3B-__init__"><strong>__init__</strong></a>(self, n_hole_states, n_particle_states, d=1.0, g=0.5, pb=0.0)</dt><dd><tt>Class&nbsp;constructor.&nbsp;Instantiate&nbsp;<a href="#PairingHamiltonian2B">PairingHamiltonian2B</a>&nbsp;<a href="builtins.html#object">object</a>.<br>
p,q,r,s&nbsp;--&nbsp;indices&nbsp;in&nbsp;single-particle&nbsp;basis</tt></dd></dl>
<dl><dt><a name="PairingHamiltonian2B-deltaPB"><strong>deltaPB</strong></a>(self, p, q, r, s)</dt><dd><tt>Determines&nbsp;if&nbsp;a&nbsp;two-body&nbsp;tensor&nbsp;elements&nbsp;should&nbsp;be&nbsp;zero,<br>
positive,&nbsp;or&nbsp;negative.&nbsp;This&nbsp;behavior&nbsp;is&nbsp;dictated&nbsp;by&nbsp;the&nbsp;pair-<br>
breaking&nbsp;term&nbsp;in&nbsp;pairing&nbsp;<a href="#Hamiltonian">Hamiltonian</a>.<br>
&nbsp;<br>
Arguments:<br>
&nbsp;<br>
n_hole_states&nbsp;--&nbsp;number&nbsp;of&nbsp;holes&nbsp;states&nbsp;in&nbsp;the&nbsp;single&nbsp;particle&nbsp;basis<br>
n_particle_states&nbsp;--&nbsp;number&nbsp;of&nbsp;particles&nbsp;states&nbsp;in&nbsp;the&nbsp;single&nbsp;particle&nbsp;basis<br>
p,q,r,s&nbsp;--&nbsp;indices&nbsp;in&nbsp;single&nbsp;particle&nbsp;basis</tt></dd></dl>
<dl><dt><a name="PairingHamiltonian2B-normal_order"><strong>normal_order</strong></a>(self)</dt><dd><tt>Normal-orders&nbsp;the&nbsp;pairing&nbsp;<a href="#Hamiltonian">Hamiltonian</a>.<br>
&nbsp;<br>
Keyword&nbsp;arguments:<br>
Returns:<br>
&nbsp;<br>
d&nbsp;--&nbsp;the&nbsp;energy&nbsp;level&nbsp;spacing&nbsp;(default:&nbsp;1.0)<br>
g&nbsp;--&nbsp;the&nbsp;pairing&nbsp;strength&nbsp;(default:&nbsp;0.5)<br>
pb&nbsp;--&nbsp;strength&nbsp;of&nbsp;the&nbsp;pair-breaking&nbsp;term&nbsp;(operates&nbsp;in&nbsp;double&nbsp;particle&nbsp;basis)&nbsp;(default:&nbsp;0.0)</tt></dd></dl>
(E,&nbsp;--&nbsp;zero-body&nbsp;piece<br>
&nbsp;f,&nbsp;--&nbsp;one-body&nbsp;piece<br>
&nbsp;G)&nbsp;--&nbsp;two-body&nbsp;piece</tt></dd></dl>
<hr>
Data descriptors inherited from <a href="hamiltonian.html#PairingHamiltonian2B">PairingHamiltonian2B</a>:<br>
Data descriptors defined here:<br>
<dl><dt><strong>E</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
E&nbsp;--&nbsp;zero-body&nbsp;(rank&nbsp;0)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;__normal_order().</tt></dd>
E&nbsp;--&nbsp;zero-body&nbsp;(rank&nbsp;0)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;normal_order().</tt></dd>
</dl>
<dl><dt><strong>G</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
G&nbsp;--&nbsp;two-body&nbsp;(rank&nbsp;4)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;__normal_order().</tt></dd>
G&nbsp;--&nbsp;two-body&nbsp;(rank&nbsp;4)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;normal_order().</tt></dd>
</dl>
<dl><dt><strong>H1B</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
H1B&nbsp;--&nbsp;one-body&nbsp;(rank&nbsp;2)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;__construct().</tt></dd>
H1B&nbsp;--&nbsp;one-body&nbsp;(rank&nbsp;2)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;construct().</tt></dd>
</dl>
<dl><dt><strong>H2B</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
H2B&nbsp;--&nbsp;two-body&nbsp;(rank&nbsp;4)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;__construct().</tt></dd>
H2B&nbsp;--&nbsp;two-body&nbsp;(rank&nbsp;4)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;construct().</tt></dd>
</dl>
<dl><dt><strong>d</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
d&nbsp;--&nbsp;energy&nbsp;level&nbsp;spacing.</tt></dd>
</dl>
<dl><dt><strong>f</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
f&nbsp;--&nbsp;one-body&nbsp;(rank&nbsp;2)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;__normal_order().</tt></dd>
f&nbsp;--&nbsp;one-body&nbsp;(rank&nbsp;2)&nbsp;tensor&nbsp;defined&nbsp;by&nbsp;normal_order().</tt></dd>
</dl>
<dl><dt><strong>g</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
g&nbsp;--&nbsp;pairing&nbsp;strength.</tt></dd>
</dl>
<dl><dt><strong>holes</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
holes&nbsp;--&nbsp;indices&nbsp;of&nbsp;hole&nbsp;states&nbsp;in&nbsp;single&nbsp;particle&nbsp;basis.</tt></dd>
</dl>
<dl><dt><strong>n_sp_states</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
n_sp_states&nbsp;--&nbsp;size&nbsp;of&nbsp;single-particle&nbsp;basis.</tt></dd>
</dl>
<dl><dt><strong>particles</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
particles&nbsp;--&nbsp;indices&nbsp;of&nbsp;particle&nbsp;states&nbsp;in&nbsp;single&nbsp;particle&nbsp;basis.</tt></dd>
</dl>
<dl><dt><strong>pb</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
pb&nbsp;--&nbsp;pair-breaking&nbsp;strength.</tt></dd>
</dl>
<dl><dt><strong>reference</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
reference&nbsp;--&nbsp;reference&nbsp;state&nbsp;(ground&nbsp;state).</tt></dd>
</dl>
<dl><dt><strong>sp_basis</strong></dt>
<dd><tt>Returns:&nbsp;<br>
<dd><tt>Returns:<br>
&nbsp;<br>
sp_basis&nbsp;--&nbsp;indices&nbsp;of&nbsp;full&nbsp;single&nbsp;particle&nbsp;basis.</tt></dd>
</dl>
......
......@@ -18,15 +18,25 @@
<tr><td bgcolor="#aa55cc"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><table width="100%" summary="list"><tr><td width="25%" valign=top><a href="tensornetwork.backends.html">tensornetwork.backends</a><br>
<a href="ci_pairing.cipy_pairing_plus_ph.html">ci_pairing.cipy_pairing_plus_ph</a><br>
<a href="tensornetwork.config.html">tensornetwork.config</a><br>
<a href="tensornetwork.contractors.html">tensornetwork.contractors</a><br>
</td><td width="25%" valign=top><a href="tensornetwork.ncon_interface.html">tensornetwork.ncon_interface</a><br>
<a href="glob.html">glob</a><br>
</td><td width="25%" valign=top><a href="itertools.html">itertools</a><br>
<a href="linecache.html">linecache</a><br>
<a href="tensornetwork.ncon_interface.html">tensornetwork.ncon_interface</a><br>
<a href="tensornetwork.network.html">tensornetwork.network</a><br>
<a href="tensornetwork.network_components.html">tensornetwork.network_components</a><br>
</td><td width="25%" valign=top><a href="numpy.html">numpy</a><br>
<a href="os.html">os</a><br>
<a href="pickle.html">pickle</a><br>
<a href="matplotlib.pyplot.html">matplotlib.pyplot</a><br>
<a href="random.html">random</a><br>
</td><td width="25%" valign=top><a href="sys.html">sys</a><br>
<a href="time.html">time</a><br>
<a href="tracemalloc.html">tracemalloc</a><br>
<a href="tensornetwork.version.html">tensornetwork.version</a><br>
</td><td width="25%" valign=top><a href="tensornetwork.visualization.html">tensornetwork.visualization</a><br>
<a href="tensornetwork.visualization.html">tensornetwork.visualization</a><br>
</td></tr></table></td></tr></table><p>
<table width="100%" cellspacing=0 cellpadding=2 border=0 summary="section">
<tr bgcolor="#eeaa77">
......@@ -38,7 +48,7 @@
&nbsp;<br>
Arguments:<br>
(required&nbsp;by&nbsp;scipy.integrate.ode)<br>
t&nbsp;--&nbsp;points&nbsp;at&nbsp;which&nbsp;to&nbsp;solve&nbsp;for&nbsp;y&nbsp;<br>
t&nbsp;--&nbsp;points&nbsp;at&nbsp;which&nbsp;to&nbsp;solve&nbsp;for&nbsp;y<br>
y&nbsp;--&nbsp;in&nbsp;this&nbsp;case,&nbsp;1D&nbsp;array&nbsp;that&nbsp;contains&nbsp;E,&nbsp;f,&nbsp;G<br>
&nbsp;<br>
(additional&nbsp;parameters)<br>
......@@ -50,7 +60,19 @@ flow&nbsp;--&nbsp;Flow&nbsp;object<br>
Returns:<br>
&nbsp;<br>
dy&nbsp;--&nbsp;next&nbsp;step&nbsp;in&nbsp;flow</tt></dd></dl>
<dl><dt><a name="-main"><strong>main</strong></a>()</dt><dd><tt>Main&nbsp;method&nbsp;uses&nbsp;scipy.integrate.ode&nbsp;to&nbsp;solve&nbsp;the&nbsp;IMSRG&nbsp;flow<br>
<dl><dt><a name="-exact_diagonalization"><strong>exact_diagonalization</strong></a>(d, g)</dt><dd><tt>Result&nbsp;of&nbsp;exact&nbsp;diagonalization&nbsp;in&nbsp;spin=0&nbsp;block&nbsp;of<br>
pairing&nbsp;Hamiltonian,&nbsp;given&nbsp;8&nbsp;single&nbsp;particle&nbsp;states&nbsp;(4&nbsp;hole&nbsp;states<br>
and&nbsp;4&nbsp;particle&nbsp;states).<br>
&nbsp;<br>
Arguments:<br>
&nbsp;<br>
d&nbsp;--&nbsp;energy&nbsp;level&nbsp;spacing<br>
g&nbsp;--&nbsp;pairing&nbsp;strength<br>
&nbsp;<br>
Returns:<br>
&nbsp;<br>
E&nbsp;--&nbsp;ground&nbsp;state&nbsp;energy</tt></dd></dl>
<dl><dt><a name="-main"><strong>main</strong></a>(n_holes, n_particles, ref=None, d=1.0, g=0.5, pb=0.0)</dt><dd><tt>Main&nbsp;method&nbsp;uses&nbsp;scipy.integrate.ode&nbsp;to&nbsp;solve&nbsp;the&nbsp;IMSRG&nbsp;flow<br>
equations.</tt></dd></dl>
<dl><dt><a name="-ravel"><strong>ravel</strong></a>(y, bas_len)</dt><dd><tt>Transforms&nbsp;1D&nbsp;array&nbsp;into&nbsp;E,&nbsp;f,&nbsp;and&nbsp;G.&nbsp;Facilitates<br>
compatability&nbsp;with&nbsp;scipy.integrate.ode.<br>
......@@ -63,6 +85,9 @@ bas_len&nbsp;--&nbsp;length&nbsp;of&nbsp;single&nbsp;particle&nbsp;basis<br>
Returns:<br>
&nbsp;<br>
E,&nbsp;f,&nbsp;G&nbsp;--&nbsp;normal-ordered&nbsp;pieces&nbsp;of&nbsp;Hamiltonian</tt></dd></dl>
<dl><dt><a name="-scan_params"><strong>scan_params</strong></a>()</dt><dd><tt>#&nbsp;@profile</tt></dd></dl>
<dl><dt><a name="-test_exact"><strong>test_exact</strong></a>(plots_dir)</dt></dl>
<dl><dt><a name="-test_refs"><strong>test_refs</strong></a>(plots_dir)</dt></dl>
<dl><dt><a name="-unravel"><strong>unravel</strong></a>(E, f, G)</dt><dd><tt>Transforms&nbsp;E,&nbsp;f,&nbsp;and&nbsp;G&nbsp;into&nbsp;a&nbsp;1D&nbsp;array.&nbsp;Facilitates<br>
compatability&nbsp;with&nbsp;scipy.integrate.ode.<br>
&nbsp;<br>
......@@ -80,9 +105,5 @@ concatenation&nbsp;of&nbsp;tensors&nbsp;peeled&nbsp;into&nbsp;1D&nbsp;arrays</tt
<font color="#ffffff" face="helvetica, arial"><big><strong>Data</strong></big></font></td></tr>
<tr><td bgcolor="#55aa55"><tt>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</tt></td><td>&nbsp;</td>
<td width="100%"><strong>absolute_import</strong> = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0), 16384)<br>
<strong>fl</strong> = &lt;flow.Flow_IMSRG2 object&gt;<br>
<strong>ha</strong> = &lt;hamiltonian.PairingHamiltonian2B object&gt;<br>
<strong>ot</strong> = &lt;occupation_tensors.OccupationTensors object&gt;<br>
<strong>wg</strong> = &lt;generator.WegnerGenerator object&gt;</td></tr></table>
<td width="100%"><strong>absolute_import</strong> = _Feature((2, 5, 0, 'alpha', 1), (3, 0, 0, 'alpha', 0), 16384)</td></tr></table>
</body></html>
\ No newline at end of file
# Main program for IM-SRG.
# Author: Jacob Davison
# Date: 07/10/2019
# import packages, libraries, and modules
# libraries
from scipy.integrate import odeint, ode
import numpy as np
import time
import pickle
import tracemalloc
import os, sys
from memory_profiler import profile
import itertools
import random
# user files
# sys.path.append('C:\\Users\\davison\\Research\\exact_diagonalization\\')
from hamiltonian import *
from occupation_tensors import *
from generator import *
from flow import *
from plot_data import *
from display_memory import *
import ci_pairing.cipy_pairing_plus_ph as ci_matrix
# @profile
def derivative(t, y, hamiltonian, occ_tensors, generator, flow):
"""Defines the derivative to pass into ode object.
Arguments:
(required by scipy.integrate.ode)
t -- points at which to solve for y
y -- in this case, 1D array that contains E, f, G
(additional parameters)
hamiltonian -- Hamiltonian object
occ_tensors -- OccupationTensors object
generator -- Generator object
flow -- Flow object
Returns:
dy -- next step in flow"""
assert isinstance(hamiltonian, Hamiltonian), "Arg 2 must be Hamiltonian object"
assert isinstance(occ_tensors, OccupationTensors), "Arg 3 must be OccupationTensors object"
assert isinstance(generator, Generator), "Arg 4 must be Generator object"
assert isinstance(flow, Flow), "Arg 5 must be a Flow object"
E, f, G = ravel(y, hamiltonian.n_sp_states)
generator.f = f
generator.G = G
dE, df, dG = flow.flow(generator)
dy = unravel(dE, df, dG)
return dy
# @profile
def unravel(E, f, G):
"""Transforms E, f, and G into a 1D array. Facilitates
compatability with scipy.integrate.ode.
Arguments:
E, f, G -- normal-ordered pieces of Hamiltonian
Returns:
concatenation of tensors peeled into 1D arrays"""
unravel_E = np.reshape(E, -1)
unravel_f = np.reshape(f, -1)
unravel_G = np.reshape(G, -1)
return np.concatenate([unravel_E, unravel_f, unravel_G], axis=0)
# @profile
def ravel(y, bas_len):
"""Transforms 1D array into E, f, and G. Facilitates
compatability with scipy.integrate.ode.
Arugments:
y -- 1D data array (output from unravel)
bas_len -- length of single particle basis
Returns:
E, f, G -- normal-ordered pieces of Hamiltonian"""
# bas_len = len(np.append(holes,particles))
ravel_E = np.reshape(y[0], ())
ravel_f = np.reshape(y[1:bas_len**2+1], (bas_len, bas_len))
ravel_G = np.reshape(y[bas_len**2+1:bas_len**2+1+bas_len**4],
(bas_len, bas_len, bas_len, bas_len))
return(ravel_E, ravel_f, ravel_G)
# @profile
def main(n_holes, n_particles, ref=None, d=1.0, g=0.5, pb=0.0):
"""Main method uses scipy.integrate.ode to solve the IMSRG flow
equations."""
start = time.time()
if ref == None:
ha = PairingHamiltonian2B(n_holes, n_particles, d=d, g=g, pb=pb)
ref = [1,1,1,1,0,0,0,0] # this is just for printing
else:
ha = PairingHamiltonian2B(n_holes, n_particles, ref=ref, d=d, g=g, pb=pb)
ot = OccupationTensors(ha.sp_basis, ha.reference)
wg = WegnerGenerator(ha, ot)
fl = Flow_IMSRG2(ha, ot)
print("""Pairing model IM-SRG flow:
d = {:2.4f}
g = {:2.4f}
pb = {:2.4f}
SP basis size = {:2d}
n_holes = {:2d}
n_particles = {:2d}
ref = {d}""".format(ha.d, ha.g, ha.pb, ha.n_sp_states,
len(ha.holes), len(ha.particles),
d=ref) )
print("Flowing...")
# --- Solve the IM-SRG flow
y0 = unravel(ha.E, ha.f, ha.G)
solver = ode(derivative,jac=None)
solver.set_integrator('vode', method='bdf', order=5, nsteps=500)
solver.set_f_params(ha, ot, wg, fl)
solver.set_initial_value(y0, 0.)
sfinal = 50
ds = 0.1
s_vals = []
E_vals = []
iters = 0
convergence = 0
while solver.successful() and solver.t < sfinal:
ys = solver.integrate(sfinal, step=True)
Es, fs, Gs = ravel(ys, ha.n_sp_states)
s_vals.append(solver.t)
E_vals.append(Es)
iters += 1
# if iters %10 == 0: print("iter: {:>6d} \t scale param: {:0.4f} \t E = {:0.9f}".format(iters, solver.t, Es))
if len(E_vals) > 20 and abs(E_vals[-1] - E_vals[-2]) < 10**-8:
print("---- Energy converged at iter {:>06d} with energy {:1.8f}\n".format(iters,E_vals[-1]))
convergence = 1
break
if len(E_vals) > 20 and abs(E_vals[-1] - E_vals[-2]) > 1:
print("---- Energy diverged at iter {:>06d} with energy {:3.8f}\n".format(iters,E_vals[-1]))
break
if iters > 20000:
print("---- Energy diverged at iter {:>06d} with energy {:3.8f}\n".format(iters,E_vals[-1]))
break
if iters % 1000 == 0:
print('Iteration {:>06d}'.format(iters))