A variation of Gonzalo's code (just for fun). This is stable, hence feel free not to upvote ;).
\documentclass{standalone}
\usepackage{tikz,graphicx}
\usetikzlibrary{decorations.markings}
\definecolor{myyellow}{RGB}{254,241,24}
\definecolor{myorange}{RGB}{234,125,1}
\begin{document}
\begin{tikzpicture}
\def\proton(#1,#2){%
\fill[shade=ball,ball color=myyellow] (#1,#2) circle (10pt);
\node at (#1,#2) {\texttt{+}};
}
\def\neutron(#1,#2){%
\fill[shade=ball,ball color=myorange] (#1,#2) circle (10pt);
}
\def\electron{%
\fill[shade=ball,ball color=gray!30] (0,0) circle (5pt);
\node at (0,0) {\texttt{-}};
}
\def\orbit(#1,#2){%
\draw[
color=violet,
rotate=#1,
postaction=decorate,
decoration={markings,
mark=at position #2 with {\electron},
}]
(0,0) ellipse (3 and 5);
}
%%Nucleons
\neutron(0.8,0.2)
\proton(0.5,-0.5)
\neutron(-0.25,-0.5)
\neutron(0.55,0.8)
\proton(-0.5,0.2)
\proton(-0.1,0.8)
\proton(0.5,0)
\proton(0.12,0.6)
\proton(0.12,-0.6)
\neutron(-0.25,0)
\neutron(-0.5,0.6)
\neutron(0.5,-0.3)
%%orbits
\orbit(-20,.15)
\orbit(15,.45)
\orbit(40,.9)
\orbit(65,.6)
\orbit(100,.3)
\orbit(125,.75)
\end{tikzpicture}
\end{document}
Putting the exact shapes of shells is somewhat tricky around a nucleus. But schematicaly differentiating them is trivial as in the following code.
\documentclass{standalone}
\usepackage{tikz,graphicx}
\usetikzlibrary{decorations.markings}
\definecolor{myyellow}{RGB}{254,241,24}
\definecolor{myorange}{RGB}{234,125,1}
\begin{document}
\begin{tikzpicture}
\def\proton(#1,#2){%
\fill[shade=ball,ball color=myyellow] (#1,#2) circle (10pt);
\node at (#1,#2) {\texttt{+}};
}
\def\neutron(#1,#2){%
\fill[shade=ball,ball color=myorange] (#1,#2) circle (10pt);
}
\def\electron{%
\fill[shade=ball,ball color=gray!30] (0,0) circle (5pt);
\node at (0,0) {\texttt{-}};
}
\def\sorbit(#1,#2){%
\draw[
color=violet,
rotate=#1,
postaction=decorate,
decoration={markings,
mark=at position #2 with {\electron},
}]
(0,0) ellipse (1.5 and 3.5);
}
\def\porbit(#1,#2){%
\draw[
color=violet,
rotate=#1,
postaction=decorate,
decoration={markings,
mark=at position #2 with {\electron},
}]
(0,0) ellipse (4 and 6);
}
%%Nucleons
\neutron(0.8,0.2)
\proton(0.5,-0.5)
\neutron(-0.25,-0.5)
\neutron(0.55,0.8)
\proton(-0.5,0.2)
\proton(-0.1,0.8)
\proton(0.5,0)
\proton(0.12,0.6)
\proton(0.12,-0.6)
\neutron(-0.25,0)
\neutron(-0.5,0.6)
\neutron(0.5,-0.3)
%%orbits
\porbit(-20,.15)
\porbit(15,.45)
\sorbit(40,.9)
\porbit(65,.6)
\sorbit(100,.3)
\porbit(125,.75)
\end{tikzpicture}
\end{document}
Update - 1
Now, time to have some animation and have fun (I blame it all on @Garbage collector, he spoiled me! ;)..).
The following code will produce an animated pdf, gif and a series of png files. Compile the code with pdflatex -shell-escape filename.tex
\documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone}
\usepackage{filecontents}
\begin{filecontents*}{atom.tex}
\documentclass[tikz,border=20pt]{standalone}
\usepackage{tikz,graphicx}
\usetikzlibrary{decorations.markings,calc}
\definecolor{myyellow}{RGB}{254,241,24}
\definecolor{myorange}{RGB}{234,125,1}
\def\proton(#1,#2){%
\fill[shade=ball,ball color=myyellow] ({rnd*#1},{rnd*#2}) circle (10pt) node {\texttt{+}};
}
\def\neutron(#1,#2){%
\fill[shade=ball,ball color=myorange] ({rnd*#1},{rnd*#2}) circle (10pt);
}
\def\electron{%
\fill[shade=ball,ball color=gray!30] (0,0) circle (5pt);
\node at (0,0) {\texttt{-}};
}
\def\orbit(#1,#2,#3){%
\draw[
color=violet,
rotate=#1,
postaction=decorate,
decoration={markings,pre=moveto,pre length=#3,
mark=at position {#2} with {\electron},
}]
(0,0) ellipse (1 and 4);
}
\begin{document}
\foreach \pos in {0,0.08,0.16,...,0.96}{%
\begin{tikzpicture}%
%%Nucleons
\neutron(0.4,0.4)
\proton(0.4,-0.4)
\neutron(-0.4,-0.4)
\neutron(0.4,0.4)
\proton(-0.4,-0.4)
\proton(0.4,0.4)
\proton(-0.4,-0.4)
\proton(0.4,-0.4)
\neutron(-0.4,0.4)
\neutron(-0.4,0.4)
\neutron(0.4,-0.4)
\proton(-0.4,0.4)
%%orbits
\orbit(0,-\pos,0cm)
\orbit(195,\pos,0cm)
\orbit(120,-\pos,0cm)
\orbit(65,\pos,0cm)
\orbit(270,\pos,0cm)
\orbit(330,-\pos,0cm)
\end{tikzpicture}
}
\end{document}
\end{filecontents*}
%
\immediate\write18{pdflatex atom}
%
% convert to GIF animation
\immediate\write18{convert -delay 10 -loop 0 -density 200 -alpha remove atom.pdf atom.gif}
%
% convert to PNG
\makeatletter
\immediate\write18{convert -density 200 -alpha on atom.pdf atom-\@percentchar02d.png}
\makeatother
%
\usepackage{animate}
\begin{document}
\begin{preview}
%\animategraphics[controls,autoplay,loop,scale=<integer>]{<frame rate>}{<PDF filename without extension>}{<left blank>}{<left blank>}
\animategraphics[controls,autoplay,loop,scale=1]{8}{atom}{}{}
\end{preview}
\end{document}
Update - 2
\documentclass[preview,border={10pt 0pt 10pt 10pt}]{standalone}
\usepackage{filecontents}
\begin{filecontents*}{atom.tex}
\documentclass[tikz,border=20pt]{standalone}
\usepackage{tikz,graphicx}
\usetikzlibrary{decorations.markings,calc}
\definecolor{myyellow}{RGB}{254,241,24}
\definecolor{myorange}{RGB}{234,125,1}
\def\proton(#1,#2){%
\fill[shade=ball,ball color=myyellow] ({rnd*#1},{rnd*#2}) circle (10pt) node {\texttt{+}};
}
\def\neutron(#1,#2){%
\fill[shade=ball,ball color=myorange] ({rnd*#1},{rnd*#2}) circle (10pt);
}
\def\electron{%
\fill[shade=ball,ball color=gray!30] (0,0) circle (5pt);
\node at (0,0) {\texttt{-}};
}
\def\onesorbit(#1,#2,#3){%
\draw[
color=violet,
rotate=#1,
postaction=decorate,
decoration={markings,pre=moveto,pre length=#3,
mark=at position #2 with {\electron},
}]
(0,0) ellipse (1 and 2);
}
\def\twosorbit(#1,#2,#3){%
\draw[
color=violet,
rotate=#1,
postaction=decorate,
decoration={markings,pre=moveto,pre length=#3,
mark=at position #2 with {\electron},
}]
(0,0) ellipse (2 and 3.5);
}
\def\twoporbit(#1,#2,#3){%
\draw[
color=violet,
rotate=#1,
postaction=decorate,
decoration={markings,pre=moveto,pre length=#3,
mark=at position #2 with {\electron},
}]
(0,0) ellipse (3 and 5);
}
\begin{document}
\foreach \pos in {0,0.08,0.16,...,0.96}{%
\begin{tikzpicture}
%%Nucleons
\neutron(0.4,0.4)
\proton(0.4,-0.4)
\neutron(-0.4,-0.4)
\neutron(0.4,0.4)
\proton(-0.4,-0.4)
\proton(0.4,0.4)
\proton(-0.4,-0.4)
\proton(0.4,-0.4)
\neutron(-0.4,0.4)
\neutron(-0.4,0.4)
\neutron(0.4,-0.4)
\proton(-0.4,0.4)
%%orbits
\onesorbit(10,\pos,0cm)
\twosorbit(160,\pos,0cm)
\onesorbit(110,-\pos,0cm)
\twoporbit(30,\pos,0cm)
\twoporbit(310,-\pos,0cm)
\twosorbit(60,-\pos,0cm)
\end{tikzpicture}
}
\end{document}
\end{filecontents*}
%
\immediate\write18{pdflatex atom}
% convert to GIF animation
\immediate\write18{convert -delay 10 -loop 0 -density 200 -alpha remove atom.pdf atom.gif}
%
% convert to PNG
\makeatletter
\immediate\write18{convert -density 200 -alpha on atom.pdf atom-\@percentchar02d.png}
\makeatother
\usepackage{animate}
\begin{document}
\begin{preview}
%\animategraphics[controls,autoplay,loop,scale=<integer>]{<frame rate>}{<PDF filename without extension>}{<left blank>}{<left blank>}
\animategraphics[controls,autoplay,loop,scale=1]{15}{atom}{}{}
\end{preview}
\end{document}
This is an attempt to show orbits in different planes using ellipse