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) {
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));
120 // first atom (all types)
121 v3_scale(&r,&basis[0],i);
122 v3_scale(&h,&basis[1],j);
124 v3_scale(&h,&basis[2],k);
127 printf(" %.5f %.5f %.5f T T T\n",r.x/x,r.y/y,r.z/z);
130 // second atom (type 1)
132 v3_add(&h,&r,&(o[0]));
133 printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z);
137 // face centered atoms (type 2)
140 v3_add(&h,&r,&(o[l]));
141 printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z);
150 // second fcc lattice
157 // first atom (all types)
158 v3_scale(&r,&basis[0],i);
159 v3_scale(&h,&basis[1],j);
161 v3_scale(&h,&basis[2],k);
167 printf(" %.5f %.5f %.5f T T T\n",r.x/x,r.y/y,r.z/z);
170 // second atom (type 1)
172 v3_add(&h,&r,&(o[0]));
173 printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z);
177 // face centered atoms (type 2)
180 v3_add(&h,&r,&(o[l]));
181 printf(" %.5f %.5f %.5f T T T\n",h.x/x,h.y/y,h.z/z);
194 printf("\ntotal: %d ions\n\n",cnt);