如何在 LateX 上获取显示氢键的图表?

如何在 LateX 上获取显示氢键的图表?

在此处输入图片描述

我设法得到了该图,但没有显示氢键,所以我想知道是否可以添加图中所示的红色氢键。这就是我为获得没有键的图所做的工作。

\documentclass{article}
\usepackage{chemfig}

\begin{document}


\begin{center}
\begin{tabular}{ |c|c|c|c|c| } 
 \hline
 \chemfig{O(-[4]H)(-[6]H)}  & \chemfig{H - O - H} & \chemfig{O(-[0]H)(-[6]H)} & \chemfig{O(-[0]H)(-[6]H)} & \chemfig{O(-[0]H)(-[6]H)}   \\ 
 \hline
  \chemfig{H - O - H} & \chemfig{O(-[6]H)(-[2]H)}  & \chemfig{H - O - H} & \chemfig{O(-[0]H)(-[6]H)} & \chemfig{O(-[0]H)(-[6]H)} \\ 
  \hline
 \chemfig{O(-[2]H)(-[4]H)} &  \chemfig{O(-[4]H)(-[6]H)}  &   \chemfig{O(-[2]H)(-[4]H)} & \chemfig{H - O - H}  & \chemfig{O(-[0]H)(-[6]H)} \\
 \hline
  \chemfig{O(-[2]H)(-[4]H)} & \chemfig{H - O - H} & \chemfig{O(-[6]H)(-[2]H)} & \chemfig{O(-[2]H)(-[4]H)} & \chemfig{H - O - H} \\ 
  \hline
  \chemfig{O(-[2]H)(-[4]H)} & \chemfig{O(-[2]H)(-[4]H)} & \chemfig{H - O - H} & \chemfig{O(-[0]H)(-[2]H)} & \chemfig{O(-[0]H)(-[2]H)} \\
 \hline
\end{tabular}
\end{center}
\end{document}

答案1

我看不出债券中存在明显的模式,所以我想你需要一次添加一个。在下面的例子中,我添加了几个

\documentclass[tikz, border = 4pt]{standalone}

\usetikzlibrary{calc}

\usetikzlibrary{decorations.pathmorphing}

\begin{document}
\begin{tikzpicture}[inner sep = 1pt, outer sep = 3pt,
  help grid/.style={blue!30},
  bond/.style={thick, black},
  hbond/.style={thick, red, decorate, decoration = {snake, amplitude = 1pt, segment length = 5pt}}]

  % Atoms
  \foreach \y in {1, 3, ..., 9} {
    \foreach \x in {1, 3, ..., 11} {
      \node (Hodd\x-\y) at (\x, \y){$H$};
    }
    \foreach \x in {2, 4, ..., 10} {
      \node (O\x-\y) at (\x, \y){$O$};
    }
  }

  \foreach \y in {2, 4, ..., 8} {
    \foreach \x in {2, 4, ..., 10} {
      \node (Heven\x-\y) at (\x, \y){$H$};
    }
  }

  % Frame + grid
  \foreach \x in {0.5, ..., 11.5}  \draw[help grid] (\x, 0.5) -- (\x, 9.5);
  \foreach \y in {0.5, ..., 9.5}  \draw[help grid] (0.5, \y) -- (11.5, \y);

  % bonds
  \draw[bond] (Hodd1-9) -- (O2-9);
  \draw[hbond] (O2-9) -- (Hodd3-9);
  % ...
  \draw[bond] (Hodd1-1) -- (O2-1);
  \draw[hbond] (O2-1) -- (Hodd3-1);
\end{tikzpicture}
\end{document}

在此处输入图片描述

相关内容