From: Axel Kohlmeyer (akohlmey_at_cmm.chem.upenn.edu)
Date: Fri Feb 01 2008 - 11:48:12 CST

yOn Fri, 1 Feb 2008, Robert Coridan wrote:

RC> Thanks for the quick response!
RC>
RC> I do have a problem with this script, though. There is another question on
RC> the vmd-l mailing list that asks this question without a vmd-related
RC> response. I get stuck when trying to use the 'writepdb' functionality in
RC> VMD 1.8.6. Here's the input/output:
RC>
RC> (VMD) 1 % set mol1 [molinfo top]
RC> 0
RC> >Main< (VMD) 2 % set old [atomselect $mol1 all]
RC> atomselect0
RC> >Main< (VMD) 3 % $old writepdb new.pdb
RC> atomsel: writepdb failed.
RC>
RC> In the text window, there is an error:
RC>
RC> ERROR) Molecule's structure has not been initialized.
RC>

RC> Am I forgetting to do something? I have loaded the dcd trajectory
RC> and I can access and see all of the frames. Any advice would be a
RC> big help.

you have to first load the .psf file and then load the
.dcd "into" it. check out the VMD tutorials... ;-)

cheers,
  axel.

RC>
RC> Thanks!
RC>
RC> On Feb 1, 2008 8:55 AM, Axel Kohlmeyer <akohlmey_at_cmm.chem.upenn.edu> wrote:
RC>
RC> > On Fri, 1 Feb 2008, Robert Coridan wrote:
RC> >
RC> > RC> Hi--
RC> >
RC> > hi robert,
RC> >
RC> > RC> I'm following along with the "User-Defined Forces in NAMD" tutorial,
RC> > RC> where you can assign a force that creates a vacuum "bubble" in a
RC> > RC> water box. I am wondering if there is any way to calculate the RDF
RC> > RC> from the center of the bubble ({0,0,0} in the simulation).
RC> >
RC> > there should be multiple. what i would do is the following:
RC> >
RC> > load your trajectory and then execute the following script code
RC> > (completely untested):
RC> >
RC> > set mol1 [molinfo top]
RC> > set old [atomselect $mol1 all]
RC> > $old writepdb new.pdb
RC> >
RC> > # now edit new.pdb so it contains an extra line with
RC> > # an ATOM record for an atom with name X and resname X
RC> > # at 0.00 0.00 0.00
RC> >
RC> > set mol2 [mol new new.pdb]
RC> > set new [atomselect $mol2 {not name X}]
RC> > set x [atomselect $mol2 {name X}]
RC> > animate delete $mol2
RC> > set numf [molinfo $mol1 get numframes]
RC> > for {set i 0}{$i < $numf}{incr i} {
RC> > animate dup $mol2
RC> > $old frame $i
RC> > $new frame $i
RC> > $x frame $i
RC> > $new set {x y z} [$old get {x y z}]
RC> > $x set {x y z} {0.0 0.0 0.0}
RC> > }
RC> >
RC> > mol delete $mol1
RC> > animate write psf new.psf $mol2
RC> > animate write dcd new.dcd $mol2
RC> >
RC> > and now you should have a psf/dcd combo that
RC> > you can use with the RDF plugin (just use "name X")
RC> > for the first selection.
RC> >
RC> > cheers,
RC> > axel.
RC> >
RC> >
RC> > RC>
RC> > RC> Thanks!
RC> > RC>
RC> >
RC> > --
RC> > =======================================================================
RC> > Axel Kohlmeyer akohlmey_at_cmm.chem.upenn.edu http://www.cmm.upenn.edu
RC> > Center for Molecular Modeling -- University of Pennsylvania
RC> > Department of Chemistry, 231 S.34th Street, Philadelphia, PA 19104-6323
RC> > tel: 1-215-898-1582, fax: 1-215-573-6233, office-tel: 1-215-898-5425
RC> > =======================================================================
RC> > If you make something idiot-proof, the universe creates a better idiot.
RC> >
RC>

-- 
=======================================================================
Axel Kohlmeyer   akohlmey_at_cmm.chem.upenn.edu   http://www.cmm.upenn.edu
   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.