X-Git-Url: https://hackdaworld.org/gitweb/?a=blobdiff_plain;f=posic.c;h=997127e75a0a6490a31396fe3abb1c6f01b6b99c;hb=737bbb619a53036e1b2f4eddeecaecb5ae088b38;hp=006fd99a298211458df528cb3986d3765a138f7a;hpb=9ae5e8af9192b47fba3743ab7f4ef6d0c34d507d;p=physik%2Fposic.git diff --git a/posic.c b/posic.c index 006fd99..997127e 100644 --- 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,11 +55,11 @@ 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"); + /* 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; } @@ -132,21 +135,41 @@ 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(ppm,"./video/si-%.15f.ppm",time); + fd1=open(xyz,O_WRONLY|O_CREAT|O_TRUNC); + if(fd1<0) { + perror("rasmol xyz 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,"write ppm %s\n",ppm); + dprintf(fd2,"zap\n"); + dprintf(fd1,"%d\nsilicon\n",amount_si); for(i=0;i