| 16 |
|
|
| 17 |
|
struct linked_xyz{ |
| 18 |
|
struct coords *r; |
| 19 |
+ |
double Hmat[3][3]; |
| 20 |
|
struct linked_xyz *next; |
| 21 |
|
}; |
| 22 |
|
|
| 24 |
|
int draw_bonds = 0; /* boolean to draw bonds or not */ |
| 25 |
|
int draw_hydrogens = 0; /*boolean to draw hydrogens */ |
| 26 |
|
int draw_atoms = 0; /*boolean to draw atoms */ |
| 27 |
+ |
int draw_box = 0; // boolean to draw the periodic Box |
| 28 |
|
int regenerateBonds = 0; // boolean to regenearate bonds each frame |
| 29 |
|
|
| 30 |
|
void usage(void); |
| 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 */ |
| 68 |
|
int nZeroes; |
| 69 |
|
double count; |
| 70 |
|
|
| 71 |
+ |
int startFrame = 1; |
| 72 |
+ |
int endFrame; |
| 73 |
+ |
int span = 0; |
| 74 |
+ |
int currentCount = 0; |
| 75 |
+ |
int haveEnd = 0; |
| 76 |
+ |
|
| 77 |
|
struct linked_xyz *current_frame; |
| 78 |
|
struct linked_xyz *temp_frame; |
| 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 */ |
| 86 |
|
|
| 131 |
|
done = 1; |
| 132 |
|
break; |
| 133 |
|
|
| 134 |
+ |
case 'f': |
| 135 |
+ |
// -f <#> => frame to render |
| 136 |
+ |
|
| 137 |
+ |
i++; |
| 138 |
+ |
startFrame = atoi( argv[i] ); |
| 139 |
+ |
endFrame = startFrame; |
| 140 |
+ |
haveEnd = 1; |
| 141 |
+ |
done = 1; |
| 142 |
+ |
break; |
| 143 |
+ |
|
| 144 |
+ |
case 's': |
| 145 |
+ |
// -s <#> => frame to start |
| 146 |
+ |
|
| 147 |
+ |
i++; |
| 148 |
+ |
startFrame = atoi( argv[i] ); |
| 149 |
+ |
done = 1; |
| 150 |
+ |
break; |
| 151 |
+ |
|
| 152 |
+ |
case 'e': |
| 153 |
+ |
// -e <#> => frame to end |
| 154 |
+ |
|
| 155 |
+ |
i++; |
| 156 |
+ |
endFrame = atoi( argv[i] ); |
| 157 |
+ |
haveEnd = 1; |
| 158 |
+ |
done = 1; |
| 159 |
+ |
break; |
| 160 |
+ |
|
| 161 |
|
case 'H': |
| 162 |
|
// -h => generate a pov-ray Header |
| 163 |
|
|
| 186 |
|
// -r => regenerate bonds |
| 187 |
|
|
| 188 |
|
regenerateBonds = 1; |
| 189 |
+ |
break; |
| 190 |
+ |
|
| 191 |
+ |
case 'p': |
| 192 |
+ |
// -r => draw periodic box |
| 193 |
+ |
|
| 194 |
+ |
draw_box = 1; |
| 195 |
|
break; |
| 196 |
|
|
| 197 |
|
default: |
| 281 |
|
current_frame->next = NULL; |
| 282 |
|
|
| 283 |
|
|
| 284 |
< |
while(eof_test != NULL){ |
| 284 |
> |
if( haveEnd ) span = endFrame - startFrame; |
| 285 |
> |
done = 0; |
| 286 |
> |
if( span < 0 ) done = 1; |
| 287 |
> |
while( (eof_test != NULL) && !done ){ |
| 288 |
|
|
| 289 |
|
(void)sscanf(read_buffer, "%d", &n_atoms); |
| 290 |
|
current_frame->r = |
| 297 |
|
printf("error in reading file\n"); |
| 298 |
|
exit(8); |
| 299 |
|
} |
| 300 |
+ |
|
| 301 |
+ |
// unless we need to get the box size |
| 302 |
+ |
|
| 303 |
+ |
if( draw_box ){ |
| 304 |
+ |
foo = strtok(read_buffer, " ,;\t"); |
| 305 |
+ |
if(foo == NULL){ |
| 306 |
+ |
printf("error in reading file\n"); |
| 307 |
+ |
exit(8); |
| 308 |
+ |
} |
| 309 |
+ |
|
| 310 |
+ |
foo = strtok(NULL, " ,;\t"); |
| 311 |
+ |
if(foo == NULL){ |
| 312 |
+ |
printf("error in reading file\n"); |
| 313 |
+ |
exit(8); |
| 314 |
+ |
} |
| 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->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->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++){ |
| 376 |
|
|
| 377 |
|
eof_test = fgets(read_buffer, sizeof(read_buffer), in_file); |
| 381 |
|
} |
| 382 |
|
|
| 383 |
|
foo = strtok(read_buffer, " ,;\t"); |
| 384 |
+ |
if(foo == NULL){ |
| 385 |
+ |
printf("error in reading file\n"); |
| 386 |
+ |
exit(8); |
| 387 |
+ |
} |
| 388 |
|
(void)strcpy(current_frame->r[i].name, foo); /*copy the atom name */ |
| 389 |
|
|
| 390 |
|
/* next we grab the positions */ |
| 419 |
|
if(current_frame->r[i].z < small_z) small_z = current_frame->r[i].z; |
| 420 |
|
|
| 421 |
|
} |
| 422 |
+ |
currentCount++; |
| 423 |
|
|
| 424 |
< |
if(n_interpolate && current_frame->next != NULL){ |
| 425 |
< |
|
| 426 |
< |
temp_frame = current_frame->next; |
| 302 |
< |
|
| 303 |
< |
for(i = 0; i < n_interpolate; i++){ |
| 424 |
> |
|
| 425 |
> |
if( currentCount >= startFrame ){ |
| 426 |
> |
if(n_interpolate && current_frame->next != NULL){ |
| 427 |
|
|
| 428 |
< |
/* open the new output file */ |
| 428 |
> |
temp_frame = current_frame->next; |
| 429 |
|
|
| 430 |
< |
sprintf(out_name, out_format, n_out ); |
| 431 |
< |
out_file = fopen(out_name, "w"); |
| 432 |
< |
n_out++; |
| 433 |
< |
if(out_file == NULL){ |
| 434 |
< |
printf("error opening output file: %s\n", out_name); |
| 435 |
< |
exit(8); |
| 436 |
< |
} |
| 437 |
< |
(void)fprintf(out_file, |
| 438 |
< |
"// The following script was automatically generated by:\n" |
| 439 |
< |
"// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n" |
| 440 |
< |
"\n" |
| 441 |
< |
"#include \"pov_header.pov\"\n" |
| 442 |
< |
"\n"); |
| 443 |
< |
|
| 444 |
< |
out_coords = |
| 445 |
< |
(struct coords *)calloc(n_atoms, sizeof(struct coords)); |
| 446 |
< |
|
| 447 |
< |
for(j=0; j < n_atoms; j++){ |
| 325 |
< |
dx = current_frame->r[j].x - temp_frame->r[j].x; |
| 326 |
< |
dy = current_frame->r[j].y - temp_frame->r[j].y; |
| 327 |
< |
dz = current_frame->r[j].z - temp_frame->r[j].z; |
| 430 |
> |
for(i = 0; i < n_interpolate; i++){ |
| 431 |
> |
|
| 432 |
> |
/* open the new output file */ |
| 433 |
> |
|
| 434 |
> |
sprintf(out_name, out_format, currentCount ); |
| 435 |
> |
out_file = fopen(out_name, "w"); |
| 436 |
> |
currentCount++; |
| 437 |
> |
if(out_file == NULL){ |
| 438 |
> |
printf("error opening output file: %s\n", out_name); |
| 439 |
> |
exit(8); |
| 440 |
> |
} |
| 441 |
> |
(void)fprintf(out_file, |
| 442 |
> |
"// The following script was automatically generated by:\n" |
| 443 |
> |
"// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n" |
| 444 |
> |
"\n" |
| 445 |
> |
"#include \"pov_header.pov\"\n" |
| 446 |
> |
"\n"); |
| 447 |
> |
if( draw_box ){ |
| 448 |
|
|
| 449 |
< |
dx /= (double)(n_interpolate + 1); |
| 450 |
< |
dy /= (double)(n_interpolate + 1); |
| 451 |
< |
dz /= (double)(n_interpolate + 1); |
| 452 |
< |
|
| 453 |
< |
strcpy(out_coords[j].name, temp_frame->r[j].name); |
| 454 |
< |
out_coords[j].x = temp_frame->r[j].x + dx * (i+1); |
| 455 |
< |
out_coords[j].y = temp_frame->r[j].y + dy * (i+1); |
| 456 |
< |
out_coords[j].z = temp_frame->r[j].z + dz * (i+1); |
| 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, %lf, %lf, %lf, %lf, %lf, %lf)\n" |
| 458 |
> |
"\n", |
| 459 |
> |
temp_frame->Hmat[0][0] + dm[0][0] * (i+1), |
| 460 |
> |
temp_frame->Hmat[2][0] + dm[2][0] * (i+1), |
| 461 |
> |
temp_frame->Hmat[1][0] + dm[1][0] * (i+1), |
| 462 |
> |
temp_frame->Hmat[0][1] + dm[0][1] * (i+1), |
| 463 |
> |
temp_frame->Hmat[2][1] + dm[2][1] * (i+1), |
| 464 |
> |
temp_frame->Hmat[1][1] + dm[1][1] * (i+1), |
| 465 |
> |
temp_frame->Hmat[0][2] + dm[0][2] * (i+1), |
| 466 |
> |
temp_frame->Hmat[2][2] + dm[2][2] * (i+1), |
| 467 |
> |
temp_frame->Hmat[1][2] + dm[1][2] * (i+1) ); |
| 468 |
> |
} |
| 469 |
> |
|
| 470 |
> |
|
| 471 |
> |
out_coords = |
| 472 |
> |
(struct coords *)calloc(n_atoms, sizeof(struct coords)); |
| 473 |
> |
|
| 474 |
> |
for(j=0; j < n_atoms; j++){ |
| 475 |
> |
dx = current_frame->r[j].x - temp_frame->r[j].x; |
| 476 |
> |
dy = current_frame->r[j].y - temp_frame->r[j].y; |
| 477 |
> |
dz = current_frame->r[j].z - temp_frame->r[j].z; |
| 478 |
> |
|
| 479 |
> |
dx /= (double)(n_interpolate + 1); |
| 480 |
> |
dy /= (double)(n_interpolate + 1); |
| 481 |
> |
dz /= (double)(n_interpolate + 1); |
| 482 |
> |
|
| 483 |
> |
strcpy(out_coords[j].name, temp_frame->r[j].name); |
| 484 |
> |
out_coords[j].x = temp_frame->r[j].x + dx * (i+1); |
| 485 |
> |
out_coords[j].y = temp_frame->r[j].y + dy * (i+1); |
| 486 |
> |
out_coords[j].z = temp_frame->r[j].z + dz * (i+1); |
| 487 |
> |
} |
| 488 |
> |
|
| 489 |
> |
pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds, |
| 490 |
> |
draw_atoms); |
| 491 |
> |
free(out_coords); |
| 492 |
> |
(void)fclose(out_file); |
| 493 |
|
} |
| 494 |
+ |
} |
| 495 |
+ |
|
| 496 |
+ |
/* open the new output file */ |
| 497 |
+ |
|
| 498 |
+ |
sprintf(out_name, out_format, currentCount ); |
| 499 |
+ |
out_file = fopen(out_name, "w"); |
| 500 |
+ |
if(out_file == NULL){ |
| 501 |
+ |
printf("error opening output file: %s\n", out_name); |
| 502 |
+ |
exit(8); |
| 503 |
+ |
} |
| 504 |
+ |
(void)fprintf(out_file, |
| 505 |
+ |
"// The following script was automatically generated by:\n" |
| 506 |
+ |
"// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n" |
| 507 |
+ |
"\n" |
| 508 |
+ |
"#include \"pov_header.pov\"\n" |
| 509 |
+ |
"\n"); |
| 510 |
+ |
|
| 511 |
+ |
if( draw_box ){ |
| 512 |
|
|
| 513 |
< |
pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds, |
| 514 |
< |
draw_atoms); |
| 515 |
< |
free(out_coords); |
| 516 |
< |
(void)fclose(out_file); |
| 513 |
> |
fprintf( out_file, |
| 514 |
> |
"makePeriodicBox( %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf %lf )\n" |
| 515 |
> |
"\n", |
| 516 |
> |
current_frame->Hmat[0][0], |
| 517 |
> |
current_frame->Hmat[2][0], |
| 518 |
> |
current_frame->Hmat[1][0], |
| 519 |
> |
current_frame->Hmat[0][1], |
| 520 |
> |
current_frame->Hmat[2][1], |
| 521 |
> |
current_frame->Hmat[1][1], |
| 522 |
> |
current_frame->Hmat[0][2], |
| 523 |
> |
current_frame->Hmat[2][2], |
| 524 |
> |
current_frame->Hmat[1][2] ); |
| 525 |
|
} |
| 526 |
+ |
|
| 527 |
+ |
|
| 528 |
+ |
|
| 529 |
+ |
out_coords = |
| 530 |
+ |
(struct coords *)calloc(n_atoms, sizeof(struct coords)); |
| 531 |
+ |
|
| 532 |
+ |
for(i = 0; i < n_atoms; i++){ |
| 533 |
+ |
strcpy(out_coords[i].name, current_frame->r[i].name); |
| 534 |
+ |
out_coords[i].x = current_frame->r[i].x; |
| 535 |
+ |
out_coords[i].y = current_frame->r[i].y; |
| 536 |
+ |
out_coords[i].z = current_frame->r[i].z; |
| 537 |
+ |
} |
| 538 |
+ |
pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds, |
| 539 |
+ |
draw_atoms); |
| 540 |
+ |
free(out_coords); |
| 541 |
+ |
|
| 542 |
+ |
(void)fclose(out_file); |
| 543 |
|
} |
| 345 |
– |
|
| 346 |
– |
/* open the new output file */ |
| 544 |
|
|
| 348 |
– |
sprintf(out_name, out_format, n_out ); |
| 349 |
– |
out_file = fopen(out_name, "w"); |
| 350 |
– |
n_out++; |
| 351 |
– |
if(out_file == NULL){ |
| 352 |
– |
printf("error opening output file: %s\n", out_name); |
| 353 |
– |
exit(8); |
| 354 |
– |
} |
| 355 |
– |
(void)fprintf(out_file, |
| 356 |
– |
"// The following script was automatically generated by:\n" |
| 357 |
– |
"// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n" |
| 358 |
– |
"\n" |
| 359 |
– |
"#include \"pov_header.pov\"\n" |
| 360 |
– |
"\n"); |
| 361 |
– |
|
| 362 |
– |
out_coords = |
| 363 |
– |
(struct coords *)calloc(n_atoms, sizeof(struct coords)); |
| 364 |
– |
|
| 365 |
– |
for(i = 0; i < n_atoms; i++){ |
| 366 |
– |
strcpy(out_coords[i].name, current_frame->r[i].name); |
| 367 |
– |
out_coords[i].x = current_frame->r[i].x; |
| 368 |
– |
out_coords[i].y = current_frame->r[i].y; |
| 369 |
– |
out_coords[i].z = current_frame->r[i].z; |
| 370 |
– |
} |
| 371 |
– |
pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds, |
| 372 |
– |
draw_atoms); |
| 373 |
– |
free(out_coords); |
| 374 |
– |
|
| 375 |
– |
(void)fclose(out_file); |
| 376 |
– |
|
| 545 |
|
/*free up memory */ |
| 546 |
|
|
| 547 |
|
temp_frame = current_frame->next; |
| 561 |
|
|
| 562 |
|
eof_test = fgets(read_buffer, sizeof(read_buffer), in_file); |
| 563 |
|
|
| 564 |
+ |
if( haveEnd ){ |
| 565 |
+ |
if( currentCount >= (endFrame + n_interpolate * span) ) done = 1; |
| 566 |
+ |
} |
| 567 |
|
} |
| 568 |
|
|
| 569 |
|
(void)fclose(in_file); |
| 579 |
|
diagonal = sqrt(rsqr); |
| 580 |
|
diagonal *= 0.5; |
| 581 |
|
|
| 582 |
+ |
// calculate the center |
| 583 |
+ |
|
| 584 |
+ |
dx = big_x + small_x; |
| 585 |
+ |
dy = big_y + small_y; |
| 586 |
+ |
dz = big_z + small_z; |
| 587 |
+ |
|
| 588 |
|
dx /= 2.0; |
| 589 |
|
dy /= 2.0; |
| 590 |
|
dz /= 2.0; |
| 591 |
< |
|
| 415 |
< |
dx += small_x; |
| 416 |
< |
dy += small_y; |
| 417 |
< |
dz += small_z; |
| 418 |
< |
|
| 591 |
> |
|
| 592 |
|
|
| 593 |
|
/*note the y and z axis is exchanged for the different coordinate |
| 594 |
|
system in pov-ray*/ |
| 618 |
|
"#declare Width = 640.0;\n" |
| 619 |
|
"#declare Height = 480.0;\n" |
| 620 |
|
"#declare Ratio = Width / Height;\n" |
| 448 |
– |
"\n" |
| 449 |
– |
"#declare zoom = %lf;\n" |
| 621 |
|
"\n" |
| 622 |
|
"#declare ATOM_SPHERE_FACTOR = 0.2;\n" |
| 623 |
|
"#declare BOND_RADIUS = 0.1;\n" |
| 624 |
|
"\n" |
| 625 |
< |
"camera{\n" |
| 626 |
< |
" location < %lf, %lf, %lf - zoom>\n" |
| 627 |
< |
" right < Ratio , 0, 0>\n" |
| 628 |
< |
" look_at < %lf, %lf, %lf >\n" |
| 629 |
< |
"}\n" |
| 625 |
> |
"// declare camera, light, and system variables\n" |
| 626 |
> |
"\n" |
| 627 |
> |
"#declare sysCenterX = %lf;\n" |
| 628 |
> |
"#declare sysCenterY = %lf;\n" |
| 629 |
> |
"#declare sysCenterZ = %lf;\n" |
| 630 |
> |
"\n" |
| 631 |
> |
"#declare zoom = %lf;\n" |
| 632 |
|
"\n", |
| 460 |
– |
diagonal, |
| 633 |
|
dx, dz, dy, |
| 634 |
< |
dx, dz, dy); |
| 635 |
< |
|
| 634 |
> |
diagonal ); |
| 635 |
> |
|
| 636 |
|
fprintf(out_file, |
| 637 |
+ |
"#declare cameraLookX = sysCenterX;\n" |
| 638 |
+ |
"#declare cameraLookY = sysCenterY;\n" |
| 639 |
+ |
"#declare cameraLookZ = sysCenterZ;\n" |
| 640 |
+ |
"\n" |
| 641 |
+ |
"#declare cameraX = cameraLookX;\n" |
| 642 |
+ |
"#declare cameraY = cameraLookY;\n" |
| 643 |
+ |
"#declare cameraZ = cameraLookZ - zoom;\n" |
| 644 |
+ |
"\n" |
| 645 |
+ |
"#declare lightAx = cameraX;\n" |
| 646 |
+ |
"#declare lightAy = cameraY;\n" |
| 647 |
+ |
"#declare lightAz = cameraZ;\n" |
| 648 |
+ |
"\n" |
| 649 |
+ |
"#declare lightBx = cameraX - zoom;\n" |
| 650 |
+ |
"#declare lightBy = cameraY + zoom;\n" |
| 651 |
+ |
"#declare lightBz = cameraZ;\n" |
| 652 |
+ |
"\n" |
| 653 |
+ |
"#declare boxCenterX = cameraLookX;\n" |
| 654 |
+ |
"#declare boxCenterY = cameraLookY;\n" |
| 655 |
+ |
"#declare boxCenterZ = cameraLookZ;\n" |
| 656 |
+ |
"\n" |
| 657 |
+ |
"// declare the cameras and the light sources\n" |
| 658 |
+ |
"\n" |
| 659 |
+ |
"camera{\n" |
| 660 |
+ |
" location < cameraX, cameraY, cameraZ>\n" |
| 661 |
+ |
" right < Ratio , 0, 0>\n" |
| 662 |
+ |
" look_at < cameraLookX, cameraLookY, cameraLookZ >\n" |
| 663 |
+ |
"}\n" |
| 664 |
+ |
"\n" |
| 665 |
|
"light_source{\n" |
| 666 |
< |
" < %lf, %lf, %lf - zoom >\n" |
| 667 |
< |
" rgb < 1.0, 1.0, 1.0 > }\n", |
| 668 |
< |
dx, dz, dy); |
| 469 |
< |
|
| 470 |
< |
fprintf(out_file, |
| 666 |
> |
" < lightAx, lightAy, lightAz >\n" |
| 667 |
> |
" rgb < 1.0, 1.0, 1.0 > }\n" |
| 668 |
> |
"\n" |
| 669 |
|
"light_source{\n" |
| 670 |
< |
" < %lf - zoom , %lf + zoom, %lf - zoom >\n" |
| 670 |
> |
" < lightBx, lightBy, lightBz >\n" |
| 671 |
|
" rgb < 1.0, 1.0, 1.0 > }\n" |
| 672 |
|
"\n" |
| 673 |
< |
"\n", |
| 476 |
< |
dx, dz, dy); |
| 477 |
< |
|
| 478 |
< |
fprintf(out_file, |
| 673 |
> |
"\n" |
| 674 |
|
"//************************************************************\n" |
| 675 |
|
"// Set whether or not to rotate the system.\n" |
| 676 |
|
"//\n" |
| 701 |
|
" #declare A33 = cos(theta_r);\n" |
| 702 |
|
"\n" |
| 703 |
|
"#end\n" |
| 704 |
+ |
"\n" |
| 705 |
+ |
"\n" |
| 706 |
+ |
"//************************************************************\n" |
| 707 |
+ |
"// declare the periodic box macro\n" |
| 708 |
+ |
"//************************************************************\n" |
| 709 |
+ |
"\n" |
| 710 |
+ |
"#macro makePeriodicBox( bx1, by1, bz1, bx2, by2, bz2, bx3, by3, bz3 )\n" |
| 711 |
+ |
"\n" |
| 712 |
+ |
" #local bcx = (bx1 + bx2 + bx3) / 2.0;\n" |
| 713 |
+ |
" #local bcy = (by1 + by2 + by3) / 2.0;\n" |
| 714 |
+ |
" #local bcz = (bz1 + bz2 + bz3) / 2.0;\n" |
| 715 |
+ |
"\n" |
| 716 |
+ |
" #local pAx = boxCenterX - bcx;\n" |
| 717 |
+ |
" #local pAy = boxCenterY - bcy;\n" |
| 718 |
+ |
" #local pAz = boxCenterZ - bcz;\n" |
| 719 |
+ |
" #local pBx = boxCenterX + bx1 - bcx;\n" |
| 720 |
+ |
" #local pBy = boxCenterY + by1 - bcy;\n" |
| 721 |
+ |
" #local pBz = boxCenterZ + bz1 - bcz;\n" |
| 722 |
+ |
" #local pCx = boxCenterX + bx2 - bcx;\n" |
| 723 |
+ |
" #local pCy = boxCenterY + by2 - bcy;\n" |
| 724 |
+ |
" #local pCz = boxCenterZ + bz2 - bcz;\n" |
| 725 |
+ |
" #local pDx = boxCenterX + bx3 - bcx;\n" |
| 726 |
+ |
" #local pDy = boxCenterY + by3 - bcy;\n" |
| 727 |
+ |
" #local pDz = boxCenterZ + bz3 - bcz;\n" |
| 728 |
+ |
" #local pEx = boxCenterX + bx1 + bx2 - bcx;\n" |
| 729 |
+ |
" #local pEy = boxCenterY + by1 + by2 - bcy;\n" |
| 730 |
+ |
" #local pEz = boxCenterZ + bz1 + bz2 - bcz;\n" |
| 731 |
+ |
" #local pFx = boxCenterX + bx1 + bx3 - bcx;\n" |
| 732 |
+ |
" #local pFy = boxCenterY + by1 + by3 - bcy;\n" |
| 733 |
+ |
" #local pFz = boxCenterZ + bz1 + bz3 - bcz;\n" |
| 734 |
+ |
" #local pGx = boxCenterX + bx2 + bx3 - bcx;\n" |
| 735 |
+ |
" #local pGy = boxCenterY + by2 + by3 - bcy;\n" |
| 736 |
+ |
" #local pGz = boxCenterZ + bz2 + bz3 - bcz;\n" |
| 737 |
+ |
" #local pHx = boxCenterX + bx1 + bx2 + bx3 - bcx;\n" |
| 738 |
+ |
" #local pHy = boxCenterY + by1 + by2 + by3 - bcy;\n" |
| 739 |
+ |
" #local pHz = boxCenterZ + bz1 + bz2 + bz3 - bcz;\n" |
| 740 |
+ |
"\n" |
| 741 |
+ |
" #local colorR = 0.90;\n" |
| 742 |
+ |
" #local colorG = 0.91;\n" |
| 743 |
+ |
" #local colorB = 0.98;\n" |
| 744 |
+ |
"\n" |
| 745 |
+ |
" #local pipeWidth = 0.4;\n" |
| 746 |
+ |
"\n" |
| 747 |
+ |
" // 1\n" |
| 748 |
+ |
" cylinder{\n" |
| 749 |
+ |
" < pAx, pAy, pAz >,\n" |
| 750 |
+ |
" < pBx, pBy, pBz >,\n" |
| 751 |
+ |
" pipeWidth\n" |
| 752 |
+ |
" texture{\n" |
| 753 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 754 |
+ |
" finish{\n" |
| 755 |
+ |
" ambient .2\n" |
| 756 |
+ |
" diffuse .6\n" |
| 757 |
+ |
" specular 1\n" |
| 758 |
+ |
" roughness .001\n" |
| 759 |
+ |
" metallic\n" |
| 760 |
+ |
" }\n" |
| 761 |
+ |
" }\n" |
| 762 |
+ |
" }\n" |
| 763 |
+ |
"\n" |
| 764 |
+ |
" // 2\n" |
| 765 |
+ |
" cylinder{\n" |
| 766 |
+ |
" < pAx, pAy, pAz >,\n" |
| 767 |
+ |
" < pCx, pCy, pCz >,\n" |
| 768 |
+ |
" pipeWidth\n" |
| 769 |
+ |
" texture{\n" |
| 770 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 771 |
+ |
" finish{\n" |
| 772 |
+ |
" ambient .2\n" |
| 773 |
+ |
" diffuse .6\n" |
| 774 |
+ |
" specular 1\n" |
| 775 |
+ |
" roughness .001\n" |
| 776 |
+ |
" metallic\n" |
| 777 |
+ |
" }\n" |
| 778 |
+ |
" }\n" |
| 779 |
+ |
" }\n" |
| 780 |
+ |
"\n" |
| 781 |
+ |
" // 3\n" |
| 782 |
+ |
" cylinder{\n" |
| 783 |
+ |
" < pAx, pAy, pAz >,\n" |
| 784 |
+ |
" < pDx, pDy, pDz >,\n" |
| 785 |
+ |
" pipeWidth\n" |
| 786 |
+ |
" texture{\n" |
| 787 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 788 |
+ |
" finish{\n" |
| 789 |
+ |
" ambient .2\n" |
| 790 |
+ |
" diffuse .6\n" |
| 791 |
+ |
" specular 1\n" |
| 792 |
+ |
" roughness .001\n" |
| 793 |
+ |
" metallic\n" |
| 794 |
+ |
" }\n" |
| 795 |
+ |
" }\n" |
| 796 |
+ |
" }\n" |
| 797 |
+ |
"\n" |
| 798 |
+ |
" // 4\n" |
| 799 |
+ |
" cylinder{\n" |
| 800 |
+ |
" < pBx, pBy, pBz >,\n" |
| 801 |
+ |
" < pEx, pEy, pEz >,\n" |
| 802 |
+ |
" pipeWidth\n" |
| 803 |
+ |
" texture{\n" |
| 804 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 805 |
+ |
" finish{\n" |
| 806 |
+ |
" ambient .2\n" |
| 807 |
+ |
" diffuse .6\n" |
| 808 |
+ |
" specular 1\n" |
| 809 |
+ |
" roughness .001\n" |
| 810 |
+ |
" metallic\n" |
| 811 |
+ |
" }\n" |
| 812 |
+ |
" }\n" |
| 813 |
+ |
" }\n" |
| 814 |
+ |
"\n" |
| 815 |
+ |
" // 5\n" |
| 816 |
+ |
" cylinder{\n" |
| 817 |
+ |
" < pCx, pCy, pCz >,\n" |
| 818 |
+ |
" < pEx, pEy, pEz >,\n" |
| 819 |
+ |
" pipeWidth\n" |
| 820 |
+ |
" texture{\n" |
| 821 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 822 |
+ |
" finish{\n" |
| 823 |
+ |
" ambient .2\n" |
| 824 |
+ |
" diffuse .6\n" |
| 825 |
+ |
" specular 1\n" |
| 826 |
+ |
" roughness .001\n" |
| 827 |
+ |
" metallic\n" |
| 828 |
+ |
" }\n" |
| 829 |
+ |
" }\n" |
| 830 |
+ |
" }\n" |
| 831 |
+ |
"\n" |
| 832 |
+ |
" // 6\n" |
| 833 |
+ |
" cylinder{\n" |
| 834 |
+ |
" < pBx, pBy, pBz >,\n" |
| 835 |
+ |
" < pFx, pFy, pFz >,\n" |
| 836 |
+ |
" pipeWidth\n" |
| 837 |
+ |
" texture{\n" |
| 838 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 839 |
+ |
" finish{\n" |
| 840 |
+ |
" ambient .2\n" |
| 841 |
+ |
" diffuse .6\n" |
| 842 |
+ |
" specular 1\n" |
| 843 |
+ |
" roughness .001\n" |
| 844 |
+ |
" metallic\n" |
| 845 |
+ |
" }\n" |
| 846 |
+ |
" }\n" |
| 847 |
+ |
" }\n" |
| 848 |
+ |
"\n" |
| 849 |
+ |
" // 7\n" |
| 850 |
+ |
" cylinder{\n" |
| 851 |
+ |
" < pCx, pCy, pCz >,\n" |
| 852 |
+ |
" < pGx, pGy, pGz >,\n" |
| 853 |
+ |
" pipeWidth\n" |
| 854 |
+ |
" texture{\n" |
| 855 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 856 |
+ |
" finish{\n" |
| 857 |
+ |
" ambient .2\n" |
| 858 |
+ |
" diffuse .6\n" |
| 859 |
+ |
" specular 1\n" |
| 860 |
+ |
" roughness .001\n" |
| 861 |
+ |
" metallic\n" |
| 862 |
+ |
" }\n" |
| 863 |
+ |
" }\n" |
| 864 |
+ |
" }\n" |
| 865 |
+ |
"\n" |
| 866 |
+ |
" // 8\n" |
| 867 |
+ |
" cylinder{\n" |
| 868 |
+ |
" < pDx, pDy, pDz >,\n" |
| 869 |
+ |
" < pGx, pGy, pGz >,\n" |
| 870 |
+ |
" pipeWidth\n" |
| 871 |
+ |
" texture{\n" |
| 872 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 873 |
+ |
" finish{\n" |
| 874 |
+ |
" ambient .2\n" |
| 875 |
+ |
" diffuse .6\n" |
| 876 |
+ |
" specular 1\n" |
| 877 |
+ |
" roughness .001\n" |
| 878 |
+ |
" metallic\n" |
| 879 |
+ |
" }\n" |
| 880 |
+ |
" }\n" |
| 881 |
+ |
" }\n" |
| 882 |
+ |
"\n" |
| 883 |
+ |
" // 9\n" |
| 884 |
+ |
" cylinder{\n" |
| 885 |
+ |
" < pDx, pDy, pDz >,\n" |
| 886 |
+ |
" < pFx, pFy, pFz >,\n" |
| 887 |
+ |
" pipeWidth\n" |
| 888 |
+ |
" texture{\n" |
| 889 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 890 |
+ |
" finish{\n" |
| 891 |
+ |
" ambient .2\n" |
| 892 |
+ |
" diffuse .6\n" |
| 893 |
+ |
" specular 1\n" |
| 894 |
+ |
" roughness .001\n" |
| 895 |
+ |
" metallic\n" |
| 896 |
+ |
" }\n" |
| 897 |
+ |
" }\n" |
| 898 |
+ |
" }\n" |
| 899 |
+ |
"\n" |
| 900 |
+ |
" // 10\n" |
| 901 |
+ |
" cylinder{\n" |
| 902 |
+ |
" < pEx, pEy, pEz >,\n" |
| 903 |
+ |
" < pHx, pHy, pHz >,\n" |
| 904 |
+ |
" pipeWidth\n" |
| 905 |
+ |
" texture{\n" |
| 906 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 907 |
+ |
" finish{\n" |
| 908 |
+ |
" ambient .2\n" |
| 909 |
+ |
" diffuse .6\n" |
| 910 |
+ |
" specular 1\n" |
| 911 |
+ |
" roughness .001\n" |
| 912 |
+ |
" metallic\n" |
| 913 |
+ |
" }\n" |
| 914 |
+ |
" }\n" |
| 915 |
+ |
" }\n" |
| 916 |
+ |
"\n" |
| 917 |
+ |
" // 11\n" |
| 918 |
+ |
" cylinder{\n" |
| 919 |
+ |
" < pFx, pFy, pFz >,\n" |
| 920 |
+ |
" < pHx, pHy, pHz >,\n" |
| 921 |
+ |
" pipeWidth\n" |
| 922 |
+ |
" texture{\n" |
| 923 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 924 |
+ |
" finish{\n" |
| 925 |
+ |
" ambient .2\n" |
| 926 |
+ |
" diffuse .6\n" |
| 927 |
+ |
" specular 1\n" |
| 928 |
+ |
" roughness .001\n" |
| 929 |
+ |
" metallic\n" |
| 930 |
+ |
" }\n" |
| 931 |
+ |
" }\n" |
| 932 |
+ |
" }\n" |
| 933 |
+ |
"\n" |
| 934 |
+ |
" // 12\n" |
| 935 |
+ |
" cylinder{\n" |
| 936 |
+ |
" < pGx, pGy, pGz >,\n" |
| 937 |
+ |
" < pHx, pHy, pHz >,\n" |
| 938 |
+ |
" pipeWidth\n" |
| 939 |
+ |
" texture{\n" |
| 940 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
| 941 |
+ |
" finish{\n" |
| 942 |
+ |
" ambient .2\n" |
| 943 |
+ |
" diffuse .6\n" |
| 944 |
+ |
" specular 1\n" |
| 945 |
+ |
" roughness .001\n" |
| 946 |
+ |
" metallic\n" |
| 947 |
+ |
" }\n" |
| 948 |
+ |
" }\n" |
| 949 |
+ |
" }\n" |
| 950 |
+ |
"\n" |
| 951 |
+ |
"#end\n" |
| 952 |
+ |
"\n" |
| 953 |
|
"\n"); |
| 954 |
< |
|
| 955 |
< |
|
| 954 |
> |
|
| 955 |
> |
|
| 956 |
> |
|
| 957 |
> |
|
| 958 |
|
make_header_macros(out_file); |
| 959 |
|
|
| 960 |
|
fclose(out_file); |
| 982 |
|
" -h draw hydrogens\n" |
| 983 |
|
" -b draw bonds\n" |
| 984 |
|
" -a draw atoms\n" |
| 985 |
+ |
" -p draw periodic box\n" |
| 986 |
|
" -r regenerate bond\n" |
| 987 |
+ |
" -f <#> render frame <#> only\n" |
| 988 |
+ |
" -s <#> begin at frame <#> (inclusive)\n" |
| 989 |
+ |
" -e <#> end at frame <#> (inclusive)\n" |
| 990 |
|
"\n", |
| 991 |
|
program_name); |
| 992 |
|
exit(8); |