2 * visual.c - visualization functions
4 * author: Frank Zirkelbach <frank.zirkelbach@physik.uni-augsburg.de>
10 #include <sys/types.h>
17 #include "../moldyn.h"
18 #include "../math/math.h"
20 /* the pse, only needed here */
43 int visual_init(t_visual *v,char *filebase) {
47 strncpy(v->fb,filebase,128);
49 sprintf(file,"%s/visualize.scr",v->fb);
51 v->fd=open(file,O_WRONLY|O_CREAT|O_EXCL,S_IRUSR|S_IWUSR);
53 perror("open visual fd");
56 dprintf(v->fd,"set write on\n");
61 int visual_tini(t_visual *v) {
64 dprintf(v->fd,"quit\n");
71 int visual_atoms(t_visual *v,double time,t_atom *atom,int n) {
81 sprintf(file,"%s/visualize_%07.f.xyz",v->fb,time);
82 fd=open(file,O_WRONLY|O_CREAT|O_TRUNC,S_IRUSR|S_IWUSR);
84 perror("open visual save file fd");
88 /* script file update */
89 dprintf(v->fd,"load xyz %s\n",file);
90 dprintf(v->fd,"spacefill 270\n");
91 dprintf(v->fd,"rotate x 100\n");
92 dprintf(v->fd,"rotate y 10\n");
93 dprintf(v->fd,"set ambient 20\n");
94 dprintf(v->fd,"set specular on\n");
95 dprintf(v->fd,"set boundbox on\n");
96 //dprintf(v->fd,"label\n");
97 sprintf(file,"%s/visualize_%07.f.ppm",v->fb,time);
98 dprintf(v->fd,"write ppm %s\n",file);
99 dprintf(v->fd,"zap\n");
101 /* write the actual data file */
102 dprintf(fd,"%d\n",(dim.x==0)?n:n+8);
103 dprintf(fd,"atoms at time %07.f\n",time);
105 dprintf(fd,"%s %f %f %f\n",pse[atom[i].element],
110 dprintf(fd,"%s %f %f %f\n",pse[0],dim.x/2,dim.y/2,dim.z/2);
111 dprintf(fd,"%s %f %f %f\n",pse[0],-dim.x/2,dim.y/2,dim.z/2);
112 dprintf(fd,"%s %f %f %f\n",pse[0],dim.x/2,-dim.y/2,dim.z/2);
113 dprintf(fd,"%s %f %f %f\n",pse[0],dim.x/2,dim.y/2,-dim.z/2);
114 dprintf(fd,"%s %f %f %f\n",pse[0],-dim.x/2,-dim.y/2,dim.z/2);
115 dprintf(fd,"%s %f %f %f\n",pse[0],dim.x/2,-dim.y/2,-dim.z/2);
116 dprintf(fd,"%s %f %f %f\n",pse[0],-dim.x/2,dim.y/2,-dim.z/2);
117 dprintf(fd,"%s %f %f %f\n",pse[0],-dim.x/2,-dim.y/2,-dim.z/2);