hdf_eos_io.h
Go to the documentation of this file.
1 /*
2  -------------------------------------------------------------------
3 
4  Copyright (C) 2006-2020, Andrew W. Steiner
5 
6  This file is part of O2scl.
7 
8  O2scl is free software; you can redistribute it and/or modify
9  it under the terms of the GNU General Public License as published by
10  the Free Software Foundation; either version 3 of the License, or
11  (at your option) any later version.
12 
13  O2scl is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with O2scl. If not, see <http://www.gnu.org/licenses/>.
20 
21  -------------------------------------------------------------------
22 */
23 #ifndef O2SCL_HDF_EOS_IO_H
24 #define O2SCL_HDF_EOS_IO_H
25 
26 /** \file hdf_eos_io.h
27  \brief HDF input of the \o2 EOS data files
28 */
29 
30 #ifdef O2SCL_PLAIN_HDF5_HEADER
31 #include <hdf5.h>
32 #else
33 #ifdef O2SCL_LINUX
34 #include <hdf5/serial/hdf5.h>
35 #else
36 #include <hdf5.h>
37 #endif
38 #endif
39 
40 #include <o2scl/constants.h>
41 #include <o2scl/hdf_file.h>
42 #include <o2scl/lib_settings.h>
43 #include <o2scl/eos_had_apr.h>
44 #include <o2scl/eos_had_skyrme.h>
45 #include <o2scl/eos_had_rmf.h>
46 #include <o2scl/eos_had_gogny.h>
47 
48 /** \brief Additional functions to read and write EOS data to HDF5 files
49  */
50 namespace o2scl_hdf {
51 
52  /** \brief Read the Gogny EOS from a data file
53 
54  If \c external is <tt>false</tt> (the default), then the model
55  (either <tt>"d1n"</tt> or <tt>"d1s"</tt> is loaded from the \o2
56  data directory in file <tt>gogny.o2</tt>. Otherwise, the
57  parameter \c model is taken to be the full pathname of the HDF5
58  file containing the EOS model data to be loaded.
59  */
60  void gogny_load(o2scl::eos_had_gogny &ge, std::string model,
61  std::string filename="");
62 
63  /** \brief Input a \ref o2scl::eos_had_rmf object from an HDF file
64 
65  If \c external is <tt>false</tt> (the default), then the model
66  is loaded from the \o2 data directory <tt>rmfdata</tt> with the
67  suffix <tt>.o2</tt>. Otherwise, the parameter \c model is
68  taken to be the full pathname of the HDF5 file containing
69  the EOS model data to be loaded.
70  */
71  void rmf_load(o2scl::eos_had_rmf &rmf, std::string model,
72  bool external=false);
73 
74  /** \brief Input a \ref o2scl::eos_had_skyrme object from an HDF file
75 
76  If \c external is <tt>false</tt> (the default), then the model
77  is loaded from the \o2 data directory <tt>skdata</tt> with the
78  suffix <tt>.o2</tt>. Otherwise, the parameter \c model is
79  taken to be the full pathname of the HDF5 file containing
80  the EOS model data to be loaded.
81 
82  The parameters <tt>b4</tt>, <tt>b4p</tt> and the reference
83  are directly read from the file.
84 
85  If the file does not contain an integer named <tt>dpfix</tt>,
86  or the value of <tt>dpfix</tt> is false, then
87  - the parameters named <tt>x0</tt>, <tt>x1</tt>, <tt>x2</tt>,
88  <tt>x3</tt>, <tt>a</tt>, <tt>b</tt>, and <tt>alpha</tt>
89  are directly read from the file,
90  - and the parameters named <tt>t0</tt>, <tt>t1</tt>, <tt>t2</tt>,
91  and <tt>t3</tt> are presumed to be stored in the file with
92  an extra factor of \f$ \hbar c \f$ and stored in fields named
93  <tt>t0hc</tt>, <tt>t1hc</tt>, <tt>t2hc</tt>, and
94  <tt>t3hc</tt> .
95 
96  Alternatively if <tt>dpfix</tt> is present and greater than
97  zero, then the values \f$ t_1=-t_2/3(5+4 x_2) \f$, \f$ x_1 =
98  -(4+5 x_2)/ (5+4 x_2) \f$, \f$ \alpha=1/3 \f$, \f$ a=1 \f$ and
99  \f$ b=0 \f$ are assumed. The values <tt>x0</tt>, <tt>x2</tt>,
100  and <tt>x3</tt> are directly read and the values <tt>t0</tt>,
101  <tt>t2</tt>, and <tt>t3</tt> are computed from fields named
102  <tt>t0hc</tt>, <tt>t2hc</tt>, and <tt>t3hc</tt> .
103 
104  If the file contains an integer named <tt>pdmode</tt>
105  and that integer is greater than zero, then
106  the parameter named <tt>W0</tt> is taken from
107  the numbers named <tt>pairfn</tt> and <tt>pairfp</tt>
108  using the relation
109  \f[
110  W_0 = \frac{(\mathrm{pairfn}+\mathrm{pairfp})}{4 \hbar c}
111  \f]
112  Otherwise, it is assumed that the file contains a
113  field named <tt>W0hc</tt> which stores the value of
114  <tt>W0</tt> times \f$ \hbar c \f$ .
115  */
116  void skyrme_load(o2scl::eos_had_skyrme &sk, std::string model,
117  bool external=false, int verbose=0);
118 
119  /** \brief Write a \ref o2scl::eos_had_skyrme object to an HDF file
120  */
121  void skyrme_write(hdf_file &hf, o2scl::eos_had_skyrme &sk,
122  std::string name);
123 
124  /** \brief Write a \ref o2scl::eos_had_skyrme object to an HDF file
125  in the \o2 data directory
126  */
127  void skyrme_write(o2scl::eos_had_skyrme &sk, std::string model);
128 
129  /** \brief Return a pointer to an eos_had_base object
130  from two strings specifying type and name
131  */
132  o2scl::eos_had_base *eos_had_strings(std::string type,
133  std::string name="");
134 
135  /** \brief List EOSs understood by \ref eos_had_strings() .
136  */
137  void eos_had_strings_list();
138 
139 }
140 
141 #endif
142 
143 
o2scl::eos_had_rmf
Relativistic mean field theory EOS.
Definition: eos_had_rmf.h:298
o2scl_hdf::gogny_load
void gogny_load(o2scl::eos_had_gogny &ge, std::string model, std::string filename="")
Read the Gogny EOS from a data file.
o2scl::eos_had_gogny
Gogny EOS.
Definition: eos_had_gogny.h:47
o2scl_hdf::skyrme_write
void skyrme_write(hdf_file &hf, o2scl::eos_had_skyrme &sk, std::string name)
Write a o2scl::eos_had_skyrme object to an HDF file.
o2scl_hdf
Additional functions to read and write EOS data to HDF5 files.
o2scl_hdf::eos_had_strings_list
void eos_had_strings_list()
List EOSs understood by eos_had_strings() .
o2scl::eos_had_skyrme
Skyrme hadronic equation of state.
Definition: eos_had_skyrme.h:226
o2scl_hdf::rmf_load
void rmf_load(o2scl::eos_had_rmf &rmf, std::string model, bool external=false)
Input a o2scl::eos_had_rmf object from an HDF file.
o2scl_hdf::eos_had_strings
o2scl::eos_had_base * eos_had_strings(std::string type, std::string name="")
Return a pointer to an eos_had_base object from two strings specifying type and name.
o2scl_hdf::skyrme_load
void skyrme_load(o2scl::eos_had_skyrme &sk, std::string model, bool external=false, int verbose=0)
Input a o2scl::eos_had_skyrme object from an HDF file.
o2scl::eos_had_base
Hadronic equation of state [abstract base].
Definition: eos_had_base.h:324

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