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 int visual_init(t_visual *v,char *filebase) {
24 strncpy(v->fb,filebase,128);
26 sprintf(file,"%s.scr",v->fb);
28 v->fd=open(file,O_WRONLY|O_CREAT|O_TRUNC);
30 perror("open visual fd");
37 int visual_tini(t_visual *v) {
39 if(v->fd) close(v->fd);
44 int visual_atoms(t_visual *v,double time,t_atom *atom,int n) {
71 sprintf(file,"%s-%.15f.xyz",v->fb,time);
72 fd=open(file,O_WRONLY|O_CREAT|O_TRUNC);
74 perror("open visual save file fd");
78 /* script file update */
79 dprintf(v->fd,"load xyz %s\n",file);
80 dprintf(v->fd,"spacefill 200\n");
81 //dprintf(v->fd,"rotate x 100\n");
82 //dprintf(v->fd,"rotate y 10\n");
83 dprintf(v->fd,"set ambient 20\n");
84 dprintf(v->fd,"set specular on\n");
85 sprintf(file,"%s-%.15f.ppm",v->fb,time);
86 dprintf(v->fd,"write ppm %s\n",file);
87 dprintf(v->fd,"zap\n");
89 /* write the actual data file */
91 dprintf(fd,"atoms at time %.15f\n",time);
93 dprintf(fd,"%s %f %f %f\n",pse[atom[i].element],
94 atom[i].r.x,atom[i].r.y,atom[i].r.z);