X-Git-Url: https://www.hackdaworld.org/gitweb/?a=blobdiff_plain;f=visual%2Fvisual.c;h=687c5613a3fc0cbfebb503401f77ea49a1664463;hb=1d32be0a3b47add316f22f506b8595d56ac09a34;hp=9d0f5a2ca85b76092d0931292dc2388a1e8e0b31;hpb=83775c491117faa149281d0302fc8b8064d6b080;p=physik%2Fposic.git diff --git a/visual/visual.c b/visual/visual.c index 9d0f5a2..687c561 100644 --- a/visual/visual.c +++ b/visual/visual.c @@ -17,6 +17,29 @@ #include "../moldyn.h" #include "../math/math.h" +/* the pse, only needed here */ +static char *pse[]={ + "*", + "H", + "He", + "Li", + "Be", + "B", + "C", + "N", + "O", + "F", + "Ne", + "Na", + "Mg", + "Al", + "Si", + "P", + "S", + "Cl", + "Ar", +}; + int visual_init(t_visual *v,char *filebase) { char file[128+8]; @@ -30,13 +53,17 @@ int visual_init(t_visual *v,char *filebase) { perror("open visual fd"); return -1; } + dprintf(v->fd,"set write on\n"); return 0; } int visual_tini(t_visual *v) { - if(v->fd) close(v->fd); + if(v->fd) { + dprintf(v->fd,"quit\n"); + close(v->fd); + } return 0; } @@ -45,28 +72,11 @@ int visual_atoms(t_visual *v,double time,t_atom *atom,int n) { int i,fd; char file[128+64]; + t_3dvec dim; - char pse[19][4]={ - "foo", - "H", - "He", - "Li", - "Be", - "B", - "C", - "N", - "O", - "F", - "Ne", - "Na", - "Mg", - "Al", - "Si", - "P", - "S", - "Cl", - "Ar", - }; + dim.x=10e9*v->dim.x; + dim.y=10e9*v->dim.y; + dim.z=10e9*v->dim.z; sprintf(file,"%s-%.15f.xyz",v->fb,time); fd=open(file,O_WRONLY|O_CREAT|O_TRUNC); @@ -77,21 +87,35 @@ int visual_atoms(t_visual *v,double time,t_atom *atom,int n) { /* script file update */ dprintf(v->fd,"load xyz %s\n",file); - dprintf(v->fd,"spacefill 200\n"); - //dprintf(v->fd,"rotate x 100\n"); - //dprintf(v->fd,"rotate y 10\n"); + dprintf(v->fd,"spacefill 270\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,"set boundbox on\n"); + dprintf(v->fd,"label\n"); sprintf(file,"%s-%.15f.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",n); + dprintf(fd,"%d\n",(dim.x==0)?n:n+8); dprintf(fd,"atoms at time %.15f\n",time); for(i=0;i