lots of mostly small changes ...
[physik/posic.git] / visual / visual.c
index 38ff0b0..29d9469 100644 (file)
 #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,6 +53,7 @@ int visual_init(t_visual *v,char *filebase) {
                perror("open visual fd");
                return -1;
        }
+       dprintf(v->fd,"set write on\n");
 
        memset(&(v->dim),0,sizeof(t_3dvec));
 
@@ -38,7 +62,10 @@ int visual_init(t_visual *v,char *filebase) {
 
 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;
 }
@@ -53,28 +80,6 @@ int visual_atoms(t_visual *v,double time,t_atom *atom,int n) {
        dim.y=10e9*v->dim.y;
        dim.z=10e9*v->dim.z;
 
-       char pse[19][4]={
-               "*",
-               "H",
-               "He",
-               "Li",
-               "Be",
-               "B",
-               "C",
-               "N",
-               "O",
-               "F",
-               "Ne",
-               "Na",
-               "Mg",
-               "Al",
-               "Si",
-               "P",
-               "S",
-               "Cl",
-               "Ar",
-       };
-
        sprintf(file,"%s-%.15f.xyz",v->fb,time);
        fd=open(file,O_WRONLY|O_CREAT|O_TRUNC);
        if(fd<0) {
@@ -84,7 +89,7 @@ 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 300\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");