I want to make in TikZ or MetaPost an image of a two dimensional lattice with oscillations like these:

optical lattice another optical lattice

(Source: http://www.uibk.ac.at/th-physik/qo/research/opticallattices.html)

or this one:

yet another optical lattice

(Source: http://news.sciencemag.org/sciencenow/2008/09/12-01.html)

I don't know even know how to begin.

  • 3
    Unfortunately I can't vote to close because this question has an open bounty. However I think that your question is off topic. Short version -- Can you do the job for me. May 7, 2012 at 17:32
  • 2
    Please don't pile on downvotes. A net score of -1 is enough to show that the question needs to be improved. More downvotes should be reserved for questions that are unsalvageable or spam.
    – Jake
    May 7, 2012 at 18:00
  • I don't want that people do the job for me I just want some ideas or which package to use! In fact I tried it alone and I did not find a good and short solution!
    – PanAkry
    May 7, 2012 at 20:16
  • IMHO this is not more or less off topic than How to draw nanotubes with TeX?
    – cgnieder
    May 8, 2012 at 21:29

2 Answers 2


Here's something to get you (or perhaps someone else) started

enter image description here

I realize that the balls aren't exactly where you want them, but you can tweak the positions yourself.

The idea was to use a surface plot of the function f(x,y)=cos(x)*cos(y) using the pgfplots package.

The only subtlety is to loop through the balls, which requires the loop to be wrapped in \pgfplotsextra{ ... }.

I borrowed Altermundus' ball shading from How can we draw a Christmas tree with decorations, using TikZ?


% borrowed from Altermundus' Christmas tree
% https://tex.stackexchange.com/questions/39149/how-can-we-draw-a-christmas-tree-with-decorations-using-tikz/39250#39250
 \shadedraw[ball color=red] (0,0) circle (60pt);


    y domain=-2*pi:2*pi
    \foreach \deco in {
        (axis cs:-1,-1,1),
        (axis cs:-2,-2,1),
        (axis cs:3,3,1),
        (axis cs:-3,-3,1),
        (axis cs:4,4,1)
        \node at \deco {\usebox{\ball}};
  • Thanks but I have the following error:pgfplots@addplotimpl@expression@curly. Any hint?
    – PanAkry
    May 7, 2012 at 20:14
  • 2
    @PanAkry make sure your distribution is up to date
    – cmhughes
    May 7, 2012 at 20:33

I made few modifications in the previous code and got this result:

Hubbard model for an optical lattice

Here is my version:




\definecolor{lightblue}{rgb}{0.2,0.2, 0.9}

    \shadedraw[ball color=#1, draw=none] (axis cs:#2,#3,#4) circle (#5 pt); 

\def \radiusparticle{5.5}
\def \zparticle{-0.5}
\def \shiftdoubleoccupation{pi*0.095}

% OBS:
% top view = 90, 90 -> useful if you want to find the positions of particles in xy-plan
% wanted view = 25, 65 -> angles phi and theta that I set for the perspective 

    axis line style={draw=none},
    tick style={draw=none},
        y domain=-2.15*pi:2.15*pi,


    \foreach \ix/\iy in {-2/1,2/1,-2/-1,2/-1}{
    \foreach \ix/\iy in {1/0,1/2,1/-2,-1/2,-1/-2}{


    \node[] (Coulombcenter) at (axis cs: 0+2*\shiftdoubleoccupation, -pi+2*\shiftdoubleoccupation, 1.0) {};

    \node[anchor=center, align=center, font=\large \rmfamily \bfseries \color{black}, circle, fill=lightgray!70!black, rounded corners=1.0pt, inner sep=4.15pt] (Coulombcircle2) at ($(Coulombcenter.center)+(0,0)$) {\hphantom{$U$}};

    \node[anchor=center, align=center, font=\large \rmfamily \bfseries \color{black}, circle, top color=blue!30!lightgray, bottom color=red!50!lightgray, rounded corners=1.0pt, inner sep=3.75pt] (Coulombcircle) at ($(Coulombcenter.center)+(0,0)$) {\hphantom{$U$}};

    \node[anchor=center, align=center, font=\large \rmfamily \bfseries \color{black}, circle, top color=lightgray!50!white, bottom color=lightgray!50!gray, rounded corners=1.0pt, inner sep=0.25pt] (Coulombtext) at ($(Coulombcenter.center)+(0,0,0)$) {$U$};

    \node[] (hoppingstart) at (axis cs: -pi, 0, \zparticle){};
    \node[] (hoppingend) at (axis cs: 0, pi, \zparticle) {};

    \draw[->,myarrowcontour] ($(hoppingstart.center)+(\radiusparticle,\radiusparticle,0.5*\radiusparticle)$) to node[auto, swap, above, font=\Large \color{white}] {}($(hoppingend.south)+(3.*\radiusparticle,3*\radiusparticle, -2.*\radiusparticle)$);

    \draw[->,myarrow] ($(hoppingstart.center)+(\radiusparticle,\radiusparticle,0.5*\radiusparticle)$) to node[auto, swap, above, font=\Large \color{white}] {\color{black}$t$}($(hoppingend.south)+(2*\radiusparticle,2*\radiusparticle, 1*\radiusparticle)$); 




Where, I defined the arrow styles as

    myarrowcontour/.style={lightblue!30!lightgray, >=latex, line width=5pt, bend left=45},
    myarrow/.style={lightblue, >=latex, line width=3.5pt, bend left=45}

but changes can improve the final result.

I hope it helps!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.