CHROMA
param_io.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Various parameter readers/writers for main programs
3  */
4 
5 #include "chromabase.h"
6 #include "io/param_io.h"
7 
8 namespace Chroma
9 {
10 
11  //! Convert a Kappa to a mass
12  Real kappaToMass(const Real& Kappa)
13  {
14  return 1.0/(2*Kappa) - Nd;
15  }
16 
17 
18  //! Convert a Kappa to a mass
19  multi1d<Real> kappaToMass(const multi1d<Real>& Kappa)
20  {
21  multi1d<Real> Mass(Kappa.size());
22 
23  for(int i=0; i < Kappa.size(); ++i)
24  Mass[i] = 1.0/(2*Kappa[i]) - Nd;
25 
26  return Mass;
27  }
28 
29 
30  //! Convert a Kappa to a mass
31  Real massToKappa(const Real& Mass)
32  {
33  return 0.5/(Nd + Mass);
34  }
35 
36 
37  //! Convert a mass to a Kappa
38  multi1d<Real> massToKappa(const multi1d<Real>& Mass)
39  {
40  multi1d<Real> Kappa(Mass.size());
41 
42  for(int i=0; i < Kappa.size(); ++i)
43  Kappa[i] = 0.5/(Nd + Mass[i]);
44 
45  return Kappa;
46  }
47 
48 
49  //! Read the input version
50  void read(XMLReader& xml, const std::string& path, IO_version_t& param)
51  {
52  XMLReader paramtop(xml, path);
53 
54  read(paramtop, "version", param.version);
55  }
56 
57 
58 #if 0
59 
60 // THIS STUFF IS OBSOLETE AND WILL BE REMOVED!!!
61 //
62 // //! Read inverter parameters
63 // void read(XMLReader& xml, const std::string& path, InvertParam_t& param)
64 // {
65 // XMLReader paramtop(xml, path);
66 //
67 // try {
68 // read(paramtop, "invType", param.invType);
69 // read(paramtop, "RsdCG", param.RsdCG);
70 // read(paramtop, "MaxCG", param.MaxCG);
71 // param.MROver = 1;
72 //
73 // if( paramtop.count("RsdCGPrec") == 1 ) {
74 // read(paramtop, "RsdCGPrec", param.RsdCGPrec);
75 // }
76 // else {
77 // param.RsdCGPrec = param.RsdCG;
78 // }
79 //
80 // if( paramtop.count("MaxCGPrec") == 1 ) {
81 // read(paramtop, "MaxCGPrec", param.MaxCGPrec);
82 // }
83 // else {
84 // param.MaxCGPrec = param.MaxCG;
85 // }
86 //
87 // }
88 // catch( const std::string& e ) {
89 // QDPIO::cerr << "Caught exception : " << e << std::endl;
90 // QDP_abort(1);
91 // }
92 //
93 // }
94 //
95 // //! Read inverter parameters
96 // void read(XMLReader& xml, const std::string& path, MultiInvertParam_t& param)
97 // {
98 // XMLReader paramtop(xml, path);
99 //
100 // read(paramtop, "invType", param.invType);
101 // read(paramtop, "RsdCG", param.RsdCG);
102 // read(paramtop, "MaxCG", param.MaxCG);
103 //
104 // param.MROver = 1;
105 // }
106 //
107 //
108 // //---------------------------- Writers -----------------------------
109 // //! Write inverter parameters
110 // void write(XMLWriter& xml, const std::string& path, const InvertParam_t& param)
111 // {
112 // push(xml, path);
113 //
114 // write(xml, "invType", param.invType);
115 // write(xml, "RsdCG", param.RsdCG);
116 // write(xml, "MaxCG", param.MaxCG);
117 // write(xml, "MROver", param.MROver);
118 // write(xml, "RsdCGPrec", param.RsdCGPrec);
119 // write(xml, "MaxCGPrec", param.MaxCGPrec);
120 // pop(xml);
121 // }
122 //
123 // //! Write inverter parameters
124 // void write(XMLWriter& xml, const std::string& path, const MultiInvertParam_t& param)
125 // {
126 // push(xml, path);
127 //
128 // write(xml, "invType", param.invType);
129 // write(xml, "RsdCG", param.RsdCG);
130 // write(xml, "MaxCG", param.MaxCG);
131 // write(xml, "MROver", param.MROver);
132 //
133 // pop(xml);
134 // }
135 #endif
136 
137 
138 } // end namespace Chroma
Primary include file for CHROMA library code.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
Real massToKappa(const Real &Mass)
Convert a Kappa to a mass.
Definition: param_io.cc:31
Real kappaToMass(const Real &Kappa)
Convert a Kappa to a mass.
Definition: param_io.cc:12
Nd
Definition: meslate.cc:74
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
const WilsonTypeFermAct< multi1d< LatticeFermion > > Handle< const ConnectState > const multi1d< Real > & Mass
Definition: pbg5p_w.cc:29
int i
Definition: pbg5p_w.cc:55
::std::string string
Definition: gtest.h:1979
Various parameter structs and reader/writers.