#### /examples/contrib3/clusters-of-atoms.tex

https://bitbucket.org/berteun/texample
LaTeX | 160 lines | 123 code | 15 blank | 22 comment | 0 complexity | 58fd616a714499579f7fe4e7f628474c MD5 | raw file
  1% Clusters of atoms
2% Author: Agustin E. Bolzan
3\documentclass{article}
4\usepackage[gray]{xcolor}
5\usepackage{tikz,pgffor}
6%%%<
7\usepackage{verbatim}
8\usepackage[active,tightpage]{preview}
9\PreviewEnvironment{tikzpicture}
10\setlength\PreviewBorder{5pt}%
11%%%>
12
13\begin{comment}
14:Title: Clusters of atoms
15
16A three dimensional illustration of various clusters of atoms.
17
18\end{comment}
19
21\begin{document}
22
23
24%\begin{figure}
25\centering
26\begin{tikzpicture}
27%\draw[help lines] (0,0) grid (10,10); %used just for visualising the positions of objects during construction
28
29\begin{scope}[yshift=-180,yslant=0.5,xslant=-1]
30    %the rectangular surface onto which the clusters are located
31    \filldraw[black!10,very thick] (0.5,1) rectangle (10,7);
32    %circle circumventing the smallest cluster
33    \node[circle,circular glow,fill=red!20,draw=red,thick]
34    at (4.1,4.9) {\phantom{perimetro}};
35\end{scope}
36
37%atom clusters are rotated for a better visualisation
38\begin{scope}[rotate around = {-5:(0,0,0)}]
39    %text describing the objects in the picture
40    \draw[-latex,thick] (6,3) node[right,text width=3cm]
41        {$\mathsf{potent\; perimeter\; sites}$} to [out=180,in=0] (4.5,1);
42    \draw[-latex,thick](3,-1)node[right]
43        {$\mathsf{Non-metallic\; molecule}$} to[out=180,in=0] (2.6,-3);
44    \draw[-latex,thick](-3,-1)node[above]
45        {$\mathsf{extra \; electron}$} to[out=-90,in=180] (-1.4,-2);
46
47    %now we start with the clusters (maybe this code could be improved by a tikz expert)
48    %the layers are built starting from the very lowest one
49
50    %largest cluster
51    %first row
52    \foreach \x  in {1.5,2,2.5,3,3.5,4}%
53        \shadedraw [ball color= red] (\x,1,-0.5) circle (0.25cm);
54    \foreach \x  in {1.25,1.75,2.25,2.75,3.25,3.75,4.25}%
55        \shadedraw [ball color= red] (\x,1,0) circle (0.25cm);
56    \foreach \x  in {1,1.5,2,2.5,3,3.5,4,4.5}%
57        \shadedraw [ball color= red] (\x,1,0.5) circle (0.25cm);
58    \foreach \x  in {0.75,1.25,1.75,2.25,2.75,3.25,3.75,4.25,4.75}%
59        \shadedraw [ball color= red] (\x,1,1) circle (0.25cm);
60    \foreach \x  in {0.5,1,1.5,2,2.5,3,3.5,4,4.5,5}%
61        \shadedraw [ball color= red] (\x,1,1.5) circle (0.25cm);
62    \foreach \x  in {0.5,1,1.5,2,2.5,3,3.5,4,4.5,5}
63        \shadedraw [ball color=red] (\x,1,2) circle (0.25cm);
64    \foreach \x  in {0.75,1.25,1.75,2.25,2.75,3.25,3.75,4.25,4.75}%
65        \shadedraw [ball color= red] (\x,1,2.5) circle (0.25cm);
66    \foreach \x  in {1,1.5,2,2.5,3,3.5,4,4.5}%
67        \shadedraw [ball color= red] (\x,1,3) circle (0.25cm);
68    \foreach \x  in {1.25,1.75,2.25,2.75,3.25,3.75,4.25}%
69        \shadedraw [ball color= red] (\x,1,3.5) circle (0.25cm);
70    \foreach \x  in {1.5,2,2.5,3,3.5,4}%
71        \shadedraw [ball color= red] (\x,1,4) circle (0.25cm);
72    %second row
73    \foreach \x  in {1.75,2.25,2.75,3.25,3.75}
74        \shadedraw [ball color=yellow] (\x,1.5,0) circle (0.25cm);
75    \foreach \x  in {1.5,2,2.5,3,3.5,4}
76        \shadedraw [ball color=yellow] (\x,1.5,0.5) circle (0.25cm);
77    \foreach \x  in {1.25,1.75,2.25,2.75,3.25,3.75,4.25}
78        \shadedraw [ball color=yellow] (\x,1.5,1) circle (0.25cm);
79    \foreach \x  in {1,1.5,2,2.5,3,3.5,4,4.5}
80        \shadedraw [ball color=yellow] (\x,1.5,1.5) circle (0.25cm);
81    \foreach \x  in {0.75,1.25,1.75,2.25,2.75,3.25,3.75,4.25,4.75}
82        \shadedraw [ball color=yellow] (\x,1.5,2) circle (0.25cm);
83    \foreach \x  in {1,1.5,2,2.5,3,3.5,4,4.5}
84        \shadedraw [ball color=yellow] (\x,1.5,2.5) circle (0.25cm);
85    \foreach \x  in {1.25,1.75,2.25,2.75,3.25,3.75,4.25}
86        \shadedraw [ball color=yellow] (\x,1.5,3) circle (0.25cm);
87    \foreach \x  in {1.5,2,2.5,3,3.5,4}
88        \shadedraw [ball color=yellow] (\x,1.5,3.5) circle (0.25cm);
89    \foreach \x  in {1.75,2.25,2.75,3.25,3.75}
90        \shadedraw [ball color=yellow] (\x,1.5,4) circle (0.25cm);
91    %third row
92    \foreach \x  in {2,2.5,3,3.5}
93        \shadedraw [ball color=yellow] (\x,2,1) circle (0.25cm);
94    \foreach \x  in {1.75,2.25,2.75,3.25,3.75}
95        \shadedraw [ball color=yellow] (\x,2,1.5) circle (0.25cm);
96    \foreach \x  in {1.5,2,2.5,3,3.5,4}
97        \shadedraw [ball color=yellow] (\x,2,2) circle (0.25cm);
98    \foreach \x  in {1.25,1.75,2.25,2.75,3.5,3.75,4.25}
99        \shadedraw [ball color=yellow] (\x,2,2.5) circle (0.25cm);
100    \foreach \x  in {1.5,2,2.5,3,3.5,4}
101        \shadedraw [ball color=yellow] (\x,2,3) circle (0.25cm);
102    \foreach \x  in {1.75,2.25,2.75,3.25,3.75}
103        \shadedraw [ball color=yellow] (\x,2,3.5) circle (0.25cm);
104    \foreach \x  in {2,2.5,3,3.5}
105        \shadedraw [ball color=yellow] (\x,2,4) circle (0.25cm);
106    %fourth row
107    \foreach \x  in {2.25,2.75,3.25}
108        \shadedraw [ball color=yellow] (\x,2.5,2) circle (0.25cm);
109    \foreach \x  in {2,2.5,3,3.5}
110        \shadedraw [ball color=yellow] (\x,2.5,2.5) circle (0.25cm);
111    \foreach \x  in {1.75,2.25,2.75,3.25,3.75}
112        \shadedraw [ball color=yellow] (\x,2.5,3) circle (0.25cm);
113    \foreach \x  in {2,2.5,3,3.5}
114        \shadedraw [ball color=yellow] (\x,2.5,3.5) circle (0.25cm);
115    \foreach \x  in {2.25,2.75,3.25}
116        \shadedraw [ball color=yellow] (\x,2.5,4) circle (0.25cm);
117
118    %medium cluster
119    %first row
120    \foreach \x  in {6.75,7.25}
121        \shadedraw [ball color=yellow] (\x,2.5,13) circle (0.25cm);
122    \foreach \x  in {6.5,7,7.5}
123        \shadedraw [ball color=yellow] (\x,2.5,13.5) circle (0.25cm);
124    \foreach \x  in {6.25,6.75,7.25,7.75}
125        \shadedraw [ball color=yellow] (\x,2.5,14) circle (0.25cm);
126    \foreach \x  in {6.5,7,7.5}
127        \shadedraw [ball color=yellow] (\x,2.5,14.5) circle (0.25cm);
128    \foreach \x  in {6.75,7.25}
129        \shadedraw [ball color=yellow] (\x,2.5,15) circle (0.25);
130
131    %second row
132    \foreach \x  in {7} %this foreach is used to be general, but it makes no sense if we put just one sphere!
133        \shadedraw [ball color=yellow] (\x,3,13.25) circle (0.25cm);
134    \foreach \x  in {6.75,7.25}
135        \shadedraw [ball color=yellow] (\x,3,13.75) circle (0.25cm);
136    \foreach \x  in {6.5,7,7.5}
137        \shadedraw [ball color=yellow] (\x,3,14.25) circle (0.25cm);
138    \foreach \x  in {6.75,7.25}
139        \shadedraw [ball color=yellow] (\x,3,14.75) circle (0.25cm);
140    \foreach \x  in {7}
141        \shadedraw [ball color=yellow] (\x,3,15.25) circle (0.25);
142
143    %smallest cluster of atoms
144
145    \foreach \x in {2.75,3.25,3.75}
146        \shadedraw [ball color = gray] (\x,2,10) circle (0.25);
147    \foreach \x in {3,3.5}
148        \shadedraw [ball color=gray] (\x,2,10.5) circle (0.25);
149    \shadedraw [ball color = gray] (3.25,2,11) circle (0.25);
150    \foreach \x in {3,3.5}
151        \shadedraw [ball color = gray] (3,2.5,10.25) circle (0.25);
152    \shadedraw [ball color = gray] (3.5,2.5,11) circle (0.25);
153
154    \shadedraw [ball color=gray] (2,1,12.5) circle(0.25);
155    \draw[-latex,thick](-4,-3)node[above]
156        {$\mathsf{single \; metal\; atom}$} to[out=-90,in=180] (-3,-4);
157\end{scope}
158\end{tikzpicture}
159%\end{figure}
160\end{document}