/* from Kevin Cowtan */ /* Taken from xtalview */ #include #include #include #define ROUND(a) ((a)>0 ? (int)(a+0.5) : (int)(a-0.5)) typedef struct { int nx,ny,nz; float a,b,c,alpha,beta,gamma; double scale; /* scale on density */ int nsym; } MAPHEADER; void main(argc, argv) int argc; char **argv; { MAPHEADER mh; FILE *file_ip,*file_op; float *map,f; int x,y,z; mh.scale=100.0; mh.nsym=1; printf("enter grid\n"); scanf("%i %i %i",&(mh.nx),&(mh.ny),&(mh.nz)); printf("enter cell\n"); scanf("%f %f %f %f %f %f", &(mh.a),&(mh.b),&(mh.c),&(mh.alpha),&(mh.beta),&(mh.gamma)); printf("%i %i %i\n",mh.nx,mh.ny,mh.nz); printf("%f %f %f\n",mh.a,mh.b,mh.c); printf("%f %f %f\n",mh.alpha,mh.beta,mh.gamma); map=malloc(mh.nx*mh.ny*mh.nz*sizeof(float)); file_ip=fopen(argv[1],"r"); for (x=0;xscale; nsym = mh->nsym; nx = mh->nx; ny = mh->ny; nz = mh->nz; para[0]=mh->a; para[1]=mh->b; para[2]=mh->c; para[3]=mh->alpha; para[4]=mh->beta; para[5]=mh->gamma; for(i=0;i<6;i++)mnx[i]=0; if( norn < 0 || norn > 2){ norn = 0; } if(ncent <0 || ncent > 1)ncent = 0; if ( norn == 0 ){ nrow = nx; ncol = nz; nplane = ny; } if ( norn == 1 ){ nrow = ny; ncol = nz; nplane = nx; } if ( norn == 2 ){ nrow = nx; ncol = ny; nplane = nz; } header = (20 + 1 + 6 + 4*1)*4; fwrite(&header,sint,1,fp); fwrite(itle, 1, 80,fp); fwrite(&noset, sint,1,fp); fwrite(para,sint, 6, fp); fwrite(&nsym,sint,1,fp); fwrite(&ncent,sint,1,fp); fwrite(&latt,sint,1,fp); fwrite(&npic,sint,1,fp); fwrite(&header,sint,1,fp); /* there are nsym records with 9 numbers next */ header = 9 * 4; for( i = 0; i