Particles and Nuclei Sub-Library: Version 0.910
mass_fit.h
00001 /*
00002   -------------------------------------------------------------------
00003   
00004   Copyright (C) 2006-2012, 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 MASS_FIT_H
00024 #define MASS_FIT_H
00025 
00026 #include <o2scl/constants.h>
00027 #include <o2scl/multi_funct.h>
00028 #include <o2scl/multi_min.h>
00029 #include <o2scl/gsl_mmin_simp2.h>
00030 #include <o2scl/nuclear_mass.h>
00031 #include <o2scl/nuclear_dist.h>
00032 
00033 #ifndef DOXYGENP
00034 namespace o2scl {
00035 #endif
00036 
00037   /** \brief Fit a nuclear mass formula
00038 
00039       There is an example of the usage of this class given in 
00040       \ref ex_mass_fit_sect.
00041 
00042       \future Convert to a real fit with errors and covariance, etc.
00043    */
00044   class mass_fit {
00045   public:
00046   
00047     mass_fit();
00048     
00049     virtual ~mass_fit() {};
00050     
00051     /// If true, then only fit doubly-even nuclei (default false)
00052     bool even_even;
00053    
00054     /// Minimum proton number to fit (default 8)
00055     int minZ;
00056     
00057     /// Minimum neutron number to fit (default 8)
00058     int minN;
00059 
00060     /// Fit the nuclear mass formula
00061     virtual int fit(nuclear_mass_fit &n, double &res);
00062     
00063     /** \brief Evaluate quality without fitting
00064      */
00065     virtual int eval(nuclear_mass &n, double &res);
00066 
00067     /** \brief The default minimizer
00068 
00069         The value of def_mmin::ntrial is automatically multiplied by
00070         10 in the constructor because the minimization frequently
00071         requires more trials than the default.
00072      */
00073     gsl_mmin_simp2<multi_funct<> > def_mmin;
00074 
00075     /// Change the minimizer for use in the fit
00076     int set_mmin(multi_min<multi_funct<> > &umm) {
00077       mm=&umm;
00078       return 0;
00079     }
00080 
00081     /** \brief The default distribution of nuclei to fit (defaults 
00082         to all nuclei in \ref def_exp_mass)
00083     */
00084     full_dist def_dist;
00085 
00086     /// The default experimental nuclear mass object for \ref def_dist
00087     ame_mass def_exp_mass;
00088 
00089     /// Set the distribution of nuclei to fit
00090     int set_dist(nuclear_dist &uexp) {
00091       exp=&uexp;
00092       return 0;
00093     }
00094     
00095     /// Set the experimental nuclear mass formula
00096     int set_exp_mass(nuclear_mass &nm);
00097 
00098   protected:
00099 
00100 #ifndef DOXYGENP
00101     
00102     /** \brief The function to minimize
00103      */
00104     virtual double min_fun(size_t nv, const ovector_base &x);
00105 
00106     /// The pointer to the minimizer
00107     multi_min<multi_funct<> > *mm;
00108     
00109     /** \brief The nuclear mass formula to fit to
00110 
00111         This pointer is set by fit() and eval().
00112      */
00113     nuclear_mass_fit *nmf;
00114     
00115     /// A pointer to the nuclear distribution (defaults to \ref def_dist)
00116     nuclear_dist *exp;
00117 
00118 #endif
00119 
00120   };
00121 
00122 #ifndef DOXYGENP
00123 }
00124 #endif
00125 
00126 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Friends

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).

Get Object-oriented Scientific Computing
Lib at SourceForge.net. Fast, secure and Free Open Source software
downloads.