From: Axel Kohlmeyer (
Date: Thu Jan 18 2007 - 11:51:48 CST

On Thu, 18 Jan 2007, Himanshu Khandelia wrote:

HK> Hi,
HK> Often, after deletion of overlapping water molecules, the psf and the pdb
HK> contain non-sequential residue numbers (like 2,4,5,6,10) instead of
HK> (1,2,3,4,5). Although this does not present a problem in NAMD analysis and
HK> simulation, it might pose difficulty if the trajectories produced by NAMD
HK> are exported to and analyzed in CHARMM. Even otherwise, it makes better
HK> sense to have sequential residue numbers.
HK> Does anyone have an available script that will renumber a multi-segment
HK> pdb and the psf sequentially, or even parts of the pdb and psf
HK> sequentially ?

for a trivial/minimal implementation of this you need
no script. on the command line create a selection for
everything and asign the value of residue to resid. e.g.:

set sel [atomselect top all]
$sel set resid [$sel get residue]
$sel writepdb renumbered.pdb


HK> Thank you for the help,
HK> -Himanshu

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.