writepdb.c File Reference

#include "../headers/writepdb.h"

Go to the source code of this file.

Functions

void write_pdb_atom_line (FILE *f, const char rec_name[], int id, const char atom_name[], char alt_loc, const char res_name[], const char chain[], int res_id, const char insert, float x, float y, float z, float occ, float bfactor, const char *symbol, int charge)
void write_pqr_atom_line (FILE *f, const char *rec_name, int id, const char *atom_name, char alt_loc, const char *res_name, const char *chain, int res_id, const char insert, float x, float y, float z, float charge, float radius)


Function Documentation

void write_pdb_atom_line ( FILE *  f,
const char  rec_name[],
int  id,
const char  atom_name[],
char  alt_loc,
const char  res_name[],
const char  chain[],
int  res_id,
const char  insert,
float  x,
float  y,
float  z,
float  occ,
float  bfactor,
const char *  symbol,
int  charge 
)

## FUNCTION: write_pdb_atom_line

## SPECIFICATION: Write an atom in the following pdb format 2.3.

COLUMNS DATA TYPE FIELD DEFINITION

1 - 6 Record name "ATOM " 7 - 11 Integer serial Atom serial number. 13 - 16 Atom name Atom name. 17 Character altLoc Alternate location indicator. 18 - 20 Residue name resName Residue name. 22 Character chainID Chain identifier. 23 - 26 Integer resSeq Residue sequence number. 27 AChar iCode Code for insertion of residues. 31 - 38 Real(8.3) x Orthogonal coordinates for X in Angstroms 39 - 46 Real(8.3) y Orthogonal coordinates for Y in Angstroms 47 - 54 Real(8.3) z Orthogonal coordinates for Z in Angstroms 55 - 60 Real(6.2) occupancy Occupancy. 61 - 66 Real(6.2) tempFactor Temperature factor. 77 - 78 LString(2) element Element symbol, right-justified. 79 - 80 LString(2) charge Charge on the atom.

## PARAMETRES:

## RETURN:

Definition at line 93 of file writepdb.c.

Referenced by write_first_bfactor_density(), write_md_pocket_atoms(), write_pdb_atoms(), write_pdb_vert(), write_pocket_pdb(), and write_pocket_pdb_DB().

00097 {
00098         /* Example of pdb record: */
00099         /* Position:          1         2         3         4         5         6 */
00100         /* Position: 123456789012345678901234567890123456789012345678901234567890 */
00101         /* Record:   ATOM    145  N   VAL A  25      32.433  16.336  57.540  1.00 */
00102         
00103         /* Position: 6         7         8 */
00104         /* Position: 012345678901234567890 */
00105         /* Record:   0 11.92           N   */
00106 
00107         int status = 0 ;
00108         char id_buf[6] = "*****",
00109                  res_id_buf[5] = "****",
00110                  charge_buf[3] = "  ";
00111         
00112         if (id < 100000) sprintf(id_buf, "%5d", id);
00113         else sprintf(id_buf, "%05x", id);
00114 
00115         if (res_id < 10000) sprintf(res_id_buf, "%4d", res_id);
00116         else if (res_id < 65536) sprintf(res_id_buf, "%04x", res_id);
00117         else sprintf(res_id_buf, "****");
00118 
00119         alt_loc = (alt_loc == '\0')? ' ': alt_loc;
00120 
00121         if(charge == -1) sprintf(charge_buf, "  ") ;
00122         else sprintf(charge_buf, "%2d", charge) ;
00123 
00124         status = fprintf(f, "%-6s%5s %4s%c%-4s%c%4s%c   %8.3f%8.3f%8.3f%6.2f%6.2f          %2s%2s\n",
00125                                                  rec_name, id_buf, atom_name, alt_loc, res_name, chain[0], 
00126                                                  res_id_buf, insert, x, y, z, occ, bfactor, symbol, charge_buf);
00127         
00128 }

void write_pqr_atom_line ( FILE *  f,
const char *  rec_name,
int  id,
const char *  atom_name,
char  alt_loc,
const char *  res_name,
const char *  chain,
int  res_id,
const char  insert,
float  x,
float  y,
float  z,
float  charge,
float  radius 
)

## FUNCTION: write_pqr_atom_line

## SPECIFICATION: Write an atom in pqr format.

COLUMNS DATA TYPE FIELD DEFINITION

1 - 6 Record name "ATOM " 7 - 11 Integer serial Atom serial number. 13 - 16 Atom name Atom name. 17 Character altLoc Alternate location indicator. 18 - 20 Residue name resName Residue name. 22 Character chainID Chain identifier. 23 - 26 Integer resSeq Residue sequence number. 27 AChar iCode Code for insertion of residues. 31 - 38 Real(8.3) x Orthogonal coordinates for X in Angstroms 39 - 46 Real(8.3) y Orthogonal coordinates for Y in Angstroms 47 - 54 Real(8.3) z Orthogonal coordinates for Z in Angstroms charge vdw radius

## PARAMETRES:

## RETURN:

Definition at line 162 of file writepdb.c.

Referenced by write_pqr_vert().

00166 {
00167         /* Example of pdb record: */
00168         /* Position:          1         2         3         4         5         6 */
00169         /* Position: 123456789012345678901234567890123456789012345678901234567890 */
00170         /* Record:   ATOM    145  N   VAL A  25      32.433  16.336  57.540  1.00 */
00171         
00172         /* Position: 6         7         8 */
00173         /* Position: 012345678901234567890 */
00174         /* Record:   0 11.92           N   */
00175         
00176         int status ;
00177         char id_buf[7],
00178                  res_id_buf[6];
00179 /*               charge_buf[3] ; */
00180         
00181         if (id < 100000) sprintf(id_buf, "%5d", id);
00182         else sprintf(id_buf, "%05x", id);
00183 
00184         if (res_id < 10000) sprintf(res_id_buf, "%4d", res_id);
00185         else if (res_id < 65536) sprintf(res_id_buf, "%04x", res_id);
00186         
00187         alt_loc = (alt_loc == '\0')? ' ': alt_loc;
00188         
00189 /*      if(charge == -1) { 
00190                 charge_buf[0] = charge_buf[1] = ' ' ;
00191                 charge_buf[2] = '\0' ;
00192         }
00193         else sprintf(charge_buf, "%2d", charge) ;
00194 */      
00195         status = fprintf(f, "%-6s%5s %4s%c%-4s%c%4s%c   %8.3f%8.3f%8.3f  %6.2f   %6.2f\n",
00196                                                  rec_name, id_buf, atom_name, alt_loc, res_name, chain[0], 
00197                                                  res_id_buf, insert, x, y, z, charge,radius) ;
00198 }


Generated on Mon Jun 7 16:44:23 2010 for fpocket by  doxygen 1.5.6