# Open source optical lattice clock

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

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.

• Wow. It's been ages since I've last used POVray. Time to refresh my memory, I guess :-) May 24 '14 at 6:28
• @downvoter: why don't you like this challenge? May 24 '14 at 6:53
• 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.) May 24 '14 at 7:27
• 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. May 24 '14 at 8:46

### 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.

#include"functions.inc"
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}}
s(0)s(<0,0,-1>)s(<-1,0,0>)s(<0,0,2>)s(<2,0,1>)s(<2,0,3>)


### ungolfed:

#version 3.7;
#include "functions.inc"
global_settings{assumed_gamma 1}
camera{
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
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
}
}
#macro s(p) //position
sphere{
pi*p+y/3 1
pigment{rgb<2,8,2>/9}
//phong for the wide highlights, specular for the small ones.
finish{phong .5 phong_size 5 specular 1 roughness .001}
}
#end
s(0)
s(<0,0,-1>)
s(<-1,0,0>)
s(<0,0,2>)
s(<2,0,1>)
s(<2,0,3>)


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

• Is it possible to get more of it in focus?
– user9206
May 25 '14 at 19:09
• @Lembik reducing the aperture will enlarge the region in focus. I will try some lower values soon, but a full render takes a while. May 25 '14 at 20:10
• 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."
– user9206
Jun 1 '14 at 9:05
• @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? Jun 1 '14 at 9:07
• How about imgur.com/9ueRjra ? I used aperture 0.8 and 9,9 adaptive 3 .
– user9206
Jun 1 '14 at 16:13