From: Yi Wang, PhD (
Date: Tue Mar 19 2013 - 01:37:54 CDT


One clumsy way I used to go with, is to move an absolutely irrelevant atom (atom that will never show up in your selection) of the system to the CoM of interest. Then the task becomes calculating the gofr between that atom and the solvent. I carried out this movement for every snapshot of the trajectory. It's not very efficient, but effective. It gets me around the issue. Hope you can come up with better methods.


Yi (Yves) Wang, PhD
Chinese Academy of Science

On 2013-3-19, at 下午1:52, 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.
> 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
> exit
> thank you
> best regards
> Anki