From: Josh Vermaas (vermaas2_at_illinois.edu)
Date: Wed Mar 13 2013 - 19:03:32 CDT

Whoops. I goofed on the correct form for the pbc command, which explains
the second error. The first probably comes from only setting the
box-size for the current frame, not all of them. Since gofr needs the
size at every frame, and the default when loading an xyz file is 0, you
get the errors you've seen. To fix this you need to set the periodic box
size for every frame. If its all the same size, the script should read:

/package require pbctools/
/
/
/mol new gr1.xyz type xyz waitfor all
//set solv [atomselect top "name O"]/
pbc set {68.44962167734951 68.44962167734951 68.44962167734951} -all
#The rest unchanged

The -all flag is important, as that will set the a, b, and c for all
frames, and not just the current one.
Sorry for the confusion!
-Josh Vermaas

On 03/13/2013 05:46 PM, Salvador H-V wrote:
> Hi again,
>
> Thanks to all the previous suggestions. But still I can no make my
> script to run and work properly.
>
> First, I followed the suggestion of remove the command: set cell {}
> and instead I used the command molinfo. Here it is my code:
>
> ============
> /mol new gr1.xyz type xyz waitfor all/
> /
> /
> /set nframes [molinfo top get numframes]/
> /
> /
> /set solv [atomselect top "name O"]/
> /
> /
> /molinfo top set a 68.44962167734951 /
> /molinfo top set b 68.44962167734951 /
> /molinfo top set c 68.44962167734951/
> /
> /
> /molinfo top set alpha 90.0 /
> /molinfo top set beta 90.0 /
> /molinfo top set gamma 90.0/
> /
> /
> /#set rdf [measure gofr $solv $solv delta 0.01 rmax 18.0 first 0 last
> [expr {$nframes-1}] step 1] /
> /set rdf [measure gofr $solv $solv delta 0.01 rmax 18.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/
> /exit/
> ==================
>
> I got the following message:
> /0/
> /100/
> /atomselect0/
> /ERROR) measure gofr: unit cell volume is zero./
> /measure gofr: error during g(r) calculation./
>
> Next, I decided to use pbctools. I made a copỳ in my home directory of
> .vmdrc file located at:/ /usr/local/lib/vmd// and I added the
> following lines:
> /set dir "/usr/local/lib/vmd/plugins/noarch/tcl/pbctools2.6/"/
> /source $dir/pkgIndex.tcl/
> /package require pbctools/
>
> Now, the script looks like:
> ===========
> /package require pbctools/
> /
> /
> /mol new gr1.xyz type xyz waitfor all/
> /
> /
> /pbc set cell "68.44962167734951 68.44962167734951 68.44962167734951"/
> /
> /
> /set nframes [molinfo top get numframes]/
> /set solv [atomselect top "name O"]/
> /
> /
> /
> /
> /set rdf [measure gofr $solv $solv delta 0.01 rmax 18.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/
> /exit/
> ========================
>
> But now I got the following message:
>
> /ERROR: pbcset: unknown option: 68.44962167734951 68.44962167734951
> 68.44962167734951/
> /100/
> /atomselect0/
> /ERROR) measure gofr: unit cell volume is zero./
> /measure gofr: error during g(r) calculation./
>
> Please let me know what I am doing wrong.
>
> All the best,
>
> SHV
>
>