CHROMA
nef_fermact_params_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief NEF 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  OverMass= Real(0);
18  N5=1;
19  b5[0]=Real(1);
20  c5[0]=Real(1);
21  }
22 
23  //! Read parameters
24  NEFFermActParams::NEFFermActParams(XMLReader& xml, const std::string& path)
25  {
26  XMLReader paramtop(xml, path);
27  read(paramtop, "Mass", Mass);
28  read(paramtop, "OverMass", OverMass);
29  read(paramtop, "N5", N5);
30  read(paramtop, "b5", b5);
31  read(paramtop, "c5", c5);
32 
33  // For the regular Moebius there is 1 value of b5 and one of c5
34  // For the general one there is 1 per 5th-dim slice.
35  // Here I check that either the array is length N5
36  // or if it is length 1 (regular Moebius) I replicate
37  // the one value N5 times.
38 
39  if ( b5.size() != N5 ) {
40 
41  if ( b5.size() == 1 ) { // Only one value entered
42  Real b5_f = b5[0]; // get the value
43  b5.resize(N5); // resize array
44  for(int s=0; s < N5; s++) { // replicate
45  b5[s] = b5_f;
46  }
47  }
48  else {
49  // Not length=N5 and not length = 1: Bomb
50  QDPIO::cerr << "b5 must have either lenght 1 or N5" << std::endl;
51  QDP_abort(1);
52  }
53 
54  }
55 
56  // Repeat for c5
57  if ( c5.size() != N5 ) {
58 
59  if ( c5.size() == 1 ) { // Only one value entered
60  Real c5_f = c5[0]; // get the value
61  c5.resize(N5); // resize array
62  for(int s=0; s < N5; s++) { // replicate
63  c5[s] = c5_f;
64  }
65  }
66  else {
67  // Not length=N5 and not length = 1: Bomb
68  QDPIO::cerr << "b5 must have either lenght 1 or N5" << std::endl;
69  QDP_abort(1);
70  }
71  }
72 
73  }
74 
75  //! Read parameters
76  void read(XMLReader& xml, const std::string& path, NEFFermActParams& param)
77  {
78  NEFFermActParams tmp(xml, path);
79  param = tmp;
80  }
81 
82 
83  //! Write parameters
84  void write(XMLWriter& xml, const std::string& path, const NEFFermActParams& param)
85  {
86  push(xml, path);
87 
88  write(xml, "Mass", param.Mass);
89  write(xml, "OverMass", param.OverMass);
90  write(xml, "N5", param.N5);
91  write(xml, "b5", param.b5);
92  write(xml, "c5", param.c5);
93 
94  pop(xml);
95  }
96 
97 
98 }
99 
Primary include file for CHROMA library code.
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.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
pop(xml_out)
multi1d< LatticeFermion > s(Ncb)
::std::string string
Definition: gtest.h:1979
Parameters for Clover fermion action.
Various parameter structs and reader/writers.
Params for clover ferm acts.
NEFFermActParams()
Default constructor.