Summary: convert PDB to CHARMm



 Hi, CCLers,
 My original question on how to convert PDB file to CHARMm format
 seemed ridiculous, but I was in a situation without QUANTA/CHARMm
 in hand. Anyway, many thanks to all the people who answered my
 question and gave me helpful information. Now the summary.
 How to convert PDB files to CHARMm format
 =========================================
        1.  CHARMm
        2.  QUANTA
        3.  RasMol
        4.  Babel
        5.  your own code
 1. CHARMm itself can read PDB files and convert to CRD/PSF format.
 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    as suggested by
               G. Matthias Ullmann <ullmann $#at#$ scripps.edu
               Rick Venable <rvenable $#at#$ deimos.cber.nih.gov>
               Ryszard Czerminski <ryszard $#at#$ moldyn.com>
               dmacks $#at#$ sas.upenn.edu (Daniel E. Macks)
               Shobana Sundaram <sshobana $#at#$ mail.med.cornell.edu
               aldo $#at#$ DUTSH15.TUDELFT.NL (aldo jongejan)
    Matthias and Shobana gave me the commands of CHARMm in details.
 Daniel
    referred me to the Charmm documentaion io.doc file. Aldo suggested me
    read the source code. In a few days I can access the CHARMm program
 in
    our Univ. Thanks.
 Example 1:
 ==========
             (by "G. Matthias Ullmann" <ullmann $#at#$
 scripps.edu>)
             ------------------------------------------------
 open read unit 12 card name "1rie.protein.pdb"
 read sequ pdb unit 12
 generate 1rie setup
 rewind unit 12
 read coor pdb unit 12
 close unit 12
 But you should read only one straint at once. If you have more than
 one straint, repeat the command like this:
 open read unit 12 card name "1rie.hetero.pdb"
 read sequ pdb unit 12
 generate fes setup
 rewind unit 12
 read coor pdb unit 12 appe
 close unit 12
 You have to edit the PDB file a little bit, so that it look like
 ATOM      1  N   THR    53      15.450   0.804  17.223  1.00 15.05
 1rfs
 ATOM      2  CA  THR    53      14.080   0.730  16.642  1.00 15.16
 1rfs
 ATOM      3  C   THR    53      14.002   1.723  15.471  1.00 14.32
 1rfs
 ATOM      4  O   THR    53      14.581   2.805  15.549  1.00 14.38
 1rfs
 ATOM      5  CB  THR    53      13.011   1.058  17.715  1.00 16.16
 1rfs
 ATOM      6  OG1 THR    53      13.161   2.411  18.160  1.00 18.16
 1rfs
 ATOM      7  CG2 THR    53      13.171   0.139  18.916  1.00 16.08
 1rfs
 ATOM      8 1H   THR    53      15.677   1.830  17.297  1.00  0.00
 1rfs
 ATOM      9 2H   THR    53      15.484   0.373  18.153  1.00  0.00
 1rfs
 ATOM     10 3H   THR    53      16.137   0.366  16.590  1.00  0.00
 1rfs
 ATOM     11  HG1 THR    53      13.847   2.552  18.821  1.00  0.00
 1rfs
 The string in the last column has to be the segid. Otherwise you can not
 read the coordinates properly.
                     ----- End of Example 1.
 Example 2:
 ==========
             (by Shobana Sundaram <sshobana $#at#$ mail.med.cornell.edu>)
             -----------------------------------------------------
 open read card unit 10 name a.pdb ('your filename')
 read coor pdb unit 10
 close unit 10
 if you want only the coordinates to be written
 open write unit 11 card name a.crd
 write coor unit 11 card
 * title
 *
 and if you want to write in psf format which included connectivities
 etc..
 write psf card name a.psf
 * title
 *
                       ----- End of Example 2
 2. QUANTA - the Graphical User Interface for CHARMm can of course do
 this.
 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    as suggested by
               dmacks $#at#$ sas.upenn.edu (Daniel E. Macks)
               Istvan Enyedy" <istvan $#at#$ giccs.georgetown.edu>
               Shobana Sundaram <sshobana $#at#$ mail.med.cornell.edu>
 3. RasMol can read both PDB and CHARMm formats
 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
    as suggested by
               Rick Venable <rvenable $#at#$ deimos.cber.nih.gov>
    RasMol can export the current image to various graphical formats,
 such as
    gif, bmp, ps; but it is not clear if it can re-write the structure
 into
    any formats other than the input one.   (Xiaomei)
 4. Babel reads both PDB and CHARMm formats but doesn't write to CHARMm
 format.
 <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
 5. Write you own code
 <<<<<<<<<<<<<<<<<<<<<
    as suggestd by
              Themis Lazaridis <lazarid $#at#$ fas.harvard.edu>
              <aldo $#at#$ DUTSH15.TUDELFT.NL> (aldo jongejan)
    Themis gave me his little code that helped me to accomplish my job in
    time. Thanks.
 Example 3:
 ==========
            (by Themis Lazaridis <lazarid $#at#$ fas.harvard.edu>)
            -----------------------------------------------
 Themis Lazaridis
 Department of Chemistry                 phone (212) 650-8364
 City College of New York                fax   (212) 650-6107
 Convent Avenue & 138th St.              email: themis $#at#$
 sci.ccny.cuny.edu
 New York, NY 10031
 http://www.sci.ccny.cuny.edu/~themis
 ----------------------
 c Reads PDB file, writes out charmm file
 c Uses a temp file
 c PDB format
 c text IATOM  TYPE  RES  IRES      X  Y  Z    W
 c  A6   I5  2X A4   A4    I5  4X     3F8.3 6X F6.2
 c charmm format
 c ATOMNO RESNO   RES  TYPE  X     Y     Z   SEGID RESID Weighting
 c   I5    I5  1X A4 1X A4 F10.5 F10.5 F10.5 1X A4 1X A4 F10.5
 c
 c
         character*80 infile,outfile,line
         character*4 str1,type,res,code,segid,resid,residold,resold
         character*1 chain
         logical loxt(1000)
         write (6,*) 'Give input PDB files, output will be .crd'
 1       read (5,'(a)') infile
         i=1
 2       i=i+1
         if (infile(i:i).eq.' ') then
          outfile=infile(1:i-1)//'.crd'
         else
          goto 2
         endif
         open (unit=11, file=infile, status='old')
         open (unit=12, file='temppdb', status='unknown')
         open (unit=13, file=outfile, status='new')
         write (13,'(a80)') '* converted from '//infile
         write (13,'(a)') '*'
         do 4 i=1,1000
 4       loxt(i)=.false.
         nss=0
         ires=0
         iat=0
         residold='    '
         resold='    '
         do 100 i=1,100000
         read (11,'(a80)',end=1000) line
         read (unit=line,fmt=500) str1
         if (str1.eq.'SSBO') then
           nss=nss+1
           goto 100
         else if (str1.eq.'ATOM') then
         iat= iat+1
         read (unit=line,fmt=500) str1,iatom,type,res,chain,resid,
      &    x,y,z,a,w,code
 500     format (a4,2x,i5,2x,a4,a4,a1,a4,4x,3f8.3,2f6.2,6x,a4)
           if ((resid.ne.residold).or.(res.ne.resold)) ires=ires+1
           residold=resid
           resold= res
           if (chain.ne.'    ') then
             segid=chain//code
           elseif (code.ne.'    ') then
             segid=code
           else
             segid='MAIN'
           endif
           if (type.eq.'CD1 ') then
              if (res.eq.'ILE ') type='CD  '
           elseif (type.eq.'OCT1') then
              type='OT1 '
           elseif (type.eq.'OCT2') then
              type='OT2 '
           elseif (type.eq.'OXT ') then
              type='OT2 '
              loxt(ires)=.true.
           endif
 c fluch resid left
 5         if (resid(1:1).eq.' ') then
             resid=resid(2:4)//' '
             goto 5
           endif
           write (12,600) iat,ires,res,type,x,y,z,segid,resid,w
 600     format (I5,I5,1X,A4,1X,A4,3F10.5,1X,A4,1X,a4,F10.5)
         else
           goto 100
         endif
 100     continue
 1000    write (6,*) 'Disulfide bonds', nss
         nres=ires
         write (13,'(i5)') iat
         close (unit=12)
         open (unit=12,file='temppdb',status='old')
         do 200 i=1,100000
         read (12,'(a80)',end=2000) line
         read (unit=line,fmt=600) iatom,ires,res,type,x,y,z,segid,resid,w
         if (loxt(ires).and.(type.eq.'O   ')) type='OT1 '
         write (13,600) iatom,ires,res,type,x,y,z,segid,resid,w
 200     continue
 2000    close (unit=11)
         close (unit=12)
         close (unit=13)
         goto 1
         end
              ----- End of Example 3
                          -----End of Summary
 //////////////////////
 Xiaomei Yang, Postdoc
 Dept of Chem & Biochem
 Univ of Texas at Austin
 Austin, 78712 TX, USA
 Tel: +1-512-471-4671 (O)
 xiaomei $#at#$ ne059.cm.utexas.edu
 /////////////////////////////