[Tex/LaTex] How to plot a lattice of points on the surface of a torus

diagramsgraphicspgfplotspstrickstikz-pgf

I am doing a report on the Ising model, without going into the complex details of the model, in its two-dimensional form it involves a lattice of points.

Lattice of Points

Which, when periodic boundary conditions are imposed can be though of as on a torus.

For clarification, what I mean by "periodic boundary conditions" is that the right neighbour to a point in the far right column is a point in the far left column in the same row, and the bottom neighbour to a point in the bottom row is a point in the top row in the same column.

Torus

Therefore, what I want to do is plot a grid on a torus, and place dots on that grid.

I also eventually want to place arrows going from one point to the next on the torus, as I did here for the lattice:

Sweep through lattice

I'm just having a lot of trouble trying to put it all together. How can this be achieved with Tikz? If not with Tikz, then how can be achieved at all?

Thank you in advance for any answers or comments.

I've done a fair bit of research on drawing a torus:

And a few other things:

And if it helps, here is the source code to the drawings I made in this post:

\begin{tikzpicture}
    \clip (-1,-1) rectangle (6cm,6cm); 
    \draw[style=help lines,thick] (0,0) grid[step=.5cm] (5,5);

    \foreach \x in {0,1,...,10}
    {
        \foreach \y in {0,1,...,10}
        {
            \node[draw,circle,inner sep=2pt,fill] at (.5*\x,.5*\y) {};
        }
    }
\end{tikzpicture}

and…

\begin{tikzpicture}
    \clip (-1,-1) rectangle (6cm,6cm); 

    \foreach \x in {0,1,...,10}
    {
        \foreach \y in {10,9,...,0}
        {
            \node[draw,circle,inner sep=1pt,fill] at (.5*\x,.5*\y) {};
            \draw[thick,->] (.5*\x,.5*\y) -- (.5*\x+.4,.5*\y);
            \draw[thick,->] (.5*\x,.5*\y) -- (.5*\x,.5*\y-.4);
        }
    }
\end{tikzpicture}

My only request is that graphics created in non-LaTeX applications like InkScape, Blender, etc not be suggested.

Best Answer

enter image description here

Edit A bug fixed (the outer equator midpoints was not calculated correctly, as pointed out by @Dror).

MWE with Asymptote, file lattice.asy:

size(200);
import graph3;

pen surfPen=rgb(1,0.7,0);
pen xarcPen=deepblue+0.7bp;
pen yarcPen=deepred+0.7bp;

currentprojection=perspective(5,4,4);

real R=2;
real a=1;

triple fs(pair t) {
  return ((R+a*Cos(t.y))*Cos(t.x),(R+a*Cos(t.y))*Sin(t.x),a*Sin(t.y));
}

surface s=surface(fs,(0,0),(360,360),8,8,Spline);
draw(s,surfPen,render(compression=Low,merge=true));

int m=20;
int n=10;
real arcFactor=0.85;

pair p,q,v;

for(int i=1;i<=n;++i){
  for(int j=0;j<m;++j){
    p=(j*360/m,(i%n)*360/n);
    q=(((j+arcFactor)%m)*360/m,i*360/n);
    v=(((j+arcFactor/2)%m)*360/m,i*360/n);
    draw(fs(p)..fs(v)..fs(q),xarcPen,Arrow3(size=4));
    q=(j*360/m,((i%n)-arcFactor)*360/n);
    draw(fs(p)..fs((p+q)/2)..fs(q),yarcPen,Arrow3(size=3));
    dot(fs(p));
  }
}

Compile with asy -f pdf -noprc -render=4 lattice.asy to get a standalone lattice.pdf.