/* Interpolates 2 POSCAR files for elastic band method. */ /* Edit the number below to the number of different atom types present. */ #define ATOMTYPES 4 /* Program assumes 2 files are concatinated, with an aditional line at the beginning of the file. This line contains the number of subdirectories to be written to, followed by a 'T' or an 'F', depending on whether or not the center of mass is shifted, followed by another 'T' or 'F' depending on whether or not the unit cell axes are interpolated. If the word 'Selective' is chosen, then 'dynamics' must also follow. The program creates the required subdirectories automatically, and also warns if coordinate errors are perhaps present due to the wrap around periodicity in the unit cell. To run, type the program name followed by the concatinated input file. Scott R. Shannon, 14/10/98 */ #include #include #include #include #define CUTOFF 0.5 #define MAXATOM 200 main(int argc, char *argv[]) { int i,j,k,dum,total,select=0,reps,numatoms[ATOMTYPES]; FILE *indat,*outdat,*ifp; double latc,uaxis[2][3][3],coords[2][MAXATOM][3]; double increments[MAXATOM][3]={0.0},axisinc[3][3]={0.0}; double cm[2][3]={0.0},cmshift[3]={0.0}; char string[50],doshift[50],interuaxis[50],command[50]; char title[50],cotype[50],filename[50]; char selstring[MAXATOM][3][5]; if ( (indat = fopen(argv[1],"r"))==NULL) { printf("\nIncorrect data file name\n\n"); exit(); } fscanf(indat,"%d %s %s",&reps,doshift,interuaxis); for (i=0;i<2;++i) { fscanf(indat,"%s",title); /* title */ fscanf(indat,"%lf",&latc); /* lattice constants */ for (j=0;j<3;++j) for (k=0;k<3;++k) fscanf(indat,"%lf",&uaxis[i][j][k]); /* unit vectors */ total = 0; for (j=0;j CUTOFF){ printf("\n\nWarning! Possible error due to wrap around in unit cell\n"); printf("\nCheck atom %d\n\n",i+1); } if (strcmp(doshift,"T")==0) { /* shift center of mass */ for (i=0;i<3;++i) cmshift[i] = cm[0][i]/total - cm[1][i]/total; printf("\nCenter of mass for second cell will be shifted by: %e %e %e\n\n", cmshift[0],cmshift[1],cmshift[2]); for (i=0;i<3;++i) cmshift[i] = cmshift[i]/(reps-1); } if (strcmp(interuaxis,"T")==0) { /* increment uc axes */ for (i=0;i<3;++i) for (j=0;j<3;++j) axisinc[i][j] = (uaxis[1][i][j] - uaxis[0][i][j])/(reps-1); } for (i=0;i