more changes ..
authorhackbard <hackbard>
Mon, 20 Mar 2006 20:50:41 +0000 (20:50 +0000)
committerhackbard <hackbard>
Mon, 20 Mar 2006 20:50:41 +0000 (20:50 +0000)
posic.c

diff --git a/posic.c b/posic.c
index d8491f4..997127e 100644 (file)
--- a/posic.c
+++ b/posic.c
@@ -55,6 +55,13 @@ int main(int argc,char **argv) {
        tau=TAU;
        tau2=tau*tau;
 
+       /* rasmol script file */
+       sprintf(scr,"./saves/si.scr");
+       fd2=open(scr,O_WRONLY|O_CREAT|O_TRUNC);
+       if(fd2<0) {
+               perror("rasmol script file open");
+               return -1;
+       }
 
        printf("starting velocity verlet: ");
        fflush(stdout);
@@ -132,12 +139,10 @@ int main(int argc,char **argv) {
 
        /* rasmol script & xyz file */
        sprintf(xyz,"./saves/si-%.15f.xyz",time);
-       sprintf(scr,"./saves/si-%.15f.scr",time);
        sprintf(ppm,"./video/si-%.15f.ppm",time);
        fd1=open(xyz,O_WRONLY|O_CREAT|O_TRUNC);
-       fd2=open(scr,O_WRONLY|O_CREAT|O_TRUNC);
-       if((fd1<0)||(fd2<0)) {
-               perror("rasmol file open");
+       if(fd1<0) {
+               perror("rasmol xyz file open");
                return -1;
        }
        dprintf(fd2,"load xyz %s\n",xyz);
@@ -146,14 +151,13 @@ int main(int argc,char **argv) {
        dprintf(fd2,"rotate y 13\n");
        dprintf(fd2,"set ambient 20\n");
        dprintf(fd2,"set specular on\n");
-       dprintf(fd2,"set write on\n");
        dprintf(fd2,"write ppm %s\n",ppm);
+       dprintf(fd2,"zap\n");
        dprintf(fd1,"%d\nsilicon\n",amount_si);
        for(i=0;i<amount_si;i++)
                dprintf(fd1,"Si %f %f %f %f\n",
                        si[i].x,si[i].y,si[i].z,time);
        close(fd1);
-       close(fd2);
 
        }
 
@@ -165,6 +169,7 @@ int main(int argc,char **argv) {
        }
 
        printf(" done\n");
+       close(fd2);
        free(si);
 
        return 0;