From: Axel Kohlmeyer (
Date: Tue Mar 19 2013 - 02:17:00 CDT

On Tue, Mar 19, 2013 at 6:52 AM, AnkiReddy katha
<> wrote:
> 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.

*of course* it does not. that would be a highly inconsistent behavior.
how should the command be able to tell the difference, anyway??

> could you please suggest me if you have done like this earlier.

measure gofr only "knows" about atoms. so to make this work, you need
to create a trajectory that has atoms at the position of the center of
mass that you want to analyze. in many cases it is sufficient to
simply select the one atom that is closest to the center of mass of a
residue or molecule.


> 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
> exit
> thank you
> best regards
> Anki

Dr. Axel Kohlmeyer
International Centre for Theoretical Physics, Trieste. Italy.