Converting between '.crd' and '.pdb'

From Docswiki
Jump to navigation Jump to search

You can actually convert between '.xyz', '.pdb' and '.crd' formats using awk and other shell commands. There is more info on the conversion between different data file formats page. Another way of doing it is using CHARMM to read in your structure in one format and then specifying that you would like to save it in a different format. The advantage of using CHARMM for this is that you know the output structure will be readable by CHARMM!

As an example, here is a CHARMM input file which will convert a set of cooridinates in CARD (crd) format into a pdb. The different parts of the input file are described in more detail on the CHARMM page.

! CHARMM printing and error tolerence

PRNLev 1
BOMLev -5

! Read standard topology and parameter files

OPEN READ CARD UNIT 1 NAME "/home/csw34/svn/CHARMM31/toppar/toph19_eef1_perm.inp"
READ RTF CARD UNIT 1
CLOSE UNIT 1

OPEN READ CARD UNIT 2 NAME "/home/csw34/svn/CHARMM31/toppar/param19_eef1_perm.inp"
READ PARAMETER CARD UNIT 2
CLOSE UNIT 2

! Generate the PSF for met-enk

READ SEQUence CARD
*
5
TYR GLY GLY PHE MET
GENErate FIRS NTER LAST CTER SETUp

! Read in the crd format input file into the COOR array

OPEN UNIT 20 NAME input.crd READ CARD
READ COOR UNIT 20 CARD FREE
CLOSE UNIT 20

! Fill and setup the internal coordinate tables

IC FILL PRESERVE
IC PARAMETERS
IC PURGE
IC BUILD

! Write the COOR array out in pdb format

OPEN UNIT 20 NAME input.pdb WRITE CARD
WRITE COOR UNIT 20 PDB
CLOSE UNIT 20

If you wanted to go the other way, from pdb to crd, the bottom of the input file should be:

! Read in the pdb format input file into the COOR array

OPEN UNIT 20 NAME input.pdb READ CARD
READ COOR UNIT 20 PDB
CLOSE UNIT 20

! Fill and setup the internal coordinate tables

IC FILL PRESERVE
IC PARAMETERS
IC PURGE
IC BUILD

! Write the COOR array out in crd format

OPEN UNIT 20 NAME input.crd WRITE CARD
WRITE COOR UNIT 20 CARD
CLOSE UNIT 20

NOTE: You need only specify the FREE keyword when READING a crd format file.

If you need to change the number of atoms (e.g. making a united-atom charmm19 .crd file, or if atoms are missing)

Once you've got your input file set up, you run it through CHARMM like this:

charmm < crd2pdb.inp

You'll see if CHARMM didn't exit properly by the big skull in the output! Here is a CARD file for the met-enk peptide so you can have a play!

input.crd