In the responses to Draw Bohr atomic model with electron shells in TeX?, there are nice drawings of atoms. However, the nuclei don't look very appealing or realistic.
I was wondering: Can anyone think of an algorithm to (semi-)automatically (for example in a randomized fashion) create large nuclei that look more realistic as for example the in the image attached?
It seems to be key that the balls are sufficiently spaced and that the spherical look requires more centered balls to be on top. Both requirements are not met with my code:
\documentclass{standalone}
\usepackage{tikz}
\begin{document}
\begin{tikzpicture}
\path (-2,-2) rectangle (2,2);
\pgfmathdeclarerandomlist{color}{{red}{white}}
\foreach \a in {1,...,200} {
\pgfmathsetmacro{\r}{rnd}
\pgfmathsetmacro{\a}{random(0,360)}
\pgfmathrandomitem{\c}{color}
\shade[ball color=\c] (\a:-\r) circle (5pt);
}
\end{tikzpicture}
\end{document}
EDIT:
In case anyone is interested, here is what I am quite happy with: Based on the answer, I have defined slightly modified versions of the suggested nucleus in three different sizes and with the option to feed a random seed to get different species.
\documentclass{standalone}
\usepackage{tikz}
\usetikzlibrary{calc}
\begin{document}
\begin{tikzpicture}
\tikzset{
pics/proton/.style={code={\shade[ball color=red] circle (3pt);}},
pics/neutron/.style={code={\shade[ball color=white] circle (3pt);}},
pics/nucleussmall/.style={code={%
\pgfmathdeclarerandomlist{nucleon}{{proton}{proton}{neutron}{neutron}{neutron}}
\pgfmathsetseed{#1+1}
\foreach \A/\R in {8/0.2, 5/0.13, 1/0}{
\pgfmathsetmacro{\S}{360/\A}
\foreach \B in {0,\S,...,360}{
\pgfmathrandomitem{\C}{nucleon}
\pic at ($(\B+2*\A+5*rnd:\R)$) {\C}; } }} },
pics/nucleusbig/.style={code={%
\pgfmathdeclarerandomlist{nucleon}{{proton}{proton}{neutron}{neutron}{neutron}}
\pgfmathsetseed{#1+1}
\foreach \A/\R in {24/0.4, 24/0.3, 24/0.2, 13/0.35, 11/0.27, 6/0.15, 1/0}{
\pgfmathsetmacro{\S}{360/\A}
\foreach \B in {0,\S,...,360}{
\pgfmathrandomitem{\C}{nucleon}
\pic at ($(\B+2*\A+5*rnd:\R)$) {\C}; } }} },
pics/nucleusbiggest/.style={code={%
\pgfmathdeclarerandomlist{nucleon}{{proton}{proton}{neutron}{neutron}{neutron}}
\pgfmathsetseed{#1+1}
\foreach \A/\R in {24/0.5, 24/0.4, 24/0.3, 24/0.2, 13/0.47, 15/0.44, 13/0.37, 11/0.27, 6/0.15, 1/0}{
\pgfmathsetmacro{\S}{360/\A}
\foreach \B in {0,\S,...,360}{
\pgfmathrandomitem{\C}{nucleon}
\pic at ($(\B+2*\A+5*rnd:\R)$) {\C}; } }} },
}
\pic at (0,0) {nucleussmall};
\pic at (2,0) {nucleusbig=1};
\pic at (4,0) {nucleusbiggest=1};
\end{tikzpicture}
\end{document}