> 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-tw/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-tw/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/31d6cbf9517d59d0efa0c4708d2108b49cbdf946)

繪製 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/cb2477be83042d8fd2bfa3ded12364a75af8f253)

在此範例中，繪出了兩個相同的原子，分別左對齊與右對齊。

依照 `modiagram` 套件文件的風格，建立原子的通用語法可寫為：

`\atom`\[$$\langle$$`名稱`$$\rangle$$]{$$\langle$$`left`$$\rangle$$|$$\langle$$`right`$$\rangle$$}{$$\langle$$`AO 規格`$$\rangle$$}

其中

* $$\langle$$`名稱`$$\rangle$$ 是原子的選用名稱
* $$\langle$$`left`$$\rangle$$ 和 $$\langle$$`right`$$\rangle$$ 決定在圖中的位置
* $$\langle$$`AO 規格`$$\rangle$$ 是原子軌域的規格。

該 $$\langle$$`AO 規格`$$\rangle$$ 一般形式如下：

```latex
sub-level = {energy; specifications}
```

其中

* `次層` 可以是 `1s`, `2s` 或 `2p`
* `能量` 是能階，一個決定圖中垂直間距的數字。若省略，則設為 0。
* `規格` 是各軌域中電子自旋的逗號分隔清單。可用值為 `up`, `down`, `pair` 而空白（只輸入分號）則表示空軌域。若省略，則設為 `pair`.

以下是前一個範例中所用指令的說明：

* `1s = { 0; pair}`。次層 `1s` 位於 `0` 能階中，該軌域包含兩個（成對）電子。
* `2s = { 1; pair}`。次層 `2s` 繪於 `1` 能階中，此軌域有兩個電子。
* `2p = {1.5; up, down}`。次層 `2p` 繪於能階 `1.5`，也就是說在圖中垂直間距設為 1.5；此次能階有兩個電子：一個自旋為 `up` 位於第一個軌域中，另一個自旋為 `down` 位於第二個軌域中。

右側第二個原子會重複相同的指令。

若要顯示（可選的） `名稱` 原子名稱，請使用 `modiagram` 附帶 `[names]` 選項：

```latex
\documentclass{article}
\usepackage{modiagram}
\begin{document}
\begin{modiagram}[names]
 \atom[Atom on the right]{right}{
    1s = { 0; pair} ,
    2s = { 1; pair} ,
    2p = {1.5; up, down }
 }

 \atom[Atom on the left]{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/f3bfc842c6f1867b216dac33b3e66890b43e1a02)

## 分子

分子的語法與 [`\atom`](#atoms) 非常相似，依照文件風格可寫為：

`\molecule`\[$$\langle$$`名稱`$$\rangle$$]{$$\langle$$`MO 規格`$$\rangle$$}

其中

* $$\langle$$`名稱`$$\rangle$$ 是分子的選用標題
* $$\langle$$`MO 規格`$$\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/59858a6ed905190b67e7734e55158fe3e27d97a4)

在上例中，分子軌域規格（$$\langle$$`MO 規格`$$\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/8573cd4014c55d1b68507ab55cc122fe94dbab72)

圖的兩側各放置三個原子，對應的分子位於中間。

## 命名方式

下圖重現自 [`modiagram` 套件](https://ctan.org/pkg/modiagram?lang=en) 文件。它包含用於軌域的名稱（標籤），這些名稱是 `tikzpicture` 中的節點，因此可在 `modiagram` 環境中。

![modiagram 軌域名稱](/files/d486a274226486f261dd4d8206939180f8dfc6a5)

以下是一個使用反鍵軌域名稱的範例 `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/1057eb9018c0c394daf8769b624707ca3d0f2a42)

## 延伸閱讀

詳情請見：

* [化學式](/latex/zh-tw/te-ding-ling-yu/02-chemistry-formulae.md)
* [費曼圖](/latex/zh-tw/te-ding-ling-yu/03-feynman-diagrams.md)
* [TikZ 套件](/latex/zh-tw/tu-biao-yu-biao-ge/05-tikz-package.md)
* [直接在 LaTeX 中繪製圖表](/latex/zh-tw/tu-biao-yu-biao-ge/04-picture-environment.md)
* [插入圖片](/latex/zh-tw/geng-duo-zhu-ti/27-inserting-images.md)
* [希臘字母與數學符號列表](/latex/zh-tw/shu-xue/11-list-of-greek-letters-and-math-symbols.md)
* [該 `modiagram` manual](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-tw/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.
