Bridge++  Ver. 1.1.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
quarkNumberSusceptibility_Wilson.cpp
Go to the documentation of this file.
1 
15 
16 //====================================================================
18 {
19  const string str_vlevel = params.get_string("verbose_level");
20 
21  m_vl = vout.set_verbose_level(str_vlevel);
22 
23  //- fetch and check input parameters
24  int Nnoise;
25 
26  int err = 0;
27  err += params.fetch_int("number_of_noises", Nnoise);
28 
29  if (err) {
30  vout.crucial(m_vl, "QuarkNumberSusceptibility_Wilson: fetch error, input parameter not found.\n");
31  abort();
32  }
33 
34 
35  set_parameters(Nnoise);
36 }
37 
38 
39 //====================================================================
41 {
42  //- print input parameters
43  vout.general(m_vl, "QuarkNumberSusceptibility_Wilson parameters:\n");
44  vout.general(m_vl, " Nnoise = %d\n", Nnoise);
45 
46  //- range check
47  int err = 0;
48  err += ParameterCheck::non_negative(Nnoise);
49 
50  if (err) {
51  vout.crucial(m_vl, "QuarkNumberSusceptibility_Wilson: parameter range check failed.\n");
52  abort();
53  }
54 
55  //- store values
56  m_Nnoise = Nnoise;
57 }
58 
59 
60 //====================================================================
62 {
63  // measurement of quark number susceptibility:
64  // tr1 = Tr[D1*Sq]
65  // tr2 = Tr[D2*Sq]
66  // tr3 = Tr[D1*Sq*D1*Sq]
67  // For definition, see the implementation note.
68 
69  vout.general(m_vl, "Quark number susceptibility:");
70  vout.general(m_vl, " Number of noise vector = %d\n", m_Nnoise);
71 
72  int dir_t = CommonParameters::Ndim() - 1;
73 
74  int Nconv;
75  double diff;
76 
77  int Nex = m_fopr->field_nex();
78  int Nvol = m_fopr->field_nvol();
79  int Nin = m_fopr->field_nin();
80 
81  Field xi(Nin, Nvol, Nex);
82  Field v1(Nin, Nvol, Nex), v2(Nin, Nvol, Nex), v3(Nin, Nvol, Nex);
83 
84  dcomplex tr1 = 0.0;
85  dcomplex tr2 = 0.0;
86  dcomplex tr3 = 0.0;
87 
88  for (int inoise = 0; inoise < m_Nnoise; ++inoise) {
89  vout.general(m_vl, " noise vector = %d\n", inoise);
90 
91  m_nv->set(xi);
92  // noise vector was set.
93 
94  m_fprop->invert_D(v3, xi, Nconv, diff);
95  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
96  // now v3 is M^-1 * xi.
97 
98  // mult D_1 and D_2
99  v1 = 0.0;
100  m_fopr->mult_up(dir_t, v1, v3);
101  v2 = 0.0;
102  m_fopr->mult_dn(dir_t, v2, v3);
103 
104  dcomplex tr_c1 = ddotc_complex(xi, v1);
105  dcomplex tr_c2 = ddotc_complex(xi, v2);
106 
107  dcomplex tr1_c = tr_c1 - tr_c2;
108  dcomplex tr2_c = tr_c1 + tr_c2;
109 
110  v3 = v1 - v2;
111  // now v3 is D_1 * M^-1 * xi.
112 
113  v1 = v3;
114  m_fprop->invert_D(v3, v1, Nconv, diff);
115  vout.general(m_vl, " Nconv = %d diff = %.8e\n", Nconv, diff);
116  // now v3 is M^-1 * D_1 * M^-1 * xi.
117 
118  // mult D_1
119  v1 = 0.0;
120  m_fopr->mult_up(dir_t, v1, v3);
121  v2 = 0.0;
122  m_fopr->mult_dn(dir_t, v2, v3);
123  v1 -= v2;
124  // now v1 is D_1 * M^-1 * D_1 * M^-1 * xi.
125 
126  dcomplex tr3_c = ddotc_complex(xi, v1);
127 
128  vout.general(m_vl, " tr1 = (%f,%f)\n", real(tr1_c), imag(tr1_c));
129  vout.general(m_vl, " tr2 = (%f,%f)\n", real(tr2_c), imag(tr2_c));
130  vout.general(m_vl, " tr3 = (%f,%f)\n", real(tr3_c), imag(tr3_c));
131 
132  tr1 += tr1_c;
133  tr2 += tr2_c;
134  tr3 += tr3_c;
135  }
136 
137  tr1 = tr1 / cmplx(double(m_Nnoise), 0.0);
138  tr2 = tr2 / cmplx(double(m_Nnoise), 0.0);
139  tr3 = tr3 / cmplx(double(m_Nnoise), 0.0);
140 
141  vout.general(m_vl, " averaged over noise vector:\n");
142  vout.general(m_vl, " tr1 = (%f,%f)\n", real(tr1), imag(tr1));
143  vout.general(m_vl, " tr2 = (%f,%f)\n", real(tr2), imag(tr2));
144  vout.general(m_vl, " tr3 = (%f,%f)\n", real(tr3), imag(tr3));
145 
146 
147  return real(tr1);
148 }
149 
150 
151 //====================================================================
152 //============================================================END=====