有人有关于如何绘制硅四面体和氧化铝八面体的代码示例吗?我需要将它们包含在我的 Beamer 演示文稿中。图形不太好。所以我想使用 Tikz 绘制它们。
答案1
更新我跟随此链接
// silica (regular) tetradhedron
unitsize(8mm);
import solids;
import three;
currentprojection=orthographic(2,1.5,5,zoom=.9,center=true);
triple A=(1,0,0), B=(0,1,0), C=(0,0,1), D=(1,1,1); // for 4 oxygen atoms
triple Si=(.5,.5,.5); // for 1 silicon atom
triple[] points={A,B,C,D};
for(var p : points){
draw(surface(sphere(p,.2)),red);
draw(Si--(Si+p)/2,gray+4pt);
draw(p--(Si+p)/2,red+4pt);
}
draw(surface(sphere(Si,.2)),gray);
对于硅四面体,我们可以用正四面体来表示。您可以自由选择其他视图currentprojection
。
运行http://asymptote.ualberta.ca/
// silica (regular) tetradhedron
unitsize(5cm);
import solids;
import three;
currentprojection=orthographic(2,1.5,5,zoom=.9,center=true);
triple A=(1,0,0), B=(0,1,0), C=(0,0,1), D=(1,1,1); // for 4 oxygen atoms
triple Si=(.5,.5,.5); // for 1 silicon atom
draw(A--B--C--D--cycle^^A--C^^B--D,gray+3pt);
draw(Si--A^^Si--B^^Si--C^^Si--D,magenta+10pt);
triple[] points={A,B,C,D};
for(var p : points)
draw(surface(sphere(p,.1)),red);
draw(surface(sphere(Si,.15)),orange);
// to see how I draw a regular tetradhedron
//draw(unitbox,lightgray);
//dot(O,red);
答案2
另一个 Ti钾Z 选项。
我使用calc
库来查找边缘端点(它们与原子相交的地方)。然后,绘制各种元素的顺序是可见性的关键。
\documentclass [tikz,border=2mm]{standalone}
\usetikzlibrary{3d,calc,perspective}
\tikzset
{% Styles
O atom/.style={shading=ball,ball color=red},
Si atom/.style={shading=ball,ball color=gray},
edge/.style={ultra thick},
bond/.style={ultra thick,blue}
}
\begin{document}
\begin{tikzpicture}[line cap=round,isometric view,rotate around z=-50]
% dimensions
\def\bd{3} % bond distance Si-O (center to center)
\pgfmathsetmacro\el{4/sqrt(6)*\bd} % edge length (tetrahedron)
\pgfmathsetmacro\ba{acos(-1/3)} % bond angle
\def\rO{0.3} % radius, oxigen
\pgfmathsetmacro\rSi{11/6*\rO} % radius, silicon
% coordinates
\foreach[count=\ii]\i in {A,B,C}
{
\begin{scope}[rotate around z=240-120*\ii,canvas is xz plane at y=0]
\coordinate (\i0) at (90-\ba:\bd); % center O
\coordinate (\i1) at (90-\ba:\bd-\rO); % surface O
\coordinate (\i2) at (90-\ba:\rSi); % surface Si
\end{scope}
}
\coordinate (D0) at (0,0,\bd); % center O
\coordinate (D1) at (0,0,\bd-\rO); % surface O
\coordinate (D2) at (0,0,\rSi); % surface Si
\coordinate (O) at (0,0,0); % center Si
% atoms, bonds and tetrahedron
\draw[O atom] (A0) circle (\rO cm);
\draw[edge] ($(A0)!\rO/\el!(B0)$) -- (B0);
\draw[edge] ($(A0)!\rO/\el!(C0)$) -- (C0);
\draw[edge] ($(A0)!\rO/\el!(D0)$) -- (D0);
\draw[bond] (A1) -- (A2);
\draw[Si atom] (O) circle (\rSi cm);
\draw[O atom] (B0) circle (\rO cm);
\draw[bond] (B1) -- (B2);
\draw[bond] (C1) -- (C2);
\draw[bond] (D1) -- (D2);
\draw[edge] ($(B0)!\rO/\el!(C0)$) -- (C0);
\draw[edge] ($(B0)!\rO/\el!(D0)$) -- (D0);
\draw[O atom] (D0) circle (\rO cm);
\draw[O atom] (C0) circle (\rO cm);
\draw[edge] ($(D0)!\rO/\el!(C0)$) -- ($(C0)!\rO/\el!(D0)$);
\end{tikzpicture}
\end{document}
更新:改进四面体距离,并按照建议删除不太准确的 SiO2 标签。
答案3
首先,构建一个简单的纯 Tikz 四面体作为开始:
\documentclass[border=1cm]{standalone}
\usepackage{tikz}
\tikzset{
ball/.style = {circle,shading=ball,minimum width=0.152cm,ball color=gray},
ball2/.style = {circle,shading=ball,minimum width=0.210cm,ball color=red!40},
ball3/.style = {circle,shading=ball,minimum width=0.097cm,ball color=green!40},
ball4/.style = {circle,shading=ball,minimum width=0.184cm,ball color=blue!40},
}
\usepackage{mhchem}
\begin{document}
\begin{tikzpicture}
\node[ball] (A) at (0,0) {};
\node[ball] (B) at (-0.5,1) {};
\node[ball] (C) at (2,0.5) {};
\node[ball] (D) at (0.75,3) {};
\node[ball2] (Si) at (0.75,1.5) {};
\draw[] (A)--(B) -- (A)--(C) (A)--(C) (B)--(D) (A)--(D) (C)--(D);
\draw[dashed] (B)--(C);
%\draw[thick,blue] (A)--(Si) -- (B)--(Si) (C)--(Si) (D)--(Si); % uncomment if you want to have bonds
\node[yshift=-2cm] at (Si) {\ce{[SiO4]^4-}};
\end{tikzpicture}
\begin{tikzpicture}
\node[ball3] (A) at (0,0) {};
\node[ball3] (B) at (3,0) {};
\node[ball3] (C) at (3.75,0.5) {};
\node[ball3] (D) at (4,2.25) {};
\node[ball3] (E) at (1,1.75) {};
\node[ball3] (F) at (1.75,2.25) {};
\node[ball4] (Al) at (2.25,1.25) {};
\draw[] (A)--(E) (A)--(B) (B)--(E) (B)--(C) (C)--(D) (D)--(F) (F)--(E) (E)--(D) (D)--(B);
\draw[dashed,red] (A)--(F) (A)--(C) (C)--(F);
\node[yshift=-2cm] at (Al) {\ce{Al(OH)3}};
\end{tikzpicture}
\end{document}