10 #ifndef SRC_INCLUDE_SMASH_POTENTIALS_H_
11 #define SRC_INCLUDE_SMASH_POTENTIALS_H_
17 #include "gsl/gsl_multiroots.h"
18 #include "gsl/gsl_vector.h"
69 ParticleList &plist)
const {
70 const std::array<double, 3> dr = (jB_lattice)
72 : std::array<double, 3>{0.1, 0.1, 0.1};
75 FourVector net_4current_left, net_4current_right;
76 for (
int i = 0; i < 3; i++) {
77 position_left = position;
78 position_left[i] -= dr[i];
79 position_right = position;
80 position_right[i] += dr[i];
82 if (jB_lattice && jB_lattice->
value_at(position_left, jmu_left)) {
83 net_4current_left = jmu_left.
jmu_net();
87 net_4current_left = std::get<1>(current);
92 if (jB_lattice && jB_lattice->
value_at(position_right, jmu_right)) {
93 net_4current_right = jmu_right.
jmu_net();
97 net_4current_right = std::get<1>(current);
120 std::function<double(
double)> root_equation = [momentum, jmu_B, mass,
121 this](
double energy) {
127 const std::array<double, 4> starting_interval_width = {0.1, 1.0, 10.0,
129 for (
double width : starting_interval_width) {
130 const double initial_guess = std::sqrt(mass * mass + momentum * momentum);
131 auto calc_frame_energy = root_solver.try_find_root(
132 initial_guess - width / 2, initial_guess + width / 2, 100000);
133 if (calc_frame_energy) {
134 return *calc_frame_energy;
137 <<
"Did not find a root for potentials in the interval ["
138 << initial_guess - width / 2 <<
" GeV ,"
139 << initial_guess + width / 2 <<
" GeV]. Trying a wider interval";
143 "Root for potentials was not found in any of the intervals "
145 throw std::runtime_error(
146 "Failed to find root for momentum-dependent potentials");
174 double symmetry_pot(
const double baryon_isospin_density,
175 const double baryon_density)
const;
183 double symmetry_S(
const double baryon_density)
const;
328 std::pow(dr.
abs(), 3);
347 std::pow(dr.
abs(), 3);
387 std::pair<ThreeVector, ThreeVector>
vdf_force(
388 double rhoB,
const double drhoB_dt,
const ThreeVector grad_rhoB,
389 const ThreeVector gradrhoB_cross_vecjB,
const double j0B,
410 std::pair<ThreeVector, ThreeVector>
vdf_force(
429 virtual std::tuple<ThreeVector, ThreeVector, ThreeVector, ThreeVector>
574 double dVsym_drhoI3(
const double rhoB,
const double rhoI3)
const;
594 double dVsym_drhoB(
const double rhoB,
const double rhoI3)
const;
605 static double skyrme_pot(
const double baryon_density,
const double A,
606 const double B,
const double tau);
637 double B,
double tau,
double C,
640 double rho_LRF = jmu.
abs();
649 double energy_LRF = std::sqrt(m * m + p_LRF * p_LRF) +
652 const double result = energy_calc * energy_calc - momentum_calc.
sqr() -
653 (energy_LRF * energy_LRF - p_LRF * p_LRF);
655 <<
"root equation for potentials called with E_calc=" << energy_calc
656 <<
" p_calc=" << momentum_calc <<
" jmu=" << jmu <<
" m=" << m
657 <<
" tau=" << tau <<
" A=" << A <<
" B=" << B <<
" C=" << C
658 <<
" Lambda=" <<
Lambda <<
" and the root equation is " << result;
684 const double fermi_momentum =
685 std::cbrt(6. * M_PI * M_PI * rho / g);
686 momentum = momentum /
hbarc;
690 std::pow(
Lambda, 3) * std::atan(fermi_momentum /
Lambda));
692 const std::array<double, 7> temp = {
693 2 * g * C * M_PI * std::pow(
Lambda, 3) /
696 momentum * momentum) /
698 std::pow(momentum + fermi_momentum, 2) +
Lambda *
Lambda,
699 std::pow(momentum - fermi_momentum, 2) +
Lambda *
Lambda,
700 2 * fermi_momentum /
Lambda,
701 (momentum + fermi_momentum) /
Lambda,
702 (momentum - fermi_momentum) /
Lambda};
703 const double result =
704 temp[0] * (temp[1] * std::log(temp[2] / temp[3]) + temp[4] -
705 2 * (std::atan(temp[5]) - std::atan(temp[6])));
Interface to the SMASH configuration files.
A class for time-efficient (time-memory trade-off) calculation of density on the lattice.
double rho(const double norm_factor=1.0)
Compute the net Eckart density on the local lattice.
FourVector jmu_net() const
A class to pre-calculate and store parameters relevant for density calculation.
The FourVector class holds relevant values in Minkowski spacetime with (+, −, −, −) metric signature.
double abs() const
calculate the lorentz invariant absolute value
FourVector lorentz_boost(const ThreeVector &v) const
Returns the FourVector boosted with velocity v.
ThreeVector threevec() const
Particle type contains the static properties of a particle species.
A class that stores parameters of potentials, calculates potentials and their gradients.
const std::vector< double > & powers() const
static double momentum_dependent_part(double momentum, double rho, double C, double Lambda)
Momentum dependent term of the potential.
bool use_skyrme_
Skyrme potential on/off.
bool use_symmetry_
Symmetry potential on/off.
double skyrme_pot(const double baryon_density) const
Evaluates Skyrme potential given a baryon density.
static double root_eq_potentials(double energy_calc, const ThreeVector &momentum_calc, const FourVector &jmu, double m, double A, double B, double tau, double C, double Lambda)
Root equation used to determine the energy in the calculation frame.
virtual bool use_symmetry() const
double symmetry_pot(const double baryon_isospin_density, const double baryon_density) const
Evaluates symmetry potential given baryon isospin density.
double mom_dependence_C_
Parameter C of the momentum-dependent part of the potentials given in MeV.
ThreeVector single_particle_energy_gradient(DensityLattice *jB_lattice, const ThreeVector &position, const ThreeVector &momentum, double mass, ParticleList &plist) const
Calculates the gradient of the single-particle energy (including potentials) in the calculation frame...
const std::vector< double > & coeffs() const
static ThreeVector B_field_integrand(ThreeVector pos, DensityOnLattice &charge_density, ThreeVector point)
Integrand for calculating the magnetic field using the Biot-Savart formula.
static ThreeVector E_field_integrand(ThreeVector pos, DensityOnLattice &charge_density, ThreeVector point)
Integrand for calculating the electric field.
std::pair< ThreeVector, ThreeVector > symmetry_force(const double rhoI3, const ThreeVector grad_j0I3, const ThreeVector dvecjI3_dt, const ThreeVector curl_vecjI3, const double rhoB, const ThreeVector grad_j0B, const ThreeVector dvecjB_dt, const ThreeVector curl_vecjB) const
Evaluates the electric and magnetic components of the symmetry force.
double calculation_frame_energy(const ThreeVector &momentum, const FourVector &jmu_B, double mass) const
Evaluates the single-particle energy (including the potential) of a particle at a given position and ...
virtual bool use_skyrme() const
double potential(const ThreeVector &r, const ParticleList &plist, const ParticleType &acts_on) const
Evaluates potential (Skyrme with optional Symmetry or VDF) at point r.
FourVector vdf_pot(double rhoB, const FourVector jmuB_net) const
Evaluates the FourVector potential in the VDF model given the rest frame density and the computationa...
bool use_potentials_outside_lattice() const
std::vector< double > powers_
Parameters of the VDF potential: exponents .
bool use_potentials_outside_lattice_
Wether potentials should be included outside of the lattice.
double dVsym_drhoB(const double rhoB, const double rhoI3) const
Calculate the derivative of the symmetry potential with respect to the net baryon density in GeV * fm...
virtual bool use_coulomb() const
double symmetry_S(const double baryon_density) const
Calculate the factor in the symmetry potential.
double symmetry_S_Pot_
Parameter S_Pot in the symmetry potential in MeV.
double skyrme_a_
Parameter of skyrme potentials: the coefficient in front of in GeV.
std::vector< double > coeffs_
Parameters of the VDF potential: coefficients , in GeV.
std::pair< ThreeVector, ThreeVector > vdf_force(double rhoB, const double drhoB_dt, const ThreeVector grad_rhoB, const ThreeVector gradrhoB_cross_vecjB, const double j0B, const ThreeVector grad_j0B, const ThreeVector vecjB, const ThreeVector dvecjB_dt, const ThreeVector curl_vecjB) const
Evaluates the electric and magnetic components of force in the VDF model given the derivatives of the...
double skyrme_tau() const
double mom_dependence_Lambda_
Parameter Lambda of the momentum-dependent part of the potentials given in 1/fm.
bool use_momentum_dependence_
Momentum-dependent part on/off.
double coulomb_r_cut() const
double skyrme_tau_
Parameters of skyrme potentials: the power index.
double symmetry_S_pot() const
Potentials(Configuration conf, const DensityParameters ¶meters)
Potentials constructor.
double dVsym_drhoI3(const double rhoB, const double rhoI3) const
Calculate the derivative of the symmetry potential with respect to the isospin density in GeV * fm^3.
int number_of_terms() const
static std::pair< double, int > force_scale(const ParticleType &data)
Evaluates the scaling factor of the forces acting on the particles.
std::pair< ThreeVector, ThreeVector > skyrme_force(const double rhoB, const ThreeVector grad_j0B, const ThreeVector dvecjB_dt, const ThreeVector curl_vecjB) const
Evaluates the electric and magnetic components of the skyrme force.
virtual std::tuple< ThreeVector, ThreeVector, ThreeVector, ThreeVector > all_forces(const ThreeVector &r, const ParticleList &plist) const
Evaluates the electric and magnetic components of the forces at point r.
bool use_coulomb_
Coulomb potential on/Off.
double symmetry_gamma_
Power in formula for :
bool symmetry_is_rhoB_dependent_
Whether the baryon density dependence of the symmetry potential is included.
double coulomb_r_cut_
Cutoff in integration for coulomb potential.
virtual bool use_vdf() const
const DensityParameters param_
Struct that contains the gaussian smearing width , the distance cutoff and the testparticle number n...
double saturation_density() const
bool use_vdf_
VDF potential on/off.
double saturation_density_
Saturation density of nuclear matter used in the VDF potential; it may vary between different paramet...
virtual bool use_momentum_dependence() const
virtual ~Potentials()
Standard destructor.
double skyrme_b_
Parameters of skyrme potentials: the coefficient in front of in GeV.
A container class to hold all the arrays on the lattice and access them.
bool value_at(const ThreeVector &r, T &value)
Interpolates lattice quantity to coordinate r.
const std::array< double, 3 > & cell_sizes() const
A class used for calculating the root of a one-dimensional equation.
The ThreeVector class represents a physical three-vector with the components .
ThreeVector cross_product(const ThreeVector &b) const
std::array< einhard::Logger<>, std::tuple_size< LogArea::AreaTuple >::value > logg
An array that stores all pre-configured Logger objects.
#define unlikely(x)
Tell the branch predictor that this expression is likely false.
constexpr double mev_to_gev
MeV to GeV conversion factor.
std::tuple< double, FourVector, ThreeVector, ThreeVector, FourVector, FourVector, FourVector, FourVector > 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...
static constexpr int LPotentials
constexpr double nuclear_density
Ground state density of symmetric nuclear matter [fm^-3].
constexpr double hbarc
GeV <-> fm conversion factor.
constexpr double really_small
Numerical error tolerance.
const double elementary_charge
Elementary electric charge in natural units, approximately 0.3.