From: Vermaas, Joshua (
Date: Tue Jan 23 2018 - 11:30:12 CST

Sure, I can write one, but that doesn't help you learn! There are also some peculiarities you'd need to watch out for with respect to wrapping, since if you wrapped your waters, the easiest approaches don't work anymore. :(

Here is an example for computing the RMSD of your water molecules over time, which you can adapt pretty easily to your own ends.

set ref [atomselect top "water" frame 0]
set sel [atomselect top "water"]
set fout [open "output.dat" "w"]
for { set f 0 } { $f < [molinfo top get numframes] } { incr f } {
$sel frame $f
puts $fout "$f [measure rmsd $sel $ref]"
close $fout


On 01/23/2018 02:16 AM, Suresh Ghimire wrote:
Dear vmd user,
How can we calculate the MSD for the water inside carbon nanotube so that we can get the self-diffusion coefficient? anybody, can you please write Tcl script for this?

Suresh Ghimire
M Sc (Physics)
Tribhuvan University, Patan Multiple Campus
Lalitpur, Nepal