This notebook contains a tutorial to perform MD simulations of an Octamethyl Silsesquioxane molecule with NAMD and the AMBER force field
Carry out the simulation
Plot thermodynamic and energetic quantities
Visualize the trajectory
Carry out the simulation in the NVE ensemble
Remove global translations and rotations with AmberTools
Additional tutorials from the NAMD/VMD webpage
View/Edit the contents on an ASCII file
We will simulate a single molecule. The necessary files to carry out the simulation are:
Inspect file run1.conf (there are many ways in Linux to view/edit the contents on an ASCII file) How long is the simulation? How many snapshots, or frames, will be saved? Which ensemble are we running?
1 In the terminal, go to the directory containing the files, then create a subdirectory in your scratch area and copy the files there.
In [ ]:%%bash mkdir -p /SNSlocal/scratch/$USER/me8t8/ cd $HOME/SHUG2015/molecular_dynamics/examples/me8t8/ cp me8t8.pdb me8t8.prmtop run0.restart.coor run1.conf /SNSlocal/scratch/$USER/me8t8/ cd /SNSlocal/scratch/$USER/me8t8/
2 Load the NAMD module. This will make available the namd command to actually run the simulation
In [ ]:%%bash module load namd which namd2 #will print the path to the namd executable
Now run the simulation. We ask that you limit your simulation to four cores. It should take about 6 minutes
In [ ]:%%bash time namd2 +idlepoll +p4 run1.conf > run1.log
After the simulation is done, it will print out in the terminal the time it took to complete. New files are generated:
One can elongate the simulation by running a second simulation using as starting conformation files files run1.restart.coor, run1.restart.vel,run1.restart.xsc
In [ ]:%%bash vmd #starts the vmd program
In case the display window shows up off-screen, issue the following command in the terminal to bring the top of the display window into view:
In [ ]:>display reposition 0 0
The NAMD Plot plugin is accessible from the Extensions tab:
Although the PDB contains only the names of the atoms and the coordinates of a conformation, VMD is smart enough to figure out which atoms are bonded to each other, thus creating a topology for the molecule and will show the bonds. Once we have topology, we can load the time evolution of coordinates with the trajectory file run1.dcd. In the main window, select molecule "me8t8.pdb" with a left click. The selection will be highlighted. Then, right-click and select Load Data Into Molecule" from the pop up menu.
The Molecule File Browser will appear. Browse to file run1.dcd and then click in Load.
There are 4000 frames to be loaded so it will take about a minute to load them all. Once finished, the Main window will show that there are 4001 frames loaded: 1 for the initial PDB, and 4000 for the trajectory.
The lower portion of the windows feature the progress bar. By sliding the bar you can select any frame. Right now it shows the last frame, which is frame with index 4000. Notice that indexes begin at zero, thus frame number 4001 has index 4000.
You probably have noticed that the molecule has vanished from the OpenGL Display window!
The reason is the following: the coordinates stored in the PDB file run1.pdb are numerically very different than the tipical coordinates in trajectory file run1.dcd. The molecule "makes a big jump" in transitioning from frame with index=0 (the PDB file) to frame with index=1 (the first frame of the trajectory). It's like if the molecule suddenly jumped behind our back and we could not see it any more. To fix this, let's rewind the movie by pressing the "Jump to the beginning" button:
We are back to the conformation of the PDB file (index=0). Now let's advance to the first frame of the trajectory by pressing the "Step forward" button:
As expected, the molecule has vanished from the OpenGL Display Window. We can change our perspective by resetting the view from the Display menu:
Now we are looking at the first frame of the trajectory and are ready to watch the movie. Click in the "play forward" button (red circle in the picture). Also, you can modify how fast the movie plays and whether you want to skip frames with the tools highlighted in the green ellipse in the picture below:
The molecule does not stay put, it rotates as a whole and its center of mass translates. This is typical of molecules subject to Brownian motion, but since the molecule is surrounded only by vacuum, why is undergoing Brownian motion?
The answer is the molecule is surrounded by "ghost particles" due to the heat bath we imposed to maintain a constant temperature. The section in configuration file run1.conf:
Constant Temperature Control temperature $temperature langevin on (do langevin dynamics) langevinDamping 5.0 (damping coefficient (gamma) of 1/ps (5.0 for equilibrium runs)) langevinHydrogen off (don't couple langevin bath to hydrogens) langevinTemp $temperature (target temperature)
The appropriate run1.conf file is located in your $HOME/SHUG2015/molecular_dynamics/examples/me8t8/NVE/ directory. The only difference with the run at constant temperature is the commenting out of the lines corresponding to the Constant Temperature Control section. Notice we have left out a line uncommented:
In [ ]:%%bash mkdir -p /SNSlocal/scratch/$USER/me8t8/NVE cd $HOME/SHUG2015/molecular_dynamics/examples/me8t8/ cp me8t8.pdb me8t8.prmtop run0.restart.coor NVE/run1.conf /SNSlocal/scratch/$USER/me8t8/NVE/ cd /SNSlocal/scratch/$USER/me8t8/NVE/
Run the simulation and use the NamdPlot plugin in VMD to check the evolution of the total energy (quantity named "TOTAL") versus time.
trajin run1.dcd rms first time 1.0 out rms2first.dat trajout run1_rms2first.dcd dcd quit
In [ ]:cd /SNSlocal/scratch/$USER/me8t8/ cp $HOME/SHUG2015/molecular_dynamics/examples/me8t8/rms2first.cpptraj ./ module load amber cpptraj -p me8t8.prmtop -i rms2first.cpptraj
cpptraj needs also the topology file me8t8.prmtop, although we could have used the PDB file me8t8.pdb. After we have entered these lines in the terminal, we can plot the RMS values:
In [ ]:%%bash xmgrace rms2first.dat &
In [ ]:%%bash vmd me8t8.pdb run1_rms2first.dcd
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