Take the 2-minute tour ×
TeX - LaTeX Stack Exchange is a question and answer site for users of TeX, LaTeX, ConTeXt, and related typesetting systems. It's 100% free, no registration required.

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.

share|improve this question
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. –  Marco Daniel May 7 '12 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 '12 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 '12 at 20:16
    
IMHO this is not more or less off topic than How to draw nanotubes with TeX? –  cgnieder May 8 '12 at 21:29
add comment

1 Answer

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?

\documentclass{article}
\usepackage{pgfplots}

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

\begin{document}

\begin{tikzpicture}
 \begin{axis}[xmin=-5,xmax=5,ymin=-5,ymax=5,zmin=-5,zmax=5,colormap/cool]
  \addplot3[
    surf,
    shader=flat,
    samples=50,
    domain=-2*pi:2*pi,
    y domain=-2*pi:2*pi
  ]{cos(deg(x))*cos(deg(y))};
  \pgfplotsextra{
    \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}};
    }
  }
 \end{axis}
\end{tikzpicture}
\end{document}
share|improve this answer
    
Thanks but I have the following error:pgfplots@addplotimpl@expression@curly. Any hint? –  PanAkry May 7 '12 at 20:14
2  
@PanAkry make sure your distribution is up to date –  cmhughes May 7 '12 at 20:33
    
@PanAkry Thanks for the bounty, I'm glad this helped :) You have quite a low acceptance rate- please consider accepting this answer (if it gets you close enough to a solution) and please review your other questions- see the details here :) –  cmhughes May 9 '12 at 11:36
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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