X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=moldyn.c;h=3c4d87399dcaceffb42f6d91ffe97a58bd8e841f;hb=c40d54eb3e319b17b2f6174c4eddcfd6ee3a407b;hp=41e022a7dfebb561d06bd6c1f64955d10cbf2112;hpb=97f4b6d802dc13e511f30adbaa25a7892289b0ff;p=physik%2Fposic.git diff --git a/moldyn.c b/moldyn.c index 41e022a..3c4d873 100644 --- a/moldyn.c +++ b/moldyn.c @@ -20,6 +20,58 @@ #include "moldyn.h" #include "report/report.h" +/* + * global variables, pse and atom colors (only needed here) + */ + +static char *pse_name[]={ + "*", + "H", + "He", + "Li", + "Be", + "B", + "C", + "N", + "O", + "F", + "Ne", + "Na", + "Mg", + "Al", + "Si", + "P", + "S", + "Cl", + "Ar", +}; + +static char *pse_col[]={ + "*", + "White", + "He", + "Li", + "Be", + "B", + "Gray", + "N", + "Blue", + "F", + "Ne", + "Na", + "Mg", + "Al", + "Yellow", + "P", + "S", + "Cl", + "Ar", +}; + +/* + * the moldyn functions + */ + int moldyn_init(t_moldyn *moldyn,int argc,char **argv) { printf("[moldyn] init\n"); @@ -427,7 +479,6 @@ int moldyn_log_shutdown(t_moldyn *moldyn) { moldyn->vlsdir); system(sc); } - if(&(moldyn->vis)) visual_tini(&(moldyn->vis)); return 0; } @@ -2004,6 +2055,96 @@ int analyze_bonds(t_moldyn *moldyn) { + return 0; +} + +/* + * visualization code + */ + +int visual_init(t_visual *v,char *filebase) { + + char file[128+8]; + + strncpy(v->fb,filebase,128); + memset(file,0,128+8); + + return 0; +} + +int visual_atoms(t_visual *v,double time,t_atom *atom,int n) { + + int i,fd; + char file[128+64]; + t_3dvec dim; + double help; + + dim.x=v->dim.x; + dim.y=v->dim.y; + dim.z=v->dim.z; + + help=(dim.x+dim.y); + + sprintf(file,"%s/atomic_conf_%07.f.xyz",v->fb,time); + fd=open(file,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR); + if(fd<0) { + perror("open visual save file fd"); + return -1; + } + + /* write the actual data file */ + dprintf(fd,"# [P] %d %07.f <%f,%f,%f>\n", + n,time,help/40.0,help/40.0,-0.8*help); + for(i=0;i