TRIQS/triqs_tprf 4.0.0
A TRIQS application
Loading...
Searching...
No Matches
hubbard_atom.cpp
1/*******************************************************************************
2 *
3 * TRIQS: a Toolbox for Research in Interacting Quantum Systems
4 *
5 * Copyright (C) 2017, H. U.R. Strand
6 *
7 * TRIQS is free software: you can redistribute it and/or modify it under the
8 * terms of the GNU General Public License as published by the Free Software
9 * Foundation, either version 3 of the License, or (at your option) any later
10 * version.
11 *
12 * TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY
13 * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
14 * FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
15 * details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * TRIQS. If not, see <http://www.gnu.org/licenses/>.
19 *
20 ******************************************************************************/
21
22#include "hubbard_atom.hpp"
23
24using namespace nda::clef;
25
26namespace {
27placeholder<0> iw;
28placeholder<1> w;
29placeholder<2> n1;
30placeholder<3> n2;
31placeholder<4> n;
32
33} // namespace
34
35namespace triqs_tprf {
36
37namespace hubbard_atom {
38
39 typedef std::complex<double> val_t;
40 typedef gf<imfreq, tensor_valued<4>> temp_1d_t;
41 typedef gf<prod<imfreq, imfreq>, tensor_valued<4>> temp_2d_t;
42
43 g_iw_t single_particle_greens_function(int nw, double beta, double U) {
44 g_iw_t g_iw{{beta, Fermion, nw}, {1, 1}};
45 g_iw[iw] << 1./(iw - U*U / (4 * iw) );
46 return g_iw;
47 }
48
49 g2_iw_t chi_ph_magnetic(int nw, int nwf, double beta, double U) {
50
51 auto mb = mesh::imfreq{beta, Boson, nw};
52 auto mf = mesh::imfreq{beta, Fermion, nwf};
53
54 temp_1d_t C{mb, {1, 1, 1, 1}}, D{mb, {1, 1, 1, 1}};
55 temp_2d_t a0{{mb, mf}, {1, 1, 1, 1}}, b0{{mb, mf}, {1, 1, 1, 1}};
56 temp_2d_t b1{{mb, mf}, {1, 1, 1, 1}}, b2{{mb, mf}, {1, 1, 1, 1}};
57 g2_iw_t chi{{mb, mf, mf}, {1, 1, 1, 1}};
58
59 val_t I(0., 1.);
60
61 val_t A = I*U*0.5;
62 val_t B = I*U*0.5 * sqrt( abs(3. - exp(beta*U*0.5)) / (1 + exp(beta*U*0.5)) );
63 C(w) << 0.;
64 C[0] = -beta * U * 0.5 / (1 + exp(-beta * U * 0.5)); // set w=0
65 D(w) << U*U*0.25 * (1. + C(w))/(1. - C(w));
66
67 val_t B0 = 1.;
68 val_t A0 = 1.;
69 val_t B1 = 1.;
70 val_t B2 = I;
71
72 a0(w, n) << A0 * beta*0.5 * (-n*(n+w) - A*A) /
73 ( (-n*n + U*U*0.25) * (-(n+w)*(n+w) + U*U*0.25) );
74
75 b0(w, n) << B0 * beta*0.5 * (-n*(n+w) - B*B) /
76 ( (-n*n + U*U*0.25) * (-(n+w)*(n+w) + U*U*0.25) );
77
78 b1(w, n) << B1 * sqrt(U*(1-C(w))) * (-n*(n+w) - D(w)) /
79 ( (-n*n + U*U*0.25) * (-(n+w)*(n+w) + U*U*0.25) );
80
81 b2(w, n) << B2 * sqrt(U*U*U*0.25) * sqrt(U*U/(1-C(w)) - w*w) /
82 ( (-n*n + U*U*0.25) * (-(n+w)*(n+w) + U*U*0.25) );
83
84 chi(w, n1, n2) << kronecker(n1, n2) * (b0(w, n1) + a0(w, n1))
85 + kronecker(n1, -w - n2) * (b0(w, n1) - a0(w, n1))
86 + b1(w, n1) * b1(w, n2) + b2(w, n1) * b2(w, n2);
87
88 return chi;
89 }
90
91 g2_iw_t gamma_ph_magnetic(int nw, int nwf, double beta, double U) {
92
93 auto mb = mesh::imfreq{beta, Boson, nw};
94 auto mf = mesh::imfreq{beta, Fermion, nwf};
95
96 temp_2d_t a0{{mb, mf}, {1, 1, 1, 1}}, b0{{mb, mf}, {1, 1, 1, 1}};
97 temp_1d_t D{mb, {1, 1, 1, 1}};
98 g2_iw_t gamma{{mb, mf, mf}, {1, 1, 1, 1}};
99
100 val_t I(0., 1.);
101
102 int s = 1; // Sign +1 (d,m); -1 (s,t)
103
104 val_t A = I*U*0.5;
105 // Modified for cplx sqrt
106 val_t B = I*U*0.5 * sqrt( abs(3. - exp(beta*U*0.5)) / (1 + exp(beta*U*0.5)) );
107 //std::cout << "3. - exp(beta*U*0.5) = " << 3. - exp(beta*U*0.5) << "\n";
108
109 val_t B0 = 1.;
110 val_t A0 = 1.;
111 val_t B1 = 1.;
112
113 a0(w, n) << beta*0.5*A*A/A0 *
114 (-n*n+U*U*0.25)*(-(n+s*w)*(n+s*w)+U*U*0.25) /
115 ((-n*(n+s*w)-A*A)*(-n*(n+s*w)));
116
117 b0(w, n) << beta*0.5*B*B/B0 *
118 (-n*n+U*U*0.25)*(-(n+s*w)*(n+s*w)+U*U*0.25) /
119 ((-n*(n+s*w)-B*B)*(-n*(n+s*w)));
120
121 for( auto const & w : mb ) {
122 val_t sqrtBBww = sqrt(4*B*B - w*w);
123 val_t powBBUU1 = std::pow(4.*B*B/(U*U) + 1., 2);
124 val_t UU4 = U*U*0.25;
125
126 // NB! The s factor has an additional sign cf Thunstrom expression
127 D[w] = -U*abs(B1)*abs(B1)/(B0*B0) * UU4*(UU4*powBBUU1 - w*w) /
128 ( U*tan( beta*0.25*(sqrtBBww - I*w) ) / sqrtBBww - s );
129 }
130
131 /*
132 // does not work for the sqrt() calls .. ? FIXME
133 D(w) << -U * abs(B1)*abs(B1) / (B0*B0) *
134 U*U*0.25 * ( U*U*0.25 * std::pow(4*B*B/(U*U) + 1, 2) - w*w) /
135 ( U*tan(beta*0.25 * (sqrt(4*B*B-w*w) - I*w)) / sqrt(4*B*B-w*w) - s );
136 */
137
138 gamma(w, n1, n2) << kronecker(n1, n2) * (b0(w, n1) + a0(w, n1))
139 + kronecker(n1, -w - n2) * (b0(w, n1) - a0(w, n1))
140 + D(w) / (-n1*(n1+s*w) - B*B) / (-n2*(n2+s*w) - B*B)
141 - B1*B1 / (B0*B0) * U;
142
143 gamma(w, n1, n2) << - 1/beta/beta * gamma(w, n1, n2);
144
145 return gamma;
146 }
147
148} // namespace hubbard_atom
149
150} // namespace triqs_tprf