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