Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages  

more/phys/skyrme.h

Go to the documentation of this file.
00001 //  more/skyrme.h -- Skyrme parameters of the effective nuclear interaction
00002 //  Copyright (C) 2001--2002  Petter Urkedal (petter.urkedal@matfys.lth.se)
00003 //
00004 //  This file is free software; you can redistribute it and/or modify
00005 //  it under the terms of the GNU General Public License as published by
00006 //  the Free Software Foundation; either version 2 of the License, or
00007 //  (at your option) any later version.
00008 //
00009 //  This file is distributed in the hope that it will be useful,
00010 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 //  GNU General Public License for more details.
00013 //
00014 //  You should have received a copy of the GNU General Public License
00015 //  along with this program; if not, write to the Free Software
00016 //  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00017 //
00018 //  As a special exception, you may use this file as part of a free
00019 //  software library without restriction.  Specifically, if other files
00020 //  instantiate templates or use macros or inline functions from this
00021 //  file, or you compile this file and link it with other files to
00022 //  produce an executable, this file does not by itself cause the
00023 //  resulting executable to be covered by the GNU General Public
00024 //  License.  This exception does not however invalidate any other
00025 //  reasons why the executable file might be covered by the GNU General
00026 //  Public License.
00027 //
00028 //  $Id: skyrme.h,v 1.1 2002/05/30 18:01:40 petter_urkedal Exp $
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   /** \class skyrme_interaction skyrme.h more/phys/skyrme.h
00047    **
00048    ** This class holds a Skyrme type parametrization of the nuclear
00049    ** interaction. It provides read and write methods, the former
00050    ** which may be applied to the supplied siii.skyrme, sgii.skyrme,
00051    ** etc. files. */
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         /** Load interaction named \c name.  */
00096         void load(std::string name);
00097 
00098         /** A name suitable for printing. */
00099         std::string print_name() const { return m_name; }
00100 
00101         /** A name suitable for mangling into file names. */
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   /** \class skyrme_name_list skyrme.h more/phys/skyrme.h
00125    **
00126    ** A list of the names of the skyrme interactions.  This is an
00127    ** empty structure which gives access to static data.  The default
00128    ** constructor makes sure the static data is constructed. */
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

Generated on Sat Sep 7 19:11:22 2002 for more with Doxygen 1.2.13.1. Doxygen 1.2.13.1 is written and copyright 1997-2002 by Dimitri van Heesch.