Tutorial 6: Diffusion of Adsorbates
- Include adsorbate diffusion in simulations
- Adjust input settings for "infinite" simulations
- Evaluate diffusion events
Keep in mind that you can speed up simulations by using multiple threads as described in the Using Multithreading with VSCode section.
Input File Setup
For this tutorial you can use the coordinates of MSA from the Molecule Library. The largest part of the main input file is identical to previous tutorials:
# Adsorption on Cu(111)
Molecule
rotationmodus = angle
rotationangle = 120.0
fixpointtype = atoms
fixpointatoms = 1
structure = ...ADJUST-YOUR-PATH.../msa.xyz
End
# Lattice of the Cu(111) surface
Lattice
transx = 30
transy = 18
vectors
2.51883 0.00000 0.00000
0.00000 4.36274 0.00000
0.00000 0.00000 1.00000
end
End
# Hollow grid points of the Cu(111) surface
Grid
points
0.00000 1.45518 0.00000
0.00000 2.90908 0.00000
1.25942 0.72771 0.00000
1.25942 3.63655 0.00000
end
EndThe major difference in the input file is the presence of diffusion events for the adsorbate in the eventlist. Furthermore coverageconvergence and forceadsorption are added. The first keyword will stop the RSA simulation once the given number of steps were performed without the occurence of an adsorption event - thereby the surface coverage is assumed to be converged. The second keyword will try to force an adsorption event once the given the given number of steps were performed without the occurence of an adsorption event.
# General settings for adsorption of aniline
Events
steps = 1500
coverageconvergence = 100
forceadsorption = 25
eventlist
1 ads 1 1.0
1 dif 1 1 10.0 2.6
end
EndCarefully test the impact of the steps, coverageconvergence, and forceadsorption settings on your calculations! Also change the weight of the events to test the impact on the simulations.
Running the Simulation
To start the simulations use the perform_multiple_rsa_runs function:
NRuns = 1000
inputfile_path = "...ADJUST-YOUR-PATH.../input.inp"
rsa_results, Nmolecules, molecules, Ngrids, grids, lattice, events, timings = perform_multiple_rsa_runs(NRuns, inputfile_path);Evaluation
As a first step of the evaluation you should check how your input keywords affected the simulations. Here, you can check how many steps were performed by using the Nsteps field, how often a certain event was performed by using the Nevents field, or which event was still possible at the end of the simulation by using the stepinfo field.
- Nsteps: Check whether the maximum allowed number of steps or the surface coverage convergence was reached.
- Nevents: Check how many adsorption events (firt value) and how many diffusion events (third number) were performed.
- stepinfo: Check the last columns of this matrix. The first value within each column tells you how many events in total were possible while the second and fourth value tell you how many adsorption and diffusion events were possible, respectively. What type of events were performed at the end of the simulation?
histo, mean, variance, minvalue, minvalue_id, maxvalue, maxvalue_id, avgvalue, avgvalue_id = plot_count_area_histograms(NRuns, rsa_results, Nmolecules, molecules, lattice, plotonly = false, area = 0.6);
avgvalue_id[4]
rsa_results[ID of most average run].Nsteps
rsa_results[ID of most average run].Nevents
rsa_results[ID of most average run].stepinfoMore information on the rsa_results structure can be found in the documentation: RSA.rsa_run_results_struct.
As usual the plot_RSA_run function can be used to visualize the final state of a simulation. In addition, it might be interesting to use the animate_RSA_run function to create an animation of the RSA simulation:
avgvalue_id[4]
surfaceplot = plot_RSA_run(rsa_results[ID of most average run].status, Ngrids, grids, Nmolecules, molecules, lattice)
anim = animate_RSA_run(rsa_results[ID of most average run].stepinfo, Ngrids, grids, Nmolecules, molecules, lattice)
gif(anim, "...ADJUST-YOUR-PATH.../rsa_animation.gif", fps = 10, loop = -1)Be aware that the generation of animations is an slow process. It is strongly advised to create animations only with a small (less than 500) number of images. If you want to play around with animations, have a look at the Plots package, which is used here to create these animations.