Thermal-FIST  1.3
Package for hadron resonance gas model applications
ThermalModelVDW.cpp
Go to the documentation of this file.
1 /*
2  * Thermal-FIST package
3  *
4  * Copyright (c) 2016-2019 Volodymyr Vovchenko
5  *
6  * GNU General Public License (GPLv3 or later)
7  */
9 
10 #include <vector>
11 #include <cmath>
12 #include <iostream>
13 #include <ctime>
14 #include <iomanip>
15 #include <fstream>
16 #include <sstream>
17 
18 #include "HRGBase/xMath.h"
20 
21 #ifdef USE_OPENMP
22 #include <omp.h>
23 #endif
24 
25 
26 #include <Eigen/Dense>
27 
28 using namespace Eigen;
29 
30 using namespace std;
31 
32 namespace thermalfist {
33 
34  ThermalModelVDW::ThermalModelVDW(ThermalParticleSystem *TPS_, const ThermalModelParameters& params):
35  ThermalModelBase(TPS_, params), m_SearchMultipleSolutions(false), m_TemperatureDependentAB(false)
36  {
37  m_chi.resize(6);
38  for(int i=0;i<6;++i) m_chi[i].resize(3);
39  m_chiarb.resize(6);
40  m_DensitiesId.resize(m_densities.size());
41  m_MuStar.resize(m_densities.size());
42  m_Virial.resize(m_densities.size(), vector<double>(m_densities.size(),0.));
43  m_Attr = m_Virial;
46  m_Volume = params.V;
47  m_TAG = "ThermalModelVDW";
48 
49  m_Ensemble = GCE;
51  }
52 
53 
55  {
56  }
57 
60  for(size_t i = 0; i < m_MuStar.size(); ++i)
61  m_MuStar[i] = m_Chem[i];
62  }
63 
64  void ThermalModelVDW::SetChemicalPotentials(const vector<double>& chem)
65  {
67  for (size_t i = 0; i < m_MuStar.size(); ++i)
68  m_MuStar[i] = m_Chem[i];
69  }
70 
71  void ThermalModelVDW::FillVirial(const vector<double> & ri) {
72  if (ri.size() != m_TPS->Particles().size()) {
73  printf("**WARNING** %s::FillVirial(const vector<double> & ri): size of ri does not match number of hadrons in the list", m_TAG.c_str());
74  return;
75  }
76  m_Virial.resize(m_TPS->Particles().size());
77  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
78  m_Virial[i].resize(m_TPS->Particles().size());
79  for (int j = 0; j < m_TPS->ComponentsNumber(); ++j)
80  m_Virial[i][j] = CuteHRGHelper::brr(ri[i], ri[j]);
81  }
82 
83  // Correct R1=R2 and R2=0
84  vector< vector<double> > fVirialTmp = m_Virial;
85  for(int i=0;i<m_TPS->ComponentsNumber();++i)
86  for(int j=0;j<m_TPS->ComponentsNumber();++j) {
87  if (i==j) m_Virial[i][j] = fVirialTmp[i][j];
88  else if ((fVirialTmp[i][i] + fVirialTmp[j][j]) > 0.0) m_Virial[i][j] = 2. * fVirialTmp[i][j] * fVirialTmp[i][i] / (fVirialTmp[i][i] + fVirialTmp[j][j]);
89  }
90 
91  m_VirialdT = vector< vector<double> >(m_TPS->Particles().size(), vector<double>(m_TPS->Particles().size(),0.));
92  m_AttrdT = vector< vector<double> >(m_TPS->Particles().size(), vector<double>(m_TPS->Particles().size(), 0.));
93  }
94 
95  void ThermalModelVDW::FillVirialEV(const vector< vector<double> >& bij)
96  {
97  if (bij.size() != m_TPS->Particles().size()) {
98  printf("**WARNING** %s::FillVirialEV(const vector<double> & bij): size of bij does not match number of hadrons in the list", m_TAG.c_str());
99  return;
100  }
101  m_Virial = bij;
102  }
103 
104  void ThermalModelVDW::FillAttraction(const vector<vector<double> >& aij)
105  {
106  if (aij.size() != m_TPS->Particles().size()) {
107  printf("**WARNING** %s::FillAttraction(const vector<double> & aij): size of aij does not match number of hadrons in the list", m_TAG.c_str());
108  return;
109  }
110  m_Attr = aij;
111  }
112 
113  void ThermalModelVDW::ReadInteractionParameters(const string & filename)
114  {
115  m_Virial = vector< vector<double> >(m_TPS->Particles().size(), vector<double>(m_TPS->Particles().size(), 0.));
116  m_Attr = vector< vector<double> >(m_TPS->Particles().size(), vector<double>(m_TPS->Particles().size(), 0.));
117 
118  ifstream fin(filename.c_str());
119  char cc[2000];
120  while (!fin.eof()) {
121  fin.getline(cc, 2000);
122  string tmp = string(cc);
123  vector<string> elems = CuteHRGHelper::split(tmp, '#');
124  if (elems.size() < 1)
125  continue;
126  istringstream iss(elems[0]);
127  int pdgid1, pdgid2;
128  double b, a;
129  if (iss >> pdgid1 >> pdgid2 >> b) {
130  if (!(iss >> a))
131  a = 0.;
132  int ind1 = m_TPS->PdgToId(pdgid1);
133  int ind2 = m_TPS->PdgToId(pdgid2);
134  if (ind1 != -1 && ind2 != -1) {
135  m_Virial[ind1][ind2] = b;
136  m_Attr[ind1][ind2] = a;
137  }
138  }
139  }
140  fin.close();
141  }
142 
143  void ThermalModelVDW::WriteInteractionParameters(const string & filename)
144  {
145  ofstream fout(filename.c_str());
146  fout << "# List of the van dar Waals interaction parameters to be used in the QvdW-HRG model"
147  << std::endl;
148  fout << "# Only particle pairs with a non-zero QvdW interaction are listed here"
149  << std::endl;
150  /*fout << "#" << std::setw(14) << "pdg_i"
151  << std::setw(15) << "pdg_j"
152  << std::setw(15) << "b_{ij}[fm^3]"
153  << std::setw(20) << "a_{ij}[GeV*fm^3]"
154  << std::endl;*/
155  fout << "#" << " " << "pdg_i"
156  << " " << "pdg_j"
157  << " " << "b_{ij}[fm^3]"
158  << " " << "a_{ij}[GeV*fm^3]"
159  << std::endl;
160  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
161  for (int j = 0; j < m_TPS->ComponentsNumber(); ++j) {
162  if (m_Virial[i][j] != 0. || m_Attr[i][j] != 0.) {
163  //fout << setw(15) << m_TPS->Particle(i).PdgId();
164  //fout << setw(15) << m_TPS->Particle(j).PdgId();
165  //fout << setw(15) << m_Virial[i][j];
166  //fout << setw(20) << m_Attr[i][j];
167  //fout << endl;
168  fout << " " << m_TPS->Particle(i).PdgId();
169  fout << " " << m_TPS->Particle(j).PdgId();
170  fout << " " << m_Virial[i][j];
171  fout << " " << m_Attr[i][j];
172  fout << endl;
173  }
174  }
175  }
176  fout.close();
177  }
178 
181  m_Virial = vector< vector<double> >(m_TPS->Particles().size(), vector<double>(m_TPS->Particles().size(), 0.));
182  m_Attr = vector< vector<double> >(m_TPS->Particles().size(), vector<double>(m_TPS->Particles().size(), 0.));
183  m_VirialdT = vector< vector<double> >(m_TPS->Particles().size(), vector<double>(m_TPS->Particles().size(), 0.));
184  m_AttrdT = vector< vector<double> >(m_TPS->Particles().size(), vector<double>(m_TPS->Particles().size(), 0.));
185  }
186 
187  std::vector<double> ThermalModelVDW::ComputeNp(const std::vector<double>& dmustar)
188  {
189  vector<double> ns(m_densities.size(), 0.);
190  for (size_t i = 0; i < m_densities.size(); ++i)
192 
193  return ComputeNp(dmustar, ns);
194  }
195 
196  std::vector<double> ThermalModelVDW::ComputeNp(const std::vector<double>& /*dmustar*/, const std::vector<double>& ns)
197  {
198  int NN = m_densities.size();
199  int NNdmu = m_MapFromdMuStar.size();
200 
201  MatrixXd densMatrix(NNdmu, NNdmu);
202  VectorXd solVector(NNdmu), xVector(NNdmu);
203 
204  for (int i = 0; i < NNdmu; ++i) {
205  for (int j = 0; j < NNdmu; ++j) {
206  densMatrix(i, j) = 0.;
207  if (i == j)
208  densMatrix(i, j) += 1.;
209 
210  for (size_t m = 0; m < m_dMuStarIndices[i].size(); ++m) {
211  densMatrix(i, j) += m_Virial[m_MapFromdMuStar[j]][m_dMuStarIndices[i][m]] * ns[m_dMuStarIndices[i][m]];
212  }
213  }
214  }
215 
216  PartialPivLU<MatrixXd> decomp(densMatrix);
217 
218  for (int kp = 0; kp < NNdmu; ++kp) {
219  xVector[kp] = 0.;
220  for (size_t m = 0; m < m_dMuStarIndices[kp].size(); ++m) {
221  xVector[kp] += ns[m_dMuStarIndices[kp][m]];
222  }
223  }
224 
225 
226  solVector = decomp.solve(xVector);
227 
228  vector<double> ntildek(NNdmu, 0.);
229  for (int i = 0; i < NNdmu; ++i)
230  ntildek[i] = solVector[i];
231 
232  vector<double> np(m_densities.size(), 0.);
233  for (int i = 0; i < NN; ++i) {
234  np[i] = 0.;
235  for (int k = 0; k < NNdmu; ++k) {
236  np[i] += m_Virial[m_MapFromdMuStar[k]][i] * solVector[k];
237  }
238  np[i] = (1. - np[i]) * ns[i];
239  }
240 
241  return np;
242  }
243 
244  vector<double> ThermalModelVDW::SearchSingleSolution(const vector<double>& muStarInit)
245  {
246  int NN = m_densities.size();
247  int NNdmu = m_MapFromdMuStar.size();
248 
249  vector<double> dmuscur(NNdmu, 0.);
250  for (int i = 0; i < NNdmu; ++i)
251  dmuscur[i] = muStarInit[m_MapFromdMuStar[i]] - m_Chem[m_MapFromdMuStar[i]];
252 
253  BroydenEquationsVDW eqs(this);
254  BroydenJacobianVDW jac(this);
255  Broyden broydn(&eqs, &jac);
256  BroydenSolutionCriteriumVDW crit(this);
257 
258  dmuscur = broydn.Solve(dmuscur, &crit);
259 
260  if (broydn.Iterations() == broydn.MaxIterations())
261  m_LastBroydenSuccessFlag = false;
262  else m_LastBroydenSuccessFlag = true;
263 
264 
265 
266  m_MaxDiff = broydn.MaxDifference();
267 
268  vector<double> ret(NN);
269  for (int i = 0; i < NN; ++i)
270  ret[i] = m_Chem[i] + dmuscur[m_MapTodMuStar[i]];
271 
272  return ret;
273  }
274 
275  vector<double> ThermalModelVDW::SearchMultipleSolutions(int iters) {
276  vector<double> csol(m_densities.size(), 0.);
277  double Psol = 0.;
278  bool solved = false;
279  double muBmin = m_Parameters.muB - 0.5 * xMath::mnucleon();
280  double muBmax = m_Parameters.muB + 0.5 * xMath::mnucleon();
281  double dmu = (muBmax - muBmin) / iters;
282  vector<double> curmust(m_densities.size(), 0.);
283  double maxdif = 0.;
284  for(int isol = 0; isol < iters; ++isol) {
285  double tmu = muBmin + (0.5 + isol) * dmu;
286  for(size_t j = 0; j < curmust.size(); ++j) {
287  curmust[j] = m_Chem[j] + (tmu - m_Parameters.muB) * m_Chem[j] / m_Parameters.muB;
288  if (m_TPS->Particles()[j].Statistics()==-1 && curmust[j] > m_TPS->Particles()[j].Mass())
289  curmust[j] = 0.98 * m_TPS->Particles()[j].Mass();
290  }
291 
292  vector<double> sol = SearchSingleSolution(curmust);
293  bool fl = true;
294  for(size_t i = 0; i < sol.size(); ++i)
295  if (sol[i] != sol[i]) fl = false;
297  if (!fl) continue;
298 
299  for(int i = 0; i < m_TPS->ComponentsNumber(); ++i)
301 
302  int NN = m_densities.size();
303 
304  MatrixXd densMatrix(NN, NN);
305  VectorXd solVector(NN), xVector(NN);
306 
307  for(int i=0;i<NN;++i)
308  for(int j=0;j<NN;++j) {
309  densMatrix(i,j) = m_Virial[j][i] * m_DensitiesId[i];
310  if (i==j) densMatrix(i,j) += 1.;
311  }
312 
313  PartialPivLU<MatrixXd> decomp(densMatrix);
314 
315  for(int i=0;i<NN;++i)
316  xVector[i] = m_DensitiesId[i];
317  solVector = decomp.solve(xVector);
318  for(int i=0;i<NN;++i)
319  m_densities[i] = solVector[i];
320 
321  double tP = 0.;
322  for(size_t i=0;i<m_densities.size();++i)
323  tP += m_TPS->Particles()[i].Density(m_Parameters, IdealGasFunctions::Pressure, m_UseWidth, sol[i]);
324  for(size_t i=0;i<m_densities.size();++i)
325  for(size_t j=0;j<m_densities.size();++j)
326  tP += -m_Attr[i][j] * m_densities[i] * m_densities[j];
327 
328  if (!solved || tP > Psol) {
329  solved = true;
330  Psol = tP;
331  csol = sol;
332  maxdif = m_MaxDiff;
333  }
334  }
335  m_LastBroydenSuccessFlag = solved;
336  m_MaxDiff = maxdif;
337  return csol;
338  }
339 
342 
343  vector<double> muStarInit = m_MuStar;
344 
345  for(size_t i=0;i<muStarInit.size();++i) {
346  if (m_TPS->Particles()[i].Statistics()==-1 && muStarInit[i] > m_TPS->Particles()[i].Mass())
347  muStarInit[i] = 0.98 * m_TPS->Particles()[i].Mass();
348  }
349 
350  m_MuStar = SearchSingleSolution(muStarInit);
351 
352  }
353  else {
355  }
356  }
357 
359  CalculatePrimordialDensitiesNew();
361  }
362 
363  void ThermalModelVDW::CalculatePrimordialDensitiesOld() {
364  m_FluctuationsCalculated = false;
365 
366  map< vector<double> , int> m_MapVDW;
367 
368  int NN = m_densities.size();
369 
370  {
371  m_MapTodMuStar.resize(NN);
372  m_MapFromdMuStar.clear();
373  m_MapVDW.clear();
374  m_dMuStarIndices.clear();
375 
376  int tind = 0;
377  for (int i = 0; i < NN; ++i) {
378  vector<double> VDWParam(0);
379  for (int j = 0; j < NN; ++j) {
380  VDWParam.push_back(m_Virial[i][j]);
381  }
382  for (int j = 0; j < NN; ++j) {
383  VDWParam.push_back(m_Attr[i][j] + m_Attr[j][i]);
384  }
385 
386  if (m_MapVDW.count(VDWParam) == 0) {
387  m_MapVDW[VDWParam] = tind;
388  m_MapTodMuStar[i] = tind;
389  m_MapFromdMuStar.push_back(i);
390  m_dMuStarIndices.push_back(vector<int>(1, i));
391  tind++;
392  }
393  else {
394  m_MapTodMuStar[i] = m_MapVDW[VDWParam];
395  m_dMuStarIndices[m_MapVDW[VDWParam]].push_back(i);
396  }
397  }
398 
399  printf("Optimization: %d --> %d\n", NN, static_cast<int>(m_MapFromdMuStar.size()));
400  }
401 
402  clock_t tbeg = clock();
403 
404  {
405 
406  vector<double> muStarInit = m_MuStar;
407 
408  for (size_t i = 0; i<muStarInit.size(); ++i) {
409  if (m_TPS->Particles()[i].Statistics() == -1 && muStarInit[i] > m_TPS->Particles()[i].Mass())
410  muStarInit[i] = 0.98 * m_TPS->Particles()[i].Mass();
411  }
412 
413 
414  m_MuStar = SearchSingleSolution(muStarInit);
415  }
416 
417 
418  printf("Solution time = %lf ms\n", (clock() - tbeg) / (double)(CLOCKS_PER_SEC) * 1.e3);
419 
420  tbeg = clock();
421 
422  for(int i=0;i<m_TPS->ComponentsNumber();++i)
424 
425  MatrixXd densMatrix(NN, NN);
426  VectorXd solVector(NN), xVector(NN);
427 
428  for(int i=0;i<NN;++i)
429  for(int j=0;j<NN;++j) {
430  densMatrix(i,j) = m_Virial[j][i] * m_DensitiesId[i];
431  if (i==j) densMatrix(i,j) += 1.;
432  }
433 
434  PartialPivLU<MatrixXd> decomp(densMatrix);
435 
436  for(int i=0;i<NN;++i) xVector[i] = m_DensitiesId[i];
437  solVector = decomp.solve(xVector);
438  for(int i=0;i<NN;++i) m_densities[i] = solVector[i];
439 
440  // TODO: Scalar density properly
441  for(int i=0;i<NN;++i) xVector[i] = m_TPS->Particles()[i].Density(m_Parameters, IdealGasFunctions::ScalarDensity, m_UseWidth, m_MuStar[i]);
442  solVector = decomp.solve(xVector);
443  m_scaldens.resize(m_densities.size());
444  for(int i=0;i<NN;++i) m_scaldens[i] = solVector[i];
445 
446 
447  tbeg = clock();
448 
449  m_Calculated = true;
450  }
451 
452  void ThermalModelVDW::CalculatePrimordialDensitiesNew() {
453  m_FluctuationsCalculated = false;
454 
455  map< vector<double>, int> m_MapVDW;
456 
457  int NN = m_densities.size();
458 
459  {
460  m_MapTodMuStar.resize(NN);
461  m_MapFromdMuStar.clear();
462  m_MapVDW.clear();
463  m_dMuStarIndices.clear();
464 
465  int tind = 0;
466  for (int i = 0; i < NN; ++i) {
467  vector<double> VDWParam(0);
468  for (int j = 0; j < NN; ++j) {
469  VDWParam.push_back(m_Virial[i][j]);
470  }
471  for (int j = 0; j < NN; ++j) {
472  VDWParam.push_back(m_Attr[i][j] + m_Attr[j][i]);
473  }
474 
475  if (m_MapVDW.count(VDWParam) == 0) {
476  m_MapVDW[VDWParam] = tind;
477  m_MapTodMuStar[i] = tind;
478  m_MapFromdMuStar.push_back(i);
479  m_dMuStarIndices.push_back(vector<int>(1, i));
480  tind++;
481  }
482  else {
483  m_MapTodMuStar[i] = m_MapVDW[VDWParam];
484  m_dMuStarIndices[m_MapVDW[VDWParam]].push_back(i);
485  }
486  }
487  }
488 
489  clock_t tbeg = clock();
490 
491  SolveEquations();
492 
493  tbeg = clock();
494 
495  for (int i = 0; i < m_TPS->ComponentsNumber(); ++i)
497 
498 
499  int NNdmu = m_MapFromdMuStar.size();
500 
501  MatrixXd densMatrix(NNdmu, NNdmu);
502  VectorXd solVector(NNdmu), xVector(NNdmu);
503 
504  for (int i = 0; i < NNdmu; ++i) {
505  for (int j = 0; j < NNdmu; ++j) {
506  densMatrix(i, j) = 0.;
507  if (i == j)
508  densMatrix(i, j) += 1.;
509 
510  for (size_t m = 0; m < m_dMuStarIndices[i].size(); ++m) {
511  densMatrix(i, j) += m_Virial[m_MapFromdMuStar[j]][m_dMuStarIndices[i][m]] * m_DensitiesId[m_dMuStarIndices[i][m]];
512  }
513  }
514  }
515 
516  PartialPivLU<MatrixXd> decomp(densMatrix);
517 
518  for (int kp = 0; kp < NNdmu; ++kp) {
519  xVector[kp] = 0.;
520  for (size_t m = 0; m < m_dMuStarIndices[kp].size(); ++m) {
521  xVector[kp] += m_DensitiesId[m_dMuStarIndices[kp][m]];
522  }
523  }
524 
525  solVector = decomp.solve(xVector);
526 
527  vector<double> ntildek(NNdmu, 0.);
528  for (int i = 0; i < NNdmu; ++i)
529  ntildek[i] = solVector[i];
530 
531  //vector<double> np(m_densities.size(), 0.);
532  for (int i = 0; i < NN; ++i) {
533  m_densities[i] = 0.;
534  for (int k = 0; k < NNdmu; ++k) {
535  m_densities[i] += m_Virial[m_MapFromdMuStar[k]][i] * solVector[k];
536  }
537  m_densities[i] = (1. - m_densities[i]) * m_DensitiesId[i];
538  }
539 
540  // TODO: Scalar density properly
542 
543  m_Calculated = true;
544  }
545 
546  vector<double> ThermalModelVDW::CalculateChargeFluctuations(const vector<double> &chgs, int order) {
547  vector<double> ret(order + 1, 0.);
548 
549  // chi1
550  for(size_t i=0;i<m_densities.size();++i)
551  ret[0] += chgs[i] * m_densities[i];
552 
553  ret[0] /= pow(m_Parameters.T * xMath::GeVtoifm(), 3);
554 
555  if (order<2) return ret;
556  // Preparing matrix for system of linear equations
557  int NN = m_densities.size();
558  MatrixXd densMatrix(2*NN, 2*NN);
559  VectorXd solVector(2*NN), xVector(2*NN);
560 
561  vector<double> chi2id(m_densities.size());
562  for(int i=0;i<NN;++i)
563  chi2id[i] = m_TPS->Particles()[i].chi(2, m_Parameters, m_UseWidth, m_MuStar[i]);
564 
565  for(int i=0;i<NN;++i)
566  for(int j=0;j<NN;++j) {
567  densMatrix(i,j) = m_Virial[j][i] * m_DensitiesId[i];
568  if (i==j) densMatrix(i,j) += 1.;
569  }
570 
571  for(int i=0;i<NN;++i)
572  for(int j=0;j<NN;++j)
573  densMatrix(i,NN+j) = 0.;
574 
575  for(int i=0;i<NN;++i) {
576  densMatrix(i,NN+i) = 0.;
577  for(int k=0;k<NN;++k) {
578  densMatrix(i,NN+i) += m_Virial[k][i] * m_densities[k];
579  }
580  densMatrix(i,NN+i) = (densMatrix(i,NN+i) - 1.) * chi2id[i] * pow(xMath::GeVtoifm(), 3) * m_Parameters.T * m_Parameters.T;
581  }
582 
583  for(int i=0;i<NN;++i)
584  for(int j=0;j<NN;++j) {
585  densMatrix(NN+i,j) = -(m_Attr[i][j] + m_Attr[j][i]);
586  }
587 
588  for(int i=0;i<NN;++i)
589  for(int j=0;j<NN;++j) {
590  densMatrix(NN+i,NN+j) = m_Virial[i][j] * m_DensitiesId[j];
591  if (i==j) densMatrix(NN+i,NN+j) += 1.;
592  }
593 
594 
595  PartialPivLU<MatrixXd> decomp(densMatrix);
596 
597  // chi2
598  vector<double> dni(NN, 0.), dmus(NN, 0.);
599 
600  for(int i=0;i<NN;++i) {
601  xVector[i] = 0.;
602  xVector[NN+i] = chgs[i];
603  }
604 
605  solVector = decomp.solve(xVector);
606 
607  for(int i=0;i<NN;++i) {
608  dni[i] = solVector[i];
609  dmus[i] = solVector[NN+i];
610  }
611 
612  for(int i=0;i<NN;++i)
613  ret[1] += chgs[i] * dni[i];
614 
615  ret[1] /= pow(m_Parameters.T, 2) * pow(xMath::GeVtoifm(), 3);
616 
617  if (order<3) return ret;
618 
619  // chi3
620  vector<double> d2ni(NN, 0.), d2mus(NN, 0.);
621 
622  vector<double> chi3id(m_densities.size());
623  for(int i=0;i<NN;++i)
624  chi3id[i] = m_TPS->Particles()[i].chi(3, m_Parameters, m_UseWidth, m_MuStar[i]);
625 
626  for(int i=0;i<NN;++i) {
627  xVector[i] = 0.;
628 
629  double tmp = 0.;
630  for(int j=0;j<NN;++j) tmp += m_Virial[j][i] * dni[j];
631  tmp = -2. * tmp * chi2id[i] * pow(xMath::GeVtoifm(), 3) * m_Parameters.T * m_Parameters.T * dmus[i];
632  xVector[i] += tmp;
633 
634  tmp = 0.;
635  for(int j=0;j<NN;++j) tmp += m_Virial[j][i] * m_densities[j];
636  tmp = -(tmp - 1.) * chi3id[i] * pow(xMath::GeVtoifm(), 3) * m_Parameters.T * dmus[i] * dmus[i];
637  xVector[i] += tmp;
638  }
639  for(int i=0;i<NN;++i) {
640  xVector[NN+i] = 0.;
641 
642  double tmp = 0.;
643  for(int j=0;j<NN;++j) tmp += -m_Virial[i][j] * dmus[j] * chi2id[j] * pow(xMath::GeVtoifm(), 3) * m_Parameters.T * m_Parameters.T * dmus[j];
644 
645  xVector[NN+i] = tmp;
646  }
647 
648  solVector = decomp.solve(xVector);
649 
650  for(int i=0;i<NN;++i) {
651  d2ni[i] = solVector[i];
652  d2mus[i] = solVector[NN+i];
653  }
654 
655  for(int i=0;i<NN;++i)
656  ret[2] += chgs[i] * d2ni[i];
657 
658  ret[2] /= m_Parameters.T * pow(xMath::GeVtoifm(), 3);
659 
660 
661  if (order<4) return ret;
662 
663  // chi4
664  vector<double> d3ni(NN, 0.), d3mus(NN, 0.);
665 
666  vector<double> chi4id(m_densities.size());
667  for (int i = 0; i < NN; ++i)
668  chi4id[i] = m_TPS->Particles()[i].chi(4, m_Parameters, m_UseWidth, m_MuStar[i]);
669 
670  vector<double> dnis(NN, 0.);
671  for(int i=0;i<NN;++i) {
672  dnis[i] = chi2id[i] * pow(xMath::GeVtoifm(), 3) * m_Parameters.T * m_Parameters.T * dmus[i];
673  }
674 
675  vector<double> d2nis(NN, 0.);
676  for(int i=0;i<NN;++i) {
677  d2nis[i] = chi3id[i] * pow(xMath::GeVtoifm(), 3) * m_Parameters.T * dmus[i] * dmus[i] +
678  chi2id[i] * pow(xMath::GeVtoifm(), 3) * m_Parameters.T * m_Parameters.T * d2mus[i];
679  }
680 
681  for(int i=0;i<NN;++i) {
682  xVector[i] = 0.;
683 
684  double tmp = 0.;
685  for(int j=0;j<NN;++j) tmp += m_Virial[j][i] * dni[j];
686  tmp = -3. * tmp * d2nis[i];
687  xVector[i] += tmp;
688 
689  tmp = 0.;
690  for(int j=0;j<NN;++j) tmp += m_Virial[j][i] * d2ni[j];
691  tmp = -3. * tmp * dnis[i];
692  xVector[i] += tmp;
693 
694  double tmps = 0.;
695  for(int j=0;j<NN;++j) tmps += m_Virial[j][i] * m_densities[j];
696 
697  tmp = -(tmps - 1.) * chi3id[i] * pow(xMath::GeVtoifm(), 3) * m_Parameters.T * d2mus[i] * 3. * dmus[i];
698  xVector[i] += tmp;
699 
700  tmp = -(tmps - 1.) * chi4id[i] * pow(xMath::GeVtoifm(), 3) * dmus[i] * dmus[i] * dmus[i];
701  xVector[i] += tmp;
702  }
703  for(int i=0;i<NN;++i) {
704  xVector[NN+i] = 0.;
705 
706  double tmp = 0.;
707  for(int j=0;j<NN;++j) tmp += -2. * m_Virial[i][j] * d2mus[j] * dnis[j];
708  xVector[NN+i] += tmp;
709 
710  tmp = 0.;
711  for(int j=0;j<NN;++j) tmp += -m_Virial[i][j] * dmus[j] * d2nis[j];
712  xVector[NN+i] += tmp;
713  }
714 
715  solVector = decomp.solve(xVector);
716 
717  for(int i=0;i<NN;++i) {
718  d3ni[i] = solVector[i];
719  d3mus[i] = solVector[NN+i];
720  }
721 
722  for(int i=0;i<NN;++i)
723  ret[3] += chgs[i] * d3ni[i];
724 
725  ret[3] /= pow(xMath::GeVtoifm(), 3);
726 
727  return ret;
728  }
729 
730  // TODO include correlations
731  vector< vector<double> > ThermalModelVDW::CalculateFluctuations(int order) {
732  if (order<1) return m_chi;
733 
734  vector<double> chgs(m_densities.size());
735  vector<double> chis;
736 
737  // Baryon charge
738  for(size_t i=0;i<chgs.size();++i)
739  chgs[i] = m_TPS->Particles()[i].BaryonCharge();
740  chis = CalculateChargeFluctuations(chgs, order);
741  for(int i=0;i<order;++i) m_chi[i][0] = chis[i];
742 
743  // Electric charge
744  for(size_t i=0;i<chgs.size();++i)
745  chgs[i] = m_TPS->Particles()[i].ElectricCharge();
746  chis = CalculateChargeFluctuations(chgs, order);
747  for(int i=0;i<order;++i) m_chi[i][1] = chis[i];
748 
749  // Strangeness charge
750  for(size_t i=0;i<chgs.size();++i)
751  chgs[i] = m_TPS->Particles()[i].Strangeness();
752  chis = CalculateChargeFluctuations(chgs, order);
753  for(int i=0;i<order;++i) m_chi[i][2] = chis[i];
754 
755  // Arbitrary charge
756  for(size_t i=0;i<chgs.size();++i)
757  chgs[i] = m_TPS->Particles()[i].ArbitraryCharge();
758  chis = CalculateChargeFluctuations(chgs, order);
759  for(int i=0;i<order;++i) m_chiarb[i] = chis[i];
760 
761  return m_chi;
762  }
763 
765  {
766  int NN = m_densities.size();
767 
768  m_PrimCorrel.resize(NN);
769  for (int i = 0; i < NN; ++i)
770  m_PrimCorrel[i].resize(NN);
772 
773  MatrixXd densMatrix(2 * NN, 2 * NN);
774  VectorXd solVector(2 * NN), xVector(2 * NN);
775 
776  vector<double> chi2id(m_densities.size());
777  for (int i = 0; i<NN; ++i)
778  chi2id[i] = m_TPS->Particles()[i].chi(2, m_Parameters, m_UseWidth, m_MuStar[i]);
779 
780  for (int i = 0; i<NN; ++i)
781  for (int j = 0; j<NN; ++j) {
782  densMatrix(i, j) = m_Virial[j][i] * m_DensitiesId[i];
783  if (i == j) densMatrix(i, j) += 1.;
784  }
785 
786  for (int i = 0; i<NN; ++i)
787  for (int j = 0; j<NN; ++j)
788  densMatrix(i, NN + j) = 0.;
789 
790  for (int i = 0; i<NN; ++i) {
791  densMatrix(i, NN + i) = 0.;
792  for (int k = 0; k<NN; ++k) {
793  densMatrix(i, NN + i) += m_Virial[k][i] * m_densities[k];
794  }
795  densMatrix(i, NN + i) = (densMatrix(i, NN + i) - 1.) * chi2id[i] * pow(xMath::GeVtoifm(), 3) * m_Parameters.T * m_Parameters.T;
796  }
797 
798  for (int i = 0; i<NN; ++i)
799  for (int j = 0; j<NN; ++j) {
800  densMatrix(NN + i, j) = -(m_Attr[i][j] + m_Attr[j][i]);
801  }
802 
803  for (int i = 0; i<NN; ++i)
804  for (int j = 0; j<NN; ++j) {
805  densMatrix(NN + i, NN + j) = m_Virial[i][j] * m_DensitiesId[j];
806  if (i == j) densMatrix(NN + i, NN + j) += 1.;
807  }
808 
809  PartialPivLU<MatrixXd> decomp(densMatrix);
810 
811  for (int k = 0; k < NN; ++k) {
812  vector<double> dni(NN, 0.), dmus(NN, 0.);
813 
814  for (int i = 0; i < NN; ++i) {
815  xVector[i] = 0.;
816  xVector[NN + i] = static_cast<int>(i == k);
817  }
818 
819  solVector = decomp.solve(xVector);
820 
821  for (int i = 0; i < NN; ++i) {
822  dni[i] = solVector[i];
823  dmus[i] = solVector[NN + i];
824  }
825 
826  for (int j = 0; j < NN; ++j) {
827  m_PrimCorrel[j][k] = dni[j];
828  }
829  }
830 
831  for (int i = 0; i < NN; ++i) {
832  m_wprim[i] = m_PrimCorrel[i][i];
833  if (m_densities[i] > 0.) m_wprim[i] *= m_Parameters.T / m_densities[i];
834  else m_wprim[i] = 1.;
835  }
836 
837  }
838 
840  {
846 
847  for (size_t i = 0; i < m_wprim.size(); ++i) {
848  m_skewprim[i] = 1.;
849  m_kurtprim[i] = 1.;
850  m_skewtot[i] = 1.;
851  m_kurttot[i] = 1.;
852  }
853 
855  }
856 
857 
860  double ret = 0.;
861  for(size_t i=0;i<m_densities.size();++i)
862  if (m_densities[i]>0.)
864  for(size_t i=0;i<m_densities.size();++i)
865  for(size_t j=0;j<m_densities.size();++j)
866  ret += -m_Attr[i][j] * m_densities[i] * m_densities[j];
867 
869  for (size_t i = 0; i < m_densities.size(); ++i) {
870  double tPid = m_TPS->Particles()[i].Density(m_Parameters, IdealGasFunctions::Pressure, m_UseWidth, m_MuStar[i]);
871  for (size_t j = 0; j < m_densities.size(); ++j) {
872  ret += -tPid * m_densities[j] * m_Parameters.T * m_VirialdT[j][i];
873  ret += m_Parameters.T * m_AttrdT[i][j] * m_densities[i] * m_densities[j];
874  }
875  }
876  }
877 
878  return ret;
879  }
880 
883  double ret = 0.;
884  for(size_t i=0;i<m_densities.size();++i)
885  if (m_densities[i]>0.)
887 
889  for (size_t i = 0; i < m_densities.size(); ++i) {
890  double tPid = m_TPS->Particles()[i].Density(m_Parameters, IdealGasFunctions::Pressure, m_UseWidth, m_MuStar[i]);
891  for (size_t j = 0; j < m_densities.size(); ++j) {
892  ret += -tPid * m_densities[j] * m_VirialdT[j][i];
893  ret += m_AttrdT[i][j] * m_densities[i] * m_densities[j];
894  }
895  }
896  }
897 
898  return ret;
899  }
900 
903  double ret = 0.;
904  for(size_t i=0;i<m_densities.size();++i)
906  for(size_t i=0;i<m_densities.size();++i)
907  for(size_t j=0;j<m_densities.size();++j)
908  ret += -m_Attr[i][j] * m_densities[i] * m_densities[j];
909  return ret;
910  }
911 
912 
915 
916  return m_scaldens[part];
917  }
918 
919  double ThermalModelVDW::MuShift(int id) const
920  {
921  if (id >= 0. && id < static_cast<int>(m_Virial.size()))
922  return m_MuStar[id] - m_Chem[id];
923  else
924  return 0.0;
925  }
926 
927  double ThermalModelVDW::VirialCoefficient(int i, int j) const
928  {
929  if (i<0 || i >= static_cast<int>(m_Virial.size()) || j < 0 || j >= static_cast<int>(m_Virial.size()))
930  return 0.;
931  return m_Virial[i][j];
932  }
933 
934  double ThermalModelVDW::AttractionCoefficient(int i, int j) const
935  {
936  if (i<0 || i >= static_cast<int>(m_Attr.size()) || j < 0 || j >= static_cast<int>(m_Attr.size()))
937  return 0.;
938  return m_Attr[i][j];
939  }
940 
941  double ThermalModelVDW::VirialCoefficientdT(int i, int j) const
942  {
943  if (i<0 || i >= static_cast<int>(m_VirialdT.size()) || j < 0 || j >= static_cast<int>(m_VirialdT.size()))
944  return 0.;
945  return m_VirialdT[i][j];
946  }
947 
948  double ThermalModelVDW::AttractionCoefficientdT(int i, int j) const
949  {
950  if (i<0 || i >= static_cast<int>(m_AttrdT.size()) || j < 0 || j >= static_cast<int>(m_AttrdT.size()))
951  return 0.;
952  return m_AttrdT[i][j];
953  }
954 
955  std::vector<double> ThermalModelVDW::BroydenEquationsVDW::Equations(const std::vector<double>& x)
956  {
957  int NN = m_THM->Densities().size();
958  vector<double> Ps(NN, 0.);
959  for (int i = 0; i < NN; ++i) {
960  Ps[i] = m_THM->TPS()->Particles()[i].Density(m_THM->Parameters(),
962  m_THM->UseWidth(),
963  m_THM->ChemicalPotential(i) + x[m_THM->m_MapTodMuStar[i]]
964  );
965  }
966 
967  vector<double> ns(NN, 0.);
968  for (int i = 0; i < NN; ++i) {
969  ns[i] = m_THM->TPS()->Particles()[i].Density(m_THM->Parameters(),
971  m_THM->UseWidth(),
972  m_THM->ChemicalPotential(i) + x[m_THM->m_MapTodMuStar[i]]
973  );
974  }
975 
976  vector<double> np = m_THM->ComputeNp(x, ns);
977 
978 
979  vector<double> ret(m_N, 0.);
980  for (size_t i = 0; i < ret.size(); ++i) {
981  ret[i] = x[i];
982  for (int j = 0; j < NN; ++j)
983  ret[i] += m_THM->VirialCoefficient(m_THM->m_MapFromdMuStar[i], j) * Ps[j]
984  - (m_THM->AttractionCoefficient(m_THM->m_MapFromdMuStar[i], j)
985  + m_THM->AttractionCoefficient(j, m_THM->m_MapFromdMuStar[i])) * np[j];
986  }
987  return ret;
988  }
989 
990  std::vector<double> ThermalModelVDW::BroydenJacobianVDW::Jacobian(const std::vector<double>& x)
991  {
992  int NN = m_THM->m_densities.size();
993  int NNdmu = m_THM->m_MapFromdMuStar.size();
994 
995  bool attrfl = false;
996  for (int i = 0; i < NN; ++i) {
997  for (int j = 0; j < NN; ++j) {
998  if (m_THM->AttractionCoefficient(i, j) != 0.0) {
999  attrfl = true;
1000  break;
1001  }
1002  }
1003  if (attrfl) break;
1004  }
1005 
1006  MatrixXd densMatrix(NNdmu, NNdmu);
1007  VectorXd solVector(NNdmu), xVector(NNdmu);
1008 
1009  std::vector<double> ret(NNdmu*NNdmu, 0.);
1010  {
1011  vector<double> Ps(NN, 0.);
1012  for (int i = 0; i<NN; ++i)
1013  Ps[i] = m_THM->TPS()->Particles()[i].Density(m_THM->Parameters(),
1015  m_THM->UseWidth(),
1016  m_THM->ChemicalPotential(i) + x[m_THM->m_MapTodMuStar[i]]
1017  );
1018 
1019  vector<double> ns(NN, 0.);
1020  for (int i = 0; i<NN; ++i)
1021  ns[i] = m_THM->TPS()->Particles()[i].Density(m_THM->Parameters(),
1023  m_THM->UseWidth(),
1024  m_THM->ChemicalPotential(i) + x[m_THM->m_MapTodMuStar[i]]
1025  );
1026 
1027  vector<double> chi2s(NN, 0.);
1028  for (int i = 0; i<NN; ++i)
1029  chi2s[i] = m_THM->TPS()->Particles()[i].chi(2, m_THM->Parameters(),
1030  m_THM->UseWidth(),
1031  m_THM->ChemicalPotential(i) + x[m_THM->m_MapTodMuStar[i]]
1032  );
1033 
1034  for (int i = 0; i < NNdmu; ++i) {
1035  for (int j = 0; j < NNdmu; ++j) {
1036  densMatrix(i, j) = 0.;
1037  if (i == j)
1038  densMatrix(i, j) += 1.;
1039 
1040  for (size_t m = 0; m < m_THM->m_dMuStarIndices[i].size(); ++m) {
1041  densMatrix(i, j) += m_THM->m_Virial[m_THM->m_MapFromdMuStar[j]][m_THM->m_dMuStarIndices[i][m]] * ns[m_THM->m_dMuStarIndices[i][m]];
1042  }
1043  }
1044  }
1045 
1046  PartialPivLU<MatrixXd> decomp(densMatrix);
1047 
1048 
1049  for (int kp = 0; kp < NNdmu; ++kp) {
1050  xVector[kp] = 0.;
1051  for (size_t m = 0; m < m_THM->m_dMuStarIndices[kp].size(); ++m) {
1052  xVector[kp] += ns[m_THM->m_dMuStarIndices[kp][m]];
1053  }
1054  }
1055 
1056 
1057  solVector = decomp.solve(xVector);
1058 
1059  vector<double> ntildek(NNdmu, 0.);
1060  for (int i = 0; i < NNdmu; ++i)
1061  ntildek[i] = solVector[i];
1062 
1063  vector<double> np(NN, 0.);
1064  for (int i = 0; i < NN; ++i) {
1065  np[i] = 0.;
1066  for (int k = 0; k < NNdmu; ++k) {
1067  np[i] += m_THM->m_Virial[m_THM->m_MapFromdMuStar[k]][i] * solVector[k];
1068  }
1069  np[i] = (1. - np[i]) * ns[i];
1070  }
1071 
1072  for (int kp = 0; kp < NNdmu; ++kp) {
1073 
1074  if (attrfl) {
1075  for (int l = 0; l < NNdmu; ++l) {
1076  xVector[l] = 0.;
1077  for (size_t m = 0; m < m_THM->m_dMuStarIndices[l].size(); ++m) {
1078  int ti = m_THM->m_dMuStarIndices[l][m];
1079  if (m_THM->m_MapTodMuStar[ti] != kp)
1080  continue;
1081 
1082  double tmps = 1.;
1083  if (ns[ti] != 0.)
1084  tmps = np[ti] / ns[ti];
1085  xVector[l] += chi2s[ti] * m_THM->m_Parameters.T * m_THM->m_Parameters.T * pow(xMath::GeVtoifm(), 3) * tmps;
1086  }
1087  }
1088 
1089  solVector = decomp.solve(xVector);
1090  for (int i = 0; i < NNdmu; ++i)
1091  if (solVector[i] > 1.) solVector[i] = 1.; // Stabilizer
1092  }
1093 
1094  vector<double> dnjdmukp(NN, 0.);
1095  if (attrfl) {
1096  for (int j = 0; j < NN; ++j) {
1097  for (int kk = 0; kk < NNdmu; ++kk) {
1098  dnjdmukp[j] += -m_THM->m_Virial[m_THM->m_MapFromdMuStar[kk]][j] * solVector[kk] * ns[j];
1099  }
1100 
1101  if (m_THM->m_MapTodMuStar[j] == kp) {
1102  double tmps = 1.;
1103  if (ns[j] != 0.)
1104  tmps = np[j] / ns[j];
1105  dnjdmukp[j] += tmps * chi2s[j] * m_THM->m_Parameters.T * m_THM->m_Parameters.T * pow(xMath::GeVtoifm(), 3);
1106  }
1107  }
1108  }
1109 
1110 
1111  for (int k = 0; k < NNdmu; ++k) {
1112  if (k == kp)
1113  ret[k*NNdmu + kp] += 1.;
1114  for (size_t m = 0; m < m_THM->m_dMuStarIndices[kp].size(); ++m) {
1115  int tj = m_THM->m_dMuStarIndices[kp][m];
1116  ret[k*NNdmu + kp] += m_THM->m_Virial[m_THM->m_MapFromdMuStar[k]][tj] * ns[tj];
1117  }
1118 
1119  if (attrfl) {
1120  for (int j = 0; j < NN; ++j) {
1121  ret[k*NNdmu + kp] += -(m_THM->m_Attr[m_THM->m_MapFromdMuStar[k]][j] + m_THM->m_Attr[j][m_THM->m_MapFromdMuStar[k]]) * dnjdmukp[j];
1122  }
1123  }
1124  }
1125 
1126  }
1127  }
1128 
1129  return ret;
1130  }
1131 
1132  bool ThermalModelVDW::BroydenSolutionCriteriumVDW::IsSolved(const std::vector<double>& x, const std::vector<double>& f, const std::vector<double>& xdelta) const
1133  {
1134  if (xdelta.size() == x.size()) {
1135  double maxdiff = 0.;
1136  for (size_t i = 0; i < xdelta.size(); ++i) {
1137  maxdiff = std::max(maxdiff, fabs(xdelta[i]));
1138  }
1139  return (maxdiff < m_MaximumError);
1140  }
1141  else {
1142  return Broyden::BroydenSolutionCriterium::IsSolved(x, f, xdelta);
1143  }
1144  }
1145 
1146 } // namespace thermalfist
Abstract base class for an HRG model implementation.
std::vector< int > m_MapTodMuStar
virtual void CalculateTwoParticleFluctuationsDecays()
Computes particle number correlations and fluctuations for all final-state particles which are marked...
std::vector< std::string > split(const std::string &s, char delim)
std::vector< double > m_Chem
Quantum van der Waals model.
void CalculateFluctuations()
Computes the fluctuation observables.
virtual void ChangeTPS(ThermalParticleSystem *TPS)
Change the particle list.
Class implementing the Broyden method to solve a system of non-linear equations.
Definition: Broyden.h:131
virtual void SetChemicalPotentials(const std::vector< double > &chem=std::vector< double >(0))
Sets the chemical potentials of all particles.
double GeVtoifm()
A constant to transform GeV into fm .
Definition: xMath.h:27
std::vector< double > SearchMultipleSolutions(int iters=300)
Uses the Broyden method with different initial guesses to look for different possible solutions of th...
std::vector< double > m_kurttot
std::vector< double > m_wprim
std::vector< double > m_scaldens
Vector of scalar densities. Not used.
const ThermalParticle & Particle(int id) const
ThermalParticle object corresponding to particle species with a provided 0-based index.
std::vector< double > m_skewprim
void FillChemicalPotentials()
Sets the chemical potentials of all particles.
void FillVirialEV(const std::vector< std::vector< double > > &bij=std::vector< std::vector< double > >(0))
Same as FillVirial() but uses the matrix of excluded-volume coefficients as input instead of radii...
int PdgToId(long long pdgid)
Transforms PDG ID to a 0-based particle id number.
double VirialCoefficient(int i, int j) const
Excluded volume coefficient .
virtual void ReadInteractionParameters(const std::string &filename)
Reads the QvdW interaction parameters from a file.
long long PdgId() const
Particle&#39;s Particle Data Group (PDG) ID number.
Class containing the particle list.
virtual std::vector< double > SearchSingleSolution(const std::vector< double > &muStarInit)
Uses the Broyden method with a provided initial guess to determine the shifted chemical potentials by...
Grand canonical ensemble.
std::vector< std::vector< int > > m_dMuStarIndices
ThermalModelParameters m_Parameters
Structure containing all thermal parameters of the model.
double AttractionCoefficient(int i, int j) const
QvdW mean field attraction coefficient .
double VirialCoefficientdT(int i, int j) const
The temperature derivative of the eigenvolume parameter .
std::vector< std::vector< double > > m_Attr
Matrix of the attractive QvdW coefficients .
int ComponentsNumber() const
Number of different particle species in the list.
virtual double MuShift(int id) const
The shift in the chemical potential of particle species i due to the QvdW interactions.
virtual ~ThermalModelVDW(void)
Destroy the ThermalModelVDW object.
std::vector< std::vector< double > > m_VirialdT
void FillVirial(const std::vector< double > &ri=std::vector< double >(0))
Fills the excluded volume coefficients based on the provided radii parameters for all species...
virtual void CalculateSusceptibilityMatrix()
Calculates the conserved charges susceptibility matrix.
Contains some extra mathematical functions used in the code.
ThermalParticleSystem * m_TPS
std::vector< int > m_MapFromdMuStar
virtual void FillChemicalPotentials()
Sets the chemical potentials of all particles.
int MaxIterations() const
Definition: Broyden.h:234
virtual void CalculateProxySusceptibilityMatrix()
Calculates the susceptibility matrix of conserved charges proxies.
virtual std::vector< double > Solve(const std::vector< double > &x0, BroydenSolutionCriterium *solcrit=NULL, int max_iterations=MAX_ITERS)
Definition: Broyden.cpp:77
double brr(double r1, double r2)
Computes the symmetric 2nd virial coefficient of the classical hard spheres equation of state from t...
std::vector< double > m_kurtprim
const std::vector< ThermalParticle > & Particles() const
Returns the vector of all particle species.
std::vector< std::vector< double > > m_TotalCorrel
std::vector< double > ComputeNp(const std::vector< double > &dmustar)
ThermalModelInteraction m_InteractionModel
virtual void ValidateCalculation()
Checks whether issues have occured during the calculation of particle densities in the CalculateDensi...
Contains some functions do deal with excluded volumes.
double MaxDifference() const
Definition: Broyden.h:239
virtual double CalculateEnergyDensity()
virtual double CalculateEntropyDensity()
double AttractionCoefficientdT(int i, int j) const
The temperature derivative of the QvdW attraction parameter .
virtual void CalculateDensities()
Calculates the primordial and total (after decays) densities of all species.
std::vector< std::vector< double > > m_AttrdT
virtual void CalculatePrimordialDensities()
Calculates the primordial densities of all species.
std::vector< double > m_densities
virtual double CalculatePressure()
Implementation of the equation of state functions.
std::vector< std::vector< double > > m_Virial
virtual std::vector< double > CalculateChargeFluctuations(const std::vector< double > &chgs, int order=4)
Calculates fluctuations (diagonal susceptibilities) of an arbitrary "conserved" charge.
virtual void ChangeTPS(ThermalParticleSystem *TPS)
Change the particle list.
std::vector< std::vector< double > > m_PrimCorrel
ThermalModelEnsemble m_Ensemble
std::vector< double > m_skewtot
virtual void CalculateParticleChargeCorrelationMatrix()
Calculates the matrix of correlators between primordial (and also final) particle numbers and conserv...
bool m_LastBroydenSuccessFlag
Whether Broyden&#39;s method was successfull.
virtual double ParticleScalarDensity(int part)
The scalar density of the particle species i.
void CalculateTwoParticleCorrelations()
Computes the fluctuations and correlations of the primordial particle numbers.
std::vector< double > m_MuStar
Vector of the shifted chemical potentials.
bool m_SearchMultipleSolutions
Whether multiple solutions are considered.
double mnucleon()
Nucleon&#39;s mass. Value as in UrQMD.
Definition: xMath.h:36
The main namespace where all classes and functions of the Thermal-FIST library reside.
virtual void SetChemicalPotentials(const std::vector< double > &chem=std::vector< double >(0))
Sets the chemical potentials of all particles.
virtual void WriteInteractionParameters(const std::string &filename)
Write the QvdW interaction parameters to a file.
std::vector< double > m_DensitiesId
Vector of ideal gas densities with shifted chemical potentials.
virtual bool IsSolved(const std::vector< double > &x, const std::vector< double > &f, const std::vector< double > &xdelta=std::vector< double >()) const
Definition: Broyden.cpp:176
int Iterations() const
Definition: Broyden.h:229
void FillAttraction(const std::vector< std::vector< double > > &aij=std::vector< std::vector< double > >(0))