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