added cvsignore file, more modifications
authorhackbard <hackbard>
Mon, 20 Mar 2006 14:34:19 +0000 (14:34 +0000)
committerhackbard <hackbard>
Mon, 20 Mar 2006 14:34:19 +0000 (14:34 +0000)
.cvsignore [new file with mode: 0644]
posic.c
posic.h

diff --git a/.cvsignore b/.cvsignore
new file mode 100644 (file)
index 0000000..3905f95
--- /dev/null
@@ -0,0 +1,5 @@
+.cvsignore
+archive
+saves
+video
+posic
diff --git a/posic.c b/posic.c
index 006fd99..d8491f4 100644 (file)
--- a/posic.c
+++ b/posic.c
@@ -15,7 +15,10 @@ int main(int argc,char **argv) {
        //t_si *c;
        int i,j,runs,amount_si;
        double time;
-       int fd;
+       int fd1,fd2;
+       unsigned char xyz[128];
+       unsigned char scr[128];
+       unsigned char ppm[128];
 
        double tau,tau2,m,m2;
        double deltax,deltay,deltaz,distance;
@@ -52,13 +55,6 @@ int main(int argc,char **argv) {
        tau=TAU;
        tau2=tau*tau;
 
-       /* rasmol */
-       printf("opening the rasmol file\n");
-       fd=open("rasmol.xyz",O_WRONLY);
-       if(fd<0) {
-               perror("rasmol file open");
-               return -1;
-       }
 
        printf("starting velocity verlet: ");
        fflush(stdout);
@@ -132,21 +128,43 @@ int main(int argc,char **argv) {
                si[i].vz+=(tau*si[i].fz/m2);
        }
 
-       time+=tau;
+       if(!(runs%10)) {
 
-       /* print out positions in rasmol format */
-       dprintf(fd,"%d\nTime %f\n",amount_si,time);
+       /* 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");
+               return -1;
+       }
+       dprintf(fd2,"load xyz %s\n",xyz);
+       dprintf(fd2,"spacefill 200\n");
+       dprintf(fd2,"rotate x 11\n");
+       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(fd1,"%d\nsilicon\n",amount_si);
        for(i=0;i<amount_si;i++)
-               dprintf(fd,"Si %f %f %f %f\n",
+               dprintf(fd1,"Si %f %f %f %f\n",
                        si[i].x,si[i].y,si[i].z,time);
+       close(fd1);
+       close(fd2);
+
+       }
+
+       /* increase time */
+       time+=tau;
        printf(".");
        fflush(stdout);
-       dprintf(fd,"\n");
 
        }
 
-       printf("done\n");
-       close(fd);
+       printf(" done\n");
        free(si);
 
        return 0;
diff --git a/posic.h b/posic.h
index 93b7219..fa0846e 100644 (file)
--- a/posic.h
+++ b/posic.h
 #ifndef POSIC_H
 #define POSIC_H
 
-#define LEN_X 5
+#define LEN_X 50
 #define LX (1.0*LEN_X/2)
-#define LEN_Y 5
+#define LEN_Y 50
 #define LY (1.0*LEN_Y/2)
-#define LEN_Z 5
+#define LEN_Z 50
 #define LZ (1.0*LEN_Z/2)
 
 #define RUNS 1000
 #define TAU 0.001
 
-#define R_CUTOFF 2
+#define R_CUTOFF 20
 #define R2_CUTOFF (R_CUTOFF*R_CUTOFF)
 
 #define SI_M 1
-#define SI_LC 0.543105
+#define SI_LC 5.43105
 #define LJ_SIGMA SI_LC
 #define LJ_SIGMA_02 (LJ_SIGMA*LJ_SIGMA)
 #define LJ_SIGMA_06 (LJ_SIGMA_02*LJ_SIGMA_02*LJ_SIGMA_02)