| 16 |
|
|
| 17 |
|
struct linked_xyz{ |
| 18 |
|
struct coords *r; |
| 19 |
< |
double boxX, boxY, boxZ; |
| 19 |
> |
double Hmat[3][3]; |
| 20 |
|
struct linked_xyz *next; |
| 21 |
|
}; |
| 22 |
|
|
| 37 |
|
|
| 38 |
|
struct coords *out_coords; |
| 39 |
|
|
| 40 |
< |
int i,j; /* loop counters */ |
| 40 |
> |
int i,j,k; /* loop counters */ |
| 41 |
|
mode_t dir_mode = S_IRWXU; |
| 42 |
|
|
| 43 |
|
int generate_header = 0; /* boolean for generating the pov ray header */ |
| 79 |
|
|
| 80 |
|
unsigned int n_interpolate = 0; /* number of frames to interpolate */ |
| 81 |
|
double dx, dy, dz; /* temp variables for interpolating distances */ |
| 82 |
+ |
double dm[3][3]; |
| 83 |
|
|
| 84 |
|
|
| 85 |
|
char pov_dir[500]; /* the pov_dir */ |
| 312 |
|
printf("error in reading file\n"); |
| 313 |
|
exit(8); |
| 314 |
|
} |
| 315 |
< |
current_frame->boxX = atof( foo ); |
| 315 |
> |
current_frame->Hmat[0][0] = atof( foo ); |
| 316 |
|
|
| 317 |
|
foo = strtok(NULL, " ,;\t"); |
| 318 |
|
if(foo == NULL){ |
| 319 |
|
printf("error in reading file\n"); |
| 320 |
|
exit(8); |
| 321 |
|
} |
| 322 |
< |
current_frame->boxY = atof( foo ); |
| 322 |
> |
current_frame->Hmat[1][0] = atof( foo ); |
| 323 |
|
|
| 324 |
|
foo = strtok(NULL, " ,;\t"); |
| 325 |
|
if(foo == NULL){ |
| 326 |
|
printf("error in reading file\n"); |
| 327 |
|
exit(8); |
| 328 |
|
} |
| 329 |
< |
current_frame->boxZ = atof( foo ); |
| 329 |
> |
current_frame->Hmat[2][0] = atof( foo ); |
| 330 |
> |
|
| 331 |
> |
foo = strtok(NULL, " ,;\t"); |
| 332 |
> |
if(foo == NULL){ |
| 333 |
> |
printf("error in reading file\n"); |
| 334 |
> |
exit(8); |
| 335 |
> |
} |
| 336 |
> |
current_frame->Hmat[0][1] = atof( foo ); |
| 337 |
> |
|
| 338 |
> |
foo = strtok(NULL, " ,;\t"); |
| 339 |
> |
if(foo == NULL){ |
| 340 |
> |
printf("error in reading file\n"); |
| 341 |
> |
exit(8); |
| 342 |
> |
} |
| 343 |
> |
current_frame->Hmat[1][1] = atof( foo ); |
| 344 |
> |
|
| 345 |
> |
foo = strtok(NULL, " ,;\t"); |
| 346 |
> |
if(foo == NULL){ |
| 347 |
> |
printf("error in reading file\n"); |
| 348 |
> |
exit(8); |
| 349 |
> |
} |
| 350 |
> |
current_frame->Hmat[2][1] = atof( foo ); |
| 351 |
> |
|
| 352 |
> |
foo = strtok(NULL, " ,;\t"); |
| 353 |
> |
if(foo == NULL){ |
| 354 |
> |
printf("error in reading file\n"); |
| 355 |
> |
exit(8); |
| 356 |
> |
} |
| 357 |
> |
current_frame->Hmat[0][2] = atof( foo ); |
| 358 |
> |
|
| 359 |
> |
foo = strtok(NULL, " ,;\t"); |
| 360 |
> |
if(foo == NULL){ |
| 361 |
> |
printf("error in reading file\n"); |
| 362 |
> |
exit(8); |
| 363 |
> |
} |
| 364 |
> |
current_frame->Hmat[1][2] = atof( foo ); |
| 365 |
> |
|
| 366 |
> |
foo = strtok(NULL, " ,;\t"); |
| 367 |
> |
if(foo == NULL){ |
| 368 |
> |
printf("error in reading file\n"); |
| 369 |
> |
exit(8); |
| 370 |
> |
} |
| 371 |
> |
current_frame->Hmat[2][2] = atof( foo ); |
| 372 |
> |
|
| 373 |
|
} |
| 374 |
|
|
| 375 |
|
for( i=0; i < n_atoms; i++){ |
| 445 |
|
"#include \"pov_header.pov\"\n" |
| 446 |
|
"\n"); |
| 447 |
|
if( draw_box ){ |
| 448 |
< |
dx = current_frame->boxX - temp_frame->boxX; |
| 449 |
< |
dy = current_frame->boxY - temp_frame->boxY; |
| 450 |
< |
dz = current_frame->boxZ - temp_frame->boxZ; |
| 451 |
< |
|
| 452 |
< |
dx /= (double)(n_interpolate + 1); |
| 453 |
< |
dy /= (double)(n_interpolate + 1); |
| 454 |
< |
dz /= (double)(n_interpolate + 1); |
| 455 |
< |
|
| 448 |
> |
|
| 449 |
> |
for (j = 0; j < 3; j++) { |
| 450 |
> |
for (k = 0; k < 3; k++) { |
| 451 |
> |
dm[j][k] = current_frame->Hmat[j][k] - temp_frame->Hmat[j][k]; |
| 452 |
> |
dm[j][k] /= (double)(n_interpolate + 1); |
| 453 |
> |
} |
| 454 |
> |
} |
| 455 |
> |
|
| 456 |
|
fprintf( out_file, |
| 457 |
< |
"makePeriodicBox( %lf, %lf, %lf )\n" |
| 457 |
> |
"makePeriodicBox( %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf)\n" |
| 458 |
|
"\n", |
| 459 |
< |
temp_frame->boxX + dx * (i+1), |
| 460 |
< |
temp_frame->boxZ + dz * (i+1), |
| 461 |
< |
temp_frame->boxY + dy * (i+1) ); |
| 459 |
> |
temp_frame->Hmat[0][0] + dm[0][0] * (i+1), |
| 460 |
> |
temp_frame->Hmat[1][0] + dm[1][0] * (i+1), |
| 461 |
> |
temp_frame->Hmat[2][0] + dm[2][0] * (i+1), |
| 462 |
> |
temp_frame->Hmat[0][1] + dm[0][1] * (i+1), |
| 463 |
> |
temp_frame->Hmat[1][1] + dm[1][1] * (i+1), |
| 464 |
> |
temp_frame->Hmat[2][1] + dm[2][1] * (i+1), |
| 465 |
> |
temp_frame->Hmat[0][2] + dm[0][2] * (i+1), |
| 466 |
> |
temp_frame->Hmat[1][2] + dm[1][2] * (i+1), |
| 467 |
> |
temp_frame->Hmat[2][2] + dm[2][2] * (i+1) ); |
| 468 |
|
} |
| 469 |
|
|
| 470 |
|
|
| 511 |
|
if( draw_box ){ |
| 512 |
|
|
| 513 |
|
fprintf( out_file, |
| 514 |
< |
"makePeriodicBox( %lf, %lf, %lf )\n" |
| 514 |
> |
"makePeriodicBox( %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf %lf )\n" |
| 515 |
|
"\n", |
| 516 |
< |
current_frame->boxX, |
| 517 |
< |
current_frame->boxZ, |
| 518 |
< |
current_frame->boxY ); |
| 516 |
> |
current_frame->Hmat[0][0], |
| 517 |
> |
current_frame->Hmat[1][0], |
| 518 |
> |
current_frame->Hmat[2][0], |
| 519 |
> |
current_frame->Hmat[0][1], |
| 520 |
> |
current_frame->Hmat[1][1], |
| 521 |
> |
current_frame->Hmat[2][1], |
| 522 |
> |
current_frame->Hmat[0][2], |
| 523 |
> |
current_frame->Hmat[1][2], |
| 524 |
> |
current_frame->Hmat[2][2] ); |
| 525 |
|
} |
| 526 |
|
|
| 527 |
|
|
| 707 |
|
"// declare the periodic box macro\n" |
| 708 |
|
"//************************************************************\n" |
| 709 |
|
"\n" |
| 710 |
< |
"#macro makePeriodicBox( lengthX, lengthY, lengthZ )\n" |
| 710 |
> |
"#macro makePeriodicBox( bx1, by1, bz1, bx2, by2, bz2, bx3, by3, bz3 )\n" |
| 711 |
|
"\n" |
| 712 |
< |
" #local addX = lengthX / 2.0;\n" |
| 713 |
< |
" #local addY = lengthY / 2.0;\n" |
| 714 |
< |
" #local addZ = lengthZ / 2.0;\n" |
| 712 |
> |
" #local pAx = -boxCenterX;\n" |
| 713 |
> |
" #local pAy = -boxCenterY;\n" |
| 714 |
> |
" #local pAz = -boxCenterZ;\n" |
| 715 |
> |
" #local pBx = bx1 - boxCenterX;\n" |
| 716 |
> |
" #local pBy = by1 - boxCenterY;\n" |
| 717 |
> |
" #local pBz = bz1 - boxCenterZ;\n" |
| 718 |
> |
" #local pCx = bx2 - boxCenterX;\n" |
| 719 |
> |
" #local pCy = by2 - boxCenterY;\n" |
| 720 |
> |
" #local pCz = bz2 - boxCenterZ;\n" |
| 721 |
> |
" #local pDx = bx3 - boxCenterX;\n" |
| 722 |
> |
" #local pDy = by3 - boxCenterY;\n" |
| 723 |
> |
" #local pDz = bz3 - boxCenterZ;\n" |
| 724 |
> |
" #local pEx = bx1 + bx2 - boxCenterX;\n" |
| 725 |
> |
" #local pEy = by1 + by2 - boxCenterY;\n" |
| 726 |
> |
" #local pEz = bz1 + bz2 - boxCenterZ;\n" |
| 727 |
> |
" #local pFx = bx1 + bx3 - boxCenterX;\n" |
| 728 |
> |
" #local pFy = by1 + by3 - boxCenterY;\n" |
| 729 |
> |
" #local pFz = bz1 + bz3 - boxCenterZ;\n" |
| 730 |
> |
" #local pGx = bx2 + bx3 - boxCenterX;\n" |
| 731 |
> |
" #local pGy = by2 + by3 - boxCenterY;\n" |
| 732 |
> |
" #local pGz = bz2 + bz3 - boxCenterZ;\n" |
| 733 |
> |
" #local pHx = bx1 + bx2 + bx3 - boxCenterX;\n" |
| 734 |
> |
" #local pHy = by1 + by2 + by3 - boxCenterY;\n" |
| 735 |
> |
" #local pHz = bz1 + bz2 + bz3 - boxCenterZ;\n" |
| 736 |
|
"\n" |
| 737 |
|
" #local colorR = 0.90;\n" |
| 738 |
|
" #local colorG = 0.91;\n" |
| 742 |
|
"\n" |
| 743 |
|
" // 1\n" |
| 744 |
|
" cylinder{\n" |
| 745 |
< |
" < boxCenterX-addX, boxCenterY-addY, boxCenterZ-addZ >,\n" |
| 746 |
< |
" < boxCenterX-addX, boxCenterY+addY, boxCenterZ-addZ >,\n" |
| 745 |
> |
" < pAx, pAy, pAz >,\n" |
| 746 |
> |
" < pBx, pBy, pBz >,\n" |
| 747 |
|
" pipeWidth\n" |
| 748 |
|
" texture{\n" |
| 749 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 759 |
|
"\n" |
| 760 |
|
" // 2\n" |
| 761 |
|
" cylinder{\n" |
| 762 |
< |
" < boxCenterX-addX, boxCenterY-addY, boxCenterZ+addZ >,\n" |
| 763 |
< |
" < boxCenterX-addX, boxCenterY+addY, boxCenterZ+addZ >,\n" |
| 762 |
> |
" < pAx, pAy, pAz >,\n" |
| 763 |
> |
" < pCx, pCy, pCz >,\n" |
| 764 |
|
" pipeWidth\n" |
| 765 |
|
" texture{\n" |
| 766 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 776 |
|
"\n" |
| 777 |
|
" // 3\n" |
| 778 |
|
" cylinder{\n" |
| 779 |
< |
" < boxCenterX+addX, boxCenterY-addY, boxCenterZ-addZ >,\n" |
| 780 |
< |
" < boxCenterX+addX, boxCenterY+addY, boxCenterZ-addZ >,\n" |
| 779 |
> |
" < pAx, pAy, pAz >,\n" |
| 780 |
> |
" < pDx, pDy, pDz >,\n" |
| 781 |
|
" pipeWidth\n" |
| 782 |
|
" texture{\n" |
| 783 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 793 |
|
"\n" |
| 794 |
|
" // 4\n" |
| 795 |
|
" cylinder{\n" |
| 796 |
< |
" < boxCenterX+addX, boxCenterY-addY, boxCenterZ+addZ >,\n" |
| 797 |
< |
" < boxCenterX+addX, boxCenterY+addY, boxCenterZ+addZ >,\n" |
| 796 |
> |
" < pBx, pBy, pBz >,\n" |
| 797 |
> |
" < pEx, pEy, pEz >,\n" |
| 798 |
|
" pipeWidth\n" |
| 799 |
|
" texture{\n" |
| 800 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 810 |
|
"\n" |
| 811 |
|
" // 5\n" |
| 812 |
|
" cylinder{\n" |
| 813 |
< |
" < boxCenterX-addX, boxCenterY-addY, boxCenterZ-addZ >,\n" |
| 814 |
< |
" < boxCenterX-addX, boxCenterY-addY, boxCenterZ+addZ >,\n" |
| 813 |
> |
" < pCx, pCy, pCz >,\n" |
| 814 |
> |
" < pEx, pEy, pEz >,\n" |
| 815 |
|
" pipeWidth\n" |
| 816 |
|
" texture{\n" |
| 817 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 827 |
|
"\n" |
| 828 |
|
" // 6\n" |
| 829 |
|
" cylinder{\n" |
| 830 |
< |
" < boxCenterX-addX, boxCenterY-addY, boxCenterZ+addZ >,\n" |
| 831 |
< |
" < boxCenterX+addX, boxCenterY-addY, boxCenterZ+addZ >,\n" |
| 830 |
> |
" < pBx, pBy, pBz >,\n" |
| 831 |
> |
" < pFx, pFy, pFz >,\n" |
| 832 |
|
" pipeWidth\n" |
| 833 |
|
" texture{\n" |
| 834 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 844 |
|
"\n" |
| 845 |
|
" // 7\n" |
| 846 |
|
" cylinder{\n" |
| 847 |
< |
" < boxCenterX+addX, boxCenterY-addY, boxCenterZ+addZ >,\n" |
| 848 |
< |
" < boxCenterX+addX, boxCenterY-addY, boxCenterZ-addZ >,\n" |
| 847 |
> |
" < pCx, pCy, pCz >,\n" |
| 848 |
> |
" < pGx, pGy, pGz >,\n" |
| 849 |
|
" pipeWidth\n" |
| 850 |
|
" texture{\n" |
| 851 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 861 |
|
"\n" |
| 862 |
|
" // 8\n" |
| 863 |
|
" cylinder{\n" |
| 864 |
< |
" < boxCenterX+addX, boxCenterY-addY, boxCenterZ-addZ >,\n" |
| 865 |
< |
" < boxCenterX-addX, boxCenterY-addY, boxCenterZ-addZ >,\n" |
| 864 |
> |
" < pDx, pDy, pDz >,\n" |
| 865 |
> |
" < pGx, pGy, pGz >,\n" |
| 866 |
|
" pipeWidth\n" |
| 867 |
|
" texture{\n" |
| 868 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 878 |
|
"\n" |
| 879 |
|
" // 9\n" |
| 880 |
|
" cylinder{\n" |
| 881 |
< |
" < boxCenterX-addX, boxCenterY+addY, boxCenterZ-addZ >,\n" |
| 882 |
< |
" < boxCenterX-addX, boxCenterY+addY, boxCenterZ+addZ >,\n" |
| 881 |
> |
" < pDx, pDy, pDz >,\n" |
| 882 |
> |
" < pFx, pFy, pFz >,\n" |
| 883 |
|
" pipeWidth\n" |
| 884 |
|
" texture{\n" |
| 885 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 895 |
|
"\n" |
| 896 |
|
" // 10\n" |
| 897 |
|
" cylinder{\n" |
| 898 |
< |
" < boxCenterX-addX, boxCenterY+addY, boxCenterZ+addZ >,\n" |
| 899 |
< |
" < boxCenterX+addX, boxCenterY+addY, boxCenterZ+addZ >,\n" |
| 898 |
> |
" < pEx, pEy, pEz >,\n" |
| 899 |
> |
" < pHx, pHy, pHz >,\n" |
| 900 |
|
" pipeWidth\n" |
| 901 |
|
" texture{\n" |
| 902 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 912 |
|
"\n" |
| 913 |
|
" // 11\n" |
| 914 |
|
" cylinder{\n" |
| 915 |
< |
" < boxCenterX+addX, boxCenterY+addY, boxCenterZ+addZ >,\n" |
| 916 |
< |
" < boxCenterX+addX, boxCenterY+addY, boxCenterZ-addZ >,\n" |
| 915 |
> |
" < pFx, pFy, pFz >,\n" |
| 916 |
> |
" < pHx, pHy, pHz >,\n" |
| 917 |
|
" pipeWidth\n" |
| 918 |
|
" texture{\n" |
| 919 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 929 |
|
"\n" |
| 930 |
|
" // 12\n" |
| 931 |
|
" cylinder{\n" |
| 932 |
< |
" < boxCenterX+addX, boxCenterY+addY, boxCenterZ-addZ >,\n" |
| 933 |
< |
" < boxCenterX-addX, boxCenterY+addY, boxCenterZ-addZ >,\n" |
| 932 |
> |
" < pGx, pGy, pGz >,\n" |
| 933 |
> |
" < pHx, pHy, pHz >,\n" |
| 934 |
|
" pipeWidth\n" |
| 935 |
|
" texture{\n" |
| 936 |
|
" pigment{ rgb < colorR, colorG, colorB > }\n" |