gauge_startup.cc

Go to the documentation of this file.
00001 // $Id: gauge_startup.cc,v 3.5 2009/05/13 13:12:19 edwards Exp $
00002 /*! \file
00003  *  \brief Initialize the gauge fields
00004  */
00005 
00006 #include "chromabase.h"
00007 #include "util/gauge/gauge_startup.h"
00008 #include "util/gauge/reunit.h"
00009 
00010 #include "qdp_iogauge.h"
00011 #include "io/param_io.h"
00012 #include "io/gauge_io.h"
00013 #include "io/readszin.h"
00014 #include "io/readmilc.h"
00015 #include "io/kyugauge_io.h"
00016 #include "io/readcppacs.h"
00017 
00018 #include "util/gauge/hotst.h"
00019 #include "util/gauge/weak_field.h"
00020 
00021 #include "actions/gauge/gaugebcs/schr_nonpert_gaugebc.h"
00022 
00023 namespace Chroma 
00024 {
00025 
00026   //! Initialize the gauge fields
00027   /*!
00028    * \ingroup gauge
00029    *
00030    * \param gauge_file_xml  File xml
00031    * \param gauge_xml       Record xml
00032    * \param u               Gauge fields
00033    * \param cfg             Configuration structure
00034    */
00035   void gaugeStartup(XMLReader& gauge_file_xml,
00036                     XMLReader& gauge_xml,
00037                     multi1d<LatticeColorMatrix>& u,
00038                     Cfg_t& cfg)
00039   {
00040     START_CODE();
00041 
00042     u.resize(Nd);
00043 
00044     switch (cfg.cfg_type) 
00045     {
00046     case CFG_TYPE_SZIN :
00047       readSzin(gauge_xml, u, cfg.cfg_file);
00048       break;
00049 
00050     case CFG_TYPE_SZINQIO:
00051     case CFG_TYPE_SCIDAC:
00052       readGauge(gauge_file_xml, gauge_xml, u, cfg.cfg_file, QDPIO_SERIAL);
00053       break;
00054 
00055     case CFG_TYPE_NERSC:
00056       readArchiv(gauge_xml, u, cfg.cfg_file);
00057       break;
00058   
00059     case CFG_TYPE_MILC:
00060       readMILC(gauge_xml, u, cfg.cfg_file);
00061       break;
00062 
00063     case CFG_TYPE_CPPACS :
00064       readCPPACS(gauge_xml, u, cfg.cfg_file);
00065       break;
00066 
00067     case CFG_TYPE_KYU:
00068     {
00069       readKYU(u, cfg.cfg_file);
00070 
00071       XMLBufferWriter file_xml, record_xml;
00072       push(file_xml, "gauge");
00073       write(file_xml, "id", int(0));
00074       pop(file_xml);
00075       push(record_xml, "kentucky");
00076       pop(record_xml);
00077 
00078       gauge_file_xml.open(file_xml);
00079       gauge_xml.open(record_xml);
00080     }
00081     break;
00082 
00083     case CFG_TYPE_DISORDERED:
00084     {
00085       QDPIO::cout << "Starting up disordered (random/hot) config" << endl;
00086       HotSt(u);
00087 
00088       XMLBufferWriter file_xml, record_xml;
00089       push(file_xml, "gauge");
00090       write(file_xml, "id", int(0));
00091       pop(file_xml);
00092       push(record_xml, "disordered");
00093       pop(record_xml);
00094 
00095       gauge_file_xml.open(file_xml);
00096       gauge_xml.open(record_xml);
00097     }
00098     break;
00099 
00100     case CFG_TYPE_UNIT:
00101     {
00102       QDPIO::cout << "Starting up unit gauge (free) config" << endl;
00103       u = 1;
00104 
00105       XMLBufferWriter file_xml, record_xml;
00106       push(file_xml, "gauge");
00107       write(file_xml, "id", int(0));
00108       pop(file_xml);
00109       push(record_xml, "unit");
00110       pop(record_xml);
00111 
00112       gauge_file_xml.open(file_xml);
00113       gauge_xml.open(record_xml);
00114     }
00115     break; 
00116 
00117     case CFG_TYPE_WEAK_FIELD:
00118     {
00119       QDPIO::cout << "Starting up a weak field config" << endl;
00120       weakField(u);
00121 
00122       XMLBufferWriter file_xml, record_xml;
00123       push(file_xml, "gauge");
00124       write(file_xml, "id", int(0));
00125       pop(file_xml);
00126       push(record_xml, "weak_field");
00127       pop(record_xml);
00128 
00129       gauge_file_xml.open(file_xml);
00130       gauge_xml.open(record_xml);
00131     }
00132     break; 
00133 
00134     case CFG_TYPE_CLASSICAL_SF:
00135     {
00136       QDPIO::cout << "Starting up a classical Schroedinger functional config" << endl;
00137       SchrGaugeBCParams params;
00138       params.loop_extent = 1;
00139       params.SchrPhiMult = 1;
00140       params.decay_dir   = Nd-1;
00141       SchrNonPertGaugeBC gaugebc(params);
00142       
00143       u = gaugebc.SFBndFld();
00144 
00145       XMLBufferWriter file_xml, record_xml;
00146       push(file_xml, "gauge");
00147       write(file_xml, "id", int(0));
00148       pop(file_xml);
00149       write(record_xml, "SF_classical", params);
00150 
00151       gauge_file_xml.open(file_xml);
00152       gauge_xml.open(record_xml);
00153     }
00154     break; 
00155 
00156     default:
00157       QDPIO::cerr << __func__ << ": Configuration type is unsupported." << endl;
00158       QDP_abort(1);
00159     }
00160 
00161     // Reunitarize gauge field (eg for Double prec?)
00162     // This should get rid of those pesky big Delta H's 
00163     // going from single to double and they can't possibly hurt
00164     // in either single or double
00165     for(int mu=0; mu < Nd; mu++){ 
00166       reunit(u[mu]);
00167     }
00168 
00169 
00170     END_CODE();
00171   }
00172 
00173 }  // end namespace Chroma

Generated on Sun Nov 22 04:29:21 2009 for CHROMA by  doxygen 1.4.7