From: Mehta, Rushita (
Date: Mon Jan 23 2017 - 05:58:53 CST


I would like to perform an RDF calculation and since I have an xyz file, I am aware that VMD does not read the PBC information in an xyz file. Here is the following script I used (with the help of forums as I am not familiar with TLC language):

package require pbctools

package require gofrgui

mol new type xyz waitfor all

pbc set {18.4681 13.9687 14.7413 \[90.2881 90.3459 90.4085\]} -all

set nframes [molinfo top get numframes]

set sel1 [atomselect top "name Cs"]
set sel2 [atomselect top "index 218"]

#Multicore Calculation
#set rdf [measure gofr $sel1 $sel2 delta 0.01 rmax 7.0 usepbc 1 selupdate 0 first 0 last [expr {$nframes-1}] step 1]

#GPU calculation
set rdf [measure rdf $sel1 $sel2 delta 0.01 rmax 7.0 usepbc 1 selupdate 0 first 0 last [expr {$nframes-1}] step 1]

set ri [lindex $rdf 0]

set gr [lindex $rdf 1]

set rdf_out [open "rdf.dat" "w"]

foreach val1 $ri val2 $gr {
 puts $rdf_out "$val1\t$val2"
close $rdf_out

However when I execute the script I receive the following message:

measure rdf: error during rdf calculation.

Could someone please help me solve this problem. In addition, I found a script which adds pbc information to an xyz file:

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

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

puts -nonewline "\n 18.4681: "
gets stdin a
puts -nonewline "\n 13.9687: "
gets stdin b
puts -nonewline "\n 14.7413: "
gets stdin c
puts -nonewline "\n 90.2881: "
gets stdin alpha
if { $alpha =="" } {
set alpha 90.000
set beta 90.000
set gamma 90.000
} else {
puts -nonewline "\n 90.3459: "
gets stdin beta
puts -nonewline "\n 90.4085: "
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.

I tried executing this script and seemed to have worked I presume as there were no errors. However when I tried using the GUI to run a RDF calculation I received the same error: measure rdf: error during rdf calculation.

Without using the scripts, when using GUI if I unclick the "Use PBC" and set the unit cell dimension for my file, the RDF calculation seems to work. Though I am not sure if PBC has been accounted for all the frames.