Skip to content

Commit

Permalink
add dft-choices.typ converted from TikZ
Browse files Browse the repository at this point in the history
add feynman-diagram-propagator-loop.typ converted from TikZ
  • Loading branch information
janosh committed Feb 1, 2025
1 parent ee02ffd commit 469f1c8
Show file tree
Hide file tree
Showing 4 changed files with 227 additions and 10 deletions.
15 changes: 8 additions & 7 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ repos:
pass_filenames: false
types: [yaml]
additional_dependencies: [pyyaml]
- id: update-readme-table
name: Update readme.md table
entry: python scripts/update_readme_table.py
language: python
pass_filenames: false
types: [yaml]
additional_dependencies: [pyyaml]
# TODO fix update-readme-table, gets stuck in infinite loop somewhow
# - id: update-readme-table
# name: Update readme.md table
# entry: python scripts/update_readme_table.py
# language: python
# pass_filenames: false
# types: [file]
# additional_dependencies: [pyyaml]
151 changes: 151 additions & 0 deletions assets/dft-choices/dft-choices.typ
Original file line number Diff line number Diff line change
@@ -0,0 +1,151 @@
#import "@preview/cetz:0.3.2": canvas, draw

#set page(width: auto, height: auto, margin: 8pt)
#set text(size: 15pt)

#canvas({
import draw: line, content, rect

// Define styles and constants
let node-sep = 1.7 // Reduced horizontal separation
let arrow-style = (mark: (end: "stealth", fill: black, offset: 4pt), stroke: 0.8pt)
let node-height = 1.6 // Shorter boxes
let node-width = 1.2 // Increased for larger text

// Helper function to create rounded rectangle nodes
let node(pos, text, fill: none, name: none, width: node-width, height: node-height) = {
rect(
(rel: (-width, -height / 2), to: pos),
(rel: (2 * width, height)),
fill: fill,
stroke: black + 0.4pt,
radius: 0.2,
name: name,
)
content(name, scale(140%, text))
}

// Create main equation nodes

node(
(0, 0),
$-frac(planck.reduce^2, 2m) arrow(nabla)_arrow(r)^2$,
fill: rgb("#ffd699"),
name: "kinetic",
width: 1.3 * node-width,
) // Kinetic term

content((rel: (-1.6 * node-width, 0.1), to: "kinetic"), scale(350%, $($), name: "lparen") // Opening parenthesis
content((rel: (1.6 * node-width, 0), to: "kinetic"), $+$, name: "plus-1")

node(
(rel: (1.4 * node-width, 0), to: "plus-1"),
$v_"ext" (arrow(r))$,
fill: rgb("#ffb3b3"),
name: "ext",
) // External potential

content((rel: (1.4 * node-width, 0), to: "ext"), $+$, name: "plus-2")

node(
(rel: (1.4 * node-width, 0), to: "plus-2"),
$v_H (arrow(r))$,
fill: rgb("#ffb3b3"),
name: "hartree",
) // Hartree potential

content((rel: (1.4 * node-width, 0), to: "hartree"), $+$, name: "plus-3")

node(
(rel: (1 * node-width, 0), to: "plus-3"),
$v_"xc"$,
fill: rgb("#ffb3b3"),
name: "xc",
width: .6 * node-width,
) // Exchange-correlation

content(
(rel: (1 * node-width, 0.1), to: "xc"),
scale(350%, $)$),
name: "rparen",
padding: 5pt,
) // Large closing parenthesis

node(
(rel: (2.4 * node-width, 0), to: "xc"),
$phi_i (arrow(r))$,
fill: rgb("#e6e6e6"),
name: "phi1",
) // Wavefunction 1

content((rel: (1.4 * node-width, 0), to: "phi1"), $=$, name: "eq-1")

node(
(rel: (1 * node-width, 0), to: "eq-1"),
$E_i$,
fill: rgb("#b3d9ff"),
name: "energy",
width: 0.6 * node-width,
) // Energy

node(
(rel: (1.9 * node-width, 0), to: "energy"),
$phi_i (arrow(r))$,
fill: rgb("#e6e6e6"),
name: "phi2",
) // Wavefunction 2

// Add comment boxes and arrows
let comment(pos, text, target-name, name: none) = {
content(pos, align(center, text), name: name)
line(name, target-name, ..arrow-style)
}

// Add comments with arrows
comment(
(node-sep, 3),
[non-rel. Schrödinger equation\
or relativistic Dirac equation],
"kinetic",
name: "kinetic-comment",
)

comment(
(rel: (-2, -3), to: "ext"),
[pseudopotential\
(ultrasoft/PAW/norm-conserving)\ or all-electron],
"ext",
name: "ext-comment",
)

comment(
(4.9 * node-sep, -3),
[Hartree potential\ from solving Poisson eq.\
or integrating charge density],
"hartree",
name: "hartree-comment",
)

comment(
(5 * node-sep, 3),
[LDA or GGA\ or hybrids],
"xc",
name: "xc-comment",
)

comment(
(rel: (2, 3), to: "phi1"),
[physical orbitals or not\ mesh density and basis set],
"phi1",
name: "phi-comment",
)
line("phi-comment", "phi2", ..arrow-style)

comment(
(rel: (0, -3), to: "energy"),
[view EVs as mere Lagrange\ multipliers or band structure approx],
"energy",
name: "energy-comment",
)
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
#import "@preview/cetz:0.3.2": canvas, draw

#set page(width: auto, height: auto, margin: 8pt)

#canvas({
import draw: line, content, circle, arc

// Define styles and constants
let radius = 1.5
let dark-blue = rgb("#4040d9")
let arrow-style = (
mark: (end: "stealth", fill: dark-blue, scale: .5),
stroke: (paint: dark-blue, thickness: 0.75pt),
)
// Draw loop circle
circle((0, 0), radius: radius, name: "loop")
// Add labels for masses/widths
content("loop.0%", $m_1^2, gamma_1^2$, anchor: "south", padding: 3pt)
content("loop.50%", $m_2^2, gamma_2^2$, anchor: "north", padding: 3pt)
// Draw momentum arrow on loop
arc(
(rel: (.23, 0), to: "loop.15%"),
radius: 0.85 * radius,
start: 140deg,
stop: 40deg,
..arrow-style,
name: "momentum-arrow",
)
content(
"momentum-arrow.mid",
text(fill: dark-blue)[$q_0$],
anchor: "north",
)
// Draw external lines
let ext-len = 2.2 * radius
// Left external line
circle("loop.25%", radius: 2pt, fill: black, name: "left-vertex")
line((-ext-len, 0), "left-vertex", stroke: 1pt, name: "left-line")
// Right external line
circle("loop.75%", radius: 2pt, fill: black, name: "right-vertex")
line("right-vertex", (ext-len, 0), stroke: 1pt, name: "right-line")
// Add momentum arrows on external lines
line(
(rel: (0.15, 0.15), to: "left-line.start"),
(rel: (-0.15, 0.15), to: "left-line.end"),
..arrow-style,
name: "left-momentum",
)
content("left-momentum", text(fill: dark-blue)[$q_0$], anchor: "south", padding: 3pt)
line(
(rel: (0.15, 0.15), to: "right-line.start"),
(rel: (-0.15, 0.15), to: "right-line.end"),
..arrow-style,
name: "right-momentum",
)
content("right-momentum", text(fill: dark-blue)[$q_0$], anchor: "south", padding: 3pt)
})
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<h3 align="center">

[![57+1 with Typst](https://img.shields.io/badge/62%20with-Typst-1f425f.svg?logo=typst)](https://typst.app)
[![57+1 with Typst](https://img.shields.io/badge/64%20with-Typst-1f425f.svg?logo=typst)](https://typst.app)
[![113 with LaTeX](https://img.shields.io/badge/113%20with-LaTeX-1f425f.svg?logo=latex)](https://latex-project.org)
[![Site](https://github.com/janosh/diagrams/actions/workflows/gh-pages.yml/badge.svg)](https://github.com/janosh/diagrams/actions/workflows/gh-pages.yml)
[![Pull Requests Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?logo=github)](https://github.com/janosh/diagrams/pulls)
Expand Down Expand Up @@ -40,7 +40,7 @@ Have a TikZ/Cetz diagram you'd like to share? [Submit a PR](https://github.com/j
| ![`convex-functions.png`](assets/convex-functions/convex-functions.png) | ![`convex-hull-of-stability.png`](assets/convex-hull-of-stability/convex-hull-of-stability.png) |
| [`critical-temperature`](https://janosh.github.io/diagrams/critical-temperature) &nbsp;[![LaTeX][latex-logo]](assets/critical-temperature/critical-temperature.tex)&nbsp;[![Typst][typst-logo]](assets/critical-temperature/critical-temperature.typ) | [`cylinder-to-plane`](https://janosh.github.io/diagrams/cylinder-to-plane) &nbsp;[![LaTeX][latex-logo]](assets/cylinder-to-plane/cylinder-to-plane.tex) |
| ![`critical-temperature.png`](assets/critical-temperature/critical-temperature.png) | ![`cylinder-to-plane.png`](assets/cylinder-to-plane/cylinder-to-plane.png) |
| [`dft-choices`](https://janosh.github.io/diagrams/dft-choices) &nbsp;[![LaTeX][latex-logo]](assets/dft-choices/dft-choices.tex) | [`dft-jacobs-ladder`](https://janosh.github.io/diagrams/dft-jacobs-ladder) &nbsp;[![Typst][typst-logo]](assets/dft-jacobs-ladder/dft-jacobs-ladder.typ) |
| [`dft-choices`](https://janosh.github.io/diagrams/dft-choices) &nbsp;[![LaTeX][latex-logo]](assets/dft-choices/dft-choices.tex)&nbsp;[![Typst][typst-logo]](assets/dft-choices/dft-choices.typ) | [`dft-jacobs-ladder`](https://janosh.github.io/diagrams/dft-jacobs-ladder) &nbsp;[![Typst][typst-logo]](assets/dft-jacobs-ladder/dft-jacobs-ladder.typ) |
| ![`dft-choices.png`](assets/dft-choices/dft-choices.png) | ![`dft-jacobs-ladder.png`](assets/dft-jacobs-ladder/dft-jacobs-ladder.png) |
| [`dft-mlff-cff-speed-accuracy-transfer`](https://janosh.github.io/diagrams/dft-mlff-cff-speed-accuracy-transfer) &nbsp;[![LaTeX][latex-logo]](assets/dft-mlff-cff-speed-accuracy-transfer/dft-mlff-cff-speed-accuracy-transfer.tex)&nbsp;[![Typst][typst-logo]](assets/dft-mlff-cff-speed-accuracy-transfer/dft-mlff-cff-speed-accuracy-transfer.typ) | [`diagrams`](https://janosh.github.io/diagrams/diagrams) &nbsp;[![LaTeX][latex-logo]](assets/diagrams/diagrams.tex) |
| ![`dft-mlff-cff-speed-accuracy-transfer.png`](assets/dft-mlff-cff-speed-accuracy-transfer/dft-mlff-cff-speed-accuracy-transfer.png) | ![`diagrams.png`](assets/diagrams/diagrams.png) |
Expand All @@ -58,7 +58,7 @@ Have a TikZ/Cetz diagram you'd like to share? [Submit a PR](https://github.com/j
| ![`feynman-diagram-4.png`](assets/feynman-diagram-4/feynman-diagram-4.png) | ![`feynman-diagram-loop.png`](assets/feynman-diagram-loop/feynman-diagram-loop.png) |
| [`feynman-diagram-loops`](https://janosh.github.io/diagrams/feynman-diagram-loops) &nbsp;[![LaTeX][latex-logo]](assets/feynman-diagram-loops/feynman-diagram-loops.tex) | [`feynman-diagram-one-point`](https://janosh.github.io/diagrams/feynman-diagram-one-point) &nbsp;[![LaTeX][latex-logo]](assets/feynman-diagram-one-point/feynman-diagram-one-point.tex) |
| ![`feynman-diagram-loops.png`](assets/feynman-diagram-loops/feynman-diagram-loops.png) | ![`feynman-diagram-one-point.png`](assets/feynman-diagram-one-point/feynman-diagram-one-point.png) |
| [`feynman-diagram-propagator-loop`](https://janosh.github.io/diagrams/feynman-diagram-propagator-loop) &nbsp;[![LaTeX][latex-logo]](assets/feynman-diagram-propagator-loop/feynman-diagram-propagator-loop.tex) | [`four-vs-of-data`](https://janosh.github.io/diagrams/four-vs-of-data) &nbsp;[![LaTeX][latex-logo]](assets/four-vs-of-data/four-vs-of-data.tex)&nbsp;[![Typst][typst-logo]](assets/four-vs-of-data/four-vs-of-data.typ) |
| [`feynman-diagram-propagator-loop`](https://janosh.github.io/diagrams/feynman-diagram-propagator-loop) &nbsp;[![LaTeX][latex-logo]](assets/feynman-diagram-propagator-loop/feynman-diagram-propagator-loop.tex)&nbsp;[![Typst][typst-logo]](assets/feynman-diagram-propagator-loop/feynman-diagram-propagator-loop.typ) | [`four-vs-of-data`](https://janosh.github.io/diagrams/four-vs-of-data) &nbsp;[![LaTeX][latex-logo]](assets/four-vs-of-data/four-vs-of-data.tex)&nbsp;[![Typst][typst-logo]](assets/four-vs-of-data/four-vs-of-data.typ) |
| ![`feynman-diagram-propagator-loop.png`](assets/feynman-diagram-propagator-loop/feynman-diagram-propagator-loop.png) | ![`four-vs-of-data.png`](assets/four-vs-of-data/four-vs-of-data.png) |
| [`gas-pressure-on-wall`](https://janosh.github.io/diagrams/gas-pressure-on-wall) &nbsp;[![LaTeX][latex-logo]](assets/gas-pressure-on-wall/gas-pressure-on-wall.tex)&nbsp;[![Typst][typst-logo]](assets/gas-pressure-on-wall/gas-pressure-on-wall.typ) | [`generative-adversarial-network`](https://janosh.github.io/diagrams/generative-adversarial-network) &nbsp;[![LaTeX][latex-logo]](assets/generative-adversarial-network/generative-adversarial-network.tex)&nbsp;[![Typst][typst-logo]](assets/generative-adversarial-network/generative-adversarial-network.typ) |
| ![`gas-pressure-on-wall.png`](assets/gas-pressure-on-wall/gas-pressure-on-wall.png) | ![`generative-adversarial-network.png`](assets/generative-adversarial-network/generative-adversarial-network.png) |
Expand Down

0 comments on commit 469f1c8

Please sign in to comment.