]> hackdaworld.org Git - physik/posic.git/commitdiff
added offset feature
authorhackbard <hackbard@sage.physik.uni-augsburg.de>
Mon, 17 Aug 2009 15:16:20 +0000 (17:16 +0200)
committerhackbard <hackbard@sage.physik.uni-augsburg.de>
Mon, 17 Aug 2009 15:16:20 +0000 (17:16 +0200)
mdrun.c
moldyn.c
moldyn.h

diff --git a/mdrun.c b/mdrun.c
index f5acaa1bdf978b41d55978842e91dbde2bc1f90c..062224b99f65ff80a9b5f97c338ed184e9524538 100644 (file)
--- 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);
index 056047cad6eee1dd499bf1c22f1cff021b9e4b00..15dcedef5fd105b05ce69e2c9d49ad5a8c4c353e 100644 (file)
--- 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;\
index 6310416690f5d955917d3d2e72c1401207290091..bdb3758b341459b465ac20bd32c03bfbf4a77a49 100644 (file)
--- 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);