CHROMA
twisted_fermbc_w.cc
Go to the documentation of this file.
1 /*! \file
2  * \brief Simple fermionic BC
3  */
4 
7 
8 namespace Chroma
9 {
10 
11  // Readers and writerss for the params
12  //! Read parameters
14  {
15  XMLReader paramtop(xml, path);
16 
17  // The BASE Simple BC boundary
18  read(paramtop, "boundary", boundary);
19  read(paramtop, "phases_by_pi", phases_by_pi);
20  read(paramtop, "phases_dir", phases_dir);
21 
22  if( boundary.size() != Nd ) {
23  QDPIO::cerr << "TwistedFermBCParams: Invalid size for boundary. Should be " << Nd << " but is " << boundary.size() << std::endl;
24  QDP_abort(1);
25  }
26 
27  if( phases_by_pi.size() != (Nd-1) ) {
28  QDPIO::cerr << "TwistedFermBCParams: Invalid size for phases_by_pi. Should be " << Nd-1 << " but is " << phases_by_pi.size() << std::endl;
29  QDP_abort(1);
30  }
31 
32  if( phases_dir.size() != (Nd-1) ) {
33  QDPIO::cerr << "TwistedFermBCParams: Invalid size for phases_dir. Should be " << Nd-1 << " but is " << phases_dir.size() << std::endl;
34  QDP_abort(1);
35  }
36 
37  for(int i=0; i < Nd-1; i++) {
38  if( toBool( phases_dir[i] < 0 || phases_dir[i] > Nd-1 ) ) {
39  QDPIO::cerr << "Invalid value in phases_dir, direction " << i << " should be between 0 and " << Nd-1 << " but is " << phases_dir[i] << std::endl;
40  }
41  }
42 
43  }
44 
45  //! Read parameters
46  void read(XMLReader& xml, const std::string& path, TwistedFermBCParams& param)
47  {
48  TwistedFermBCParams tmp(xml, path);
49  param = tmp;
50  }
51 
52  //! Write parameters
53  void write(XMLWriter& xml_out, const std::string& path, const TwistedFermBCParams& param)
54  {
55  if ( path != "." )
56  push(xml_out, path);
57 
58  write(xml_out, "FermBC", WilsonTypeTwistedFermBCEnv::name);
59  write(xml_out, "boundary", param.boundary);
60  write(xml_out, "phases_by_pi", param.phases_by_pi);
61  write(xml_out, "phases_dir", param.phases_dir);
62 
63  if( path != "." )
64  pop(xml_out);
65  }
66 
67 
68  //! Name and registration
69  namespace WilsonTypeTwistedFermBCEnv
70  {
71  //! Callback function
72  FermBC<LatticeFermion,
73  multi1d<LatticeColorMatrix>,
74  multi1d<LatticeColorMatrix> >* createFermBC(XMLReader& xml_in, const std::string& path)
75  {
76  TwistedFermBCParams bc(xml_in, path);
77  return new TwistedFermBC<LatticeFermion>(bc.boundary,
78  bc.phases_by_pi,
79  bc.phases_dir);
80  }
81 
82  //! Name to be used
83  const std::string name = "TWISTED_FERMBC";
84 
85  static bool registered = false;
86 
87  //! Register all the factories
88  // Register all objects
89  bool registerAll()
90  {
91  bool success = true;
92  if (! registered)
93  {
95  registered = true;
96  }
97  return success;
98  }
99  }
100 }
Base class for all fermion action boundary conditions.
Definition: fermbc.h:20
static T & Instance()
Definition: singleton.h:432
Concrete class for all fermionic actions with twisted boundary conditions.
Fermion Boundary Condition factories.
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.
multi1d< int > bc
Nd
Definition: meslate.cc:74
FermBC< LatticeFermion, multi1d< LatticeColorMatrix >, multi1d< LatticeColorMatrix > > * createFermBC(XMLReader &xml_in, const std::string &path)
Callback function.
bool registerAll()
Register all the factories.
const std::string name
Name to be used.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
LatticeFermion tmp
Definition: mespbg5p_w.cc:36
push(xml_out,"Condensates")
int i
Definition: pbg5p_w.cc:55
pop(xml_out)
::std::string string
Definition: gtest.h:1979
Params struct for twisted params.
Twisted fermionic BC.