X-Git-Url: https://www.hackdaworld.org/gitweb/?a=blobdiff_plain;f=visual%2Fvisual.c;h=73b49410cb99574720cf618fc5f04df9a17a372a;hb=97f4b6d802dc13e511f30adbaa25a7892289b0ff;hp=03c20a134e8eec805128d4fd89ffa93d9b8c10f7;hpb=dc70c570abec4596355df26ff19756658e33e762;p=physik%2Fposic.git diff --git a/visual/visual.c b/visual/visual.c index 03c20a1..73b4941 100644 --- a/visual/visual.c +++ b/visual/visual.c @@ -18,7 +18,7 @@ #include "../math/math.h" /* the pse, only needed here */ -static char *pse[]={ +static char *pse_name[]={ "*", "H", "He", @@ -40,32 +40,56 @@ static char *pse[]={ "Ar", }; +static char *pse_col[]={ + "*", + "White", + "He", + "Li", + "Be", + "B", + "Gray", + "N", + "Blue", + "F", + "Ne", + "Na", + "Mg", + "Al", + "Yellow", + "P", + "S", + "Cl", + "Ar", +}; + int visual_init(t_visual *v,char *filebase) { char file[128+8]; strncpy(v->fb,filebase,128); memset(file,0,128+8); - sprintf(file,"%s.scr",v->fb); + //sprintf(file,"%s/visualize.scr",v->fb); // obsolete! - v->fd=open(file,O_WRONLY|O_CREAT|O_TRUNC); + /* obsolete! + v->fd=open(file,O_WRONLY|O_CREAT|O_EXCL,S_IRUSR|S_IWUSR); if(v->fd<0) { perror("open visual fd"); return -1; } dprintf(v->fd,"set write on\n"); - - memset(&(v->dim),0,sizeof(t_3dvec)); + */ return 0; } int visual_tini(t_visual *v) { + /* obsolete! if(v->fd) { dprintf(v->fd,"quit\n"); close(v->fd); } + */ return 0; } @@ -75,48 +99,88 @@ 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=10e9*v->dim.x; - dim.y=10e9*v->dim.y; - dim.z=10e9*v->dim.z; + dim.x=v->dim.x; + dim.y=v->dim.y; + dim.z=v->dim.z; - sprintf(file,"%s-%.15f.xyz",v->fb,time); - fd=open(file,O_WRONLY|O_CREAT|O_TRUNC); + 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; } /* script file update */ + /* obsolete! dprintf(v->fd,"load xyz %s\n",file); - dprintf(v->fd,"spacefill 270\n"); + dprintf(v->fd,"spacefill 200\n"); dprintf(v->fd,"rotate x 100\n"); dprintf(v->fd,"rotate y 10\n"); dprintf(v->fd,"set ambient 20\n"); dprintf(v->fd,"set specular on\n"); - dprintf(v->fd,"label\n"); - sprintf(file,"%s-%.15f.ppm",v->fb,time); + dprintf(v->fd,"set boundbox on\n"); + //dprintf(v->fd,"label\n"); + sprintf(file,"%s/visualize_%07.f.ppm",v->fb,time); dprintf(v->fd,"write ppm %s\n",file); dprintf(v->fd,"zap\n"); + */ /* write the actual data file */ - dprintf(fd,"%d\n",(dim.x==0)?n:n+8); - dprintf(fd,"atoms at time %.15f\n",time); + //dprintf(fd,"%d\n",(dim.x==0)?n:n+8); + 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