20 int main(
int argc,
char *argv[]) {
24 int i, j, isbig, itmp;
32 fprintf(stderr,
"This program fixes X-PLOR DCD files to work with CHARMM.\n");
33 fprintf(stderr,
"Usage: %s <filename>\n",argv[0]);
37 if ( ( fd = open(argv[1], O_RDWR) ) < 0 ) {
38 fprintf(stderr,
"Can't open %s for updating.\n",argv[1]);
42 if ( fstat(fd,&statbuf) < 0 ) {
43 fprintf(stderr,
"Can't stat %s.\n",argv[1]);
50 fprintf(stderr,
"%s is not in DCD format.\n",argv[1]);
55 fprintf(stderr,
"%s is not in DCD format.\n",argv[1]);
59 if ( ( d = mmap(0,n,PROT_READ|PROT_WRITE,
MAP_FILE|MAP_SHARED,fd,0) )
61 fprintf(stderr,
"Can't mmap %s.\n",argv[1]);
65 #define SKIPFOUR {d+=4;n-=4;}
66 #define SKIP(X) {d+=(X);n-=(X);}
67 #define READINT(X) { X=0; if (isbig) { for(j=0;j<4;++j,X<<8) X+=d[j]; } \
68 else { for(j=3;j>=0;--j,X<<8) X+=d[j]; } }
74 for(j=0;j<8;++j) ((
char*)(&delta))[j] = d[j];
76 for(j=0;j<4;++j) d[j] = ((
char*)(&delta4))[j];
77 for(j=4;j<8;++j) d[j] = 0;
int main(int argc, char *argv[])