From: Axel Kohlmeyer (
Date: Fri Sep 21 2007 - 17:08:32 CDT

On Fri, 21 Sep 2007, Nicolas Sapay wrote:

NS> John,
NS> Thanks for your comment. Unfortunately, I can't use a psf structure
NS> because that requires some CHARMM formated files and my system is
NS> derived from a bunch of GROMACS *.itp files. I can probably write a
NS> quick-and-dirty script to convert topologies but I not sure a simple
NS> residue renumbering worth it :)

no problem there. just load the .pdb, interactively fix the bonds
and do: animate write psf newfile.psf

for as long as you only need the psf file for visualization, that
is good enough. i'm using this technique (and some more elaborate
scripting) for visualizing trajectories from coarse grained MD,
where a distance based bond-guessing will fail miserably).
if needed you can also modify the .psf in a (programmable) text
editor or similar to do the renumbering (e.g. with vi and the
's' command).


NS> Nicolas
NS> John Stone wrote:
NS> > Nicolas,
NS> > You cannot presently modify the bond determination criteria on-the-fly,
NS> > but you can interactively edit the bonds and cause VMD to re-analyze
NS> > the structure on-the-fly. You could also use psfgen or autopsf to
NS> > build a complete structure and load a PSF with your PDB which would
NS> > more permanently address the issue. I plan to add some features that'll
NS> > allow more flexible automatic bond determination criteria soon in support
NS> > of people that work with very unusual structures that combine
NS> > silicon nanodevices and biological molecules, that would likely
NS> > help in cases like yours as well.
NS> >
NS> > Cheers,
NS> > John Stone
NS> >
NS> >
NS> > On Fri, Sep 21, 2007 at 02:14:23PM -0600, Nicolas Sapay wrote:
NS> >
NS> >> Thanks for the fast answer,
NS> >>
NS> >> I have tried the selection text "residue $res" as you have suggested but
NS> >> the problem was still there. So, I have re-rechecked my pdb file.
NS> >> Apparently, a bond between the O1 and the P1 of the 200the lipid is not
NS> >> recognized by VMD. Lipid 200 is thus considered as 2 different residues.
NS> >> Same thing probably happened to 3 other lipids. That would explain why I
NS> >> have 4 more residues that expected. The problem is probably solvable if
NS> >> I find a way to modify the VMD criteria that define bonds.
NS> >>
NS> >> Nicolas
NS> >>
NS> >> Axel Kohlmeyer wrote:
NS> >>
NS> >>> On Fri, 21 Sep 2007, Nicolas Sapay wrote:
NS> >>>
NS> >>>
NS> >>> nicolas,
NS> >>>
NS> >>>
NS> >>> NS> 5 set sel [ atomselect $molid "$seltext" ]
NS> >>> NS> 6 # Retrieve the 'residue' number of the selection
NS> >>> NS> 7 set reslist [ lsort -integer -unique [ $sel get residue ] ]
NS> >>> NS> 8
NS> >>> NS> 9 # Assign a new 'resid' to each residue of the selection
NS> >>> NS> 10 foreach res $reslist {
NS> >>> NS> 11 # Do a temporary selection
NS> >>> NS> 12 set tmpsel [ atomselect $molid "$seltext and residue
NS> >>> NS> $res" ]
NS> >>>
NS> >>> please note, that in this case you overwrite only the resids
NS> >>> of those atoms that are in the selection, so parts of the same
NS> >>> residue may have different resids after the procedure.
NS> >>> if you want to overwrite the resid of all atoms in a given residue,
NS> >>> just use the selection text of "residue $res".
NS> >>>
NS> >>> NS> 13 $tmpsel set resid $start
NS> >>> NS> 14 $tmpsel delete
NS> >>> NS> 15 # Increment the new resid
NS> >>> NS> 16 incr start
NS> >>> NS> 17 }
NS> >>> NS> 18 $sel delete
NS> >>> NS> 19 return
NS> >>> NS> 20}
NS> >>> NS> #======================================
NS> >>> NS> However, the proc doesn't work with a simple system of 214 identical
NS> >>> NS> residues (it's a membrane bilayer). When I use the 'residue' keyword
NS> >>> at NS> line 7, I obtain a list of 218 'residue' which is wrong. But when I
NS> >>> do NS> the same thing using the 'resid' keyworkd, I obtain a correct list
NS> >>> of NS> 214 'resid'. Why do the 'residue' keyword give me 4 more residues?
NS> >>> (When NS> I do the renumbering, the resids start to be wrong at 200)
NS> >>>
NS> >>> please check, whether those resids have been actually overwritten.
NS> >>> see above.
NS> >>>
NS> >>> cheers,
NS> >>> axel.
NS> >>>
NS> >>> NS>
NS> >>> NS> Thanks for your help. I hope I'm not too confusing with all this
NS> >>> NS> 'residue' and 'resid'
NS> >>> NS>
NS> >>> NS>
NS> >>> NS>
NS> >>> NS> Nicolas
NS> >>> NS>
NS> >>> NS>
NS> >>>
NS> >>>
NS> >>>
NS> >
NS> >
NS> >
NS> >

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.