projects
/
physik
/
posic.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
init testing
[physik/posic.git]
/
init
/
init.c
diff --git
a/init/init.c
b/init/init.c
index
1f62963
..
07b4dc6
100644
(file)
--- a/
init/init.c
+++ b/
init/init.c
@@
-9,13
+9,18
@@
#include "../moldyn.h"
/* fcc lattice init */
#include "../moldyn.h"
/* fcc lattice init */
-int fcc_init(
t_3dvec *dim
,double lc,t_atom *atom,t_3dvec *origin) {
+int fcc_init(
int a,int b,int c
,double lc,t_atom *atom,t_3dvec *origin) {
int count;
int i,j;
t_3dvec o,r,n;
t_3dvec basis[3];
double help[3];
int count;
int i,j;
t_3dvec o,r,n;
t_3dvec basis[3];
double help[3];
+ double x,y,z;
+
+ x=a*lc;
+ y=b*lc;
+ z=c*lc;
if(origin) v3_copy(&o,origin);
else v3_zero(&o);
if(origin) v3_copy(&o,origin);
else v3_zero(&o);
@@
-34,14
+39,16
@@
int fcc_init(t_3dvec *dim,double lc,t_atom *atom,t_3dvec *origin) {
count=0;
/* fill up the room */
count=0;
/* fill up the room */
- while(r.x<dim->x) {
- while(r.y<dim->y) {
- while(r.z<dim->z) {
+ while(r.x<x) {
+ r.y=.0;
+ while(r.y<y) {
+ r.z=.0;
+ while(r.z<z) {
v3_copy(&(atom[count].r),&r);
count+=1;
for(i=0;i<3;i++) {
v3_add(&n,&r,&basis[i]);
v3_copy(&(atom[count].r),&r);
count+=1;
for(i=0;i<3;i++) {
v3_add(&n,&r,&basis[i]);
- if((n.x<
dim->x+o.x)&&(n.y<dim->y+o.y)&&(n.z<dim->
z+o.z)) {
+ if((n.x<
x+o.x)&&(n.y<y+o.y)&&(n.z<
z+o.z)) {
v3_copy(&(atom[count].r),&n);
count+=1;
}
v3_copy(&(atom[count].r),&n);
count+=1;
}
@@
-54,9
+61,9
@@
int fcc_init(t_3dvec *dim,double lc,t_atom *atom,t_3dvec *origin) {
}
/* coordinate transformation */
}
/* coordinate transformation */
- help[0]=
dim->
x/2.0;
- help[1]=
dim->
y/2.0;
- help[2]=
dim->
z/2.0;
+ help[0]=x/2.0;
+ help[1]=y/2.0;
+ help[2]=z/2.0;
v3_set(&n,help);
for(i=0;i<count;i++)
v3_sub(&(atom[i].r),&(atom[i].r),&n);
v3_set(&n,help);
for(i=0;i<count;i++)
v3_sub(&(atom[i].r),&(atom[i].r),&n);
@@
-64,12
+71,12
@@
int fcc_init(t_3dvec *dim,double lc,t_atom *atom,t_3dvec *origin) {
return count;
}
return count;
}
-int diamond_init(
t_3dvec *dim
,double lc,t_atom *atom,t_3dvec *origin) {
+int diamond_init(
int a,int b,int c
,double lc,t_atom *atom,t_3dvec *origin) {
int count;
t_3dvec o;
int count;
t_3dvec o;
- count=fcc_init(
dim
,lc,atom,origin);
+ count=fcc_init(
a,b,c
,lc,atom,origin);
o.x=0.25*lc;
o.y=0.25*lc;
o.x=0.25*lc;
o.y=0.25*lc;
@@
-77,8
+84,7
@@
int diamond_init(t_3dvec *dim,double lc,t_atom *atom,t_3dvec *origin) {
if(origin) v3_add(&o,&o,origin);
if(origin) v3_add(&o,&o,origin);
- count+=fcc_init(dim,lc,&atom[count],&o);
-
+ count+=fcc_init(a,b,c,lc,&atom[count],&o);
return count;
}
return count;
}