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.1.tar.gz (15.9 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.1-py3-none-any.whl (23.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: messthaler_wulff-2026.5.1.tar.gz
  • Upload date:
  • Size: 15.9 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.1.tar.gz
Algorithm Hash digest
SHA256 8d8dea484772cceb4523ac7aae8db359cec7e9c4e92b793d8d1d8fc86339816e
MD5 d91bdde927a2e98260de564bfaa031fa
BLAKE2b-256 aa3fff0f2285834b2884d87c5af00bc5c9c3d5615e0d7342e9bc7c6bf04e2845

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for messthaler_wulff-2026.5.1-py3-none-any.whl
Algorithm Hash digest
SHA256 8a80e1add9290c3a91e39b8b4464f688618638edbf0bc78c1ac013b9e304090e
MD5 b468c6a2518d5c928cfaffc70950c972
BLAKE2b-256 ee807f8bba0ec9b006c67a85a0a3d82cfd223902208ae18615a6c14652e8798a

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