Main Page | Class List | Directories | File List | Class Members | File Members

dcd.h

Go to the documentation of this file.
00001 /*
00002  * Copyright (C) 2004-2005 by David J. Hardy.  All rights reserved.
00003  */
00004 
00028 #ifndef MDIO_DCD_H
00029 #define MDIO_DCD_H
00030 
00031 #include "mdio/file.h"
00032 #include "mdapi/mdtypes.h"
00033 
00034 #ifdef __cplusplus
00035 extern "C" {
00036 #endif
00037 
00041   enum {
00042     MDIO_DCD_UNITCELL  = 0x001, 
00043     MDIO_DCD_FIXEDCELL = 0x002  
00044   };
00045 
00048   typedef struct mdio_DcdHeader_t {
00049     double timestep;    
00050     int32 natoms;       
00051     int32 firststep;    
00052     int32 framestepcnt; 
00053     int32 cellstatus;   
00054   } mdio_DcdHeader;
00055 
00058   typedef struct mdio_DcdCell_t {
00059     MD_Dvec vec1;  
00060     MD_Dvec vec2;  
00061     MD_Dvec vec3;  
00062   } mdio_DcdCell;
00063 
00068   typedef struct mdio_Dcd_t {
00069     mdio_File file;
00070     struct {
00071       int32 nbhead_begin;   /* = 84 (bytes for "head" section) */
00072       char title[4];        /* = "CORD" */
00073       int32 numframes;      /*  number of frames, updated as we write */
00074       int32 firststep;      /*  first step number */
00075       int32 framestepcnt;   /*  number of steps per frame */
00076       int32 numsteps;       /*  total number sim steps + first step, updated */
00077       int32 zero5[5];       /* = 0 */
00078       float timestep;       /*  time step */
00079       int32 iscell;         /* = 1 if unitcell info, = 0 if not */
00080       int32 zero8[8];       /* = 0 */
00081       int32 charmmversion;  /* = 24 (CHARMM 24 format DCD file) */
00082       int32 nbhead_end;     /* = 84 (bytes for "head" section) */
00083 
00084       int32 nbtitle_begin;  /* = 164 (bytes for "title" section) */
00085       int32 numtitle;       /* = 2 (i.e. two 80-char title strings) */
00086       char title_str[80];   /*  remarks title string */
00087       char create_str[80];  /*  remarks create time string */
00088       int32 nbtitle_end;    /* = 164 (bytes for "title" section) */
00089 
00090       int32 nbnatoms_begin; /* = 4 (bytes for "natoms" section) */
00091       int32 natoms;         /*  number of atoms */
00092       int32 nbnatoms_end;   /* = 4 (bytes for "natoms" section) */
00093     } header;
00094     struct {
00095       int32 dummy1;         /*  (padding to 8-byte word alignment) */
00096       int32 nbcell_begin;   /* = 48 (bytes for "unitcell" section) */
00097       double unitcell[6];   /*  describes periodic cell */
00098       int32 nbcell_end;     /* = 48 (bytes for "unitcell" section) */
00099       int32 dummy2;         /*  (padding to 8-byte word alignment) */
00100     } cell;
00101     int32 *coordbuf;        /*  buffer for coordinates with byte num info */
00102     float *x;               /*  points to x-coordinates in coordbuf */
00103     float *y;               /*  points to y-coordinates in coordbuf */
00104     float *z;               /*  points to z-coordinates in coordbuf */
00105     int32 coordbuflen;      /* = 3*(N + 2) elements */
00106     int32 nbcell;           /* = 56 (bytes written for "unitcell") */
00107     int32 stepnum;
00108     int32 status;
00109   } mdio_Dcd;
00110 
00111 
00112 /* constructor and destructor */
00113 
00120   mdio_Dcd *mdio_createDcd(void);
00121 
00122 
00127   void mdio_destroyDcd(mdio_Dcd *);
00128 
00129 
00130 /* write DCD file */
00131 
00140   int mdio_writeBeginDcd(mdio_Dcd *, const char *name);
00141 
00142 
00152   int mdio_writeHeaderDcd(mdio_Dcd *, const mdio_DcdHeader *header);
00153 
00154 
00170   int mdio_writeFrameDcd(mdio_Dcd *, const MD_Dvec *coord,
00171       const mdio_DcdCell *cell, int32 stepnum);
00172 
00173 
00181   int mdio_writeEndDcd(mdio_Dcd *);
00182 
00183 
00184 /* constructor and destructor for pre-allocated mdio_Dcd object */
00185 
00191   int mdio_initializeDcd(mdio_Dcd *);
00192 
00193 
00199   void mdio_cleanupDcd(mdio_Dcd *);
00200 
00201 #ifdef __cplusplus
00202 }
00203 #endif
00204 
00205 #endif /* MDIO_DCD_H */

Generated on Mon Sep 26 10:55:18 2005 for MDX by  doxygen 1.4.4