From: hackbard Date: Thu, 30 Nov 2006 20:52:12 +0000 (+0000) Subject: testing X-Git-Url: https://hackdaworld.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a33fe7f5d4d7e09b5b52f5f4dadd462cf868ec2f;p=physik%2Fposic.git testing --- diff --git a/moldyn.c b/moldyn.c index 815fc87..26f298f 100644 --- a/moldyn.c +++ b/moldyn.c @@ -635,7 +635,6 @@ int moldyn_integrate(t_moldyn *moldyn) { /* zero absolute time */ moldyn->time=0.0; - for(sched=0;schedschedule.content_count;sched++) { /* setting amount of runs and finite time step size */ @@ -759,15 +758,15 @@ int velocity_verlet(t_moldyn *moldyn) { int potential_force_calc(t_moldyn *moldyn) { int i,j,k,count; - t_atom *atom,*btom,*ktom; + t_atom *itom,*jtom,*ktom; t_linkcell *lc; - t_list neighbour[27],neighbourk[27]; - t_list *this,*thisk; - u8 bc,bck; + t_list neighbour_i[27],neighbour_j[27]; + t_list *this,*that; + u8 bc_ij,bc_ijk; int countn,dnlc; count=moldyn->count; - atom=moldyn->atom; + itom=moldyn->atom; lc=&(moldyn->lc); /* reset energy */ @@ -776,85 +775,117 @@ int potential_force_calc(t_moldyn *moldyn) { for(i=0;ifunc1b(moldyn,&(atom[i])); + if(itom[i].attr&ATOM_ATTR_1BP) + moldyn->func1b(moldyn,&(itom[i])); /* 2 body pair potential/force */ - if(atom[i].attr&(ATOM_ATTR_2BP|ATOM_ATTR_3BP)) { + if(itom[i].attr&(ATOM_ATTR_2BP|ATOM_ATTR_3BP)) { link_cell_neighbour_index(moldyn, - (atom[i].r.x+moldyn->dim.x/2)/lc->x, - (atom[i].r.y+moldyn->dim.y/2)/lc->y, - (atom[i].r.z+moldyn->dim.z/2)/lc->z, - neighbour); + (itom[i].r.x+moldyn->dim.x/2)/lc->x, + (itom[i].r.y+moldyn->dim.y/2)/lc->y, + (itom[i].r.z+moldyn->dim.z/2)/lc->z, + neighbour_i); countn=lc->countn; dnlc=lc->dnlc; for(j=0;jstart==NULL) continue; - bc=(jcurrent->data; + jtom=this->current->data; - if(btom==&(atom[i])) + if(jtom==&(itom[i])) continue; - if((btom->attr&ATOM_ATTR_2BP)& - (atom[i].attr&ATOM_ATTR_2BP)) + if((jtom->attr&ATOM_ATTR_2BP)& + (itom[i].attr&ATOM_ATTR_2BP)) moldyn->func2b(moldyn, - &(atom[i]), - btom, - bc); + &(itom[i]), + jtom, + bc_ij); /* 3 body potential/force */ - if(!(atom[i].attr&ATOM_ATTR_3BP)|| - !(btom->attr&ATOM_ATTR_3BP)) + if(!(itom[i].attr&ATOM_ATTR_3BP)|| + !(jtom->attr&ATOM_ATTR_3BP)) continue; link_cell_neighbour_index(moldyn, - (btom->r.x+moldyn->dim.x/2)/lc->x, - (btom->r.y+moldyn->dim.y/2)/lc->y, - (btom->r.z+moldyn->dim.z/2)/lc->z, - neighbourk); + (jtom->r.x+moldyn->dim.x/2)/lc->x, + (jtom->r.y+moldyn->dim.y/2)/lc->y, + (jtom->r.z+moldyn->dim.z/2)/lc->z, + neighbour_j); + /* neighbours of j */ for(k=0;kcountn;k++) { - thisk=&(neighbourk[k]); - list_reset(thisk); + that=&(neighbour_j[k]); + list_reset(that); + + if(that->start==NULL) + continue; + + bc_ijk=(kdnlc)?0:1; + + do { + + ktom=that->current->data; + + if(!(ktom->attr&ATOM_ATTR_3BP)) + continue; + + if(ktom==jtom) + continue; + + if(ktom==&(itom[i])) + continue; + + moldyn->func3b(moldyn,&(itom[i]),jtom,ktom,bc_ijk); + + } while(list_next(that)!=\ + L_NO_NEXT_ELEMENT); + + } + + /* neighbours of i */ + for(k=0;kstart==NULL) + if(that->start==NULL) continue; - bck=(kdnlc)?0:1; + bc_ijk=(kcurrent->data; + ktom=that->current->data; if(!(ktom->attr&ATOM_ATTR_3BP)) continue; - if(ktom==btom) + if(ktom==jtom) continue; - if(ktom==&(atom[i])) + if(ktom==&(itom[i])) continue; - moldyn->func3b(moldyn,&(atom[i]),btom,ktom,bck); + moldyn->func3b(moldyn,&(itom[i]),jtom,ktom,bc_ijk); - } while(list_next(thisk)!=\ + } while(list_next(that)!=\ L_NO_NEXT_ELEMENT); } diff --git a/sic.c b/sic.c index 2cd32eb..82b3710 100644 --- a/sic.c +++ b/sic.c @@ -86,6 +86,7 @@ printf("%d\n",sizeof(t_atom)); /* cutoff radius */ printf("[sic] setting cutoff radius\n"); set_cutoff(&md,TM_S_SI); + //set_cutoff(&md,1.0*LC_SI); /* set (initial) dimensions of simulation volume */ printf("[sic] setting dimensions\n"); @@ -99,6 +100,7 @@ printf("%d\n",sizeof(t_atom)); printf("[sic] creating atoms\n"); create_lattice(&md,DIAMOND,LC_SI,SI,M_SI, ATOM_ATTR_1BP|ATOM_ATTR_2BP|ATOM_ATTR_3BP, + //ATOM_ATTR_2BP, 0,4,4,4); /* setting a nearest neighbour distance for the moldyn checks */ @@ -106,7 +108,7 @@ printf("%d\n",sizeof(t_atom)); /* set temperature */ printf("[sic] setting temperature\n"); - set_temperature(&md,273.0+450.0); + set_temperature(&md,10.0); /* initial thermal fluctuations of particles */ printf("[sic] thermal init\n"); @@ -114,12 +116,12 @@ printf("%d\n",sizeof(t_atom)); /* create the simulation schedule */ printf("[sic] adding schedule\n"); - moldyn_add_schedule(&md,10000,1.0e-15); + moldyn_add_schedule(&md,1000,1.0e-15); /* activate logging */ printf("[sic] activate logging\n"); - moldyn_set_log(&md,LOG_TOTAL_ENERGY,"saves/test-energy",100); - moldyn_set_log(&md,VISUAL_STEP,"saves/test-visual",100); + moldyn_set_log(&md,LOG_TOTAL_ENERGY,"saves/test-energy",10); + moldyn_set_log(&md,VISUAL_STEP,"saves/test-visual",10); /* * let's do the actual md algorithm now