A recent question showed how Mathematica could be used to make a beautiful optical lattice clock image. The image looks like this.

enter image description here

This challenge is to reproduce this image as closely as possible using as short code as possible using only easily available open source tools (and without just downloading the image or parts of it).

Rules As it is not reasonable to ask for a pixel by pixel reproduction this is a popularity contest. However, please up-vote code that is a short (in the style of code-golf) and which produces an accurate and beautiful reproduction of the image.

  • 2
    \$\begingroup\$ Wow. It's been ages since I've last used POVray. Time to refresh my memory, I guess :-) \$\endgroup\$ Commented May 24, 2014 at 6:28
  • \$\begingroup\$ @downvoter: why don't you like this challenge? \$\endgroup\$ Commented May 24, 2014 at 6:53
  • 5
    \$\begingroup\$ Maybe because they just don't like it? Maybe because OP says it's a popularity contest and then tells the populus what to do? Maybe using random open source libraries is a somewhat unclear restriction? Maybe because they don't think that image is beautiful and can't agree with the fundamental statement of the question? Maybe because it's not well formatted? (To name a few reasons.) \$\endgroup\$
    – bot47
    Commented May 24, 2014 at 7:27
  • \$\begingroup\$ I had no idea what this was about, so here's the original article. nature.com/nphoton/journal/v5/n4/covers/index.html I thought maybe we had to arrange the green balls into digits. But apparently this is not the case, they are just atoms confined in potential wells by laser beams that therefore move in a determined way to tell the time. So if you did arrange them into digits, they would be the smallest in the world. \$\endgroup\$ Commented May 24, 2014 at 8:46

1 Answer 1


POV-Ray, 512 characters

Here's my try. I didn't manage to replicate the lighting, so I've decided to keep the variation of highlight positions rather than to put the lights further away to keep the background brighter.

The area shadow is rather low-quality. I might as well turn it off completely (and save precious characters), but if someone is willing to donate some computing power and crank up the shadow quality and/or the dither quality, I'll gladly accept.

camera{location<-3,5,-6>right x look_at 0 focal_point 0 aperture 1 blur_samples 9}  
#macro s(p)sphere{pi*p+y/3 1 pigment{rgb<2,8,2>/9}finish{phong .5 phong_size 5 specular 1 roughness .001}}#end
#macro l(p,c)light_source{p c/8 area_light 9*x,9*z,3,3}#end l(<6,6,0>,<8,4,8>)l(<0,6,0>,<4,8,8>)
isosurface{function{y/3+pow(cos(x)*cos(z),2)/2}contained_by{box{-9,100}}pigment{tiling 1 color_map{[.9 rgb 1][1 rgb 0]}scale .5/pi}}   




#version 3.7;
#include "functions.inc"                
global_settings{assumed_gamma 1} 
  location <-3,5,-6>  
  right x //set the aspect ratio
  look_at 0   
  focal_point 0 aperture 1 blur_samples 9

#macro l(p,c) // position, color
    p c/8 
    area_light 9*x,9*z,3,3

    tiling 1
    color_map{[.9 rgb 1][1 rgb 0]}       
    scale .5/pi
#macro s(p) //position
    pi*p+y/3 1
    //phong for the wide highlights, specular for the small ones.
    finish{phong .5 phong_size 5 specular 1 roughness .001}

P.S.: I've only counted the five line-breaks to round the character count to a perfectly round number.

  • \$\begingroup\$ Is it possible to get more of it in focus? \$\endgroup\$
    – user9206
    Commented May 25, 2014 at 19:09
  • \$\begingroup\$ @Lembik reducing the aperture will enlarge the region in focus. I will try some lower values soon, but a full render takes a while. \$\endgroup\$ Commented May 25, 2014 at 20:10
  • \$\begingroup\$ I get a Parsing error and a Parsing warning. They are "Possible Parse Error: assumed_gamma not specified in this POV-Ray 3.7 or later scene. Future versions of POV-Ray may consider this a fatal error. To avoid this warning, explicitly specify 'assumed_gamma 1.0' in the global_settings section. See the documentation for more details. " and "Parse Warning: This scene had other declarations preceding the first #version directive. Please be aware that as of POV-Ray 3.7, unless already specified via an INI option, a #version is expected as the first declaration in a scene file." \$\endgroup\$
    – user9206
    Commented Jun 1, 2014 at 9:05
  • \$\begingroup\$ @Lembik they are just warnings. I can add assumed_gamma and #version, but code golf was never about clean coding as far as I'm aware, was it? \$\endgroup\$ Commented Jun 1, 2014 at 9:07
  • 2
    \$\begingroup\$ How about imgur.com/9ueRjra ? I used aperture 0.8 and 9,9 adaptive 3 . \$\endgroup\$
    – user9206
    Commented Jun 1, 2014 at 16:13

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.