Add PBC information for XYZ or PDB trajectory files in VMD.

VMD has trouble to read in the PBC information of PDB file, XYZ just does not contain PBC information. But sometimes, PDB trajectory file is convenient to analyze. VMD can run Tcl/Tk and Perl script. The following is a script to add PBC information for PDB or XYZ trajectory files (add information to each frame). I do not have the link of the script, sorry about the author.

If you do not know how to run script in VMD. Click “Extensions” – “Tk console”

Use “pwd” and “cd” to go to the directory where the script locates. then “source *.tcl”. It will work.

#############################

#pick ID for current molecule
set molid [molinfo top]

#pick the number of frames
set n [molinfo $molid get numframes]

puts -nonewline "\n Set length for a (angstrom): "
gets stdin a
puts -nonewline "\n Set length for b (angstrom): "
gets stdin b
puts -nonewline "\n Set length for c (angstrom): "
gets stdin c
puts -nonewline "\n Set angle alpha (if monoclinic cell press enter): "
gets stdin alpha
if { $alpha =="" } {
set alpha 90.000
set beta 90.000
set gamma 90.000
} else {
puts -nonewline "\n Set angle beta (degrees): "
gets stdin beta
puts -nonewline "\n Set angle gamma (degrees): "
gets stdin gamma
}

# Applying to all the frames
for {set i 0} {$i < $n} {incr i} {
molinfo $molid set frame $i
molinfo $molid set a $a
molinfo $molid set b $b
molinfo $molid set c $c
molinfo $molid set alpha $alpha
molinfo $molid set beta $beta
molinfo $molid set gamma $gamma
}
#rewind trajectory
animate goto start
###add the size to each frame.

#############################

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s