From: Axel Kohlmeyer (
Date: Thu Jan 29 2015 - 13:33:20 CST

On Thu, Jan 29, 2015 at 1:30 PM, Brian Radak
<> wrote:
> Hello,
> I'm using vmd to call psfgen in order to patch a solvated structure and
> create duplicate "dummy" atoms. I'd like psfgen to build the new atoms in
> accord with patch's IC table and
> without changing the existing ones. As such, I believe it should suffice to
> "seed" the psfgen guesscoord command by explicitly setting a few atoms in
> the chain as direct copies of existing atoms (these will be non-interacting,
> so it is not a problem).
> My script looks something like this:
> # load psfgen and load psf and coordinates into psfgen and vmd (these must
> be separate?)
> package require psfgen
> <load topology files with patch, etc.>
> readpsf ...
> mol load psf ..
> # apply the patch (which adds new atoms) and regenerate bond/angle/dihedral
> terms
> patch ...
> regenerate angles dihedrals
> # "seed" the ic build by copying the atom CB to its copy CB1
> set cb [atomselect top "segid PROT and resid 2 and name CB"]
> set cbx [$cb get {x y z}]
> coord PROT 2 CB1 $cbx # <-- PROBLEM HAPPENS HERE
> guesscoord
> writepsf ..
> writepdb ...
> however I seem to be missing something as to how Tcl and/or psfgen take the
> coordinate values. The psfgen coord command keeps giving a standard usage
> error:
> arguments: segid resid atomname { x y z }
> MOLECULE DESTROYED BY FATAL ERROR! Use resetpsf to start over
> I've tried a number of ways of reformatting the coordinates with puts or
> expr or [], but I can't even tell what vmd/tcl thinks I am giving it.

that is most likely because an atomselect function returns not just a
simple {x y z} coordinate tuple, but a list of those, one for each
atom in the selection. so what you get is not a list, but a list of
lists, i.e. { {x y z} }.

the simplest way to get rid of the additional braces would be to use:

set cbx [lindex 0 [$cb get {x y z}]]

> Any help much appreciated,
> Brian
> --
> Brian Radak
> Postdoctoral Scholar
> University of Chicago
> Department of Biochemistry & Molecular Biology
> Gordon Center for Integrative Science, W323A
> 929 E. 57th St.
> Chicago, IL 60637-1454
> Tel: 773/834-2812
> e-mail:

Dr. Axel Kohlmeyer
College of Science & Technology, Temple University, Philadelphia PA, USA
International Centre for Theoretical Physics, Trieste. Italy.