From: hackbard Date: Mon, 17 Aug 2009 15:16:20 +0000 (+0200) Subject: added offset feature X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f0e4c6422ec1aff0cf86597fef919335bba75c1b;p=physik%2Fposic.git added offset feature --- diff --git a/mdrun.c b/mdrun.c index f5acaa1..062224b 100644 --- a/mdrun.c +++ b/mdrun.c @@ -393,6 +393,14 @@ int mdrun_parse_config(t_mdrun *mdrun) { continue; } + // offset + if(word[i][0]=='o') { + fp.o_params.o.x=atof(word[++i])*fp.lc; + fp.o_params.o.y=atof(word[++i])*fp.lc; + fp.o_params.o.z=atof(word[++i])*fp.lc; + fp.o_params.use=1; + continue; + } i+=1; } add_stage(mdrun,STAGE_FILL,&fp); @@ -1317,7 +1325,8 @@ int mdrun_hook(void *ptr1,void *ptr2) { fp->lx,fp->ly,fp->lz, &o, &(fp->p_params), - &(fp->d_params)); + &(fp->d_params), + &(fp->o_params)); o.x+=0.25*fp->lc; o.y=o.x; o.z=o.x; @@ -1328,7 +1337,8 @@ int mdrun_hook(void *ptr1,void *ptr2) { fp->lx,fp->ly,fp->lz, &o, &(fp->p_params), - &(fp->d_params)); + &(fp->d_params), + &(fp->o_params)); break; default: @@ -1341,7 +1351,8 @@ int mdrun_hook(void *ptr1,void *ptr2) { fp->lx,fp->ly,fp->lz, NULL, &(fp->p_params), - &(fp->d_params)); + &(fp->d_params), + &(fp->o_params)); break; } moldyn_bc_check(moldyn); diff --git a/moldyn.c b/moldyn.c index 056047c..15dcede 100644 --- a/moldyn.c +++ b/moldyn.c @@ -520,7 +520,8 @@ int moldyn_log_shutdown(t_moldyn *moldyn) { int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element, u8 attr,u8 brand,int a,int b,int c,t_3dvec *origin, - t_part_params *p_params,t_defect_params *d_params) { + t_part_params *p_params,t_defect_params *d_params, + t_offset_params *o_params) { int new,count; int ret; @@ -592,6 +593,8 @@ int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element, switch(type) { case CUBIC: + if(o_params->use) + v3_add(&orig,&orig,&(o_params->o)); set_nn_dist(moldyn,lc); ret=cubic_init(a,b,c,lc,atom,&orig,p_params,d_params); strcpy(name,"cubic"); @@ -599,6 +602,8 @@ int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element, case FCC: if(!origin) v3_scale(&orig,&orig,0.5); + if(o_params->use) + v3_add(&orig,&orig,&(o_params->o)); set_nn_dist(moldyn,0.5*sqrt(2.0)*lc); ret=fcc_init(a,b,c,lc,atom,&orig,p_params,d_params); strcpy(name,"fcc"); @@ -606,6 +611,8 @@ int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element, case DIAMOND: if(!origin) v3_scale(&orig,&orig,0.25); + if(o_params->use) + v3_add(&orig,&orig,&(o_params->o)); set_nn_dist(moldyn,0.25*sqrt(3.0)*lc); ret=diamond_init(a,b,c,lc,atom,&orig,p_params,d_params); strcpy(name,"diamond"); @@ -806,8 +813,6 @@ int del_atom(t_moldyn *moldyn,int tag) { case DEFECT_STYPE_DB_Z:\ d_o.z=d_params->od;\ d_d.z=d_params->dd;\ -d_d.x=0.9;\ -d_d.y=0.9;\ break;\ case DEFECT_STYPE_DB_R:\ break;\ diff --git a/moldyn.h b/moldyn.h index 6310416..bdb3758 100644 --- a/moldyn.h +++ b/moldyn.h @@ -444,7 +444,8 @@ int moldyn_log_shutdown(t_moldyn *moldyn); int create_lattice(t_moldyn *moldyn,u8 type,double lc,int element, u8 attr,u8 brand,int a,int b,int c,t_3dvec *origin, - t_part_params *p_params,t_defect_params *d_params); + t_part_params *p_params,t_defect_params *d_params, + t_offset_params *o_params); int add_atom(t_moldyn *moldyn,int element,u8 brand,u8 attr, t_3dvec *r,t_3dvec *v); int del_atom(t_moldyn *moldyn,int tag);