leetmaa / KMCLib

A kinetic Monte Carlo Python/C++ library.
GNU General Public License v3.0
119 stars 49 forks source link

Question about KMC time step calculated in SimulationTimer::propagateTime #33

Closed tfhughes closed 1 day ago

tfhughes commented 1 day ago

I found your article on calculating MSDs from KMC simulations with variable time steps extremely useful. I see that in your main article on KMCLib that you calculate the time step in equation 3 as dt = -ln(u)/r_t, where u is a random number in (0, 1) and r_t is the total escape rate for a given site. If I understand correctly this is a sum over escape rates to the given site's neighbors. In the KMCLib code this is done in simulationtimer.cpp SimulationTimer::propagateTime. It seems that this is the proper way to calculate the time step since I see the same is done in other KMC codes. I am curious why it doesn't just go as the inverse of the escape rate specific to the picked neighbor? I am also curious why the factor of -ln(u)? My apologizes for the distraction if the answer is obvious. I am reasonably new to KMC codes.