[Tex/LaTex] Draw realistic 3D crystal structures (diamond)

3dasymptotediagramspstrickstikz-pgf

I want to draw a realistic 3D crystal structure, e.g. diamond. The point where I struggle is to draw connecting 3D rods.

Desired result

In the end it should describe the cubic cell of diamond, e.g. like the following picture from Phase Transformations & Complex
Properties Research Group
. Cubic cell of diamond

Comments

Example

Here is a pstricks example:

\documentclass{standalone}
\usepackage{pstricks}
\usepackage{pst-solides3d}

\begin{document}
 \begin{pspicture}(-4,-4)(14,14)
  \psSolid[object=cylindre, h=6, r=1, fillcolor=yellow](0,0,0)
  \psSolid[object=sphere, r=2, fillcolor=red!25](0,0,0)
  \psSolid[object=sphere, r=2, fillcolor=red!25](0,0,6)
 \end{pspicture}
\end{document}

Result:

Best Answer

Since you included the asymptote tag, I assume you will not object to an Asymptote solution:

%process:
% pdflatex filename.tex
% asy filename-*.asy
% pdflatex filename.tex
\documentclass{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}
import three;
settings.render=8;
settings.prc=false;
size(10cm);

currentprojection = orthographic((3,4,5));

material spherecolor = material(diffusepen=black, ambientpen=gray(0.1), specularpen=white);
material cylcolor = material(diffusepen=white, ambientpen=white);

real cylRadius = 0.1;
real sphereRadius = 0.2;

void drawRod(triple a, triple b) {
  surface rod = extrude(scale(cylRadius)*unitcircle, axis=length(b-a)*Z);
  triple orthovector = cross(Z, b-a);
  if (length(orthovector) > .01) {
    real angle = aCos(dot(Z, b-a) / length(b-a));
    rod = rotate(angle, orthovector) * rod;
  }
  draw(shift(a)*rod, surfacepen=cylcolor);
}

void drawSphere(triple center) {
     draw(shift(center)*scale3(sphereRadius)*unitsphere, surfacepen=spherecolor);
}

triple a = O;
triple b = X;
triple c = 2Z;

drawSphere(a);
drawSphere(b);
drawSphere(c);
drawRod(a,b);
drawRod(b,c);
\end{asy}
\end{document}

gives the output