Skip to main content

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.

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

messthaler_wulff-2026.5.2.tar.gz (14.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

messthaler_wulff-2026.5.2-py3-none-any.whl (21.8 kB view details)

Uploaded Python 3

File details

Details for the file messthaler_wulff-2026.5.2.tar.gz.

File metadata

  • Download URL: messthaler_wulff-2026.5.2.tar.gz
  • Upload date:
  • Size: 14.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.3

File hashes

Hashes for messthaler_wulff-2026.5.2.tar.gz
Algorithm Hash digest
SHA256 32e26b49f80e40d829f50eb6186040e3160c71cb77ad91363d94375546b26698
MD5 8aa9598e9a9bdc4d83a41d9566abad7b
BLAKE2b-256 130cc038e132a68707e5447ccd518d6edd60a106bb143543e9c16e66adbad308

See more details on using hashes here.

File details

Details for the file messthaler_wulff-2026.5.2-py3-none-any.whl.

File metadata

File hashes

Hashes for messthaler_wulff-2026.5.2-py3-none-any.whl
Algorithm Hash digest
SHA256 a1c96264d6ba0a0fe2c2de14a14a66bbfc75fef10890310197743dde77d328b4
MD5 e587b7ac151e8f110c38e3b0aac21bd1
BLAKE2b-256 f3a0ece413778e809482eb3b3a4c2f26979bf5eea2840c868b0b3ed517f7c1ff

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page