Thermal-FIST 1.5
Package for hadron resonance gas model applications
Loading...
Searching...
No Matches
ThermalModelEVCrossterms.cpp
Go to the documentation of this file.
1/*
2 * Thermal-FIST package
3 *
4 * Copyright (c) 2015-2019 Volodymyr Vovchenko
5 *
6 * GNU General Public License (GPLv3 or later)
7 */
9
10#ifdef USE_OPENMP
11#include <omp.h>
12#endif
13
14#include <vector>
15#include <cmath>
16#include <iostream>
17#include <iomanip>
18#include <algorithm>
19#include <fstream>
20#include <sstream>
21
22#include "HRGBase/xMath.h"
24
25#include <Eigen/Dense>
26
27using namespace std;
28
29namespace thermalfist {
30
31 void ThermalModelEVCrossterms::ReadInteractionParameters(const std::string & filename)
32 {
33 m_Virial = std::vector< std::vector<double> >(m_TPS->Particles().size(), std::vector<double>(m_TPS->Particles().size(), 0.));
34
35 ifstream fin(filename.c_str());
36 char cc[2000];
37 while (!fin.eof()) {
38 fin.getline(cc, 2000);
39 string tmp = string(cc);
40 vector<string> elems = CuteHRGHelper::split(tmp, '#');
41 if (elems.size() < 1)
42 continue;
43 istringstream iss(elems[0]);
44 long long pdgid1, pdgid2;
45 double b;
46 if (iss >> pdgid1 >> pdgid2 >> b) {
47 int ind1 = m_TPS->PdgToId(pdgid1);
48 int ind2 = m_TPS->PdgToId(pdgid2);
49 if (ind1 != -1 && ind2 != -1)
50 m_Virial[ind1][ind2] = b;
51 }
52 }
53 fin.close();
54 }
55
57 {
58 ofstream fout(filename.c_str());
59 fout << "# List of crossterms parameters to be used in the Crossterms excluded-volume HRG model"
60 << std::endl;
61 fout << "# Only particle pairs with a non-zero eigenvolume parameter are listed here"
62 << std::endl;
63 fout << "#" << " " << "pdg_i"
64 << " " << "pdg_j"
65 << " " << "b_{ij}[fm^3]"
66 << std::endl;
67 for (int i = 0; i < m_TPS->ComponentsNumber(); ++i) {
68 for (int j = 0; j < m_TPS->ComponentsNumber(); ++j) {
69 if (m_Virial[i][j] != 0.) {
70 fout << " " << m_TPS->Particle(i).PdgId();
71 fout << " " << m_TPS->Particle(j).PdgId();
72 fout << " " << m_Virial[i][j];
73 fout << std::endl;
74 }
75 }
76 }
77 fout.close();
78 }
79
80 void ThermalModelEVCrossterms::SetAttraction(int i, int j, double a)
81 {
82 if (a != 0.0) {
83 printf("**WARNING** ThermalModelEVCrossterms::SetAttraction(): Trying to include attraction into ThermalModelEVCrossterms()!\n");
84 }
85 //m_Attr[i][j] = 0.0;
86 }
87
89 {
90 if (search) {
91 printf("**WARNING** ThermalModelEVCrossterms::SetMultipleSolutionsMode(): Trying to search for multiple solutions in ThermalModelEVCrossterms()! There is no need.\n");
92 }
94 }
95
96
98 auto vdWb = GetBaryonBaryonInteractionMatrix(model->TPS(), b);
99 // Iterate over all hadron pairs
100 for (int i1 = 0; i1 < model->TPS()->Particles().size(); ++i1) {
101 for (int i2 = 0; i2 < model->TPS()->Particles().size(); ++i2) {
102 model->SetRepulsion(i1, i2, vdWb[i1][i2]);
103 }
104 }
105 }
106
107} // namespace thermalfist
Contains some functions to deal with excluded volumes.
Abstract base class for an HRG model implementation.
virtual void SetRepulsion(int i, int j, double b)
Same as SetVirial() but with a more clear name on what is actually does.
virtual void ReadInteractionParameters(const std::string &filename)
Reads the QvdW interaction parameters from a file.
virtual void SetAttraction(int i, int j, double a)
Set the vdW mean field attraction coefficient .
virtual void SetMultipleSolutionsMode(bool search)
No need to search for multiple soultions in EV-HRG model.
virtual void WriteInteractionParameters(const std::string &filename)
Write the QvdW interaction parameters to a file.
std::vector< std::vector< double > > m_Virial
bool m_SearchMultipleSolutions
Whether multiple solutions are considered.
std::vector< std::string > split(const std::string &s, char delim)
The main namespace where all classes and functions of the Thermal-FIST library reside.
Definition CosmicEoS.h:9
std::vector< std::vector< double > > GetBaryonBaryonInteractionMatrix(const ThermalParticleSystem *TPS, double param)
Returns the matrix of attraction and repulsion parameters for baryon-baryon and antibaryon-antibaryon...
void SetEVHRGInteractionParameters(ThermalModelBase *model, double b)
Sets EV interactions for baryon-baryon and antibaryon-antibaryon pairs as in https://arxiv....
Contains some extra mathematical functions used in the code.