30 return static_cast<double>(type.
charge());
41 const double r_sqr = r.
sqr();
44 return std::make_pair(0.0,
ThreeVector(0.0, 0.0, 0.0));
48 const double u_r_scalar = r * u.
threevec();
49 const double r_rest_sqr = r_sqr + u_r_scalar * u_r_scalar;
53 return std::make_pair(0.0,
ThreeVector(0.0, 0.0, 0.0));
57 ? sf * (r + u.
threevec() * u_r_scalar) *
61 return std::make_pair(sf, sf_grad);
66 std::tuple<double, FourVector, ThreeVector, ThreeVector, ThreeVector>
69 bool compute_gradient,
bool smearing) {
83 std::array<FourVector, 4> djmu_dx;
85 for (
const auto &
p : plist) {
91 const double m = mom.
abs();
95 const double m_inv = 1.0 / m;
97 p.position().threevec() - r, mom, m_inv, par, compute_gradient);
101 const FourVector tmp = mom * (dens_factor / mom.x0());
103 if (dens_factor > 0.) {
104 jmu_pos += tmp * sf_and_grad.first;
106 jmu_neg += tmp * sf_and_grad.first;
109 if (dens_factor > 0.) {
115 if (compute_gradient) {
116 for (
int k = 1; k <= 3; k++) {
117 djmu_dx[k] += tmp * sf_and_grad.second[k - 1];
118 djmu_dx[0] -= tmp * sf_and_grad.second[k - 1] * tmp.
threevec()[k - 1] /
136 if (compute_gradient) {
137 j_rot.
set_x1(djmu_dx[2].x3() - djmu_dx[3].x2());
138 j_rot.
set_x2(djmu_dx[3].x1() - djmu_dx[1].x3());
139 j_rot.
set_x3(djmu_dx[1].x2() - djmu_dx[2].x1());
141 for (
int i = 1; i < 4; i++) {
145 return std::make_tuple(rho_eck, jmu_pos + jmu_neg, rho_grad, dj_dt, j_rot);
148 std::tuple<double, FourVector, ThreeVector, ThreeVector, ThreeVector>
151 bool compute_gradient,
bool smearing) {
155 std::tuple<double, FourVector, ThreeVector, ThreeVector, ThreeVector>
158 bool compute_gradient,
bool smearing) {
166 os <<
"hadron density";
169 os <<
"baryon density";
172 os <<
"baryonic isospin density";
175 os <<
"pion density";
178 os <<
"total isospin3 density";
184 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.
int baryon_number() const
Collection of useful constants that are known at compile time.
double abs() const
calculate the lorentz invariant absolute value
ThreeVector threevec() const
std::tuple< double, FourVector, ThreeVector, ThreeVector, ThreeVector > current_eckart_impl(const ThreeVector &r, const T &plist, const DensityParameters &par, DensityType dens_type, bool compute_gradient, bool smearing)
Calculates Eckart rest frame density and 4-current of a given density type and optionally the gradien...
void set_x1(double x)
set first component
Particle type contains the static properties of a particle species.
int32_t charge() const
The charge of the particle.
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...
std::tuple< double, FourVector, ThreeVector, ThreeVector, ThreeVector > current_eckart(const ThreeVector &r, const ParticleList &plist, const DensityParameters &par, DensityType dens_type, bool compute_gradient, bool smearing)
Calculates Eckart rest frame density and 4-current of a given density type and optionally the gradien...
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.
double two_sig_sqr_inv() const
double isospin3_rel() const
double norm_factor_sf() const
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.
void set_x2(double y)
set second component