From: Richard Swenson (swenson_at_hec.utah.edu)
Date: Fri Nov 09 2007 - 09:20:55 CST

Dibayadeep,

I often use a simple awk script wrapped in a bash script to renumber my pdb
files when I am merging or splitting files. I'll copy one version of it to
this email. You'll probably have to modify it to get it to work with your
pdb files, but it gives you the idea.

#!/bin/bash
new=$1.pdb
old=$1

awk -v pdbfile=$new -v prev_resid=-1 -v cur_resid=0 -v prev_seg=0 ' {
        
atm=substr($0,1,6);atmnum=substr($0,7,5);blank1=substr($0,12,1);atmnam=subst
r($0,13,4);altloc=substr($0,17,1);resnam=substr($0,18,4);chain=substr($0,22,
1);resid=substr($0,23,4);icode=substr($0,27,1);blank2=substr($0,28,3);x=subs
tr($0,31,8);y=substr($0,39,8);z=substr($0,47,8);occupancy=substr($0,55,6);te
mpfactor=substr($0,61,6);blank3=substr($0,67,6);segid=substr($0,73,4);
        chain=" ";
        if (FNR >= 1) atmnum=FNR;
        if (FNR >99999) atmnum="*****";
        if (cur_resid!=int(resid)&&prev_resid!=int(resid)) cur_resid+=1;
        if (FNR>=1&&prev_seg!=segid) cur_resid=1 ;
        prev_seg=segid ;
        prev_resid=int(resid);
        if (FNR>=1) resid=cur_resid;
        
printf("%-6s%5s%1s%4s%1s%4s%1s%4s%1s%3s%8s%8s%8s%6s%6s%6s%-4s\n",atm,atmnum,
blank1,atmnam,altloc,resnam,chain,resid,icode,blank2,x,y,z,occupancy,tempfac
tor,blank3,segid) > pdbfile }' $old

Richard

-----Original Message-----
From: owner-vmd-l_at_ks.uiuc.edu [mailto:owner-vmd-l_at_ks.uiuc.edu] On Behalf Of
Dibyadeep Paul
Sent: Thursday, November 08, 2007 7:24 AM
To: vmd-l_at_ks.uiuc.edu
Subject: Re: vmd-l: merging two pdb files

Sir, will just merging together two pdb files that work? What I want
is to have another pdb file, which will be have the two protein
molecules simultaneously, so that I can directly use the single file,
instead of the two files. Wont it also be necessary to modify the
numbering of the atoms and molecules etc? I dont think these can be
achieved by simply using cat.

Sincerely

Dibyadeep

On Nov 8, 2007 6:09 PM, Axel Kohlmeyer <akohlmey_at_cmm.chem.upenn.edu> wrote:
> On Thu, 8 Nov 2007, Dibyadeep Paul wrote:
>
> DP> Hii all
> DP>
> DP> I am actually a new user of vmd. Is there any way to merge together
> DP> two pdb files using vmd? Although I tried a lot, I couldn't do so. If
> DP> not what program would you use to do so.
>
> you could use the extremely sophisticated program 'cat'
> to merge those files (it was written solely for the
> purpose of concatenating files). for more details try
> cat --help (it helps if you do this on a linux machine...).
>
> <g>,
> axel.
>
> DP>
> DP> Sincerely
> DP>
> DP> Dibyadeep
> DP>
>
> --
> =======================================================================
> 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.
>