2 * create lattice (for usage in vasp POSCAR file)
4 * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
12 #include "../math/math.h"
17 * there is fcc/diamond/zincblende only!
21 * 0: <0.5 0.5 0> <0 0.5 0.5> <0.5 0 0.5> contains 2 atoms
22 * 1: <0.5 -0.5 0> <0.5 0.5 0> <0 0 1> contains 4 atoms
23 * 2: <1 0 0> <0 1 0> <0 0 1> contains 8 atoms
29 * 2nd fcc: <0.25 0.25 0.25>
30 * -> diag: <0.25 0.25 0.25>
33 * 1st fcc: <0 0 0> <0.5 0.5 0.5>
34 * 2nd fcc: <0.5 0 0.25> <1.0 or 0.0 0.5 0.75>
38 * 1st fcc: <0 0 0> <0.5 0.5 0> <0.5 0 0.5> <0 0.5 0.5>
39 * 2nd fcc: <0.25 0.25 0.25> <0.75 0.75 0.25> <0.75 0.25 0.75>
41 * -> diag: <0.25 0.25 0.25>
45 int main(int argc,char **argv) {
47 int i,j,k,l,cnt,estimated;
56 printf("usage: %s type fcc/dia lx ly lz\n",argv[0]);
57 printf(" basis types: 0, 1, 2 (see code)\n");
58 printf(" fcc/dia: 0=fcc, 1=dia\n");
79 memset(basis,0,3*sizeof(t_3dvec));
80 memset(o,0,3*sizeof(t_3dvec));
117 if(fccdia=='1') estimated*=2;
118 if(type=='1') estimated*=2;
119 if(type=='2') estimated*=4;
122 // print POSCAR 'header'
124 printf("cubic diamond\n");
127 v3_scale(&h,&basis[0],x);
128 printf(" %.5f %.5f %.5f\n",h.x,h.y,h.z);
129 v3_scale(&h,&basis[1],y);
130 printf(" %.5f %.5f %.5f\n",h.x,h.y,h.z);
131 v3_scale(&h,&basis[2],z);
132 printf(" %.5f %.5f %.5f\n",h.x,h.y,h.z);
134 printf(" %d\n",estimated);
135 printf("selective dynamics\n");
138 // now print the coordinates
144 // first atom (all types)
149 printf(" %.5f %.5f %.5f T T T\n",r.x/x,r.y/y,r.z/z);
152 // second atom (type 1)
154 v3_add(&h,&r,&(o[0]));
155 printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z);
159 // face centered atoms (type 2)
162 v3_add(&h,&r,&(o[l]));
163 printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z);
172 // second fcc lattice
179 // first atom (all types)
187 printf(" %.5f %.5f %.5f T T T\n",r.x/x,r.y/y,r.z/z);
190 // second atom (type 1)
192 v3_add(&h,&r,&(o[0]));
193 printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z);
197 // face centered atoms (type 2)
200 v3_add(&h,&r,&(o[l]));
201 printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z);
215 printf("\nWARNING! counted %d ions and estimated %d ions\n\n",