我曾尝试使用 LaTeX 构建一个图形并将其附加到我的 LaTeX 文档上,但不幸的是,这样做会损失很多质量,而我非常想保留 LaTeX 风格,因此我开始构建它。虽然行与行之间的间距太大,但方案非常简单。我最大的问题是如何在右侧书写和绘制箭头。我将在这里将方程式作为向下箭头,这是代码的一部分。
\begin{equation}
\begin{split}
$Construct $ v(r_i)&=-\sum_{\alpha}\frac{Z_\alpha}{r_{i\alpha}} \nonumber
\label{}
\end{split}
\end{equation}
\begin{center}
$\Big\downarrow$
\end{center}
\begin{equation}
\begin{split}
$Guess $ n(r) \nonumber
\label{}
\end{split}
\end{equation}
\begin{center}
$\Big\downarrow$
\end{center}
\begin{equation}
\begin{split}
v_{s}=v(r)+\int\frac{n(r')}{|r-r'|}dr'+v_{xc}(r) \nonumber
\label{}
\end{split}
\end{equation}
\begin{center}
$\Big\downarrow$
\end{center}
\begin{equation}
\begin{split}
[-\frac{1}{2}\nabla^2+v+v_H+v_{xc}]\psi_i=\epsilon\psi_i \nonumber
\label{}
\end{split}
\end{equation}
\begin{center}
$\Big\downarrow$
\end{center}
\begin{equation}
\begin{split}
n(r)=\sum_i^N|\psi_i|^2 \nonumber
\label{}
\end{split}
\end{equation}
\begin{center}
$\Big\downarrow$
\end{center}
\begin{center}
\textcolor{green}{\textbf{YES}}
\end{center}
答案1
有两种基本钛钾这里可以使用的 Z 工具,chains
或者matrix
。这是基于 的提案chains
。
\documentclass{article}
\usepackage{mleftright}
\usepackage{tikz}
\usetikzlibrary{arrows.meta,bending,chains}
\newcommand{\diff}{\mathop{}\!\mathrm{d}}
\mleftright
\begin{document}
\begin{tikzpicture}[arj/.style={semithick,-Stealth[bend]}]
\path[start chain=D going below,nodes={on chain,join=by arj,align=center}]
node{Construct $\displaystyle v(r_i)=-\sum_{\alpha}\frac{Z_\alpha}{r_{i\alpha}}$}
node{Guess $\displaystyle n(r)$}
node[alias=calc1]{Calculate $\displaystyle v_{s}=v(r)+\int\frac{n(r')}{|r-r'|}\diff r'+v_{xc}(r)$}
node[alias=solve]{Solve the Kohn--Sham equation\\
$\displaystyle \left[-\frac{1}{2}\nabla^2+v+v_H+v_{xc}\right]\psi_i=\varepsilon\psi_i$}
node[alias=calc2]{Calculate new $\displaystyle n(r)=\sum_i^N|\psi_i|^2$}
node[alias=q]{Does the calculation converge?}
node[text=green!70!black]{YES}
node{Calculate eigenvalues.};
\path node[right=8em of calc2,text=red] (NO) {NO}
(NO|-solve) node (gen) {Generate new $n(r)$};
\draw[arj] (q) to[out=0,in=-90] (NO);
\draw[arj] (NO) to (gen);
\draw[arj] (gen) to[out=90,in=0] (calc1);
\end{tikzpicture}
\end{document}
答案2
一种方式是pstricks
:在标准alignat
环境中,我嵌套两个gathered
环境,并在这些环境内定义两对用 s 连接的节点\nccurve
:
\documentclass{article}
\usepackage{nccmath, mathtools}
\usepackage{old-arrows}
\usepackage[usestackEOL]{stackengine}
\usepackage{xcolor}
\usepackage{pst-node}
\begin{document}
\begin{alignat*}{2}
& \begin{gathered}
\text{Construct\enspace} v(r_i)=-\smash[b]{\sum_{\alpha}\frac{Z_\alpha}{r_{i\alpha}}} \\
\Big\downarrow \\
\text{Guess\enspace} n(r)\\
\Big\downarrow \\
\text{Calculate\enspace} v_{s}=v(r)+\int\frac{n(r')}{|r-r'|}dr'+v_{xc}(r) \pnode[2em, 0pt]{Int}\\
\Big\downarrow \\
\Centerstack[l]{Solve the Kohn-\\Sham equation}\enspace\Bigl [-\mfrac{1}{2}\nabla^2+v+v_H+v_{xc}\Bigr]\psi_i=\epsilon\psi_i \\
\Big\downarrow \\
\text{Calculate new \enspace}n(r)=\smash{\sum_i^N}|\psi_i|^2 \\
\Big\downarrow \\
\text{Does the calculation converge?}\pnode[3em, 0pt]{Conv} \\
\Big. \vrule \\
\textbf{\color{green}YES} \\
\Big\downarrow \\
\text{Calculate eigenvalues}
\end{gathered}
&\hspace{4em} & \begin{gathered}
\rnode{Gen}{\text{Generate new\enspace} n(r)} \\
\Big\uparrow \\
\rnode{No}{\textbf{\color{red}NO}}
\end{gathered}
\psset{linewidth=0.4pt, nodesep=3pt, arrowinset=0.2, arrowsize=3pt}
\nccurve[angleA=5, angleB=-100]{Conv}{No}
\nccurve[angleA=100, angleB=-5, arrows=->]{Gen}{Int}
\end{alignat*}
\end{document}