asqtad_fermact_s.cc

Go to the documentation of this file.
00001 // $Id: asqtad_fermact_s.cc,v 3.2 2006/11/17 02:17:31 edwards Exp $
00002 /*! \file
00003  *  \brief Asqtad staggered fermion action
00004  */
00005 // NEW $Id: asqtad_fermact_s.cc 2003/11/12 steve
00006 
00007 #include "chromabase.h"
00008 //#include "actions/ferm/linop/asqtad_linop_s.h"
00009 //#include "actions/ferm/fermacts/asqtad_fermact_s.h"
00010 //#include "actions/ferm/linop/lmdagm_s.h"
00011 
00012 #include "actions/ferm/fermacts/fermact_factory_s.h"
00013 #include "actions/ferm/fermstates/ferm_createstate_reader_s.h"
00014 
00015 #include "actions/ferm/linop/asqtad_mdagm_s.h"
00016 #include "actions/ferm/linop/asqtad_linop_s.h"
00017 #include "actions/ferm/fermacts/asqtad_fermact_s.h"
00018 #include "util/gauge/stag_phases_s.h"
00019 
00020 namespace Chroma 
00021 { 
00022 
00023   //! Hooks to register the class with the fermact factory
00024   namespace AsqtadFermActEnv
00025   {
00026     //! Callback function
00027     StaggeredTypeFermAct<LatticeStaggeredFermion,
00028                          multi1d<LatticeColorMatrix>,
00029                          multi1d<LatticeColorMatrix> >* createFermAct4D(XMLReader& xml_in,
00030                                                                         const std::string& path)
00031     {
00032       return new AsqtadFermAct(StaggeredCreateFermStateEnv::reader(xml_in, path), 
00033                                AsqtadFermActParams(xml_in, path));
00034     }
00035 
00036     //! Callback function
00037     /*! Differs in return type */
00038     FermionAction<LatticeStaggeredFermion,
00039                   multi1d<LatticeColorMatrix>,
00040                   multi1d<LatticeColorMatrix> >* createFermAct(XMLReader& xml_in,
00041                                                                const std::string& path)
00042     {
00043       return createFermAct4D(xml_in, path);
00044     }
00045 
00046     //! Name to be used
00047     const std::string name = "ASQTAD";
00048 
00049     //! Local registration flag
00050     static bool registered = false;
00051 
00052     //! Register all the factories
00053     bool registerAll() 
00054     {
00055       bool success = true; 
00056       if (! registered)
00057       {
00058         success &= Chroma::TheStagFermionActionFactory::Instance().registerObject(name, createFermAct);
00059         success &= Chroma::TheStagTypeFermActFactory::Instance().registerObject(name, createFermAct4D);
00060         registered = true;
00061       }
00062       return success;
00063     }
00064   }
00065 
00066 
00067   //! Produce a linear operator for this action
00068   /*!
00069    * \ingroup fermact
00070    *
00071    * The operator acts on the entire lattice
00072    *
00073    * \param u_fat, u_triple      fat7 and triple links    (Read)
00074    * \u has already had KS phases multiplied in.
00075    */
00076   EvenOddLinearOperator<LatticeStaggeredFermion,
00077                         multi1d<LatticeColorMatrix>,
00078                         multi1d<LatticeColorMatrix> >* 
00079   AsqtadFermAct::linOp(Handle< FermState<T,P,Q> > state) const
00080   {
00081 
00082     // Why in fact are we casting to the base class on both sides of
00083     // this assignment ? The answer is so that we can use a proxy.
00084     // Both the Proxy and the ConnectState inherit from the BaseClass
00085     // and can be cast to and from the base class. However the Proxy
00086     // and the connect state cannot be directly cast into each other.
00087     // Which is why we have a virtual base class in the first place.
00088     //
00089     // So We cast the ConnectState to an AsqtadConnectStateBase
00090     // This we can do at our leisure from either AsqtadConnectState
00091     // OR from the Proxy. We then get access to all the virtual methods
00092     // in the AsqtadConnectState. Only Restriction: We have to use the
00093     // get() methods as they are all the base class provides.
00094     return new AsqtadLinOp(state.cast<AsqtadConnectStateBase>(), param.Mass);
00095   }
00096 
00097   //! Produce a M^dag.M linear operator for this action
00098   /*!
00099    * \ingroup fermact
00100    *
00101    * The operator acts on the checkerboarded lattice
00102    *
00103    * \param u_fat, u_triple      fat7 and triple links         (Read)
00104    */
00105   DiffLinearOperator<LatticeStaggeredFermion, 
00106                      multi1d<LatticeColorMatrix>,
00107                      multi1d<LatticeColorMatrix> >* 
00108   AsqtadFermAct::lMdagM(Handle< FermState<T,P,Q> > state) const
00109   {
00110     return new AsqtadMdagM(state.cast<AsqtadConnectStateBase>(), param.Mass);
00111   }
00112 
00113 
00114   //! Create a state -- this multiplies in the K-S phases computes the fat and triple links etc
00115   AsqtadConnectStateBase*
00116   AsqtadFermAct::createState(const multi1d<LatticeColorMatrix>& u_) const
00117   {
00118     multi1d<LatticeColorMatrix> u_with_phases(Nd);
00119     multi1d<LatticeColorMatrix> u_fat(Nd);
00120     multi1d<LatticeColorMatrix> u_triple(Nd);
00121 
00122     // First put in the BC
00123     u_with_phases = u_;
00124     getFermBC().modify(u_with_phases);
00125 
00126     // Now multiply in phases
00127     //
00128     // alpha comes from the StagPhases:: namespace
00129     for(int i = 0; i < Nd; i++) { 
00130       u_with_phases[i] *= StagPhases::alpha(i);
00131     }
00132 
00133     // Make Fat7 and triple links
00134     Fat7_Links(u_with_phases, u_fat, param.u0);
00135     Triple_Links(u_with_phases, u_triple, param.u0);
00136 
00137     return new AsqtadConnectState(cfs->getFermBC(), u_with_phases, u_fat, u_triple);
00138   }
00139 
00140 } // End Namespace Chroma
00141 

Generated on Sun Nov 22 04:28:49 2009 for CHROMA by  doxygen 1.4.7