Hi there,
This script calculates the MSD and diffusivity for a set of penetrant molecules in a matrix. The first part of the script calculates the MSD using Forcite and the second part calculates the diffusivity based on the MSD.
The MSD calculation requires the definition of sets of penetrant molecules. If your penetrant molecules consists of unique forcefield types, for example oxygen or nitrogen molecules, you can automate the set definition and leave the \\\$setsDefined variable set to "no". If you do this, you should specify the \\\$forcefieldType of the penetrant molecule.
If you change \\\$setsDefined to "yes", you should have your penetrant molecules pre-defined as a set called "penetrants".
The second part of the script calculates the diffusivity from the MSD data. It does this by putting the data in a number of bins and then looking to see if the gradient changes on going from bin to bin. Iterating through all the bins, the longest time without a gradient change is calculated. This is assumed to represent the region of real diffusion. A line is fit to this region and the slope of the line and hence diffusivity is calculated. The log of the data in this region is also calculated to check whether the slope is equal to 1, indicating real diffusion.
The settings for this calculation are the number of bins and the tolerance. The tolerance refers to the difference in gradient that is acceptable for the slope to still be "linear".
A study table is generated containing the change in the gradients in individual columns. Plot this data by selecting all the data in the study table and clicking on QuickPlot. You should have different colored lines indicating where the gradient changes. This can be useful in tuning the number of bins and the tolerance.
Best regards,
Stephen
