Skip to content

Commit 8a03639

Browse files
committed
add dft-choices.typ converted from TikZ
add feynman-diagram-propagator-loop.typ converted from TikZ add rnvp-affine-coupling-layer.typ converted from TikZ (renamed from rnvp.tex)
1 parent ee02ffd commit 8a03639

13 files changed

+366
-12
lines changed

.pre-commit-config.yaml

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,11 @@ repos:
7070
pass_filenames: false
7171
types: [yaml]
7272
additional_dependencies: [pyyaml]
73-
- id: update-readme-table
74-
name: Update readme.md table
75-
entry: python scripts/update_readme_table.py
76-
language: python
77-
pass_filenames: false
78-
types: [yaml]
79-
additional_dependencies: [pyyaml]
73+
# TODO fix update-readme-table, gets stuck in infinite loop somewhow
74+
# - id: update-readme-table
75+
# name: Update readme.md table
76+
# entry: python scripts/update_readme_table.py
77+
# language: python
78+
# pass_filenames: false
79+
# types: [file]
80+
# additional_dependencies: [pyyaml]

assets/dft-choices/dft-choices.typ

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
#import "@preview/cetz:0.3.2": canvas, draw
2+
3+
#set page(width: auto, height: auto, margin: 8pt)
4+
#set text(size: 15pt)
5+
6+
#canvas({
7+
import draw: line, content, rect
8+
9+
// Define styles and constants
10+
let node-sep = 1.7 // Reduced horizontal separation
11+
let arrow-style = (mark: (end: "stealth", fill: black, offset: 4pt), stroke: 0.8pt)
12+
let node-height = 1.6 // Shorter boxes
13+
let node-width = 1.2 // Increased for larger text
14+
15+
// Helper function to create rounded rectangle nodes
16+
let node(pos, text, fill: none, name: none, width: node-width, height: node-height) = {
17+
rect(
18+
(rel: (-width, -height / 2), to: pos),
19+
(rel: (2 * width, height)),
20+
fill: fill,
21+
stroke: black + 0.4pt,
22+
radius: 0.2,
23+
name: name,
24+
)
25+
content(name, scale(140%, text))
26+
}
27+
28+
// Create main equation nodes
29+
30+
node(
31+
(0, 0),
32+
$-frac(planck.reduce^2, 2m) arrow(nabla)_arrow(r)^2$,
33+
fill: rgb("#ffd699"),
34+
name: "kinetic",
35+
width: 1.3 * node-width,
36+
) // Kinetic term
37+
38+
content((rel: (-1.6 * node-width, 0.1), to: "kinetic"), scale(350%, $($), name: "lparen") // Opening parenthesis
39+
40+
content((rel: (1.6 * node-width, 0), to: "kinetic"), $+$, name: "plus-1")
41+
42+
node(
43+
(rel: (1.4 * node-width, 0), to: "plus-1"),
44+
$v_"ext" (arrow(r))$,
45+
fill: rgb("#ffb3b3"),
46+
name: "ext",
47+
) // External potential
48+
49+
content((rel: (1.4 * node-width, 0), to: "ext"), $+$, name: "plus-2")
50+
51+
node(
52+
(rel: (1.4 * node-width, 0), to: "plus-2"),
53+
$v_H (arrow(r))$,
54+
fill: rgb("#ffb3b3"),
55+
name: "hartree",
56+
) // Hartree potential
57+
58+
content((rel: (1.4 * node-width, 0), to: "hartree"), $+$, name: "plus-3")
59+
60+
node(
61+
(rel: (1 * node-width, 0), to: "plus-3"),
62+
$v_"xc"$,
63+
fill: rgb("#ffb3b3"),
64+
name: "xc",
65+
width: .6 * node-width,
66+
) // Exchange-correlation
67+
68+
content(
69+
(rel: (1 * node-width, 0.1), to: "xc"),
70+
scale(350%, $)$),
71+
name: "rparen",
72+
padding: 5pt,
73+
) // Large closing parenthesis
74+
75+
node(
76+
(rel: (2.4 * node-width, 0), to: "xc"),
77+
$phi_i (arrow(r))$,
78+
fill: rgb("#e6e6e6"),
79+
name: "phi1",
80+
) // Wavefunction 1
81+
82+
content((rel: (1.4 * node-width, 0), to: "phi1"), $=$, name: "eq-1")
83+
84+
node(
85+
(rel: (1 * node-width, 0), to: "eq-1"),
86+
$E_i$,
87+
fill: rgb("#b3d9ff"),
88+
name: "energy",
89+
width: 0.6 * node-width,
90+
) // Energy
91+
92+
node(
93+
(rel: (1.9 * node-width, 0), to: "energy"),
94+
$phi_i (arrow(r))$,
95+
fill: rgb("#e6e6e6"),
96+
name: "phi2",
97+
) // Wavefunction 2
98+
99+
// Add comment boxes and arrows
100+
let comment(pos, text, target-name, name: none) = {
101+
content(pos, align(center, text), name: name)
102+
line(name, target-name, ..arrow-style)
103+
}
104+
105+
// Add comments with arrows
106+
comment(
107+
(node-sep, 3),
108+
[non-rel. Schrödinger equation\
109+
or relativistic Dirac equation],
110+
"kinetic",
111+
name: "kinetic-comment",
112+
)
113+
114+
comment(
115+
(rel: (-2, -3), to: "ext"),
116+
[pseudopotential\
117+
(ultrasoft/PAW/norm-conserving)\ or all-electron],
118+
"ext",
119+
name: "ext-comment",
120+
)
121+
122+
comment(
123+
(4.9 * node-sep, -3),
124+
[Hartree potential\ from solving Poisson eq.\
125+
or integrating charge density],
126+
"hartree",
127+
name: "hartree-comment",
128+
)
129+
130+
comment(
131+
(5 * node-sep, 3),
132+
[LDA or GGA\ or hybrids],
133+
"xc",
134+
name: "xc-comment",
135+
)
136+
137+
comment(
138+
(rel: (2, 3), to: "phi1"),
139+
[physical orbitals or not\ mesh density and basis set],
140+
"phi1",
141+
name: "phi-comment",
142+
)
143+
line("phi-comment", "phi2", ..arrow-style)
144+
145+
comment(
146+
(rel: (0, -3), to: "energy"),
147+
[view EVs as mere Lagrange\ multipliers or band structure approx],
148+
"energy",
149+
name: "energy-comment",
150+
)
151+
})
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#import "@preview/cetz:0.3.2": canvas, draw
2+
3+
#set page(width: auto, height: auto, margin: 8pt)
4+
5+
#canvas({
6+
import draw: line, content, circle, arc
7+
8+
// Define styles and constants
9+
let radius = 1.5
10+
let dark-blue = rgb("#4040d9")
11+
let arrow-style = (
12+
mark: (end: "stealth", fill: dark-blue, scale: .5),
13+
stroke: (paint: dark-blue, thickness: 0.75pt),
14+
)
15+
16+
// Draw loop circle
17+
circle((0, 0), radius: radius, name: "loop")
18+
19+
// Add labels for masses/widths
20+
content("loop.0%", $m_1^2, gamma_1^2$, anchor: "south", padding: 3pt)
21+
content("loop.50%", $m_2^2, gamma_2^2$, anchor: "north", padding: 3pt)
22+
23+
// Draw momentum arrow on loop
24+
arc(
25+
(rel: (.23, 0), to: "loop.15%"),
26+
radius: 0.85 * radius,
27+
start: 140deg,
28+
stop: 40deg,
29+
..arrow-style,
30+
name: "momentum-arrow",
31+
)
32+
content(
33+
"momentum-arrow.mid",
34+
text(fill: dark-blue)[$q_0$],
35+
anchor: "north",
36+
)
37+
38+
// Draw external lines
39+
let ext-len = 2.2 * radius
40+
41+
// Left external line
42+
circle("loop.25%", radius: 2pt, fill: black, name: "left-vertex")
43+
line((-ext-len, 0), "left-vertex", stroke: 1pt, name: "left-line")
44+
45+
// Right external line
46+
circle("loop.75%", radius: 2pt, fill: black, name: "right-vertex")
47+
line("right-vertex", (ext-len, 0), stroke: 1pt, name: "right-line")
48+
49+
// Add momentum arrows on external lines
50+
line(
51+
(rel: (0.15, 0.15), to: "left-line.start"),
52+
(rel: (-0.15, 0.15), to: "left-line.end"),
53+
..arrow-style,
54+
name: "left-momentum",
55+
)
56+
content("left-momentum", text(fill: dark-blue)[$q_0$], anchor: "south", padding: 3pt)
57+
58+
line(
59+
(rel: (0.15, 0.15), to: "right-line.start"),
60+
(rel: (-0.15, 0.15), to: "right-line.end"),
61+
..arrow-style,
62+
name: "right-momentum",
63+
)
64+
content("right-momentum", text(fill: dark-blue)[$q_0$], anchor: "south", padding: 3pt)
65+
})
Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,135 @@
1+
#import "@preview/cetz:0.3.2": canvas, draw
2+
3+
#set page(width: auto, height: auto, margin: 8pt)
4+
5+
#canvas({
6+
import draw: line, content, rect, circle, hobby
7+
8+
// Define styles and constants
9+
let node-width = 1
10+
let node-height = 0.6
11+
let horiz-sep = 1.2
12+
let vert-sep = 4
13+
let arrow-style = (end: "stealth", fill: black, scale: .5)
14+
let (orange, blue, teal) = (rgb("#e8c268"), rgb("#63a7e390"), rgb("#008080"))
15+
16+
// Helper function for boxes
17+
let box(pos, text, fill: none, name: none) = {
18+
rect(
19+
pos,
20+
(rel: (node-width, node-height)),
21+
fill: fill,
22+
stroke: black + 0.3pt,
23+
name: name,
24+
)
25+
content(name, text)
26+
}
27+
28+
// Top row x nodes
29+
box((0, 0), $x_1$, fill: blue, name: "x1")
30+
box((horiz-sep, 0), $x_2$, fill: blue, name: "x2")
31+
box((3 * horiz-sep, 0), $x_d$, fill: blue, name: "xd")
32+
content(("x2", 50%, "xd"), text(size: 14pt)[$dots.c$], name: "xdots1")
33+
34+
// Green boxes with more spacing
35+
box((5 * horiz-sep, 0), $x_(d+1)$, fill: orange, name: "xd-plus-1")
36+
box((7 * horiz-sep, 0), $x_D$, fill: orange, name: "xD")
37+
content(("xd-plus-1", 50%, "xD"), text(size: 14pt)[$dots.c$], name: "xdots2")
38+
39+
// Bottom row z nodes
40+
box((0, -vert-sep), $z_1$, fill: blue, name: "z1")
41+
box((horiz-sep, -vert-sep), $z_2$, fill: blue, name: "z2")
42+
box((3 * horiz-sep, -vert-sep), $z_d$, fill: blue, name: "zd")
43+
content(("z2", 50%, "zd"), text(size: 14pt)[$dots.c$], name: "zdots1")
44+
45+
// Orange boxes
46+
box((5 * horiz-sep, -vert-sep), $z_(d+1)$, fill: orange, name: "zd-plus-1")
47+
box((7 * horiz-sep, -vert-sep), $z_D$, fill: orange, name: "zD")
48+
content(("zd-plus-1", 50%, "zD"), text(size: 14pt)[$dots.c$], name: "zdots2")
49+
50+
// Vertical connecting lines
51+
line("z1", "x1", mark: arrow-style, name: "line1")
52+
line("z2", "x2", mark: arrow-style, name: "line2")
53+
line("zd", "xd", mark: arrow-style, name: "lined")
54+
line("zd-plus-1", "xd-plus-1", mark: arrow-style, name: "line-d-plus-1")
55+
line("zD", "xD", mark: arrow-style, name: "lineD")
56+
57+
// Scale and translate functions
58+
let mid-x = 4 * horiz-sep
59+
let mid-y = -vert-sep / 2
60+
61+
// Function triangles and circles
62+
// Draw t triangle with lines
63+
content(
64+
(4.3 * horiz-sep, 0.4 * -vert-sep),
65+
text(fill: white)[t],
66+
frame: "circle",
67+
name: "t-circle",
68+
stroke: none,
69+
fill: teal,
70+
padding: 2pt,
71+
)
72+
line(
73+
"z1.north-west",
74+
"t-circle",
75+
"zd.north-east",
76+
fill: teal.transparentize(40%),
77+
close: true,
78+
stroke: none,
79+
name: "t-triangle",
80+
)
81+
82+
// Draw s triangle with lines
83+
content(
84+
(rel: (.6, -.75), to: "t-circle"),
85+
text(fill: white, baseline: -1pt)[s],
86+
frame: "circle",
87+
name: "s-circle",
88+
stroke: none,
89+
fill: orange,
90+
padding: 2pt,
91+
)
92+
line(
93+
"z1.north-west",
94+
"s-circle",
95+
"zd.north-east",
96+
fill: orange.transparentize(30%),
97+
close: true,
98+
stroke: none,
99+
name: "s-triangle",
100+
)
101+
102+
// Operation circles
103+
for line-name in ("line-d-plus-1", "lineD") {
104+
for (op, (color, label, pos)) in (
105+
"odot": (orange, $dot.circle$, "40%"),
106+
"oplus": (teal, $plus.circle$, "70%"),
107+
).pairs() {
108+
content(
109+
line-name + "." + pos,
110+
text(fill: white, baseline: -.2pt)[#label],
111+
frame: "circle",
112+
name: line-name + "-" + op,
113+
stroke: none,
114+
fill: color,
115+
padding: .1pt,
116+
)
117+
}
118+
}
119+
120+
// Connect s and t to operations
121+
for line-name in ("line-d-plus-1", "lineD") {
122+
hobby(
123+
"s-circle",
124+
line-name + "-odot",
125+
mark: (..arrow-style, offset: 5pt),
126+
stroke: orange + 0.75pt,
127+
)
128+
hobby(
129+
"t-circle",
130+
line-name + "-oplus",
131+
mark: (..arrow-style, offset: 5pt),
132+
stroke: teal + 0.75pt,
133+
)
134+
}
135+
})

assets/rnvp/rnvp.yml renamed to assets/rnvp-affine-coupling-layer/rnvp-affine-coupling-layer.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
title: RNVP
1+
title: RNVP Affine Coupling Layer
22
tags:
33
- machine learning
44
- generative modeling

0 commit comments

Comments
 (0)