CHROMA
clover_fermact_params_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Clover fermion action parameters
3  */
4 
5 #include "chromabase.h"
7 
8 #include "io/param_io.h"
9 
10 namespace Chroma
11 {
12 
13  //! Default constructor
15  {
16  Mass = Real(0);
17  u0 = Real(1);
18  clovCoeffR = clovCoeffT = Real(0);
19  max_norm=0;
20  max_norm_usedP=false;
21  twisted_m_usedP = false;
22  twisted_m = Real(0);
23 
24  }
25 
26  //! Read parameters
28  {
29  XMLReader paramtop(xml, path);
30 
31  // Read the stuff for the action
32  if (paramtop.count("Mass") != 0)
33  {
34  read(paramtop, "Mass", Mass);
35  if (paramtop.count("Kappa") != 0)
36  {
37  QDPIO::cerr << "Error: found both a Kappa and a Mass tag" << std::endl;
38  QDP_abort(1);
39  }
40  }
41  else if (paramtop.count("Kappa") != 0)
42  {
43  Real Kappa;
44  read(paramtop, "Kappa", Kappa);
45  Mass = kappaToMass(Kappa); // Convert Kappa to Mass
46  QDPIO::cout << "Kappa is " << Kappa << " Mass is " << Mass << std::endl << std::flush;
47  }
48  else
49  {
50  QDPIO::cerr << "Error: neither Mass or Kappa found" << std::endl;
51  QDP_abort(1);
52  }
53 
54  // Read optional u0
55  if (paramtop.count("u0") != 0)
56  read(paramtop, "u0", u0);
57  else {
58  u0 = Real(1);
59  QDPIO::cout << "u0 is " << u0 << std::endl << std::flush;
60  }
61  // Read optional anisoParam
62  if (paramtop.count("AnisoParam") != 0)
63  read(paramtop, "AnisoParam", anisoParam);
64 
65  // If aniso, read all clover coeff
66  if (anisoParam.anisoP)
67  {
68  read(paramtop, "clovCoeffR", clovCoeffR);
69  read(paramtop, "clovCoeffT", clovCoeffT);
70  }
71  else
72  {
73  Real clovCoeff;
74  read(paramtop, "clovCoeff", clovCoeff);
75  clovCoeffR = clovCoeff;
76  clovCoeffT = clovCoeff;
77  }
78 
79  if( paramtop.count("MaxNorm") != 0 ){
80  read(paramtop, "MaxNorm", max_norm);
81  QDPIO::cout << "MaxNorm="<<max_norm<<std::endl;
82  max_norm_usedP=true;
83  }
84  else {
85  max_norm_usedP=false;
86  max_norm=Real(0);
87  }
88 
89 
90 
91  if( paramtop.count("TwistedM") != 0 ) {
92  twisted_m_usedP = true;
93  read(paramtop, "TwistedM", twisted_m);
94  }
95  else {
96  twisted_m_usedP = false;
97  }
98 
99  }
100 
101  //! Read parameters
102  void read(XMLReader& xml, const std::string& path, CloverFermActParams& param)
103  {
104  CloverFermActParams tmp(xml, path);
105  param = tmp;
106  }
107 
108 
109  //! Write parameters
110  void write(XMLWriter& xml, const std::string& path, const CloverFermActParams& param)
111  {
112  push(xml, path);
113 
114  write(xml, "Mass", param.Mass);
115  write(xml, "u0", param.u0);
116 
117  if (param.anisoParam.anisoP)
118  {
119  write(xml, "clovCoeffR", param.clovCoeffR);
120  write(xml, "clovCoeffT", param.clovCoeffT);
121  }
122  else
123  {
124  write(xml, "clovCoeff", param.clovCoeffR);
125  }
126 
127  if (param.max_norm_usedP){
128  write(xml, "MaxNorm", param.max_norm);
129  }
130 
131 
132  if (param.twisted_m_usedP == true ) {
133  write(xml, "TwistedM", param.twisted_m);
134  }
135 
136  pop(xml);
137  }
138 
139 
140 }
141 
Primary include file for CHROMA library code.
Parameters for Clover fermion action.
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void write(XMLWriter &xml, const std::string &path, const AsqtadFermActParams &param)
Writer parameters.
Real kappaToMass(const Real &Kappa)
Convert a Kappa to a mass.
Definition: param_io.cc:12
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
pop(xml_out)
::std::string string
Definition: gtest.h:1979
Various parameter structs and reader/writers.
Params for clover ferm acts.
CloverFermActParams()
Default constructor.