2018-01-14 22:03:14 +00:00
|
|
|
/*************************************************************************************
|
2016-01-02 14:51:32 +00:00
|
|
|
|
|
|
|
Grid physics library, www.github.com/paboyle/Grid
|
|
|
|
|
|
|
|
Source file: ./lib/qcd/utils/CovariantCshift.h
|
|
|
|
|
|
|
|
Copyright (C) 2015
|
|
|
|
|
|
|
|
Author: Azusa Yamaguchi <ayamaguc@staffmail.ed.ac.uk>
|
|
|
|
Author: paboyle <paboyle@ph.ed.ac.uk>
|
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
(at your option) any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License along
|
|
|
|
with this program; if not, write to the Free Software Foundation, Inc.,
|
|
|
|
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
|
|
|
|
|
|
See the full license in the file "LICENSE" in the top level distribution directory
|
2018-01-14 22:03:14 +00:00
|
|
|
*************************************************************************************/
|
|
|
|
/* END LEGAL */
|
2015-06-05 10:02:36 +01:00
|
|
|
#ifndef QCD_UTILS_COVARIANT_CSHIFT_H
|
|
|
|
#define QCD_UTILS_COVARIANT_CSHIFT_H
|
2016-01-02 13:37:25 +00:00
|
|
|
|
2018-01-14 22:03:14 +00:00
|
|
|
NAMESPACE_BEGIN(Grid);
|
|
|
|
|
2015-06-05 10:02:36 +01:00
|
|
|
////////////////////////////////////////////////////////////////////////
|
|
|
|
// Low performance implementation of CovariantCshift API
|
|
|
|
////////////////////////////////////////////////////////////////////////
|
2015-12-29 19:22:59 +00:00
|
|
|
// Make these members of an Impl class for BC's.
|
2016-01-02 13:37:25 +00:00
|
|
|
|
|
|
|
namespace PeriodicBC {
|
|
|
|
|
|
|
|
template<class covariant,class gauge> Lattice<covariant> CovShiftForward(const Lattice<gauge> &Link,
|
2018-01-14 22:03:14 +00:00
|
|
|
int mu,
|
|
|
|
const Lattice<covariant> &field)
|
2016-01-02 13:37:25 +00:00
|
|
|
{
|
|
|
|
return Link*Cshift(field,mu,1);// moves towards negative mu
|
|
|
|
}
|
|
|
|
template<class covariant,class gauge> Lattice<covariant> CovShiftBackward(const Lattice<gauge> &Link,
|
|
|
|
int mu,
|
|
|
|
const Lattice<covariant> &field)
|
|
|
|
{
|
2018-01-27 00:04:12 +00:00
|
|
|
Lattice<covariant> tmp(field.Grid());
|
2016-01-02 13:37:25 +00:00
|
|
|
tmp = adj(Link)*field;
|
|
|
|
return Cshift(tmp,mu,-1);// moves towards positive mu
|
|
|
|
}
|
2015-06-05 10:02:36 +01:00
|
|
|
}
|
2016-01-02 13:37:25 +00:00
|
|
|
|
|
|
|
|
2016-01-03 01:38:11 +00:00
|
|
|
namespace ConjugateBC {
|
2016-01-02 13:37:25 +00:00
|
|
|
|
|
|
|
// Must give right answers across boundary
|
|
|
|
// <----
|
|
|
|
// --
|
|
|
|
// | |
|
|
|
|
// xxxxxxxxxxxxxxxxxxxx
|
|
|
|
// | |
|
|
|
|
//
|
|
|
|
// Stap= Cshift(GImpl::CovShiftForward(U[nu],nu,
|
|
|
|
// GImpl::CovShiftForward(U[nu],nu,
|
|
|
|
// GImpl::CovShiftBackward(U[mu],mu,
|
|
|
|
// GImpl::CovShiftBackward(U[nu],nu,
|
|
|
|
// GImpl::CovShiftIdentityBackward(U[nu],nu,-1))))) , mu, 1);
|
|
|
|
//
|
|
|
|
// U U^* U^* U^T U^adj = U (U U U^dag U^T )^*
|
|
|
|
// = U (U U U^dag)^* ( U^T )^*
|
|
|
|
//
|
2018-01-24 13:14:09 +00:00
|
|
|
// So covariant shift rule: Conjugate inward shifted plane when crossing boundary applies.
|
2016-01-02 13:37:25 +00:00
|
|
|
//
|
2018-01-24 13:14:09 +00:00
|
|
|
// This Conjugate should be applied to BOTH the link and the covariant field on backward shift
|
2016-01-02 13:37:25 +00:00
|
|
|
// boundary wrap.
|
|
|
|
//
|
|
|
|
// | |
|
|
|
|
// xxxxxxxxxxxxxxxxx
|
2018-01-24 13:14:09 +00:00
|
|
|
// | | <---- this link is Conjugated, and the path leading into it. Segment crossing in and out is double Conjugated.
|
2016-01-02 13:37:25 +00:00
|
|
|
// --
|
|
|
|
// ------->
|
|
|
|
template<class covariant,class gauge> Lattice<covariant> CovShiftForward(const Lattice<gauge> &Link,
|
2018-01-14 22:03:14 +00:00
|
|
|
int mu,
|
|
|
|
const Lattice<covariant> &field)
|
2016-01-02 13:37:25 +00:00
|
|
|
{
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase * grid = Link.Grid();
|
2016-01-02 13:37:25 +00:00
|
|
|
|
|
|
|
int Lmu = grid->GlobalDimensions()[mu]-1;
|
|
|
|
|
|
|
|
conformable(field,Link);
|
|
|
|
|
|
|
|
Lattice<iScalar<vInteger> > coor(grid); LatticeCoordinate(coor,mu);
|
|
|
|
|
2018-03-07 16:54:11 +00:00
|
|
|
Lattice<covariant> field_bc = Cshift(field,mu,1);// moves towards negative mu;
|
2016-01-02 13:37:25 +00:00
|
|
|
|
2018-03-07 16:54:11 +00:00
|
|
|
field_bc = where(coor==Lmu,conjugate(field_bc),field_bc);
|
|
|
|
// std::cout<<"Gparity::CovCshiftForward mu="<<mu<<std::endl;
|
|
|
|
return Link*field_bc;
|
2016-01-02 13:37:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
template<class covariant,class gauge> Lattice<covariant> CovShiftBackward(const Lattice<gauge> &Link,
|
|
|
|
int mu,
|
|
|
|
const Lattice<covariant> &field)
|
|
|
|
{
|
2018-01-27 00:04:12 +00:00
|
|
|
GridBase * grid = field.Grid();
|
2016-01-02 13:37:25 +00:00
|
|
|
|
|
|
|
int Lmu = grid->GlobalDimensions()[mu]-1;
|
|
|
|
|
|
|
|
conformable(field,Link);
|
|
|
|
|
|
|
|
Lattice<iScalar<vInteger> > coor(grid); LatticeCoordinate(coor,mu);
|
|
|
|
|
2018-03-07 16:54:11 +00:00
|
|
|
Lattice<covariant> tmp(grid);
|
2018-03-06 12:13:26 +00:00
|
|
|
|
2018-03-07 16:54:11 +00:00
|
|
|
tmp = adj(Link)*field;
|
|
|
|
tmp = where(coor==Lmu,conjugate(tmp),tmp);
|
|
|
|
// std::cout<<"Gparity::CovCshiftBackward mu="<<mu<<std::endl;
|
|
|
|
return Cshift(tmp,mu,-1);// moves towards positive mu
|
2016-01-02 13:37:25 +00:00
|
|
|
}
|
|
|
|
|
2015-06-05 10:02:36 +01:00
|
|
|
}
|
2015-12-29 19:22:59 +00:00
|
|
|
|
2016-01-02 13:37:25 +00:00
|
|
|
|
2018-01-14 22:03:14 +00:00
|
|
|
NAMESPACE_END(Grid);
|
2015-06-05 10:19:42 +01:00
|
|
|
#endif
|