No project description provided
Project description
title: The Meßthaler-Wulff Project author: Julia Meßthaler
Blazingly fast code for finding all crystals (subsets of a graph) that can be constructed using only transformations that locally minimize surface energy.
Subcommands
energies
crystals
stats
plot
Mathematical Background
quadratic form, etc
The Problem
Let $(G, E)$ be some graph and $N{}: G → \wp(G)$ denote the neighbors of a given node, defined as $$ N{}(n) := { n_0 \in G \mid {n_0, n} \in E } $$
Now we can define a crystal as $c \subset G$ with $c$ finite. This allows us to define the set of all crystals $C := { c \subset G \mid c \text{ finite} }$.
Now we can define the surface energy of the crystal $c$ (or arbitrary subsets of $G$) as $$ E_c := \sum_{n \in c} f_{G \setminus c}(n) $$ where $f_M(n)$ denotes the "friendliness" of the node $n$ or how many friends it has defined as $$ f_M(n) := # { n_0 \in N{}(n) \mid n_0 \in M } $$
The idea now is to find crystals $c$ such that $\frac{E_{c}}{#c}$ is optimal.
Note:
$$ E_c = \sum_{n} χ_c(n) · (#N{}(n) - f_c(n)) $$
$$ = \sum_n χ_c(n) · #N{}(n) - \sum_{a,b \in N{}(a)} χ_c(a) · χ_c(b) $$
$$ N{}' := (#N{}(n_i))_{1 ≤ i ≤ B} $$
$$ E_c = (N{}'^\top · χ_c) - (χ_c^\top · A_G · χ_c) $$
The Crystal Graph
We can impose a graph structure on $C$ with the edges $$ T := { { c, c \setminus {n} } \mid c \in C \text{ and } n \in c } $$ we call these the transformations and $(C,T)$ the transformation graph.
If we want to discover optimal crystals, then we must efficiently walk this graph. Since this graph is very dense and very large, we must first discuss some optimizations:
Efficient Transformations
In the code this is achieved using the stateful class AdditiveSimulation that walks
along the transformation graph. This class keeps track of two
important properties, namely $f_c(n)$ and $χ_c(n)$ for (almost) all
$n \in G$, we do not need to store the (possibly) infinite number of values, as
we can let $f_c(n)$ default to $0$ and $χ_c(n)$ to $0$.
$χ_c(n) \in {0,1}$ is the characteristic function of the set $c$
and is equal to $1$ exactly iff the node is in $c$.
To the characteristic function we can associate a sign using $s: {0,1} → {-1, 1}$, defined as $s(x) = 2x - 1$.
Now let us take a look at what happens, if we walk along an edge $t \in T$. Let $n$ be the single node that is affected by this transformation.
Let $φ$ be any specific integer quantity we are tracking, then let $Δφ := φ' - φ$ be the difference between the old and the new value of the quantity.
$χ_c$ is updated using $Δχ_c(n) = -s∘χ_c(n)$.
The friendliness $f_c(n)$ does not change. Instead, the friendliness of each neighbor must be updated. So for each $n_0 \in N{}(n)$: $Δ f_c(n_0) = -s∘χ_c(n)$.
For updating the Energy $E_c$ will first require some work. We already know the update rule for neighbors $n_0$ of $n$. For nodes $n_0$ that are not $n$ or neighbors of $n$ the differential is $Δ f_c(n_0) = 0$, in essence this is also not problematic.
However for $n$ the differential is more involved, as the transition makes the node become part of or be excluded from the sum that defines $E_c$. So its contribution is $$ -s∘χ_c(n) · f_{G \setminus c}(n) = -s∘χ_c(n) · [#N{}(n) - f_c(n)] $$
Now for the calculation: $$ Δ E_c = \sum_{n_0 \in c} f_{G \setminus c}(n_0) $$
$$ = \left[ \sum_{n_0 \in N{}(n) ∩ c} Δ f_{G \setminus c}(n_0)\right] -s∘χ_c(n) · [#N{}(n) - f_c(n)] $$
$$ = \left[ \sum_{n_0 \in N{}(n) ∩ c} s∘χ_c(n) \right] -s∘χ_c(n) · [#N{}(n) - f_c(n)] $$
$$ = s∘χ_c(n) · f_c(n) -s∘χ_c(n) · [#N{}(n) - f_c(n)] $$
$$ = s∘χ_c(n) · (2f_c(n) - #N{}(n)) $$
Min-Calculus
$$ Q: ℤ^n → ℤ $$
$$ r_k: ℤ^{n-k} → ℤ $$
$$ \min(Q) = r_n $$
$$ r_0 = Q $$
$$ r_k = \min(r_{k-1}(0),r_{k-1}(1)) $$
Solvers
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file messthaler_wulff-2026.5.5.tar.gz.
File metadata
- Download URL: messthaler_wulff-2026.5.5.tar.gz
- Upload date:
- Size: 14.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
09f73c30fdf8e21987b2e8d2222f0d4e51ed4d62078051b53eee6ae2cae2015a
|
|
| MD5 |
1d9d6cf76a4653ad2cef991a18e139a9
|
|
| BLAKE2b-256 |
ad3a838e40a7a3d9bfc9189d1100582d04ecdb34ba2963bceeda7f7245a95644
|
File details
Details for the file messthaler_wulff-2026.5.5-py3-none-any.whl.
File metadata
- Download URL: messthaler_wulff-2026.5.5-py3-none-any.whl
- Upload date:
- Size: 21.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
39cddfbef57b67e4374ef8fe3fb2017ef109855b616cbe94e55d08fd45805639
|
|
| MD5 |
6482f0e0a7fb3f6310ccdf6ebab1eb5d
|
|
| BLAKE2b-256 |
f88d948282bf3bc582dbfadb3145ddbe007321b96c3c883b198f3a4d20e98efe
|