Skip to content

Instantly share code, notes, and snippets.

@theoctober19th
Created May 21, 2019 10:43
Show Gist options
  • Save theoctober19th/10c7ee6a404a7894324281b7a8f6e773 to your computer and use it in GitHub Desktop.
Save theoctober19th/10c7ee6a404a7894324281b7a8f6e773 to your computer and use it in GitHub Desktop.
Flowchart
\documentclass[a4paper,10pt]{article}
\usepackage[utf8]{inputenc}
\usepackage{tikz}
\usetikzlibrary{shapes.geometric, arrows}
\tikzstyle{decision} = [diamond, draw, text badly centered]
\tikzstyle{block} = [rectangle, draw, text centered, rounded corners, minimum size=2em, inner sep=4]
\tikzstyle{line} = [draw, -latex']
\begin{document}
\pagestyle{empty}
\begin{tikzpicture}[node distance = 2cm, auto]
% Blocks
\node [block] (guess) {Guess initial density $\rho^{in}(r)$ };
\node [block, below of=guess] (calc) {$\nu_{HK}(r) = \nu (r) + \frac{\partial J[\rho]}{\partial \rho (r)} + \frac{\partial Exc[\rho]}{\partial \rho (r)}$};
\node [block, below of=calc ] (solve) {\begin{tabular}{c}
Solve $[- \frac 1 2 V^2 + \nu_{HK} (r)] \psi_i = \epsilon_i \psi_i$ \\ Find new density: \\ $\rho^{out}(r) = \sum_{i=1}^{N} \left | \psi_i (r)\right | ^2$
\end{tabular} };
\node [decision, below of=solve, node distance = 3cm] (check) {$\left | \rho^{in} (r) - \rho^{out}(r) \right | $};
\node [block, below of=check, node distance = 3cm] (last) {\begin{tabular}{c}
$\rho = \rho^{out}$ \\
$E[\rho] = \int \rho(r) \nu(r) dr + F_{HK}[\rho]$
\end{tabular}};
%Edges
\path [line] (guess) -- (calc);
\path [line] (calc) -- (solve);
\path [line] (solve) -- (check);
\path [line] (check) -- node {$\leq \epsilon_r$} (last);
\path [line] (check.east) -- +(1.5,0) |- node[pos=0, above, right] {$> \epsilon_r $} (calc);
\end{tikzpicture}
\end{document}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment