---
myst:
html_meta:
"description": "User guide for the Adaptive Kinetic Monte Carlo (aKMC) method in eOn. Learn how to coarse-grain molecular dynamics for rare event systems."
"keywords": "aKMC, adaptive kinetic monte carlo, eOn, rare event systems, transition state theory"
---
# Adaptive kinetic Monte Carlo
The adaptive kinetic Monte Carlo (aKMC) method is a method to coarse grain
molecular dynamics for rare event systems as described in
{cite:t}`ak-henkelmanLongTimeScale2001,ak-xuAdaptiveKineticMonte2008`. A rare
event system is one in which the interesting dynamics is governed by short
transitions between stable states. The fast vibrational motion within a stable
state is considered to be in equilibrium and described statisitcally. A
transition between states is treated as first order, since it is a rare
event, and the rate of the transition is calculated from the harmonic
approximation to transition state theory (hTST).
The hTST approximation of a transition rate is calculated from the energy
difference between the saddle point along the minimum energy path for the
transition and the initial minimum. The vibrational modes at these points are
also used to calculate the prefactor. An hTST rate is of the standard Arrhenius
form {math}`R = v \exp (-\Delta E/kT)` where {math}`v` is the product of all positive
modes at the minimum divided by those at the saddle, {math}`\Delta E` is the energy
barrier, and {math}`kT` is the thermal enregy.
To propagate the dynamics within aKMC, a list of all possible rates
leading away from the current stable state to any other state is required.
Formally, there are an enourmously large number of such transitions (also called
processes) available in a typical atomic system, but in fact only the
transitions with the fastest rates with the highest probability of happening are
required. The search for processes is then limited to those with rates on the
same order as the fastest processes found.
The search for possible processes is the primary task of the aKMC simulations.
Each client does a minimum mode (minmode) following search from the miminum of
the current state and searches for a saddle point which connects from the
minimum in the current state to an adjacent state
{cite:p}`ak-henkelmanDimerMethodFinding1999`. A saddle point is connected to a
state if a minimization initiated along the negative mode at the saddle
converges to the minimum of that state.
Each client is tasked with one or more such searches. It climbs from the minimum
to a saddle, and if successful, it minimizes on either side of the saddle to
determine the connecting states. The prefactor for the transition is also
calculated by finite difference and the hTST rate is calculated. These data are
reported back to the server. A search result is appended as one line, then
flushed and synced. A final line with no newline or too few fields is
dropped, and the next append cuts that tail off first. A write that stops
partway leaves the previous log.
Adaptive (a), or off-lattice KMC {cite:p}`ak-trochetOffLatticeKineticMonte2020`
works in continuous configuration space. The method builds a rate table from
local atomic movements and energy barriers, so atoms can sit off a grid. The
confidence scheme and thermal accessibility settings restrict accepted
transitions to those that meet the documented thresholds.
The server is reponsible for the time evolution of the system by the KMC
algorithm. Each process leading to a new state is tabulated in a rate table and
one transition is selected stochastically with a probability proportional to its
rate. The transition time is drawn from a first-order distribution for the total
rate of escape from the state. A draw that sits a few ulps past the running
sum of normalized rates takes the last process, and the step is kept. A
draw well past that sum matches no row: the step count does not advance,
and the state and the simulation time stay as they were. An empty table,
or a table whose rates sum to zero, is the same kind of mismatch.
Adding a process appends one line to the process table, then flushes and
syncs it.
A final line with no newline or the wrong number of fields is dropped, and
the next append cuts that tail off first. A write that stops partway leaves
the previous table.
A new state is recorded by appending one line to `state_table`, then
flushing and syncing it. A final line with no newline or the wrong number
of fields is dropped, and the next append cuts that tail off first. A
write that stops partway leaves the previous table.
A complete tutorial is [also provided](project:../tutorials/akmc.md).
## State list
Visited minima live under `states/`, and `states/state_table` holds one
energy per state. A new run creates the directory and an empty table
together. A run that stopped after the directory was created, and before
the table existed, resumes: the table is created with an exclusive open
when it is absent. A table that is already there is not truncated.
## Prepared imbalance
A two-state channel relaxes a prepared population imbalance as
{math}`\exp(-t/\tau)` with {math}`\tau = 1/(k_f + k_b)`. Both rates are the
harmonic transition-state rates the process table already stores. A saddle
that returns to the same basin has no population mode. Its mean return time
is {math}`1/k`. A cluster has no box length, so this time is not converted
to a conductivity. The dynamics job keeps its one bath.
## Configuration
Start the aKMC server with `python -m eon.server`.
The server accepts `[Main] job = akmc`.
The client has no `akmc` job, so that token does not run there.
```{code-block} ini
[Main]
job = akmc
[AKMC]
confidence_scheme = old
```
`eon/config.yaml` names this section `[AKMC]`.
The server lowercases a heading only to test whether the section is known.
That test accepts `[akmc]`.
The server reads `[AKMC]`. A section whose name differs from a known one only
by case, such as `[akmc]`, is rejected when the configuration is read.
On the server, `confidence_scheme` defaults to `old`.
The schema class below defaults `confidence_scheme` to `new`.
`confidence_scheme = amsel` takes the score from the `amsel` package, and
`[amsel] state_confidence` selects it. See the coarse-graining page.
```{eval-rst}
.. autopydantic_model:: eon.schema.AKMCConfig
```
## References
```{bibliography}
---
style: alpha
filter: docname in docnames
labelprefix: AK_
keyprefix: ak-
---
```