-
Notifications
You must be signed in to change notification settings - Fork 0
/
dcd.h
59 lines (51 loc) · 1.8 KB
/
dcd.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#ifndef M_PI_2
#define M_PI_2 1.57079632679489661922
#endif
#define PI 3.1415926
#define RECSCALE32BIT 1
#define RECSCALE64BIT 2
#define RECSCALEMAX 2
typedef struct {
fio_fd fd;
int natoms;
int nsets;
int setsread;
int istart;
int nsavc;
double delta;
int nfixed;
float *x, *y, *z;
int *freeind;
float *fixedcoords;
int reverse;
int charmm;
int first;
int with_unitcell;
} dcdhandle;
/* Define error codes that may be returned by the DCD routines */
#define DCD_SUCCESS 0 /* No problems */
#define DCD_EOF -1 /* Normal EOF */
#define DCD_DNE -2 /* DCD file does not exist */
#define DCD_OPENFAILED -3 /* Open of DCD file failed */
#define DCD_BADREAD -4 /* read call on DCD file failed */
#define DCD_BADEOF -5 /* premature EOF found in DCD file */
#define DCD_BADFORMAT -6 /* format of DCD file is wrong */
#define DCD_FILEEXISTS -7 /* output file already exists */
#define DCD_BADMALLOC -8 /* malloc failed */
#define DCD_BADWRITE -9 /* write call on DCD file failed */
/* Define feature flags for this DCD file */
#define DCD_IS_XPLOR 0x00
#define DCD_IS_CHARMM 0x01
#define DCD_HAS_4DIMS 0x02
#define DCD_HAS_EXTRA_BLOCK 0x04
#define DCD_HAS_64BIT_REC 0x08
/* defines used by write_dcdstep */
#define NFILE_POS 8L
#define NSTEP_POS 20L
/* READ Macro to make porting easier */
#define READ(fd, buf, size) fio_fread(((void *) buf), (size), 1, (fd))
/* WRITE Macro to make porting easier */
#define WRITE(fd, buf, size) fio_fwrite(((void *) buf), (size), 1, (fd))
/* XXX This is broken - fread never returns -1 */
#define CHECK_FREAD(X, msg) if (X==-1) { return(DCD_BADREAD); }
#define CHECK_FEOF(X, msg) if (X==0) { return(DCD_BADEOF); }