  This work is motivated by the study of local protein structure, which is
defined by two variable dihedral angles that take values from probability
distributions on the flat torus. Our goal is to provide the space
$\mathcal{P}(\mathbb{R}^2/\mathbb{Z}^2)$ with a metric that quantifies local
structural modifications due to changes in the protein sequence, and to define
associated two-sample goodness-of-fit testing approaches. Due to its
adaptability to the space geometry, we focus on the Wasserstein distance as a
metric between distributions.
  We extend existing results of the theory of Optimal Transport to the
$d$-dimensional flat torus $\mathbb{T}^d=\mathbb{R}^d/\mathbb{Z}^d$, in
particular a Central Limit Theorem. Moreover, we propose different approaches
for two-sample goodness-of-fit testing for the one and two-dimensional case,
based on the Wasserstein distance. We prove their validity and consistency. We
provide an implementation of these tests in \textsf{R}. Their performance is
assessed by numerical experiments on synthetic data and illustrated by an
application to protein structure data.
