CHROMA
t_hamiltonian.cc
Go to the documentation of this file.
1 #include "chroma.h"
2 
3 using namespace Chroma;
4 
5 //! To insure linking of code, place the registered code flags here
6 /*! This is the bit of code that dictates what fermacts are in use */
8 {
9  bool foo = true;
10 
11 
12  // GaugeBC's
15 
16  // GaugeActs
18 
19  // Gauge Monomials
21 
22  // 4D Ferm actions
24 
25  // 4D Ferm Monomials
27  return foo;
28 }
29 
30 
31 int main(int argc, char *argv[])
32 {
33  // Initialise QDP
34  Chroma::initialize(&argc, &argv);
35 
36  // Setup a small lattice
37  const int nrow_arr[] = {2, 2, 2, 2};
38  multi1d<int> nrow(Nd);
39  nrow=nrow_arr;
40  Layout::setLattSize(nrow);
41  Layout::create();
42 
43 
44  multi1d<LatticeColorMatrix> u(Nd);
45  {
46  XMLReader file_xml;
47  XMLReader config_xml;
48  Cfg_t foo; foo.cfg_type=CFG_TYPE_UNIT;;
49  // Cfg_t foo; foo.cfg_type=CFG_TYPE_SZIN; foo.cfg_file="./CFGIN";
50  gaugeStartup(file_xml, config_xml, u, foo);
51  }
52 
53  // Dump output
54  XMLFileWriter& xml_out = Chroma::getXMLOutputInstance();
55  XMLFileWriter& xml_log = Chroma::getXMLLogInstance();
56  push(xml_out, "t_gauge_ferm_monomials");
57  push(xml_log, "t_gauge_ferm_monomials");
58 
59  // Read Parameters
60  multi1d<int> boundary(Nd); // Ferm BC's
61  std::string monomial_name; // String for Factory
62  XMLReader param_in(Chroma::getXMLInputFileName());
63  // Snarf it all
64  XMLReader paramtop(param_in, "/HamiltonianTest");
65 
66 
68 
69  try {
70 
71  read(paramtop, "./Hamiltonian", H_handle);
72 
73  }
74  catch( const std::string& e) {
75  QDPIO::cerr << "Error Reading Hamiltonian " << e << std::endl;
76  QDP_abort(1);
77  }
78 
79  // Fictitious momenta for now
80  multi1d<LatticeColorMatrix> p(Nd);
81  for(int mu=0; mu<Nd; mu++) {
82  gaussian(p[mu]);
83  }
84 
85  // Create a field state
86  GaugeFieldState gauge_state(p,u);
87 
88  // Refresh Pseudofermions
89  H_handle->refreshInternalFields(gauge_state);
90 
91  // Compute Force from Monomial
92  multi1d<LatticeColorMatrix> dsdq(Nd);
93  H_handle->dsdq(dsdq, gauge_state);
94 
95  // Compute action from monomial
96  Double KE, PE;
97  H_handle->mesE(gauge_state, KE, PE);
98  QDPIO::cout << "KE = " << KE << " PE = " << PE << std::endl;
99 
100  pop(xml_log);
101  pop(xml_out);
102  xml_out.close();
103 
104  // Finish
106 
107  exit(0);
108 }
Primary include file for CHROMA in application codes.
Pure gauge field state.
Definition: field_state.h:83
Class for counted reference semantics.
Definition: handle.h:33
int mu
Definition: cool.cc:24
void read(XMLReader &xml, const std::string &path, AsqtadFermActParams &param)
Read parameters.
void gaugeStartup(XMLReader &gauge_file_xml, XMLReader &gauge_xml, multi1d< LatticeColorMatrix > &u, Cfg_t &cfg)
Initialize the gauge fields.
Nd
Definition: meslate.cc:74
bool registerAll()
Register all the factories.
bool registerAll()
Register all the factories.
bool registerAll()
Register all the factories.
bool registerAll()
Register all the factories.
bool registerAll()
Register all the factories.
Asqtad Staggered-Dirac operator.
Definition: klein_gord.cc:10
gaussian(aux)
XMLFileWriter & getXMLLogInstance()
Get xml log instance.
Definition: chroma_init.cc:378
static multi1d< LatticeColorMatrix > u
push(xml_out,"Condensates")
void initialize(int *argc, char ***argv)
Chroma initialisation routine.
Definition: chroma_init.cc:114
void finalize(void)
Chroma finalization routine.
Definition: chroma_init.cc:308
std::string getXMLInputFileName()
Get input file name.
Definition: chroma_init.cc:88
pop(xml_out)
XMLFileWriter & getXMLOutputInstance()
Get xml output instance.
Definition: chroma_init.cc:359
FloatingPoint< double > Double
Definition: gtest.h:7351
::std::string string
Definition: gtest.h:1979
Gauge configuration structure.
Definition: cfgtype_io.h:16
CfgType cfg_type
Definition: cfgtype_io.h:17
bool linkage_hack()
To insure linking of code, place the registered code flags here.
Definition: t_hamiltonian.cc:7
int main(int argc, char *argv[])