Skip to content

tree structure for kinetic monte carlo (and maybe more)

License

Notifications You must be signed in to change notification settings

samwaseda/kmc-tree

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Tree structure

This code is meant for an efficient calculation of kinetic Monte Carlo method

How to compile

Download all files and run python setup.py build_ext --inplace.

How to use it

Suppose you have $N$ diffusing solutes (such as vacancies or interstitial atoms). Let's say each of them has 4 possible jumps. Then you can create the tree by:

from tree import Tree
import numpy as np

tree = Tree()
tree.append([[0.1, 0.2, 0.3, 0.4]
             [0.5, 0.6, 0.7, 0.8], # jump probabilities
	    [0, 1] # indices
	   )

Then you can put a random number between 0 and 1:

tree.choose_event(0.5)
tree.get_index() # This will return 1
tree.get_jump_id() # This will return 2

# Then either remove the leaf by:
tree.remove()

# Or update the values for example by:
tree.update([0.9, 1, 1.1, 1.3])

About

tree structure for kinetic monte carlo (and maybe more)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published