Go to the documentation of this file.
23 #ifndef O2SCL_NONREL_FERMION_H
24 #define O2SCL_NONREL_FERMION_H
34 #include <o2scl/constants.h>
35 #include <o2scl/mroot.h>
36 #include <o2scl/inte.h>
37 #include <o2scl/root_cern.h>
38 #include <o2scl/root_brent_gsl.h>
39 #include <o2scl/classical.h>
40 #include <o2scl/inte_qagiu_gsl.h>
42 #include <o2scl/fermion.h>
43 #include <o2scl/polylog.h>
45 #ifndef DOXYGEN_NO_O2NS
87 template<
class inte_t=
class fermion_nr_
integ_gsl,
class fp_t=
double>
108 f.
kf=sqrt(2.0*f.
ms*(f.
nu-f.
m));
144 O2SCL_ERR(
"Temperature less than zero in fermion_nonrel::calc_mu().",
152 fp_t y, sy, spi, ey, int1, int2;
190 f.
en=(5.0*(f.
ed-f.
n*f.
m)/3.0-(f.
nu-f.
m)*f.
n)/temper;
193 f.
pr=2.0*(f.
ed-f.
n*f.
m)/3.0;
198 f.
en=(5.0*f.
ed/3.0-f.
nu*f.
n)/temper;
205 if (!std::isfinite(f.
nu) || !std::isfinite(f.
n)) {
206 O2SCL_ERR2(
"Chemical potential or density in ",
226 "fermion_nonrel::calc_density().",
exc_einval);
230 "fermion_nonrel::calc_density().",
exc_einval);
241 std::string str=((std::string)
"Density, ")+
o2scl::dtos(f.
n)+
242 ", less than zero when temperature is positive in "+
243 "fermion_nonrel::calc_density().";
255 y=-(f.
nu-f.
m)/temper;
271 f.
en=(5.0*(f.
ed-f.
n*f.
m)/3.0-(f.
nu-f.
m)*f.
n)/temper;
274 f.
pr=2.0*(f.
ed-f.
n*f.
m)/3.0;
282 f.
en=(5.0*f.
ed/3.0-f.
nu*f.
n)/temper;
296 O2SCL_ERR2(
"Function fermion_nonrel::pair_mu() not ",
305 O2SCL_ERR2(
"Function fermion_nonrel::pair_density() not ",
313 fp_t init_n=f.
n, init_m=f.
m, init_ms=f.
ms, init_nu=f.
nu;
318 nex=-(f.
nu-f.
m)/temper;
325 if (nex>-GSL_LOG_DBL_MIN*0.9) nex=-GSL_LOG_DBL_MIN/2.0;
327 funct mf=std::bind(std::mem_fn<fp_t(fp_t,fp_t,fp_t)>
329 this,std::placeholders::_1,f.
n/f.
g,f.
ms*temper);
340 fp_t blow=fabs(nex), bhigh=-blow;
341 fp_t yhigh=mf(bhigh), ylow=mf(blow);
342 for(
size_t j=0;j<10 && yhigh*ylow>0.0;j++) {
343 fp_t delta=fabs(blow);
349 if ((yhigh<0.0 && ylow>0.0) || (yhigh>0.0 && ylow<0.0)) {
353 if (ret==0) nex=blow;
364 nex=-(f.
nu-f.
m)/temper;
372 std::cout <<
"Function fermion_nonrel::nu_from_n() failed."
374 std::cout.precision(14);
375 std::cout <<
" n,m,ms,T,nu: " << init_n <<
" " << init_m <<
" "
376 << init_ms <<
" " << temper <<
" " << init_nu << std::endl;
379 O2SCL_ERR(
"Solver failed in fermion_nonrel::nu_from_n().",ret);
387 f.
nu=-nex*temper+f.
m;
408 virtual const char *
type() {
return "fermion_nonrel"; }
425 if (((-x)<GSL_LOG_DBL_MIN) || !std::isfinite(x)) {
429 nden=
integ.calc_1o2(-x);
434 fp_t ret=nden/nog-1.0;
440 #ifndef DOXYGEN_NO_O2NS
456 #ifndef DOXYGEN_NO_O2NS
virtual void calc_density(part_tl< fp_t > &p, fp_t temper)
Calculate properties as function of density.
virtual int pair_density(fermion &f, fp_t temper)
Compute thermodynamics with antiparticles at fixed density (unimplemented)
virtual int solve(fp_t &x, func_t &func)=0
virtual void calc_density_zerot(fermion &f)
Zero temperature fermions.
fp_t mu
Chemical potential.
fp_t ms
Effective mass (Dirac unless otherwise specified)
#define O2SCL_ERR2(d, d2, n)
fermion_nonrel_tl()
Create a nonrelativistic fermion with mass 'm' and degeneracy 'g'.
fp_t solve_fun(fp_t x, fp_t nog, fp_t msT)
Function to compute chemical potential from density.
virtual void pair_mu(fermion &f, fp_t temper)
Compute thermodynamics with antiparticles at fixed chemical potential (unimplemented)
virtual void calc_mu(fermion &f, fp_t temper)
Calculate properties as function of chemical potential.
virtual int solve_bkt(fp_t &x1, fp_t x2, func_t &f)
bool non_interacting
True if the particle is non-interacting (default true)
inte_t integ
Object for Fermi-Dirac integrals.
fp_t g
Degeneracy (e.g. spin and color if applicable)
virtual int calc_density(fermion &f, fp_t temper)
Calculate properties as function of density.
void set_density_root(root<> &rp)
Set the solver for use in calculating the chemical potential from the density.
void kf_from_density(fermion_tl< double > &f)
Calculate the Fermi momentum from the density.
bool inc_rest_mass
If true, include the mass in the energy density and chemical potential (default true)
root_cern def_density_root
The default solver for calc_density().
virtual const char * type()
Return string denoting type ("fermion_nonrel")
std::function< double(double)> funct
virtual void nu_from_n(fermion &f, fp_t temper)
Calculate effective chemical potential from density.
root * density_root
Solver to compute chemical potential from density.
Fermion with finite-temperature thermodynamics [abstract base].
Nonrelativistic fermion class.
std::string dtos(double x, std::ostream &format)
virtual void calc_mu_zerot(fermion &f)
Zero temperature fermions.
fp_t nu
Effective chemical potential.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).