From: Axel Kohlmeyer (
Date: Fri Feb 01 2008 - 08:55:39 CST

On Fri, 1 Feb 2008, Robert Coridan wrote:

RC> Hi--

hi robert,
RC> I'm following along with the "User-Defined Forces in NAMD" tutorial,
RC> where you can assign a force that creates a vacuum "bubble" in a
RC> water box. I am wondering if there is any way to calculate the RDF
RC> from the center of the bubble ({0,0,0} in the simulation).

there should be multiple. what i would do is the following:

load your trajectory and then execute the following script code
(completely untested):

set mol1 [molinfo top]
set old [atomselect $mol1 all]
$old writepdb new.pdb

# now edit new.pdb so it contains an extra line with
# an ATOM record for an atom with name X and resname X
# at 0.00 0.00 0.00

set mol2 [mol new new.pdb]
set new [atomselect $mol2 {not name X}]
set x [atomselect $mol2 {name X}]
animate delete $mol2
set numf [molinfo $mol1 get numframes]
for {set i 0}{$i < $numf}{incr i} {
   animate dup $mol2
   $old frame $i
   $new frame $i
   $x frame $i
   $new set {x y z} [$old get {x y z}]
   $x set {x y z} {0.0 0.0 0.0}

mol delete $mol1
animate write psf new.psf $mol2
animate write dcd new.dcd $mol2

and now you should have a psf/dcd combo that
you can use with the RDF plugin (just use "name X")
for the first selection.


RC> Thanks!

Axel Kohlmeyer
   Center for Molecular Modeling   --   University of Pennsylvania
Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
tel: 1-215-898-1582,  fax: 1-215-573-6233,  office-tel: 1-215-898-5425
If you make something idiot-proof, the universe creates a better idiot.