dcdlib.h

Go to the documentation of this file.
00001 
00007 /*
00008    dcdlib contains C routines used for reading and writing binary
00009    dcd files.  The format of these files is from binary FORTRAN output,
00010    so its pretty ugly.  If you're squimish, don't look!!
00011 */
00012 
00013 #ifndef DCDLIB_H
00014 #define DCDLIB_H
00015 
00016 #include "largefiles.h"  // must be first!
00017 #include "common.h" // for int32 definition
00018 #include "Vector.h"
00019 #include <stdio.h>
00020 #include <string.h>
00021 #ifndef _NO_MALLOC_H
00022 #include <malloc.h>
00023 #endif
00024 #ifndef WIN32
00025 #include <unistd.h>
00026 #endif
00027 #include <fcntl.h>
00028 #include <sys/stat.h>
00029 #include <sys/types.h>
00030 #include <errno.h>
00031 #ifndef WIN32
00032 #include <pwd.h>
00033 #endif
00034 #include <time.h>
00035 #ifdef WIN32
00036 #include <io.h>
00037 #endif
00038 
00039 #ifdef WIN32
00040 #define OFF_T __int64
00041 #else
00042 #define OFF_T off_t
00043 #endif
00044 
00045 
00046 /*  DEFINE ERROR CODES THAT MAY BE RETURNED BY DCD ROUTINES             */
00047 #define DCD_DNE         -2      /*  DCD file does not exist             */
00048 #define DCD_OPENFAILED  -3      /*  Open of DCD file failed             */
00049 #define DCD_BADREAD     -4      /*  read call on DCD file failed        */
00050 #define DCD_BADEOF      -5      /*  premature EOF found in DCD file     */
00051 #define DCD_BADFORMAT   -6      /*  format of DCD file is wrong         */
00052 #define DCD_FILEEXISTS  -7      /*  output file already exists          */
00053 #define DCD_BADMALLOC   -8      /*  malloc failed                       */
00054 
00055 /*                      FUNCTION ALLUSIONS                              */
00056 int open_dcd_read(char *);      /*  Open a DCD file for reading         */
00057 int read_dcdheader(int, int*, int*, int*, int*, double*, int*, int**);  
00058                                 /*  Read the DCD header                 */
00059 int read_dcdstep(int, int, float*, float*, float*, int, int, int*);     
00060                                 /*  Read a timestep's values            */
00061 int open_dcd_write(const char *);     /*  Open a DCD file for writing           */
00062 
00063 int write_dcdstep(int, int, float *, float *, float *, double *unitcell);
00064                                 /*  Write out a timesteps values        */
00065 int write_dcdheader(int, const char*, int, int, int, int, int, double, int);    
00066                                 /*  Write a dcd header                  */
00067 int get_dcdheader_size(); 
00068                                 /* Get the total size of the header */
00069 void close_dcd_read(int, int, int *);
00070                                 /*  Close a dcd file open for reading   */
00071 void close_dcd_write(int);      /*  Close a dcd file open for writing   */
00072 
00073 int open_dcd_write_par_slave(char *dcdname);
00074 /* Slaves open existing file created by master */
00075 int write_dcdstep_par_cell(int fd, double *cell);
00076 int write_dcdstep_par_XYZUnits(int fd, int N);
00077      /* Master writes unit cell and natom info */
00078 int update_dcdstep_par_header(int fd); 
00079      /* Master updates header */
00080 
00081 /* Write out a timesteps values partially in parallel for part [parL, parU] */
00082 int write_dcdstep_par_slave(int fd, int parL, int parU, int N, float *X, float *Y, float *Z);
00083     
00084 /* wrapper for seeking the dcd file */
00085 OFF_T NAMD_seek(int file, OFF_T offset, int whence);
00086 
00087 #endif /* ! DCDLIB_H */
00088 

Generated on Fri Sep 22 01:17:12 2017 for NAMD by  doxygen 1.4.7