From: John Stone (johns_at_ks.uiuc.edu)
Date: Tue Oct 07 2003 - 13:32:33 CDT

Srinivas,
  Try using it like this:
makewatersphere 32.0 32 32 32

That worked for me. It generated a water sphere with 11763 atoms,
and a couple of quick measurements show the diameter of the generated
sphere to be 64.

Try that out and let me know if you still have problems.

I think I found a bug/limitation in solvate which my script has to
work around, but for now, just use the values I give above and you
should be fine.

If you want the sphere centered at 0 0 0, you can use an atom selection
and the 'moveby' command to translate the sphere back to the origin,
and then write out the new coordinates via the 'writepdb' atom selection
subcommand.

Thanks,
  John Stone
  vmd_at_ks.uiuc.edu

On Tue, Oct 07, 2003 at 04:14:38PM +0100, srinivasa murthy wrote:
> hi john,
> The script which you had given,works. But I
> try
> to generate sphere of radius more than 32 angstrom,
> its
> not working. I noted that, when radius exceeds 32
> angstom, the water box created by the script contained
> more than 27783 atoms(which is no. of atoms in wat.psf
> and wat.pdb of ..plugins/noarch/tcl/solvate1.2).
>
> regards
> srinivasa
>
> -----x-----
> --- John Stone <johns_at_ks.uiuc.edu> wrote: >
> > Hi,
> > Your script is broken in several respects, here's
> > a script I wrote
> > that does what you had intended to do, but does it
> > correctly, and uses
> > solvate and psfgen to get the job done more or less
> > as you had originally
> > intended. Mine is written as several Tcl
> > procedures, and you can specify
> > your own radius and the center of the water sphere
> > that you want to keep.
> > The major problem with your script is that you
> > assumed that the molecule
> > loaded by VMD is the same structure that psfgen is
> > operating on, but
> > this is in fact not the case. You must explicitly
> > tell psfgen what to
> > load and work with, and this is done by writing your
> > atom selection back
> > out as a PDB file, as I do in my new version of your
> > script. Take a look
> > and let me know if you have questions. I did use
> > one evil trick in my
> > script, which is to load the topology file from the
> > one that is included
> > with the solvate script. Other than that, the rest
> > of the script should
> > be understandable.
> >
> > Enjoy,
> > John Stone
> > vmd_at_ks.uiuc.edu
> ---------------------------------------
> proc drawselectionsphere { rad cx cy cz } {
> draw material Transparent
> set solvdraw [format "draw sphere { $cx $cy $cz }
> radius $rad"]
> eval $solvdraw
> display update
> }
>
>
> proc makewatersphere { rad cx cy cz } {
> echo "generating water box of size [expr $rad * 2]
> cubed"
> package require solvate
>
> set solvcmd [format "solvate -o new -minmax {{ -$rad
> -$rad -$rad} {$rad $rad
> $rad}} -t 1.0"]
> puts $solvcmd
> # run the solvate command
> eval $solvcmd
> mol new combine.psf
> mol addfile combine.pdb
> drawselectionsphere $rad $cx $cy $cz
>
> echo "generating water sphere of radius $rad from
> box, in VMD"
> set r2 [expr $rad*$rad]
> set wat2keep [atomselect top "same residue as
> ((sqr(x-$cx)+sqr(y-$cy)+sqr(z-$cz)) <= $r2)"]
> $wat2keep writepdb watersphere.pdb
> $wat2keep delete
> mol delete top
> }
>
> proc makewaterspherepsf {} {
> package require psfgen
> set solversion [package require solvate]
>
> echo "generating water sphere PSF, via psfgen"
> set oldctx [psfcontext new]
> topology
> $env(VMDDIR)/plugins/noarch/tcl/solvate$solversion/wat.top
>
> segment SOLV {
> auto none
> pdb watersphere.pdb
> }
>
> coordpdb watersphere.pdb SOLV
>
> writepsf watersphere.psf
> writepdb watersphere.pdb
> psfcontext $oldctx delete
> }
>
> echo "deleting any old files"
> file delete -force watersphere.psf
> file delete -force watersphere.pdb
> makewatersphere 10.0 20 20 20
>
> mol new watersphere.pdb
> makewaterspherepsf
>
> mol delete top
> mol new watersphere.psf
> mol addfile watersphere.pdb
> ----------------------------------------------------
>
>
>
>
> ________________________________________________________________________
> Yahoo! India Matrimony: Find your partner online.
> Go to http://yahoo.shaadi.com

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078