mirror of
				https://github.com/paboyle/Grid.git
				synced 2025-11-04 05:54:32 +00:00 
			
		
		
		
	Hadrons: beware of the nasty uninitialised twists
This commit is contained in:
		@@ -112,8 +112,6 @@ void TDWF<FImpl>::setup(void)
 | 
			
		||||
                 << par().mass << ", M5= " << par().M5 << " and Ls= "
 | 
			
		||||
                 << par().Ls << " using gauge field '" << par().gauge << "'"
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << par().boundary
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
                 
 | 
			
		||||
    auto &U    = envGet(GaugeField, par().gauge);
 | 
			
		||||
    auto &g4   = *envGetGrid(FermionField);
 | 
			
		||||
@@ -121,8 +119,26 @@ void TDWF<FImpl>::setup(void)
 | 
			
		||||
    auto &g5   = *envGetGrid(FermionField, par().Ls);
 | 
			
		||||
    auto &grb5 = *envGetRbGrid(FermionField, par().Ls);
 | 
			
		||||
    typename DomainWallFermion<FImpl>::ImplParams implParams;
 | 
			
		||||
    implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    if (!par().boundary.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    }
 | 
			
		||||
    if (!par().twist.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    }
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << implParams.boundary_phases
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LOG(Message) << "Twists: " << implParams.twist_n_2pi_L
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    if (implParams.boundary_phases.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of boundary phase");
 | 
			
		||||
    }
 | 
			
		||||
    if (implParams.twist_n_2pi_L.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of twist");
 | 
			
		||||
    }
 | 
			
		||||
    envCreateDerived(FMat, DomainWallFermion<FImpl>, getName(), par().Ls, U, g5,
 | 
			
		||||
                     grb5, g4, grb4, par().mass, par().M5, implParams);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -112,17 +112,33 @@ void TMobiusDWF<FImpl>::setup(void)
 | 
			
		||||
                 << ", b= " << par().b << ", c= " << par().c
 | 
			
		||||
                 << " using gauge field '" << par().gauge << "'"
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << par().boundary
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
 | 
			
		||||
                 
 | 
			
		||||
    auto &U    = envGet(GaugeField, par().gauge);
 | 
			
		||||
    auto &g4   = *envGetGrid(FermionField);
 | 
			
		||||
    auto &grb4 = *envGetRbGrid(FermionField);
 | 
			
		||||
    auto &g5   = *envGetGrid(FermionField, par().Ls);
 | 
			
		||||
    auto &grb5 = *envGetRbGrid(FermionField, par().Ls);
 | 
			
		||||
    typename MobiusFermion<FImpl>::ImplParams implParams;
 | 
			
		||||
    implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    if (!par().boundary.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    }
 | 
			
		||||
    if (!par().twist.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    }
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << implParams.boundary_phases
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LOG(Message) << "Twists: " << implParams.twist_n_2pi_L
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    if (implParams.boundary_phases.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of boundary phase");
 | 
			
		||||
    }
 | 
			
		||||
    if (implParams.twist_n_2pi_L.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of twist");
 | 
			
		||||
    }
 | 
			
		||||
    envCreateDerived(FMat, MobiusFermion<FImpl>, getName(), par().Ls, U, g5,
 | 
			
		||||
                     grb5, g4, grb4, par().mass, par().M5, par().b, par().c,
 | 
			
		||||
                     implParams);
 | 
			
		||||
 
 | 
			
		||||
@@ -111,8 +111,6 @@ void TScaledDWF<FImpl>::setup(void)
 | 
			
		||||
                 << ", scale= " << par().scale
 | 
			
		||||
                 << " using gauge field '" << par().gauge << "'"
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << par().boundary
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
 | 
			
		||||
    auto &U    = envGet(GaugeField, par().gauge);
 | 
			
		||||
    auto &g4   = *envGetGrid(FermionField);
 | 
			
		||||
@@ -120,8 +118,26 @@ void TScaledDWF<FImpl>::setup(void)
 | 
			
		||||
    auto &g5   = *envGetGrid(FermionField, par().Ls);
 | 
			
		||||
    auto &grb5 = *envGetRbGrid(FermionField, par().Ls);
 | 
			
		||||
    typename ScaledShamirFermion<FImpl>::ImplParams implParams;
 | 
			
		||||
    implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    if (!par().boundary.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    }
 | 
			
		||||
    if (!par().twist.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    }
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << implParams.boundary_phases
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LOG(Message) << "Twists: " << implParams.twist_n_2pi_L
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    if (implParams.boundary_phases.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of boundary phase");
 | 
			
		||||
    }
 | 
			
		||||
    if (implParams.twist_n_2pi_L.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of twist");
 | 
			
		||||
    }
 | 
			
		||||
    envCreateDerived(FMat, ScaledShamirFermion<FImpl>, getName(), par().Ls, U, g5,
 | 
			
		||||
                     grb5, g4, grb4, par().mass, par().M5, par().scale,
 | 
			
		||||
                     implParams);
 | 
			
		||||
 
 | 
			
		||||
@@ -109,15 +109,31 @@ void TWilson<FImpl>::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    LOG(Message) << "Setting up Wilson fermion matrix with m= " << par().mass
 | 
			
		||||
                 << " using gauge field '" << par().gauge << "'" << std::endl;
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << par().boundary
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
                 
 | 
			
		||||
    auto &U      = envGet(GaugeField, par().gauge);
 | 
			
		||||
    auto &grid   = *envGetGrid(FermionField);
 | 
			
		||||
    auto &gridRb = *envGetRbGrid(FermionField);
 | 
			
		||||
    typename WilsonFermion<FImpl>::ImplParams implParams;
 | 
			
		||||
    implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    if (!par().boundary.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    }
 | 
			
		||||
    if (!par().twist.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    }
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << implParams.boundary_phases
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LOG(Message) << "Twists: " << implParams.twist_n_2pi_L
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    if (implParams.boundary_phases.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of boundary phase");
 | 
			
		||||
    }
 | 
			
		||||
    if (implParams.twist_n_2pi_L.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of twist");
 | 
			
		||||
    }
 | 
			
		||||
    envCreateDerived(FMat, WilsonFermion<FImpl>, getName(), 1, U, grid, gridRb,
 | 
			
		||||
                     par().mass, implParams);
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -112,17 +112,34 @@ void TWilsonClover<FImpl>::setup(void)
 | 
			
		||||
{
 | 
			
		||||
    LOG(Message) << "Setting up Wilson clover fermion matrix with m= " << par().mass
 | 
			
		||||
                 << " using gauge field '" << par().gauge << "'" << std::endl;
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << par().boundary 
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LOG(Message) << "Clover term csw_r: " << par().csw_r
 | 
			
		||||
                 << " csw_t: " << par().csw_t
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
                 
 | 
			
		||||
    auto &U      = envGet(GaugeField, par().gauge);
 | 
			
		||||
    auto &grid   = *envGetGrid(FermionField);
 | 
			
		||||
    auto &gridRb = *envGetRbGrid(FermionField);
 | 
			
		||||
    typename WilsonCloverFermion<FImpl>::ImplParams implParams;
 | 
			
		||||
    implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    if (!par().boundary.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    }
 | 
			
		||||
    if (!par().twist.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    }
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << implParams.boundary_phases
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LOG(Message) << "Twists: " << implParams.twist_n_2pi_L
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    if (implParams.boundary_phases.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of boundary phase");
 | 
			
		||||
    }
 | 
			
		||||
    if (implParams.twist_n_2pi_L.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of twist");
 | 
			
		||||
    }
 | 
			
		||||
    envCreateDerived(FMat, WilsonCloverFermion<FImpl>, getName(), 1, U, grid,
 | 
			
		||||
                     gridRb, par().mass, par().csw_r, par().csw_t, 
 | 
			
		||||
                     par().clover_anisotropy, implParams); 
 | 
			
		||||
 
 | 
			
		||||
@@ -118,10 +118,7 @@ void TZMobiusDWF<FImpl>::setup(void)
 | 
			
		||||
    {
 | 
			
		||||
        LOG(Message) << "  omega[" << i << "]= " << par().omega[i] << std::endl;
 | 
			
		||||
    }
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << par().boundary
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
 | 
			
		||||
    env().createGrid(par().Ls);
 | 
			
		||||
    auto &U    = envGet(GaugeField, par().gauge);
 | 
			
		||||
    auto &g4   = *envGetGrid(FermionField);
 | 
			
		||||
    auto &grb4 = *envGetRbGrid(FermionField);
 | 
			
		||||
@@ -129,8 +126,26 @@ void TZMobiusDWF<FImpl>::setup(void)
 | 
			
		||||
    auto &grb5 = *envGetRbGrid(FermionField, par().Ls);
 | 
			
		||||
    auto omega = par().omega;
 | 
			
		||||
    typename ZMobiusFermion<FImpl>::ImplParams implParams;
 | 
			
		||||
    implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    if (!par().boundary.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.boundary_phases = strToVec<Complex>(par().boundary);
 | 
			
		||||
    }
 | 
			
		||||
    if (!par().twist.empty())
 | 
			
		||||
    {
 | 
			
		||||
        implParams.twist_n_2pi_L   = strToVec<Real>(par().twist);
 | 
			
		||||
    }
 | 
			
		||||
    LOG(Message) << "Fermion boundary conditions: " << implParams.boundary_phases
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    LOG(Message) << "Twists: " << implParams.twist_n_2pi_L
 | 
			
		||||
                 << std::endl;
 | 
			
		||||
    if (implParams.boundary_phases.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of boundary phase");
 | 
			
		||||
    }
 | 
			
		||||
    if (implParams.twist_n_2pi_L.size() != env().getNd())
 | 
			
		||||
    {
 | 
			
		||||
        HADRONS_ERROR(Size, "Wrong number of twist");
 | 
			
		||||
    }
 | 
			
		||||
    envCreateDerived(FMat, ZMobiusFermion<FImpl>, getName(), par().Ls, U, g5,
 | 
			
		||||
                     grb5, g4, grb4, par().mass, par().M5, omega,
 | 
			
		||||
                     par().b, par().c, implParams);
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user