From: hackbard Date: Mon, 11 Jul 2011 11:38:08 +0000 (+0200) Subject: feature to del atoms outside a spherical volume X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=8e2583bfb346f0f054cf0f2ca35f25cd20a6f8d4;p=physik%2Fposic.git feature to del atoms outside a spherical volume --- diff --git a/mdrun.c b/mdrun.c index 76e6c4d..fb1cbe0 100644 --- a/mdrun.c +++ b/mdrun.c @@ -803,18 +803,35 @@ int del_atoms(t_moldyn *moldyn,t_mdrun *mdrun) { t_del_atoms_params *delp; int i; t_3dvec dist; - + u8 outer; + + outer=0; stage=mdrun->stage.current->data; delp=stage->params; + if(delp->r<0) + outer=1; + for(i=0;icount;i++) { v3_sub(&dist,&(delp->o),&(moldyn->atom[i].r)); //printf("%d ----> %f %f %f = %f | %f\n",i,dist.x,dist.y,dist.z,v3_absolute_square(&dist),delp->r*delp->r); if(v3_absolute_square(&dist)<=(delp->r*delp->r)) { - del_atom(moldyn,moldyn->atom[i].tag); - printf("%s atom deleted: %d %d %d\n",ME, - moldyn->atom[i].tag,moldyn->atom[i].element, - moldyn->atom[i].brand); + if(!outer) { + del_atom(moldyn,moldyn->atom[i].tag); + printf("%s atom deleted: %d %d %d\n",ME, + moldyn->atom[i].tag, + moldyn->atom[i].element, + moldyn->atom[i].brand); + } + } + else { + if(outer) { + del_atom(moldyn,moldyn->atom[i].tag); + printf("%s atom deleted: %d %d %d\n",ME, + moldyn->atom[i].tag, + moldyn->atom[i].element, + moldyn->atom[i].brand); + } } }