35 const double r_sqr = r.
sqr();
38 return std::make_pair(0.0,
ThreeVector(0.0, 0.0, 0.0));
42 const double u_r_scalar = r * u.
threevec();
43 const double r_rest_sqr = r_sqr + u_r_scalar * u_r_scalar;
47 return std::make_pair(0.0,
ThreeVector(0.0, 0.0, 0.0));
51 ? sf * (r + u.
threevec() * u_r_scalar) *
55 return std::make_pair(sf, sf_grad);
76 std::array<FourVector, 4> djmu_dx;
78 for (
const auto &
p : plist) {
84 const double m = mom.
abs();
88 const double m_inv = 1.0 / m;
90 p.position().threevec() - r, mom, m_inv, par, compute_gradient);
94 const FourVector tmp = mom * (dens_factor / mom.x0());
95 if (dens_factor > 0.) {
96 jmu_pos += tmp * sf_and_grad.first;
98 jmu_neg += tmp * sf_and_grad.first;
100 if (compute_gradient) {
101 for (
int k = 1; k <= 3; k++) {
102 djmu_dx[k] += tmp * sf_and_grad.second[k - 1];
103 djmu_dx[0] -= tmp * sf_and_grad.second[k - 1] * tmp.
threevec()[k - 1] /
121 if (compute_gradient) {
122 j_rot.
set_x1(djmu_dx[2].x3() - djmu_dx[3].x2());
123 j_rot.
set_x2(djmu_dx[3].x1() - djmu_dx[1].x3());
124 j_rot.
set_x3(djmu_dx[1].x2() - djmu_dx[2].x1());
126 for (
int i = 1; i < 4; i++) {
130 return std::make_tuple(rho_eck, rho_grad, dj_dt, j_rot);
133 std::tuple<double, ThreeVector, ThreeVector, ThreeVector>
rho_eckart(
136 bool compute_gradient) {
139 std::tuple<double, ThreeVector, ThreeVector, ThreeVector>
rho_eckart(
148 os <<
"hadron density";
151 os <<
"baryon density";
154 os <<
"baryonic isospin density";
157 os <<
"pion density";
163 os.setstate(std::ios_base::failbit);
A class to pre-calculate and store parameters relevant for density calculation.
The ThreeVector class represents a physical three-vector with the components .
constexpr double really_small
Numerical error tolerance.
double norm_factor_sf() const
Collection of useful constants that are known at compile time.
std::tuple< double, ThreeVector, ThreeVector, ThreeVector > rho_eckart(const ThreeVector &r, const ParticleList &plist, const DensityParameters &par, DensityType dens_type, bool compute_gradient)
Calculates Eckart rest frame density and optionally the gradient of the density in an arbitary frame...
double two_sig_sqr_inv() const
void set_x1(double x)
set first component
double isospin3_rel() const
ThreeVector threevec() const
int baryon_number() const
Particle type contains the static properties of a particle species.
std::tuple< double, ThreeVector, ThreeVector, ThreeVector > rho_eckart_impl(const ThreeVector &r, const T &plist, const DensityParameters &par, DensityType dens_type, bool compute_gradient)
Calculates Eckart rest frame density and optionally the gradient of the density in an arbitary frame...
double density_factor(const ParticleType &type, DensityType dens_type)
Get the factor that determines how much a particle contributes to the density type that is computed...
void set_x3(double z)
set third component
std::pair< double, ThreeVector > unnormalized_smearing_factor(const ThreeVector &r, const FourVector &p, const double m_inv, const DensityParameters &dens_par, const bool compute_gradient=false)
Implements gaussian smearing for any quantity.
The Particles class abstracts the storage and manipulation of particles.
DensityType
Allows to choose which kind of density to calculate.
std::ostream & operator<<(std::ostream &out, const ActionPtr &action)
Convenience: dereferences the ActionPtr to Action.
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
double abs() const
calculate the lorentz invariant absolute value
void set_x2(double y)
set second component