2 * init.c - create initial conditions
4 * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
8 #include "../math/math.h"
11 /* fcc lattice init */
12 int fcc_init(int a,int b,int c,double lc,t_atom *atom,t_3dvec *origin) {
25 if(origin) v3_copy(&o,origin);
28 /* construct the basis */
31 if(i!=j) help[j]=0.5*lc;
34 v3_set(&basis[i],help);
41 /* fill up the room */
47 v3_copy(&(atom[count].r),&r);
50 v3_add(&n,&r,&basis[i]);
51 if((n.x<x+o.x)&&(n.y<y+o.y)&&(n.z<z+o.z)) {
52 v3_copy(&(atom[count].r),&n);
63 /* coordinate transformation */
69 v3_sub(&(atom[i].r),&(atom[i].r),&n);
74 int diamond_init(int a,int b,int c,double lc,t_atom *atom,t_3dvec *origin) {
79 count=fcc_init(a,b,c,lc,atom,origin);
85 if(origin) v3_add(&o,&o,origin);
87 count+=fcc_init(a,b,c,lc,&atom[count],&o);