> For the complete documentation index, see [llms.txt](https://overleaf-pro.ayaka.space/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://overleaf-pro.ayaka.space/latex/zh-cn/te-ding-ling-yu/04-molecular-orbital-diagrams.md).

# 分子轨道图

本文简要介绍如何创建 [分子轨道图](https://en.wikipedia.org/wiki/Molecular_orbital_diagram) 在 LaTeX 中使用 [`modiagram` 宏包](https://ctan.org/pkg/modiagram?lang=en)。强烈建议读者查阅 [`modiagram` 包文档](http://mirrors.ctan.org/macros/latex/contrib/modiagram/modiagram_en.pdf) ，其中包含许多有用的示例来展示其众多功能——远超出我们在这篇简短文章中所能涉及的范围。

有关更传统的 *分子结构图* 的信息，请参阅我们关于 [化学公式](/latex/zh-cn/te-ding-ling-yu/02-chemistry-formulae.md).

## 引言

分子图是使用 [`modiagram` 宏包](https://ctan.org/pkg/modiagram?lang=en) 创建的，你可以通过在文档导言区添加以下一行将其导入到文档中：

`\usepackage{modiagram}`\[$$\langle$$`选项`$$\rangle$$]

这些 $$\langle$$`选项`$$\rangle$$ 被列出并演示在 [包文档](http://mirrors.ctan.org/macros/latex/contrib/modiagram/modiagram_en.pdf).

要全局应用宏包 $$\langle$$`选项`$$\rangle$$ *全局* 你可以

* 在加载宏包时通过 `\usepackage{modiagram}`\[$$\langle$$`选项`$$\rangle$$设置它们，或者
* 使用设置命令 `\setmodiagram`{$$\langle$$`选项`$$\rangle$$}

MO 图使用 `modiagram` 环境创建，该环境支持对宏包的局部使用 $$\langle$$`选项`$$\rangle$$:

`\begin{modiagram}`\[$$\langle$$`选项`$$\rangle$$] ...

`\end{modiagram}`

下面的示例演示了一个最小的 `modiagram` 环境，不使用任何 $$\langle$$`选项`$$\rangle$$:

```latex
\documentclass{article}
\usepackage{modiagram}
\begin{document}

第一组原子示例：

\begin{modiagram}
\atom{left}{1s, 2s, 2p}
\end{modiagram}
\end{document}
```

[在 Overleaf 中打开此示例。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=example+of+molecular+diagram\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bmodiagram%7D%0A%5Cbegin%7Bdocument%7D%0A%0AFirst+example+atoms%3A%0A%0A%5Cbegin%7Bmodiagram%7D%0A%5Catom%7Bleft%7D%7B1s%2C+2s%2C+2p%7D%0A%5Cend%7Bmodiagram%7D%0A%5Cend%7Bdocument%7D)

此示例生成以下输出：

![LaTeX 中生成的分子图示例](/files/311f6f8bcbd7fe0ef958cdca22a9fff4ff009266)

绘制 MO 图的基本命令是 `\atom` ，如上例所示，它接受两个参数：

* `left`：原子的对齐方式。
* `1s, 2s, 2p`：要绘制的能级子层。这些还可以进一步自定义，你将在 [下一节](#atoms).

## 原子

你可以向引言示例中展示的命令传递一些关于原子轨道的额外信息。

```latex
\documentclass{article}
\usepackage{modiagram}
\begin{document}

\begin{modiagram}
 \atom{right}{
    1s = { 0; pair} ,
    2s = { 1; pair} ,
    2p = {1.5; up, down }
 }

 \atom{left}{
    1s = { 0; pair} ,
    2s = { 1; pair} ,
    2p = {1.5; up, down }
 }
 \end{modiagram}
\end{document}
```

[在 Overleaf 中打开此示例。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=example+of+molecular+diagram\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bmodiagram%7D%0A%5Cbegin%7Bdocument%7D%0A%0A%5Cbegin%7Bmodiagram%7D%0A+%5Catom%7Bright%7D%7B%0A++++1s+%3D+%7B+0%3B+pair%7D+%2C%0A++++2s+%3D+%7B+1%3B+pair%7D+%2C%0A++++2p+%3D+%7B1.5%3B+up%2C+down+%7D%0A+%7D%0A%0A+%5Catom%7Bleft%7D%7B%0A++++1s+%3D+%7B+0%3B+pair%7D+%2C%0A++++2s+%3D+%7B+1%3B+pair%7D+%2C%0A++++2p+%3D+%7B1.5%3B+up%2C+down+%7D%0A+%7D%0A+%5Cend%7Bmodiagram%7D%0A%5Cend%7Bdocument%7D)

此示例生成以下输出：

![原子轨道示例](/files/2e0b888f225549b5d6addb753cf6ebcc1138ea45)

在这个例子中，绘制了两个相同的原子，分别左对齐和右对齐。

遵循 `modiagram` 宏包文档的风格，创建原子的通用语法可写为：

`\atom`\[$$\langle$$`名称`$$\rangle$$]{$$\langle$$`left`$$\rangle$$|$$\langle$$`right`$$\rangle$$}{$$\langle$$`AO-spec`$$\rangle$$}

其中

* $$\langle$$`名称`$$\rangle$$ 是原子的可选名称
* $$\langle$$`left`$$\rangle$$ 和 $$\langle$$`right`$$\rangle$$ 决定在图中的位置
* $$\langle$$`AO-spec`$$\rangle$$ 是原子轨道的规范。

该 $$\langle$$`AO-spec`$$\rangle$$ 采用如下通用形式

```latex
子层 = {能量; 规格}
```

其中

* `子层` 可以是 `1s`, `2s` 或 `2p`
* `能量` 是能量级，一个决定图中垂直间距的数字。如果省略，则设为 0。
* `规格` 是一个以逗号分隔的电子自旋列表，包含每个轨道中的电子。可取的值有 `up`, `下`, `成对` ，以及空轨道（只输入分号）。如果省略，则设为 `成对`.

以下是前一个示例中所用命令的说明：

* `1s = { 0; pair}`。该子层 `1s` 位于 `0` 能级中，该轨道包含两个（成对的）电子。
* `2s = { 1; pair}`。该子层 `2s` 绘制在 `1` 能级中，这个轨道中有两个电子。
* `2p = {1.5; up, down}`。该子层 `2p` 绘制在能级 `1.5`中，即在图中垂直间距设为 1.5；这个子能级有两个电子：一个自旋为 `up` ，位于第一个轨道中，另一个自旋为 `下` ，位于第二个轨道中。

第二个原子在右侧重复了相同的命令。

要显示原子的（可选） `名称` 原子的，请使用一个 `modiagram` 环境，并带有 `[names]` 选项：

```latex
\documentclass{article}
\usepackage{modiagram}
\begin{document}
\begin{modiagram}[names]
 \atom[右侧的原子]{right}{
    1s = { 0; pair} ,
    2s = { 1; pair} ,
    2p = {1.5; up, down }
 }

 \atom[左侧的原子]{left}{
    1s = { 0; pair} ,
    2s = { 1; pair} ,
    2p = {1.5; up, down }
 }
\end{modiagram}
\end{document}
```

[在 Overleaf 中打开此示例。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+the+names+option+in+a+molecular+diagram\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bmodiagram%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bmodiagram%7D%5Bnames%5D%0A+%5Catom%5BAtom+on+the+right%5D%7Bright%7D%7B%0A++++1s+%3D+%7B+0%3B+pair%7D+%2C%0A++++2s+%3D+%7B+1%3B+pair%7D+%2C%0A++++2p+%3D+%7B1.5%3B+up%2C+down+%7D%0A+%7D%0A%0A+%5Catom%5BAtom+on+the+left%5D%7Bleft%7D%7B%0A++++1s+%3D+%7B+0%3B+pair%7D+%2C%0A++++2s+%3D+%7B+1%3B+pair%7D+%2C%0A++++2p+%3D+%7B1.5%3B+up%2C+down+%7D%0A+%7D%0A%5Cend%7Bmodiagram%7D%0A%5Cend%7Bdocument%7D)

此示例生成以下输出：

![分子轨道示例](/files/6b96295590d3893c5d5ef096ec7ad8b78feb2343)

## 分子

分子的语法与 [`\atom`](#atoms) 非常相似，并且按照文档风格，可以写为：

`\molecule`\[$$\langle$$`名称`$$\rangle$$]{$$\langle$$`MO-spec`$$\rangle$$}

其中

* $$\langle$$`名称`$$\rangle$$ 是分子的可选标题
* $$\langle$$`MO-spec`$$\rangle$$ 是分子轨道的规范

这些能级子层 `1s`, `2s` 和 `2p` 变为 `1sMO`, `2sMO` 和 `2pMO` 分别对应。下面是一个基本示例：

```latex
\documentclass{article}
\usepackage{modiagram}
\begin{document}
\begin{modiagram}
 \atom{left}{1s}
 \atom{right}{1s={;up}}
 \molecule{
    1sMO={0.75;pair,up}
  }
\end{modiagram}
\end{document}
```

[在 Overleaf 中打开此示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Molecule+example+with+modiagram+package\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bmodiagram%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bmodiagram%7D%0A+%5Catom%7Bleft%7D%7B1s%7D%0A+%5Catom%7Bright%7D%7B1s%3D%7B%3Bup%7D%7D%0A+%5Cmolecule%7B%0A++++1sMO%3D%7B0.75%3Bpair%2Cup%7D%0A++%7D%0A%5Cend%7Bmodiagram%7D%0A%5Cend%7Bdocument%7D)

此示例生成以下输出：

![分子图示例](/files/06e9d0982e8698ef2adb82fb32467f3514ef8ee2)

在上面的示例中，分子轨道规范（$$\langle$$`MO-spec`$$\rangle$$ ）是

```latex
1sMO={0.75;pair,up}
```

其中

* `0.75` 现在是比率 *（能量增益）/（能量损失）*.
* `pair, up` 分别是成键和反键分子轨道中电子的自旋。

下一个稍微更复杂一些的示例将帮助你理解语法：

```latex
\documentclass{article}
\usepackage{modiagram}
\begin{document}
\begin{modiagram}
 \atom{left}{
      1s, 2s, 2p = {;pair,up,up}
  }
  \atom{right}{
      1s, 2s, 2p = {;pair,up,up}
  }
  \molecule{
      1sMO, 2sMO, 2pMO = {;pair,pair,pair,up,up}
  }
\end{modiagram}
\end{document}
```

[在 Overleaf 中打开此示例](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=More+elaborate+modiagram+example\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bmodiagram%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bmodiagram%7D%0A+%5Catom%7Bleft%7D%7B%0A++++++1s%2C+2s%2C+2p+%3D+%7B%3Bpair%2Cup%2Cup%7D%0A++%7D%0A++%5Catom%7Bright%7D%7B%0A++++++1s%2C+2s%2C+2p+%3D+%7B%3Bpair%2Cup%2Cup%7D%0A++%7D%0A++%5Cmolecule%7B%0A++++++1sMO%2C+2sMO%2C+2pMO+%3D+%7B%3Bpair%2Cpair%2Cpair%2Cup%2Cup%7D%0A++%7D%0A%5Cend%7Bmodiagram%7D%0A%5Cend%7Bdocument%7D)

此示例生成以下输出：

![分子轨道详细示例](/files/7672e27f972a12b7a6a9b345d6e80ef70c9e17b3)

图的两侧各放置三个原子，对应的分子位于中间。

## 命名方案

下图转载自 [`modiagram` 宏包](https://ctan.org/pkg/modiagram?lang=en) 文档。它包含用于轨道的名称（标签），这些标签是一个 `tikzpicture` 中的节点，因此可以在 `modiagram` 环境中。

![modiagram 轨道名称](/files/010ec8a051c74552ffb65ef5cae0c174e8f830b4)

以下是一个使用反键轨道名称的示例 `1sigma*` 进行相对定位。

```latex
\documentclass{article}
\usepackage{modiagram}
\begin{document}
\begin{modiagram}
 \atom{left}{1s}
 \atom{right}{1s={;up}}
 \molecule{
    1sMO={;pair,up}
 }
 \draw[<-,shorten <=8pt,shorten >=15pt,blue]
 (1sigma*) --++(2,1) node {反键 MO};
\end{modiagram}
\end{document}
```

[在 Overleaf 中打开此示例。](https://www.overleaf.com/docs?engine=pdflatex\&snip_name=Using+orbital+labels+in+an+modiagram+environment\&snip=%5Cdocumentclass%7Barticle%7D%0A%5Cusepackage%7Bmodiagram%7D%0A%5Cbegin%7Bdocument%7D%0A%5Cbegin%7Bmodiagram%7D%0A+%5Catom%7Bleft%7D%7B1s%7D%0A+%5Catom%7Bright%7D%7B1s%3D%7B%3Bup%7D%7D%0A+%5Cmolecule%7B%0A++++1sMO%3D%7B%3Bpair%2Cup%7D%0A+%7D%0A+%5Cdraw%5B%3C-%2Cshorten+%3C%3D8pt%2Cshorten+%3E%3D15pt%2Cblue%5D%0A+%281sigma%2A%29+--%2B%2B%282%2C1%29+node+%7Banti-bonding+MO%7D%3B%0A%5Cend%7Bmodiagram%7D%0A%5Cend%7Bdocument%7D)

此示例生成以下输出：

![带有反键轨道的示例](/files/bb4ef24509efd9e6f17163bc243576e32a2d6546)

## 进一步阅读

更多信息请参见：

* [化学公式](/latex/zh-cn/te-ding-ling-yu/02-chemistry-formulae.md)
* [费曼图](/latex/zh-cn/te-ding-ling-yu/03-feynman-diagrams.md)
* [TikZ 宏包](/latex/zh-cn/tu-biao-he-biao-ge/05-tikz-package.md)
* [直接在 LaTeX 中绘制图示](/latex/zh-cn/tu-biao-he-biao-ge/04-picture-environment.md)
* [插入图片](/latex/zh-cn/geng-duo-zhu-ti/27-inserting-images.md)
* [希腊字母和数学符号列表](/latex/zh-cn/shu-xue/11-list-of-greek-letters-and-math-symbols.md)
* [该 `modiagram` 手册](http://mirrors.ctan.org/macros/latex/contrib/modiagram/modiagram_en.pdf)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://overleaf-pro.ayaka.space/latex/zh-cn/te-ding-ling-yu/04-molecular-orbital-diagrams.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
