Modified kernel function to include periodic and locally periodic kernels