This notebook contains a tutorial to carry out calculation of the intermediate structure factor $I(Q,t)$ with the Sassena program. It is recommended that you do the molecular dynamics tutorial for this same molecule before trying this tutorial.
Octa-methyl Silsesqioxane
Calculation of $I(Q,t)$ and quick view with hdfview
Load Sassena output into Mantid
View/Edit the contents on an ASCII file
(Top)
In the figure above, mPOSS molecule composed of Si (yellow), O (red), C (cyan), and H (grey) atoms. Nine different chains of consecutive O-Si-C-H covalent bonds can be constructed for each methyl group, due to the three different oxygen and hydrogen atoms that can be selected at the extremes of the chain.
mPOSS molecule non-vibrational degrees of freedom are restricted to discrete rotational diffusion of the methyl groups (-CH3). In the AMBER force field the barrier to rotation is described by a dihedral 4-body term.
(Top)
The necessary files to carry out the simulation are:
If you completed the tutorial on molecular dynamics for this molecule, you should have produced file run1_rms2first.dcd yourself.
Inspect file sassena.xml (can be viewed in the web browser):
Inspect file hydrogens.pdb. Find out what atoms are being selected for the calculation of $I(Q,t)$.
All necessary files are contained in directory $HOME/SHUG2015/sassena/examples/me8t8/. Let's copy them to the scratch area:
In [ ]:
%%bash
mkdir -p /SNSlocal/scratch/$USER/me8t8/
cd $HOME/SHUG2015/sassena/examples/me8t8/
/bin/cp hydrogens.pdb me8t8.pdb run1_rms2first.dcd sassena.xml /SNSlocal/scratch/$USER/me8t8/
cd /SNSlocal/scratch/$USER/me8t8/
Load the sassena module. This will make available the sassena command to actually run the calculation
In [ ]:
%%bash
module load sassena
which sassena #will print the path to the namd executable
Now run the calculation. We ask that you limit to four cores. It should take about 1 minute
In [ ]:
%%bash
time mpirun -np 4 sassena --config sassena.xml &> sassena.log
After the calculation is done, new files are generated:
File fqt_inc.h5 can be inspected with command hdfview
. In the terminal, type:
In [ ]:
%%bash
hdfview &
Load file fqt_inc.h5 thought the $File \rightarrow Open$ browser.
Now double-click in the fqt block data to display the nine structure factors (one per row). Highlight the first row (row in index=0, corresponding to $I(Q=0.3A^{-1},t)$) and click in the "Line Plot" icon:
In the Line Plot Options be sure to select "Row" and then click "OK":
A simple plot of $I(Q=0.3A^{-1},t)$ will be displayed. It shows a fast decay (in less than 200ps) follow by a fluctuating plateau.
The spike at $t$~4000ps is an artifact due to poor statistics. In order to calculate $I(Q,t)$ we have to compare many pairs of frames separated in time by $t$, and there are very few pairs when $t$ becomes comparable to the simulation span. These scarcity produces an artificially high correlation, hence the spike. In general, the statistical significance degrades with increasing $t$.
In [ ]:
%%bash
module load mantid
MantidPlot &
The Mantid session will start. Select SNS as "Default Facility" and BASIS as "Default Instrument":
The initial Mantid session should look like the picture below, but don't worry if some of the panels are not showing up. Panels can be brought to view from the View menu.
Mantid can plot data with the intensity normalized by the bin width, and this is the default behavior for all histogram and event data. As we are not going to use this normalization in this course we need to change the default settings. To do that, go to "View"->"Preferences..." and in the new window select "2D Plots" and untick "Normalize histograms to bin width".
As a first impression, you can think of Mantid as a collection of Algorithms and Workspaces. An algorithm is a piece of code that performs a specific task. A workspace is a (multidimensional) matrix where data are stored.
We will use algorithm "LoadSassena" :
Workspace "fqt" (in the figure, within the orange dashed circle) is instantiated in the workspace panel.
Let's expand the contents of fqt. If you click in the "+" sign, we see that "fqt" is actually made up of six workspaces.
Clicking in the "+" of each workspace will show a brief report of its contents. For instance, fqt_fqt.Re will inform this workspace contains 9 histograms (one per Q-value, values are 0.3$A^{-1}$, 0.5$A^{-1}$, 0.7$A^{-1}$,...,1.9$A^{-1}$) and each histogram contains 7999 bins corresponding to 7999 time points.
Let's plot the histogram corresponding to Q=0.5 and Q=0.9. First left-click in workspace fqt_fqt.Re and select "Plot Spectrum"
In the popup enter the appropriate indexes for these two Q-values,separated by a comma,then press OK.
The two histograms are depicted on the same plot.
Why does the plateau diminishes with increasing Q-value? (Hint: $I(Q,t)$ is the Fourier transform of the self-correlation function $G(r,t)$. What is the physical meaning of this correlation function?)
Notice that $I(Q,t)$ extends to negative times, but we do not have negative times in the simulation, nor in the sassena output file fqt_inc.h5. The LoadSassena algorithm assumes that $I(Q,t)$ is an even function of time, and will symmetrize the data loaded from file fqt_inc.h5. This step is justified because Newton's equations are invariant under time reversal (at least for potentials that are time-independent, as was the case of our simulation).
Exercise Plot the imaginary part of $I(Q,t)$ (workspace fqt_fqt.Im).
We can inspect the actual data of workspace fqt_fqt.Re by double-clicking on the workspace. It also shows the Q-values of each histogram on the left column.
At this point, it is useful to check out the Mantid help on displaying data to be aware of other ways of plotting data, or adding a curve to and existing plot.
(Top)
1 File is shown in the terminal:
In [ ]:
%%bash
cat file #will dump all contents of the file to the terminal
less file #will fill the terminal with beginning of the file, and wait for user input
vi file #the best Linux text editor according to vi fans
emacs -nw file #the best Linux text editor according to emacs fans
2 File is shown in a separate window
In [ ]:
%%bash
emacs file &
gedit file & #recommended for those familiar with windows, similar to notepad
openoffice.org file & #like WORD, maybe to much for a simple ASCII file
(Top)
(Top)
(Top)
Quoted text
image caption |
some text |