From 1261bf82aa2e5758d8dd28bed88c96ed5fcc979c Mon Sep 17 00:00:00 2001 From: hackbard Date: Sun, 14 Sep 2008 01:48:51 +0200 Subject: [PATCH] visual atoms using moldyn func now, updated TODO, atom_match build by Makefile --- Makefile | 4 +- TODO.txt | 11 ++-- visual_atoms.c | 143 ++++++++++++++++++++++--------------------------- 3 files changed, 75 insertions(+), 83 deletions(-) diff --git a/Makefile b/Makefile index 4de3dcc..462a9b7 100644 --- a/Makefile +++ b/Makefile @@ -33,7 +33,7 @@ SRC += potentials/tersoff.c potentials/albe.c SRC += potentials/albe_fast.c ALL = mdrun sic fluctuation_calc postproc pair_correlation_calc diffusion_calc -ALL += bond_analyze search_bonds visual_atoms display_atom_data +ALL += bond_analyze search_bonds visual_atoms display_atom_data atom_match all: $(ALL) @@ -57,6 +57,8 @@ visual_atoms: $(DEPS) display_atom_data: $(DEPS) +atom_match: $(DEPS) + .PHONY:clean clean: rm -vf $(ALL) *.o */*.o diff --git a/TODO.txt b/TODO.txt index bf6f4ad..570ee54 100644 --- a/TODO.txt +++ b/TODO.txt @@ -11,17 +11,20 @@ implement - improve ins_m_atoms (merge to general ins_atoms function maybe) - clean up mdrun + - config sanity checks - introduce/improve fill command (multiple fills) - check virial calc, where does the - come from? - angular distribution - - structfactoranalyze (see nordlund paper) + - structurfactoranalyze (see nordlund paper) - filled atoms need atom attrib?!?!? or aattr pre prerun - bond_analyze to dump xyz file of atoms + - improve diff calc + - make it parallel! (mpi/openmp) <- email to ralfu (asap) * openmp: doch auf verlet listen (pointer problem!) @@ -56,13 +59,13 @@ simulation runs - cryst simulations: reasonable pctrl? - even higher temperatures - tctrl only in outer regions -- cryst of molten area with cryst area next to it - only 1 atom per timestep - EXTENDED C-C cutoff - different sized SiC prec in Si (4:5! diff temperatures) -- more interstitial combinations - melting exps (both, anneal + interface method) -- characterize interstitials by PCF, then inc temperature +- interstitials: + - more interstitial combinations + - characterize interstitials by PCF, then inc temperature learn ***** diff --git a/visual_atoms.c b/visual_atoms.c index a98ecd6..68901ec 100644 --- a/visual_atoms.c +++ b/visual_atoms.c @@ -23,6 +23,14 @@ #undef PSE_NAME #undef PSE_COL +typedef struct s_data { + int ca; + double radius; + double lc; + int ma; + double ox,oy,oz; +} t_data; + int usage(char *prog) { printf("\nusage:\n"); @@ -32,33 +40,47 @@ int usage(char *prog) { return -1; } +int process(t_moldyn *moldyn,t_atom *itom,t_atom *jtom,void *ptr,u8 bc) { + + t_3dvec dist; + double d; + t_data *data; + + data=ptr; + + v3_sub(&dist,&(itom->r),&(jtom->r)); + if(bc) check_per_bound(moldyn,&dist); + d=v3_norm(&dist); + + if(d<=data->radius) { + printf("%s %f %f %f %s %f\n", + pse_name[jtom->element], + jtom->r.x+data->ox,jtom->r.y+data->oy,jtom->r.z+data->oz, + (jtom->tag==data->ma)?"Red":pse_col[jtom->element], + jtom->ekin); + } + + return 0; +} + int main(int argc,char **argv) { t_moldyn moldyn; - t_atom *itom,*jtom; - int j; + t_data data; int ret; - t_list n[27]; - t_list *this; - t_linkcell *lc; - t_3dvec dist; - double d,radius; - double ox,oy,oz; - int ma,ca; - double lac; + t_atom *atom; if(argc<4) { usage(argv[0]); return -1; } - - ca=atoi(argv[2]); - radius=atof(argv[3]); - lac=atof(argv[4]); - - ma=-1; + + data.ca=atoi(argv[2]); + data.radius=atof(argv[3]); + data.lc=atof(argv[4]); + data.ma=-1; if(argc==6) - ma=atoi(argv[5]); + data.ma=atoi(argv[5]); memset(&moldyn,0,sizeof(t_moldyn)); @@ -70,87 +92,52 @@ int main(int argc,char **argv) { } /* link cell init */ - moldyn.cutoff=radius; + moldyn.cutoff=data.radius; link_cell_init(&moldyn,VERBOSE); - lc=&(moldyn.lc); - - /* serach atoms */ - itom=&(moldyn.atom[ca]); - link_cell_neighbour_index(&moldyn, - (itom->r.x+moldyn.dim.x/2)/lc->x, - (itom->r.y+moldyn.dim.y/2)/lc->y, - (itom->r.z+moldyn.dim.z/2)/lc->z, - n); + atom=&(moldyn.atom[data.ca]); /* prepare offset */ - ox=0.0; - if(itom->r.x<0) { - while((itom->r.x+ox)<(-lac/2.0)) - ox+=lac; + data.ox=0.0; + if(atom->r.x<0) { + while((atom->r.x+data.ox)<(-data.lc/2.0)) + data.ox+=data.lc; } else { - while((itom->r.x+ox)>(lac/2.0)) - ox-=lac; + while((atom->r.x+data.ox)>(data.lc/2.0)) + data.ox-=data.lc; } - oy=0.0; - if(itom->r.y<0) { - while((itom->r.y+oy)<(-lac/2.0)) - oy+=lac; + data.oy=0.0; + if(atom->r.y<0) { + while((atom->r.y+data.oy)<(-data.lc/2.0)) + data.oy+=data.lc; } else { - while((itom->r.y+oy)>(lac/2.0)) - oy-=lac; + while((atom->r.y+data.oy)>(data.lc/2.0)) + data.oy-=data.lc; } - oz=0.0; - if(itom->r.z<0) { - while((itom->r.z+oz)<(-lac/2.0)) - oz+=lac; + data.oz=0.0; + if(atom->r.z<0) { + while((atom->r.z+data.oz)<(-data.lc/2.0)) + data.oz+=data.lc; } else { - while((itom->r.z+oz)>(lac/2.0)) - oz-=lac; + while((atom->r.z+data.oz)>(data.lc/2.0)) + data.oz-=data.lc; } - + /* print the centered atom */ printf("%s %f %f %f %s %f\n", - pse_name[itom->element],itom->r.x+ox,itom->r.y+oy,itom->r.z+oz, - "Green",itom->ekin); - - for(j=0;j<27;j++) { - this=&(n[j]); - list_reset_f(this); - - if(this->start==NULL) - continue; - - do { - - jtom=this->current->data; - - if(jtom==itom) - continue; - - v3_sub(&dist,&(itom->r),&(jtom->r)); - check_per_bound(&moldyn,&dist); - d=v3_norm(&dist); - - if(d<=radius) { - printf("%s %f %f %f %s %f\n", - pse_name[jtom->element], - jtom->r.x+ox,jtom->r.y+oy,jtom->r.z+oz, - (jtom->tag==ma)?"Red":pse_col[jtom->element], - jtom->ekin); - } - - } while(list_next_f(this)!=L_NO_NEXT_ELEMENT); - } + pse_name[atom->element],atom->r.x+data.ox,atom->r.y+data.oy, + atom->r.z+data.oz,"Green",atom->ekin); + process_neighbours(&moldyn,&data,atom,process); + link_cell_shutdown(&moldyn); - moldyn_free_save_file(&moldyn); return 0; } + -- 2.39.2