Coarse graining

In aKMC simulations where there are vastly different rates, the simulation can get stuck in a group of states connected by relatively fast rates. Exploring slower transitions can take a prohibitively large number of KMC steps. eOn implements two methods that skip those fast recrossings.

Note

AS-KMC and MCAMC cannot be used simultaneously.

Monte Carlo with Absorbing Markov Chains (MCAMC)

The first method, projective dynamics, described in Novotny [CG_Nov01], groups states that are joined by fast rates into “superbasins”. Information about transitions between states in a superbasin is lost, but the rates for transitions across a superbasin are correct. The numpy fallback copies the rate matrices and the cost vector, as the compiled solver does, so a later call sees the same input.

Transition counts and energy levels are replaced in one step. A write that stops partway leaves the previous file.

A superbasin directory that already exists still gets a storage folder. A later merge archives the previous basin there.

Accelerated Superbasin Kinetic Monte Carlo (AS-KMC)

The second method, accelerated superbasin kinetic Monte Carlo (AS-KMC) of Voter [CG_Vot97], artificially raises low barriers. The dynamics between states connected by fast rates are simulated, but an error is introduced in the dynamics direction and time.

The basic process of AS-KMC involves gradually raising process barriers found to be inside of a superbasin such that exiting from the basin gradually becomes more likely. The method is designed to raise all the barriers in the superbasin simultaneously. Once a particular barrier has been crossed a certain number of times, \(N_f\) (more on determining \(N_f\) shortly), a check is performed to determine whether or not the current state is part of a superbasin. The first time a process is followed, that sighting counts toward \(N_f\). When the count already meets \(N_f\), the Superbasin Criterion runs on that visit. This is called the Superbasin Criterion.

In the Superbasin Criterion, a search is performed, originating at the current state and proceeding outward through all low-barrier processes to adjacent states, and then through all low-barrier processes from each of these states, etc. For each low-barrier process found, if the process has been followed fewer than \(N_f\) times, the Superbasin Criterion fails and no barriers are raised.

Thus, in the outward-expanding search from the originating state, the search continues until either a low-barrier process has been seen fewer than \(N_f\) times (and the Criterion fails) or until all connected low-barrier processes have been found and have been crossed at least \(N_f\) times (the edges of the superbasin are then defined and the Criterion passes). If the Superbasin Criterion passes, all the low-barrier processes (each of which as been crossed \(N_f\) times) are raised.

Several parameters dictate the functioning of the AS-KMC method. These parameters dictate how much the barriers are raised each time the Superbasin Criterion passes(eon.schema.CoarseGrainingConfig.askmc_barrier_raise_param), what defines a “low-barrier” for use in the Superbasin Criterion(eon.schema.CoarseGrainingConfig.askmc_high_barrier_def), and the approximate amount of error the user might expect in eventual superbasin exit direction and time compared to normal KMC simulation (eon.schema.CoarseGrainingConfig.askmc_confidence).

A new modified-process row is appended as one line, then flushed and synced. 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 rows.

The counters in askmc_data.txt are replaced in one step. A write that stops partway leaves the previous counters.

amsel discover_decide

[amsel] discover_decide = true runs on the current state’s process table. The state list can hold one state. use_mcamc stays off. use_mcamc is not required. The repeat-count confidence scheme does not hold this step. A run that leaves discover_decide off still waits for confidence under confidence_scheme.

A barrier strictly below e_min_init counts as an in-basin edge. A barrier at or above e_min_init counts as an exit. On Si6N8 isomer 1 the back barrier is 0.20 eV and the flip-out barrier is 0.30 eV. With e_min_init at 0.25 eV the 0.20 eV edge stays in the basin and the 0.30 eV edge leaves. A table that has only the 0.30 eV saddle, and no faster edge, still leaves. The transient set is that state. The product is absorbing. A product column of -1 is that same exit: the label sent to amsel is a 32-bit id at or above 2147483648, and the hop creates the product state from the process id.

The basin comes from amsel.discover_decide_status when a faster edge is present. The exit time and the exit channel come from the mean-rate method (MRM) or from first-passage-time analysis (FPTA). debug_use_mean_time selects MRM. The mean exit time is the MRM value tau_total. Otherwise, FPTA draws one first-passage time. Both kernels live in the amsel package. With that package absent, the log line reads amsel discover_decide status=unavailable and no step is taken until the confidence threshold is met. Once that threshold is met, the step is ordinary kinetic Monte Carlo.

[amsel]
discover_decide = true
e_min_init = 0.25
e_min_step = 0.05
e_min_floor = 0.05
cv_threshold = 10.0
on_error = fallback_single

One status list:

  • unavailable, available off: amsel did not import, or on_error is unavailable_mcamc after a failed call

  • fallback_single, available on: the call failed and on_error is fallback_single; the step stays ordinary kinetic Monte Carlo

  • accepted or retightened: one basin, and the exit comes from MRM or FPTA

  • split_required: the exit is the primary basin that contains the entry state

  • rejected_no_metastable_basin: no basin, and the step stays ordinary kinetic Monte Carlo

unavailable together with available on sits outside this list.

pydantic model eon.schema.AmselConfig[source]

[amsel] keys. Field names and defaults match eon/config.yaml.

Fields:
  • discover_decide (bool)

  • e_min_init (float)

  • e_min_step (float)

  • e_min_floor (float)

  • cv_threshold (float)

  • on_error (Literal['fallback_single', 'unavailable_mcamc', 'raise'])

  • state_confidence (Literal['heuristic', 'good-turing', 'reverse-capped', 'two-sided', 'coverage'])

  • reverse_barrier_tolerance (float)

  • relevant_rate_share (float)

  • category_alpha (float)

  • discover_wait_for_confidence (bool)

  • displacement (Literal['eon', 'direction_cover'])

  • active_atoms (Literal['decaf_clustering', 'median_outlier'])

  • direction_seed (int)

field discover_decide: bool = False

Independent of eon.schema.CoarseGrainingConfig.use_mcamc. The repeat-count confidence scheme does not hold this step. A barrier strictly below e_min_init is an in-basin edge. A barrier at or above e_min_init is an exit. A table with no faster edge still leaves: the transient set is the entry state. The exit time and the exit channel come from the mean-rate method (MRM) or from first-passage-time analysis (FPTA). Those kernels are the amsel package. When that package is absent the log line is amsel discover_decide status=unavailable and no step is taken until the confidence threshold is met. A product column of -1 is still an exit: the absorbing label is a 32-bit id, and the hop creates the product state from the process id.

Call amsel discover_decide on the current state’s process table at each KMC step, without waiting for the repeat-count confidence.

field e_min_init: float = 0.5

Initial transition-state cutoff in eV. A barrier strictly below this cutoff stays inside the basin.

field e_min_step: float = 0.05

Step, in eV, by which discover_decide lowers the cutoff when it retightens the basin.

field e_min_floor: float = 0.05

Lowest transition-state cutoff, in eV, that discover_decide will use.

field cv_threshold: float = 10.0

Largest coefficient of variation for which a basin is accepted.

field on_error: Literal['fallback_single', 'unavailable_mcamc', 'raise'] = 'fallback_single'

fallback_single returns status fallback_single with available true, and the step is ordinary KMC. unavailable_mcamc returns status unavailable with available false. raise re-raises the exception. unavailable with available true is not a status this model names.

Result of a failed amsel call.

field state_confidence: Literal['heuristic', 'good-turing', 'reverse-capped', 'two-sided', 'coverage'] = 'heuristic'

heuristic rises with the number of processes. good-turing is one minus singletons over hits, the coverage of the search distribution. reverse-capped bounds the heuristic by the exit rate this state’s own searches found over that rate plus the rate known only from the far side. two-sided is the share of saddles known from the far side that the searches recover, pooled over all states, with the same bound.

coverage is for displacement = direction_cover and is the score the search loop is built for. It is one minus the posterior probability that a missed exit carries more than relevant_rate_share of the state’s escape rate, computed by amsel.search_confidence from the state’s search records: how much of the direction cover of each active atom the searches have tried, what they found there, and at what rates. The state is as confident as its least covered atom. Under this score [AKMC] confidence is a probability: 0.95 keeps searching a state until a relevant missed exit has posterior probability at most 0.05. A state with no search scores close to 0, so no state is special. A state with no free active atom has no cover and is scored with eOn’s new scheme on the searches it gets.

A find is a saddle search launched from the state that came back on the process. The reverse of the process a state was entered by is known from the far side and is not a find, and a state without a find has confidence 0 for every score.

Score that [AKMC] confidence_scheme = amsel uses.

field reverse_barrier_tolerance: float = 0.02

Energy, in eV, within which a process matches a saddle known from the far side.

field relevant_rate_share: float = 0.01

The default is the one amsel uses. A smaller share asks for more searches before a state is confident.

Share of a state’s known escape rate that a missed exit must exceed to matter to state_confidence = coverage.

Constraints:
  • gt = 0.0

  • lt = 1.0

field category_alpha: float = 0.5

1/2 is Jeffreys’ prior and the default of amsel. 1 is the uniform prior, its sensitivity check.

Dirichlet concentration of the prior on unseen exits for state_confidence = coverage.

Constraints:
  • gt = 0.0

field discover_wait_for_confidence: bool = False

Off, an exit is taken as soon as one process leaves the basin, whatever else the searches would have found.

Hold the discover_decide exit until the state meets [AKMC] confidence.

field displacement: Literal['eon', 'direction_cover'] = 'eon'

eon uses the [Saddle Search] displacement weights. direction_cover takes each start from amsel.next_search_start, which rebuilds the direction cover of the state from its search records and returns the best free arm. The push is the seed of the arm over all atoms, scaled to displace_magnitude.

The client uses a start it is sent only when [Saddle Search] client_displace_type is load. Every job with an amsel start is sent with that value, and a configuration that sets any other value next to direction_cover is rejected when it is read.

A state with no free active atom takes the [Saddle Search] displacement instead. The crystal a vacancy and an interstitial leave when they recombine is one. The reason is then a record of kind fallback in the state’s search records, and those searches have type random.

So does a state whose cover has no arm left, since repeating arms would count the same finds again.

Every start and what its search ended on are records of a readcon-db corpus in the state directory, states/N/searches.db, with the fields of the record under eon_search in the metadata of its frame. A record holds the atoms a push moves and the push itself, or the active atoms of the structure a search ended on, and names the process a search landed on; it does not copy a structure eOn keeps. The next start is planned from that corpus alone, read in work-unit order. A start is recorded when its search is created, not when its result is registered, so a search that fails or is lost has used its start and the start is not tried again. The corpus needs the readcon_db module: direction_cover is rejected when the configuration is read if the module does not load, and with [AKMC] server_side_process_search, which keeps no records. It is an LMDB directory under [Paths] states and belongs on a local filesystem.

Source of the saddle-search starts of an AKMC state.

field active_atoms: Literal['decaf_clustering', 'median_outlier'] = 'decaf_clustering'

Rule of amsel.select_active_atoms for direction_cover.

field direction_seed: int = 0

Seed of the direction plan, not negative. The state number is added to it.

Constraints:
  • ge = 0

With use_mcamc on as well, an accepted basin still leaves through MRM or FPTA. A rejected basin falls through to the MCAMC superbasin step. split_required on that MCAMC object keeps the entry state and writes the reduced member list.

The superbasin exit draw uses the same strict cumulative test as a single-state kinetic Monte Carlo step. A column whose probability is zero is not selected when the draw is zero.

Configuration

[Coarse Graining]
pydantic model eon.schema.CoarseGrainingConfig[source]
Fields:
  • use_mcamc (bool)

  • state_file (str)

  • superbasin_scheme (Literal['energy_level', 'transition_counting', 'rate'])

  • max_size (int)

  • number_of_transitions (int)

  • energy_increment (float)

  • rate_threshold (float)

  • superbasin_confidence (bool)

  • use_askmc (bool)

  • askmc_confidence (float)

  • askmc_barrier_raise_param (float)

  • askmc_high_barrier_def (float)

  • askmc_barrier_test_on (bool)

  • askmc_connections_test_on (bool | None)

field use_mcamc: bool = False

Mutually exclusive with eon.schema.CoarseGrainingConfig.use_askmc.

This option determines whether the Monte Carlo with Absorbing Markov Chains (MCAMC) coarse graining method will be used.

field state_file: str = 'superbasin'

File name for the state-specific data stored within each of the state directories.

field superbasin_scheme: Literal['energy_level', 'transition_counting', 'rate'] = 'transition_counting'
Options:
  • transition_counting: Counts the number of times that the simulation has transitioned between a given pair of states. After a critical number of transitions have occurred, the pair of states are merged to form a superbasin.

  • energy_level: States are merged based on energy levels filling up existing basins.

  • rate: States are merged based only on rate criteria.

MCAMC provides a method for calculating transition rates across superbasins. An additional method is needed in order to decide when to combine states into a superbasin.

field max_size: int = 0

The maximal number of states that will be merged together. If 0, there is no limit.

field number_of_transitions: int = 5

Only used if eon.schema.CoarseGrainingConfig.superbasin_scheme is transition_counting.

This is the number of transitions that must occur between two states before they are merged into a superbasin.

field energy_increment: float = 0.01

Only used if eon.schema.CoarseGrainingConfig.superbasin_scheme is energy_level.

The first time each state is visited, it is assigned an energy level first equal to the energy of the minimum. Every time the state is visited again by the Monte Carlo simulation, the energy level is increased by this amount.

field rate_threshold: float = 1000000000.0

Only used if eon.schema.CoarseGrainingConfig.superbasin_scheme is rate.

Any state with a rate (in 1/time) greater than this is merged into a single basin.

field superbasin_confidence: bool = True

Superbasin KMC steps only consider exit processes from the superbasin. As fast processes get absorbed more and more into the superbasin, the relevant exit processes have higher and higher barriers. The confidence to have found all relevant processes leading away from a state is heavily influenced by the fast processes, that no longer exit the superbasin. To make sure that the confidence is adequately high for the barrier energies leaving the superbasin, additional searches need to be performed. This setting (which defaults to true) enables these additional searches. The searches are marked in states/<state_number>/search_results.txt by appending the number of the superbasin in which the search was performed in brackets. In general, this option should not be disabled! It exists only for debug purposes and cases where the user is sure that the additional searches are not needed.

Superbasin KMC confidence.

field use_askmc: bool = False

Mutually exclusive with eon.schema.CoarseGrainingConfig.use_mcamc.

This option determines whether the AS-KMC coarse graining method will be used.

field askmc_confidence: float = 0.9

The confidence for AS-KMC. This value determines the accuracy of the direction of the dynamics trajectory.

field askmc_barrier_raise_param: float = 1.5

This parameter sets how much the barriers are raised during AS-KMC.

field askmc_high_barrier_def: float = 2.0

This parameter sets how high a barrier must be to be considered ‘high’ in AS-KMC.

field askmc_barrier_test_on: bool = True

Because the implemented Superbasin Criterion actually only considers processes which have been passed over at least once, there is some chance that a low-barrier process in a superbasin might have not been visited at all while all other low-barrier processes have been visited at least \(N_f\) times. This is unlikely, but this test verifies that such has not happened, considering even processes which have not been visited when determining if the Superbasin Criterion has first, because the implemented Superbasin Criterion actually only considers processes which have been passed over at least once, there is some chance that a low-barrier process in a superbasin might have not been visited at all while all other low-barrier processes have been visited at least \(N_f\) times. This is unlikely, but this test verifies that such has not happened, considering even processes which have not been visited when determining if the Superbasin Criterion has passed. This check should not add significant overhead.

This test verifies that no low-barrier process in a superbasin has been missed, considering even processes which have not been visited.

field askmc_connections_test_on: bool | None = False

This parameter determines whether to ensure that there are no processes which connect states in the defined superbasin which have not been visited yet and which have a low-barrier. This check is somewhat more computationally expensive than the previous because structure comparisons have to be made when finding product states of unvisited processes.

Ensures that there are no processes which connect states in the defined superbasin which have not been visited yet and which have a low-barrier.

References

[CG_Nov01]

M. A. Novotny. A Tutorial on Advanced Dynamic Monte Carlo Methods for Systems with Discrete State Spaces, pages 153–210. WORLD SCIENTIFIC, April 2001. doi:10.1142/9789812811578_0003.

[CG_Vot97]

Arthur F. Voter. Hyperdynamics: Accelerated Molecular Dynamics of Infrequent Events. Physical Review Letters, 78(20):3908–3911, May 1997. doi:10.1103/PhysRevLett.78.3908.

amsel state confidence

[AKMC] confidence_scheme = amsel takes the confidence of a state from the amsel package. [amsel] state_confidence selects the score:

  • heuristic rises with the number of processes

  • good-turing is one minus singletons over hits

  • reverse-capped bounds the heuristic by the exit rate the state’s own searches found over that rate plus the rate known only from the far side

  • two-sided is the share of saddles known from the far side that the searches recover, pooled over all states, with the same bound

[AKMC]
confidence_scheme = amsel

[amsel]
state_confidence = two-sided
reverse_barrier_tolerance = 0.02

Only a saddle search that was launched from a state and came back counts as a find of that state. When the trajectory enters a state, the reverse of the entry process is in its table and counts as known from the far side, not as a find. A state none of whose searches has found a process has confidence 0 for every score.

The coverage score

state_confidence = coverage is for displacement = direction_cover, and it is the score the search loop below is built for. It uses none of the four scores above. amsel rebuilds the direction cover of the state from its search records and returns one minus the posterior probability that a missed exit carries more than relevant_rate_share of the state’s escape rate. That probability comes from how much of the cover of each active atom the searches have tried, what they found there, and at what rates. The state is as confident as its least covered atom.

[AKMC]
confidence_scheme = amsel
confidence = 0.95

[amsel]
displacement = direction_cover
state_confidence = coverage
relevant_rate_share = 0.01
category_alpha = 0.5

Under this score [AKMC] confidence is a probability. 0.95 searches a state until a relevant missed exit has posterior probability at most 0.05. A value chosen for one of eOn’s own schemes does not carry over: those are functions of repeat counts and are not probabilities. relevant_rate_share and category_alpha default to the values amsel uses, a share of 0.01 and Jeffreys’ prior of 1/2; a smaller share asks for more searches.

A state with no search scores close to 0 from the estimator itself, and no other state enters the score, so the first state of a run is not a special case. A state with no free active atom has no cover; it is searched with the eOn displacement and scored with eOn’s new scheme. The log has one line per change of the records, amsel coverage: state N confidence ..., with the worst and the mean missed-exit probability over the active atoms.

The run searches the state it is in until the score meets [AKMC] confidence and then leaves, so each state it left was certified when it was left. After every pass the log reports the residence weight of the states that are not certified, amsel residence share (reported, not enforced): eta_res=...: the share of the mean time to leave the visited network, from the first state, that is spent in them. A process whose product was never entered counts as a way out of the network. The number is a record of how much of the mean time rests on unfinished tables. Nothing acts on it: the run does not return to a state because of it.

With discover_decide on, an amsel exit is taken as soon as one process leaves the basin, even when the state is not confident. Set discover_wait_for_confidence = true to search until [AKMC] confidence is met and take the exit from that table.

amsel search starts

[amsel] displacement = direction_cover takes every saddle-search start of an AKMC state from amsel: active_atoms selects the atoms, and the direction cover of the state gives the next start. Recycling and the kinetic database still come first. The [Saddle Search] displacement weights are then not used.

A start is an arm of the cover, a centre atom and a direction on it. amsel plans it from the state’s search records: it rebuilds the cover from what every earlier search of the state ended on and returns its best free arm, so the directions tried on an atom spread away from the ones already tried and toward the gaps the results leave. The push is the seed of the arm, which moves the centre atom along the direction and its neighbours with it, scaled so that the whole displacement has length displace_magnitude.

The client begins a search at the start it is sent only when [Saddle Search] client_displace_type is load; with any other value it draws a displacement of its own. Every job with an amsel start is therefore sent with client_displace_type = load, and a config.ini that sets another value next to direction_cover is rejected when it is read. Leave the key out or set it to load.

A state with no free active atom takes the [Saddle Search] displacement instead. A cell without a defect is one, such as the crystal a vacancy and an interstitial leave when they recombine. The log then has a line amsel direction_cover: state N uses the eOn displacement from here on, the reason is a record of kind fallback in the state’s search records, and the searches of that state have type random in search_results.txt.

So does a state whose cover has no arm left: every arm is recorded or out. Repeating arms would count the same finds again.

Every start and what its search ended on are kept as records of a readcon-db corpus in the state directory, states/N/searches.db. A search is two trajectories of one frame: 2 * wuid is written when the job is created and 2 * wuid + 1 when its result is registered. A start with no second trajectory has not come back. The fields of a record are under eon_search in the metadata of its frame.

A record holds no second copy of a structure eOn keeps. The frame of a start holds the atoms its push moves, and the record the push as it was applied: mode lists each of those atoms with its unit vector, magnitude the length, atoms their rows in the state, written so that the numbers read back unchanged. The structure the client was sent is the reactant plus that push. The frame of a result holds the active atoms of the structure the search ended on. A search that landed on a process names it by process_id; its saddle and far minimum are in states/N/procdata. A search that landed on no process leaves no file in eOn unless [Debug] keep_bad_saddles is set, and its record then names the directory. A search of a 4000-atom state costs about 10 kB on disk.

A search can find a connected saddle that eOn leaves off the table, as it does above the thermal window. Its record is connected with off_table set, the barrier and the energies, no process and no rate: the direction led to a saddle, and the saddle is no exit of the table. eOn keeps no file of it, so the active atoms of the saddle and of the far minimum are the two frames of that record.

The next start is planned from this corpus and from nothing else, so a start is used when its search is created: a search that fails or is lost is not tried again. The records are read in work-unit order, so the plan does not depend on the order in which several clients return.

The corpus is an LMDB directory. It follows [Paths] states, and LMDB does not support network filesystems: put the state directory on a local disk when the run directory is not. One corpus is opened per state, each with a lock file, and at most eight are open at a time.

A server that stops between recording a start and submitting its job finds the record when it starts again and sends that start; it does not plan a second one for the same work unit. A server that stops between registering a result and recording it leaves the start without a result: its arm stays taken, and the coverage score counts it as not returned. A start with no second trajectory has not come back. The next start is planned from this corpus and from nothing else, so a start is used when its search is created: a search that fails or is lost is not tried again. The records are read in work-unit order, so the plan does not depend on the order in which several clients return.

The corpus needs the readcon_db module. direction_cover is rejected when the configuration is read if the module does not load, and it is rejected with [AKMC] server_side_process_search = true, which keeps no records.

[amsel]
displacement = direction_cover
active_atoms = decaf_clustering

amsel has to be built with the direction-cover feature.