From: AnkiReddy katha (
Date: Tue Mar 19 2013 - 00:52:52 CDT

dear VMD users

i want to calculate gofr between the center of mass of a functional group
and solvent.
This functional group consists of three atoms (C, O, O).
the following script (based on the discussions in this list), i used.
The first selection has three atoms, however i think this will not give
between the center of mass of these three atoms and water.
could you please suggest me if you have done like this earlier.

package require pbctools
mol load psf aach_ion.psf dcd aachwtion_nvt1.dcd
set nframes [molinfo top get numframes]

set solute [atomselect top "name C3T or name O1T or name O2T"]
set solvent [atomselect top "name OH2"]

set rdf [measure gofr $solute $solvent delta 0.1 rmax 10.0 usepbc 1
selupdate 0 first 0 last [expr {$nframes-1}] step 1]
set ri [lindex $rdf 0]

set gr [lindex $rdf 1]

set outfile rdfct.dat
set rdf_out [open $outfile w]

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

thank you
best regards