}
moldyn->atom=ptr;
atom=&(moldyn->atom[count]);
-
- v3_zero(&origin);
+
+ /* no atoms on the boundaries (only reason: it looks better!) */
+ origin.x=0.5*lc;
+ origin.y=0.5*lc;
+ origin.z=0.5*lc;
switch(type) {
case CUBIC:
set_nn_dist(moldyn,lc);
- origin.x=0.5*lc;
- origin.y=0.5*lc;
- origin.z=0.5*lc;
ret=cubic_init(a,b,c,lc,atom,&origin);
break;
case FCC:
+ v3_scale(&origin,&origin,0.5);
set_nn_dist(moldyn,0.5*sqrt(2.0)*lc);
- ret=fcc_init(a,b,c,lc,atom,NULL);
+ ret=fcc_init(a,b,c,lc,atom,&origin);
break;
case DIAMOND:
+ v3_scale(&origin,&origin,0.25);
set_nn_dist(moldyn,0.25*sqrt(3.0)*lc);
ret=diamond_init(a,b,c,lc,atom,&origin);
break;
int fcc_init(int a,int b,int c,double lc,t_atom *atom,t_3dvec *origin) {
int count;
- int i,j;
+ int i,j,k,l;
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);
+ count=0;
+ if(origin)
+ v3_copy(&o,origin);
+ else
+ v3_zero(&o);
/* construct the basis */
- for(i=0;i<3;i++) {
- for(j=0;j<3;j++) {
- if(i!=j) help[j]=0.5*lc;
- else help[j]=.0;
- }
- v3_set(&basis[i],help);
- }
+ memset(basis,0,3*sizeof(t_3dvec));
+ basis[0].x=0.5*lc;
+ basis[0].y=0.5*lc;
+ basis[1].x=0.5*lc;
+ basis[1].z=0.5*lc;
+ basis[2].y=0.5*lc;
+ basis[2].z=0.5*lc;
- v3_zero(&r);
- count=0;
-
/* fill up the room */
r.x=o.x;
- while(r.x<x) {
+ for(i=0;i<a;i++) {
r.y=o.y;
- while(r.y<y) {
+ for(j=0;j<b;j++) {
r.z=o.z;
- while(r.z<z) {
+ for(k=0;k<c;k++) {
+ /* first atom */
v3_copy(&(atom[count].r),&r);
- atom[count].element=1;
count+=1;
- for(i=0;i<3;i++) {
- v3_add(&n,&r,&basis[i]);
- if((n.x<x+o.x)&&
- (n.y<y+o.y)&&
- (n.z<z+o.z)) {
- v3_copy(&(atom[count].r),&n);
- count+=1;
- }
+ r.z+=lc;
+ /* the three face centered atoms */
+ for(l=0;l<3;l++) {
+ v3_add(&n,&r,&basis[l]);
+ v3_copy(&(atom[count].r),&n);
+ count+=1;
}
- r.z+=lc;
}
r.y+=lc;
}
r.x+=lc;
}
-
+
/* coordinate transformation */
- 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);
-
+ for(i=0;i<count;i++) {
+ atom[i].r.x-=(a*lc)/2.0;
+ atom[i].r.y-=(b*lc)/2.0;
+ atom[i].r.z-=(c*lc)/2.0;
+ }
+
return count;
}
v3_scale(&force,&force,-1.0); /* f = - grad E */
v3_add(&(ai->f),&(ai->f),&force);
virial_calc(ai,&force,&distance);
+if(force.x*distance.x<=0) printf("virial xx: %.15f -> %f %f %f\n",force.x*distance.x,distance.x,distance.y,distance.z);
virial_calc(aj,&force,&distance); /* f and d signe switched */
}
#define M_SI 28.08553 /* amu */
//#define LJ_SIGMA_SI ((0.25*sqrt(3.0)*LC_SI)/1.122462) /* A */
-#define LJ_SIGMA_SI (LC_SI/1.122462) /* A */
+//#define LJ_SIGMA_SI (LC_SI/1.122462) /* A */
+#define LJ_SIGMA_SI (0.5*sqrt(2.0)*LC_SI/1.122462) /* A */
#define LJ_EPSILON_SI (2.1678*EV) /* NA */
#define TM_R_SI (2.7e-10*METER) /* A */
set title 'Energy per atom vs. time' \n\
set xlabel 'Time [fs]' \n\
set ylabel 'Energy per atom [eV]' \n\
-set terminal postscript eps enhanced color dashed lw 1 'Helvetica' 14 \n\
+set terminal postscript eps enhanced color solid lw 1 'Helvetica' 14 \n\
set output 'energy.eps' \n\
plot \"energy\" using 1:2 title 'Kinetic energy' with lines , \"energy\" using 1:3 title 'Potential energy' with lines , \"energy\" using 1:4 title 'Total energy' with lines\
";
set_pbc(&md,TRUE,TRUE,TRUE);
/* create the lattice / place atoms */
- create_lattice(&md,CUBIC,LC_SI,SI,M_SI,
- //create_lattice(&md,FCC,LC_SI,SI,M_SI,
+ //create_lattice(&md,CUBIC,LC_SI,SI,M_SI,
+ create_lattice(&md,FCC,LC_SI,SI,M_SI,
//create_lattice(&md,DIAMOND,LC_SI,SI,M_SI,
// ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP|ATOM_ATTR_HB,
ATOM_ATTR_2BP|ATOM_ATTR_HB,
set_pressure(&md,ATM);
/* set p/t scaling */
- set_pt_scale(&md,P_SCALE_BERENDSEN,0.001,
- T_SCALE_BERENDSEN,100.0);
+ //set_pt_scale(&md,P_SCALE_BERENDSEN,0.001,
+ // T_SCALE_BERENDSEN,100.0);
//set_pt_scale(&md,0,0,T_SCALE_DIRECT,1.0);
//set_pt_scale(&md,P_SCALE_BERENDSEN,0.001,0,0);
thermal_init(&md,TRUE);
/* create the simulation schedule */
- moldyn_add_schedule(&md,100001,1.0);
+ moldyn_add_schedule(&md,101,1.0);
//moldyn_add_schedule(&md,501,1.0);
//moldyn_add_schedule(&md,501,1.0);
moldyn_set_log_dir(&md,argv[1]);
moldyn_set_report(&md,"Frank Zirkelbach","Test 1");
moldyn_set_log(&md,LOG_TOTAL_ENERGY,1);
- moldyn_set_log(&md,VISUAL_STEP,1000);
+ moldyn_set_log(&md,VISUAL_STEP,1);
moldyn_set_log(&md,CREATE_REPORT,0);
/*
/* script file update */
dprintf(v->fd,"load xyz %s\n",file);
- dprintf(v->fd,"spacefill\n");
- //dprintf(v->fd,"spacefill 100\n");
+ dprintf(v->fd,"spacefill 200\n");
dprintf(v->fd,"rotate x 100\n");
dprintf(v->fd,"rotate y 10\n");
dprintf(v->fd,"set ambient 20\n");