00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031 #ifndef MORE_PHYS_SKYRME_H
00032 #define MORE_PHYS_SKYRME_H
00033
00034 #include <more/bits/config.h>
00035 #include <stdexcept>
00036 #include <iosfwd>
00037 #include <string>
00038 #include <more/io/syncstream.h>
00039 #include <list>
00040
00041 namespace more {
00042 namespace phys {
00043
00044 extern std::string skyrme_datadir;
00045
00046
00047
00048
00049
00050
00051
00052 template<typename T>
00053 struct skyrme_interaction
00054 {
00055 typedef T real_type;
00056
00057 T get_t0() const { return t0; }
00058 T get_t1() const { return t1; }
00059 T get_t2() const { return t2; }
00060 T get_t3() const { return t3; }
00061 T get_x0() const { return x0; }
00062 T get_x1() const { return x1; }
00063 T get_x2() const { return x2; }
00064 T get_x3() const { return x3; }
00065 T get_alpha() const { return alpha; }
00066
00067 T get_W0() const
00068 {
00069 if (!isospin_dependent_LS_p())
00070 return w;
00071 else
00072 throw std::logic_error("No W0 term in interaction.");
00073 }
00074
00075 T get_W1() const
00076 {
00077 if (isospin_dependent_LS_p())
00078 return w;
00079 else
00080 throw std::logic_error("No W1 term in interaction.");
00081 }
00082
00083 T get_W2() const
00084 {
00085 if (isospin_dependent_LS_p())
00086 return w2;
00087 else
00088 throw std::logic_error("No W2 term in interaction.");
00089 }
00090
00091 bool isospin_dependent_LS_p() const { return m_force == 10; }
00092
00093 void sync(more::io::syncstream&);
00094
00095
00096 void load(std::string name);
00097
00098
00099 std::string print_name() const { return m_name; }
00100
00101
00102 std::string path_comp_name() const { return m_fname; }
00103
00104 friend std::istream&
00105 operator>>(std::istream& is, skyrme_interaction& V)
00106 { V.read(is); return is; }
00107
00108 friend std::ostream&
00109 operator<<(std::ostream& os, const skyrme_interaction& V)
00110 { V.write(os); return os; }
00111
00112 private:
00113 std::string m_name, m_fname;
00114 int m_force;
00115 real_type t0, x0, t1, x1, t2, x2, t3, x3, alpha, w, w2;
00116
00117 void read(std::istream& sm);
00118 void write(std::ostream& sm) const;
00119
00120 static void get_available();
00121 static bool s_done_init;
00122 };
00123
00124
00125
00126
00127
00128
00129 struct skyrme_name_list
00130 {
00131 private:
00132 typedef std::list<std::string> subcontainer;
00133 public:
00134 typedef subcontainer::const_iterator iterator;
00135
00136 skyrme_name_list();
00137
00138 static std::string name_to_path_comp(std::string name);
00139
00140 iterator begin() const { return s_names.begin(); }
00141 iterator end() const { return s_names.end(); }
00142
00143 private:
00144 static bool s_done_init;
00145 static subcontainer s_names;
00146 };
00147
00148 }}
00149
00150 #endif