eff_boson.h

00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006, 2007, Andrew W. Steiner
00005   
00006   This file is part of O2scl.
00007   
00008   O2scl is free software; you can redistribute it and/or modify
00009   it under the terms of the GNU General Public License as published by
00010   the Free Software Foundation; either version 3 of the License, or
00011   (at your option) any later version.
00012   
00013   O2scl is distributed in the hope that it will be useful,
00014   but WITHOUT ANY WARRANTY; without even the implied warranty of
00015   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016   GNU General Public License for more details.
00017   
00018   You should have received a copy of the GNU General Public License
00019   along with O2scl. If not, see <http://www.gnu.org/licenses/>.
00020 
00021   -------------------------------------------------------------------
00022 */
00023 #ifndef O2SCL_EFF_BOSON_H
00024 #define O2SCL_EFF_BOSON_H
00025 
00026 #include <string>
00027 #include <iostream>
00028 #include <fstream>
00029 #include <cmath>
00030 #include <o2scl/constants.h>
00031 #include <o2scl/funct.h>
00032 #include <o2scl/mm_funct.h>
00033 #include <o2scl/root.h>
00034 #include <o2scl/mroot.h>
00035 #include <o2scl/inte.h>
00036 #include <o2scl/boson.h>
00037 #include <o2scl/cern_mroot_root.h>
00038 #include <o2scl/gsl_mroot_hybrids.h>
00039 
00040 #ifndef DOXYGENP
00041 namespace o2scl {
00042 #endif
00043 
00044   /** 
00045       \brief Boson class from fitting method
00046 
00047       The constructor loads the coefficients from the file \c boselat3 
00048       by default. If this is not successful, then
00049       is_loaded() will return false.
00050 
00051       \todo Better documentation (see eff_fermion)
00052       \todo Remove native error codes
00053   */
00054   /*
00055     The pdf documentation fails if these lines are added.
00056     
00057     \todo Use file_detect instead of text_in_file.
00058   */
00059   class eff_boson : public boson {
00060 
00061   public:
00062 
00063     /// Create a boson with mass \c m  and degeneracy \c g 
00064     eff_boson(double m=0.0, double g=0.0);
00065     virtual ~eff_boson();
00066   
00067     /** \brief Load coefficients for finite-temperature approximation
00068       
00069         Presently acceptable values of \c fn are: \c boselat3 from
00070         Lattimer's notes \c bosejel21, \c bosejel22, \c bosejel34, and
00071         \c bosejel34cons from \ref Johns96.
00072       
00073         boselat3
00074         \include boselat3
00075         bosejel21
00076         \include bosejel21
00077         bosejel22
00078         \include bosejel22
00079         bosejel34
00080         \include bosejel34
00081         bosejel34cons
00082         \include bosejel34cons 
00083     */
00084     static int loadcoeff(std::string bfile);
00085   
00086     virtual int calc_mu(const double temper);
00087     virtual int calc_density(const double temper);
00088     virtual int pair_mu(const double temper);
00089     virtual int pair_density(const double temper);
00090 
00091     /** \brief Set the solver for use in calculating \f$ \psi \f$ */
00092     int set_psi_root(root<void *,funct<void *> > &rp) {
00093       psi_root=&rp;
00094       return 0;
00095     }
00096 
00097     /** \brief Set the solver for use in calculating the chemical
00098         potential from the density */
00099     int set_density_mroot(mroot<void *,mm_funct<void *> > &rp) {
00100       density_mroot=&rp;
00101       return 0;
00102     }
00103 
00104     /** \brief Set the solver for use in calculating the chemical
00105         potential from the density (meth2=true) */
00106     int set_meth2_root(root<void *,funct<void *> > &rp) {
00107       meth2_root=&rp;
00108       return 0;
00109     }
00110 
00111     /** \brief The default solver for calc_density() and pair_density()
00112     */
00113     gsl_mroot_hybrids<void *,mm_funct<void *> > def_density_mroot;
00114 
00115     /** \brief The default solver for \f$ \psi \f$
00116      */
00117     cern_mroot_root<void *,funct<void *> > def_psi_root;
00118 
00119     /** \brief The default solver for calc_density() and pair_density()
00120     */
00121     cern_mroot_root<void *,funct<void *> > def_meth2_root;
00122 
00123     virtual const char *type() { return "eff_boson"; }
00124 
00125 #ifndef DOXYGEN_INTERNAL
00126 
00127     friend class io_tlate<eff_boson>;
00128 
00129   protected:
00130   
00131     /// The coefficients
00132     static double **Pmnb;
00133     /// The number of coefficient rows
00134     static int sizem;
00135     /// The number of coefficient columns
00136     static int sizen;
00137     /// The parameter, \f$ a \f$
00138     static double parma;
00139     /// Temporary storage
00140     static double fix_density;
00141     /// Temporary storage
00142     static double stat_temper;
00143     /// True if coefficients have been loaded
00144     static bool loaded;
00145 
00146     /// The solver for calc_density()
00147     mroot<void *,mm_funct<void *> > *density_mroot;
00148     /// The solver to compute \f$ h \f$ from \f$ \psi \f$.
00149     root<void *,funct<void *> > *psi_root;
00150     /// The solver for calc_density()
00151     root<void *,funct<void *> > *meth2_root;
00152 
00153     /// The function which solves for \f$ h \f$ from \f$ \psi \f$.
00154     int solve_fun(double x, double &y, void *&pa);
00155 
00156     /// Fix density for calc_density()
00157     int density_fun(size_t nv, const ovector_view &x, ovector_view &y, 
00158                     void *&pa);
00159 
00160     /// Fix density for pair_density()
00161     int pair_density_fun(size_t nv, const ovector_view &x, ovector_view &y, 
00162                          void *&pa);
00163 
00164 #endif
00165   };
00166 
00167   template<> int io_tlate<eff_boson>::input
00168     (cinput *co, in_file_format *ins, eff_boson *b);
00169   template<> int io_tlate<eff_boson>::output
00170     (coutput *co, out_file_format *outs, eff_boson *b);
00171   template<> const char *io_tlate<eff_boson>::type();
00172   
00173   typedef io_tlate<eff_boson> eff_boson_io_type;
00174 
00175 #ifndef DOXYGENP
00176 }
00177 #endif
00178 
00179 #endif

Documentation generated with Doxygen and provided under the GNU Free Documentation License. See License Information for details.

Project hosting provided by SourceForge.net Logo, O2scl Sourceforge Project Page