ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/xyz2pov/src/xyz2pov.c
Revision: 515
Committed: Thu May 1 17:36:33 2003 UTC (21 years, 2 months ago) by mmeineke
Content type: text/plain
File size: 23280 byte(s)
Log Message:
updated xyz2pov to put out better pov scripts. I'm begining to think pov2anim isn't as useful.
not sure if I should up date it, or just leave the rendering steps to shell scripts.

File Contents

# Content
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <math.h>
5 #include <unistd.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8
9 #include "frameCount.h"
10 #include "atom_parser.h"
11 #include "pov_writer.h"
12
13
14 #define POV_DIR "./pov"
15
16
17 struct linked_xyz{
18 struct coords *r;
19 double boxX, boxY, boxZ;
20 struct linked_xyz *next;
21 };
22
23 char *program_name; /*the name of the program */
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);
31
32 int main(argc, argv)
33 int argc;
34 char *argv[];
35 {
36
37
38 struct coords *out_coords;
39
40 int i,j; /* loop counters */
41 mode_t dir_mode = S_IRWXU;
42
43 int generate_header = 0; /* boolean for generating the pov ray header */
44 double big_x = 0;
45 double big_y = 0; /* lets me know the biggest x y and z */
46 double big_z = 0;
47 double small_x = 0;
48 double small_y = 0; /* lets me know the smallest x, y, z */
49 double small_z = 0;
50 double rsqr; /* the square of the diagonal */
51 double diagonal; /* the diagonal length of the sim box */
52
53 unsigned int n_atoms; /*the number of atoms in each time step */
54 char read_buffer[120]; /*the line buffer for reading */
55 char *eof_test; /*ptr to see when we reach the end of the file */
56 char *foo; /*the pointer to the current string token */
57 FILE *in_file; /* the input file */
58 FILE *out_file; /*the output file */
59 char *out_prefix = NULL; /*the prefix of the output file */
60 int have_prefix = 0;
61 char out_name[500]; /*the output name */
62 char out_format[1000];
63 char *in_name = NULL; /*the name of the input file */
64 unsigned int n_out = 0; /*keeps track of which output file is being written*/
65 int done;
66 char current_flag;
67 int nFrames;
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
83
84 char pov_dir[500]; /* the pov_dir */
85
86 program_name = argv[0]; /*save the program name in case we need it*/
87
88
89 for( i = 1; i < argc; i++){
90
91 if(argv[i][0] =='-'){
92
93 // parse the option
94
95 if(argv[i][1] == '-' ){
96
97 // parse long word options
98
99 fprintf( stderr,
100 "Invalid option \"%s\"\n", argv[i] );
101 usage();
102
103 }
104
105 else{
106
107 // parse single character options
108
109 done = 0;
110 j = 1;
111 current_flag = argv[i][j];
112 while( (current_flag != '\0') && (!done) ){
113
114 switch(current_flag){
115
116 case 'o':
117 // -o <prefix> => the output prefix.
118
119 i++;
120 out_prefix = argv[i];
121 have_prefix = 1;
122 done = 1;
123 break;
124
125 case 'i':
126 // -i <#> => the number to interpolate
127
128 i++;
129 n_interpolate = atoi( argv[i] );
130 done = 1;
131 break;
132
133 case 'f':
134 // -f <#> => frame to render
135
136 i++;
137 startFrame = atoi( argv[i] );
138 endFrame = startFrame;
139 haveEnd = 1;
140 done = 1;
141 break;
142
143 case 's':
144 // -s <#> => frame to start
145
146 i++;
147 startFrame = atoi( argv[i] );
148 done = 1;
149 break;
150
151 case 'e':
152 // -e <#> => frame to end
153
154 i++;
155 endFrame = atoi( argv[i] );
156 haveEnd = 1;
157 done = 1;
158 break;
159
160 case 'H':
161 // -h => generate a pov-ray Header
162
163 generate_header = 1;
164 break;
165
166 case 'h':
167 // -h => draw Hydrogens
168
169 draw_hydrogens = 1;
170 break;
171
172 case 'b':
173 // -b => draw bonds
174
175 draw_bonds = 1;
176 break;
177
178 case 'a':
179 // -a => draw the atoms
180
181 draw_atoms = 1;
182 break;
183
184 case 'r':
185 // -r => regenerate bonds
186
187 regenerateBonds = 1;
188 break;
189
190 case 'p':
191 // -r => draw periodic box
192
193 draw_box = 1;
194 break;
195
196 default:
197
198 (void)fprintf(stderr, "Bad option \"-%c\"\n", current_flag);
199 usage();
200 }
201 j++;
202 current_flag = argv[i][j];
203 }
204 }
205 }
206
207 else{
208
209 if( in_name != NULL ){
210 fprintf( stderr,
211 "Error at \"%s\", program does not currently support\n"
212 "more than one input file.\n"
213 "\n",
214 argv[i]);
215 usage();
216 }
217
218 in_name = argv[i];
219 }
220 }
221
222 if(in_name == NULL){
223 usage();
224 }
225
226
227
228 in_file = fopen(in_name, "r");
229 if(in_file == NULL){
230 printf("Cannot open file: %s\n", in_name);
231 exit(8);
232 }
233
234
235
236 if(access(POV_DIR, F_OK)){
237 /*create the pov directory*/
238 mkdir(POV_DIR, dir_mode);
239 }
240 strcpy(pov_dir, POV_DIR); strcat(pov_dir, "/");
241
242
243 // initialize atom type parser
244
245 initializeParser();
246 initBondList();
247
248 // count the number of frames
249
250 printf( "Counting the number of frames..." );
251 fflush(stdout);
252
253 nFrames = frameCount( in_name );
254
255 printf( "done.\n"
256 "%d frames found\n",
257 nFrames);
258 fflush(stdout);
259
260 // create the output string
261
262 nZeroes = 1;
263 count = (double)( nFrames * (n_interpolate+1) );
264 while( count >= 10.0 ){
265 count /= 10.0;
266 nZeroes++;
267 }
268
269 if(!have_prefix){
270 out_prefix = strtok(in_name, ".");
271 }
272
273 sprintf( out_format, "%s%s%%0%dd.pov", pov_dir, out_prefix, nZeroes );
274
275 // start reading the first frame
276
277 eof_test = fgets(read_buffer, sizeof(read_buffer), in_file);
278
279 current_frame = (struct linked_xyz *)malloc(sizeof(struct linked_xyz));
280 current_frame->next = NULL;
281
282
283 if( haveEnd ) span = endFrame - startFrame;
284 done = 0;
285 if( span < 0 ) done = 1;
286 while( (eof_test != NULL) && !done ){
287
288 (void)sscanf(read_buffer, "%d", &n_atoms);
289 current_frame->r =
290 (struct coords *)calloc(n_atoms, sizeof(struct coords));
291
292 /*read and toss the comment line */
293
294 eof_test = fgets(read_buffer, sizeof(read_buffer), in_file);
295 if(eof_test == NULL){
296 printf("error in reading file\n");
297 exit(8);
298 }
299
300 // unless we need to get the box size
301
302 if( draw_box ){
303 foo = strtok(read_buffer, " ,;\t");
304 if(foo == NULL){
305 printf("error in reading file\n");
306 exit(8);
307 }
308
309 foo = strtok(NULL, " ,;\t");
310 if(foo == NULL){
311 printf("error in reading file\n");
312 exit(8);
313 }
314 current_frame->boxX = atof( foo );
315
316 foo = strtok(NULL, " ,;\t");
317 if(foo == NULL){
318 printf("error in reading file\n");
319 exit(8);
320 }
321 current_frame->boxY = atof( foo );
322
323 foo = strtok(NULL, " ,;\t");
324 if(foo == NULL){
325 printf("error in reading file\n");
326 exit(8);
327 }
328 current_frame->boxZ = atof( foo );
329 }
330
331 for( i=0; i < n_atoms; i++){
332
333 eof_test = fgets(read_buffer, sizeof(read_buffer), in_file);
334 if(eof_test == NULL){
335 printf("error in reading file\n");
336 exit(8);
337 }
338
339 foo = strtok(read_buffer, " ,;\t");
340 if(foo == NULL){
341 printf("error in reading file\n");
342 exit(8);
343 }
344 (void)strcpy(current_frame->r[i].name, foo); /*copy the atom name */
345
346 /* next we grab the positions */
347
348 foo = strtok(NULL, " ,;\t");
349 if(foo == NULL){
350 printf("error in reading file\n");
351 exit(8);
352 }
353 (void)sscanf(foo, "%lf",&current_frame->r[i].x);
354 if(current_frame->r[i].x > big_x) big_x = current_frame->r[i].x;
355 if(current_frame->r[i].x < small_x) small_x = current_frame->r[i].x;
356
357
358 foo = strtok(NULL, " ,;\t");
359 if(foo == NULL){
360 printf("error in reading file\n");
361 exit(8);
362 }
363 (void)sscanf(foo, "%lf", &current_frame->r[i].y);
364 if(current_frame->r[i].y > big_y) big_y = current_frame->r[i].y;
365 if(current_frame->r[i].y < small_y) small_y = current_frame->r[i].y;
366
367
368 foo = strtok(NULL, " ,;\t");
369 if(foo == NULL){
370 printf("error in reading file\n");
371 exit(8);
372 }
373 (void)sscanf(foo, "%lf", &current_frame->r[i].z);
374 if(current_frame->r[i].z > big_z) big_z = current_frame->r[i].z;
375 if(current_frame->r[i].z < small_z) small_z = current_frame->r[i].z;
376
377 }
378 currentCount++;
379
380
381 if( currentCount >= startFrame ){
382 if(n_interpolate && current_frame->next != NULL){
383
384 temp_frame = current_frame->next;
385
386 for(i = 0; i < n_interpolate; i++){
387
388 /* open the new output file */
389
390 sprintf(out_name, out_format, currentCount );
391 out_file = fopen(out_name, "w");
392 currentCount++;
393 if(out_file == NULL){
394 printf("error opening output file: %s\n", out_name);
395 exit(8);
396 }
397 (void)fprintf(out_file,
398 "// The following script was automatically generated by:\n"
399 "// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n"
400 "\n"
401 "#include \"pov_header.pov\"\n"
402 "\n");
403 if( draw_box ){
404 dx = current_frame->boxX - temp_frame->boxX;
405 dy = current_frame->boxY - temp_frame->boxY;
406 dz = current_frame->boxZ - temp_frame->boxZ;
407
408 dx /= (double)(n_interpolate + 1);
409 dy /= (double)(n_interpolate + 1);
410 dz /= (double)(n_interpolate + 1);
411
412 fprintf( out_file,
413 "makePeriodicBox( %lf, %lf, %lf )\n"
414 "\n",
415 temp_frame->boxX + dx * (i+1),
416 temp_frame->boxZ + dz * (i+1),
417 temp_frame->boxY + dy * (i+1) );
418 }
419
420
421 out_coords =
422 (struct coords *)calloc(n_atoms, sizeof(struct coords));
423
424 for(j=0; j < n_atoms; j++){
425 dx = current_frame->r[j].x - temp_frame->r[j].x;
426 dy = current_frame->r[j].y - temp_frame->r[j].y;
427 dz = current_frame->r[j].z - temp_frame->r[j].z;
428
429 dx /= (double)(n_interpolate + 1);
430 dy /= (double)(n_interpolate + 1);
431 dz /= (double)(n_interpolate + 1);
432
433 strcpy(out_coords[j].name, temp_frame->r[j].name);
434 out_coords[j].x = temp_frame->r[j].x + dx * (i+1);
435 out_coords[j].y = temp_frame->r[j].y + dy * (i+1);
436 out_coords[j].z = temp_frame->r[j].z + dz * (i+1);
437 }
438
439 pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds,
440 draw_atoms);
441 free(out_coords);
442 (void)fclose(out_file);
443 }
444 }
445
446 /* open the new output file */
447
448 sprintf(out_name, out_format, currentCount );
449 out_file = fopen(out_name, "w");
450 if(out_file == NULL){
451 printf("error opening output file: %s\n", out_name);
452 exit(8);
453 }
454 (void)fprintf(out_file,
455 "// The following script was automatically generated by:\n"
456 "// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n"
457 "\n"
458 "#include \"pov_header.pov\"\n"
459 "\n");
460
461 if( draw_box ){
462
463 fprintf( out_file,
464 "makePeriodicBox( %lf, %lf, %lf )\n"
465 "\n",
466 current_frame->boxX,
467 current_frame->boxZ,
468 current_frame->boxY );
469 }
470
471
472
473 out_coords =
474 (struct coords *)calloc(n_atoms, sizeof(struct coords));
475
476 for(i = 0; i < n_atoms; i++){
477 strcpy(out_coords[i].name, current_frame->r[i].name);
478 out_coords[i].x = current_frame->r[i].x;
479 out_coords[i].y = current_frame->r[i].y;
480 out_coords[i].z = current_frame->r[i].z;
481 }
482 pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds,
483 draw_atoms);
484 free(out_coords);
485
486 (void)fclose(out_file);
487 }
488
489 /*free up memory */
490
491 temp_frame = current_frame->next;
492 current_frame->next = NULL;
493
494 if(temp_frame != NULL){
495
496 free(temp_frame->r);
497 free(temp_frame);
498 }
499
500 /* make a new frame */
501
502 temp_frame = (struct linked_xyz *)malloc(sizeof(struct linked_xyz));
503 temp_frame->next = current_frame;
504 current_frame = temp_frame;
505
506 eof_test = fgets(read_buffer, sizeof(read_buffer), in_file);
507
508 if( haveEnd ){
509 if( currentCount >= (endFrame + n_interpolate * span) ) done = 1;
510 }
511 }
512
513 (void)fclose(in_file);
514
515
516 if(generate_header){
517
518 dx = big_x - small_x;
519 dy = big_y - small_y;
520 dz = big_z - small_z;
521
522 rsqr = dx * dx + dy * dy + dz * dz;
523 diagonal = sqrt(rsqr);
524 diagonal *= 0.5;
525
526 // calculate the center
527
528 dx = big_x + small_x;
529 dy = big_y + small_y;
530 dz = big_z + small_z;
531
532 dx /= 2.0;
533 dy /= 2.0;
534 dz /= 2.0;
535
536
537 /*note the y and z axis is exchanged for the different coordinate
538 system in pov-ray*/
539
540
541 out_file = fopen("pov_header.pov", "w");
542
543 fprintf(out_file,
544 "// The following script was automatically generated by:\n"
545 "// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n"
546 "\n"
547 "\n"
548 "background { rgb <1.0, 1.0, 1.0> }\n"
549 "\n"
550 "\n"
551 );
552
553 fprintf(out_file,
554 "//******************************************************\n"
555 "// Declare the resolution, camera, and light sources.\n"
556 "//******************************************************\n"
557 "\n"
558 "// NOTE: if you plan to render at a different resoltion,\n"
559 "// be sure to update the following two lines to maintain\n"
560 "// the correct aspect ratio.\n"
561 "\n"
562 "#declare Width = 640.0;\n"
563 "#declare Height = 480.0;\n"
564 "#declare Ratio = Width / Height;\n"
565 "\n"
566 "#declare ATOM_SPHERE_FACTOR = 0.2;\n"
567 "#declare BOND_RADIUS = 0.1;\n"
568 "\n"
569 "// declare camera, light, and system variables\n"
570 "\n"
571 "#declare sysCenterX = %lf;\n"
572 "#declare sysCenterY = %lf;\n"
573 "#declare sysCenterZ = %lf;\n"
574 "\n"
575 "#declare zoom = %lf;\n"
576 "\n",
577 dx, dz, dy,
578 diagonal );
579
580 fprintf(out_file,
581 "#declare cameraLookX = sysCenterX;\n"
582 "#declare cameraLookY = sysCenterY;\n"
583 "#declare cameraLookZ = sysCenterZ;\n"
584 "\n"
585 "#declare cameraX = cameraLookX;\n"
586 "#declare cameraY = cameraLookY;\n"
587 "#declare cameraZ = cameraLookZ - zoom;\n"
588 "\n"
589 "#declare lightAx = cameraX;\n"
590 "#declare lightAy = cameraY;\n"
591 "#declare lightAz = cameraZ;\n"
592 "\n"
593 "#declare lightBx = cameraX - zoom;\n"
594 "#declare lightBy = cameraY + zoom;\n"
595 "#declare lightBz = cameraZ;\n"
596 "\n"
597 "#declare boxCenterX = cameraLookX;\n"
598 "#declare boxCenterY = cameraLookY;\n"
599 "#declare boxCenterZ = cameraLookZ;\n"
600 "\n"
601 "// declare the cameras and the light sources\n"
602 "\n"
603 "camera{\n"
604 " location < cameraX, cameraY, cameraZ>\n"
605 " right < Ratio , 0, 0>\n"
606 " look_at < cameraLookX, cameraLookY, cameraLookZ >\n"
607 "}\n"
608 "\n"
609 "light_source{\n"
610 " < lightAx, lightAy, lightAz >\n"
611 " rgb < 1.0, 1.0, 1.0 > }\n"
612 "\n"
613 "light_source{\n"
614 " < lightBx, lightBy, lightBz >\n"
615 " rgb < 1.0, 1.0, 1.0 > }\n"
616 "\n"
617 "\n"
618 "//************************************************************\n"
619 "// Set whether or not to rotate the system.\n"
620 "//\n"
621 "// To Rotate, set ROTATE to 1.0 (true),\n"
622 "// Then set the Euler Angles PHI, THETA, and PSI in degrees.\n"
623 "//************************************************************\n"
624 "\n"
625 "#declare ROTATE = 0.0;\n"
626 "#declare PHI = 0.0;\n"
627 "#declare THETA = 0.0;\n"
628 "#declare PSI = 0.0;\n"
629 "\n"
630 "#if(ROTATE)\n"
631 " #declare phi_r = radians(PHI);\n"
632 " #declare theta_r = radians(THETA);\n"
633 " #declare psi_r = radians(PSI);\n"
634 "\n"
635 " #declare A11 = cos(phi_r) * cos(psi_r) - sin(phi_r) * cos(theta_r) * sin(psi_r);\n"
636 " #declare A12 = sin(phi_r) * cos(psi_r) + cos(phi_r) * cos(theta_r) * sin(psi_r);\n"
637 " #declare A13 = sin(theta_r) * sin(psi_r);\n"
638 "\n"
639 " #declare A21 = -cos(phi_r) * sin(psi_r) - sin(phi_r) * cos(theta_r) * cos(psi_r);\n"
640 " #declare A22 = -sin(phi_r) * sin(psi_r) + cos(phi_r) * cos(theta_r) * cos(psi_r);\n"
641 " #declare A23 = sin(theta_r) * cos(psi_r);\n"
642 "\n"
643 " #declare A31 = sin(phi_r) * sin(theta_r);\n"
644 " #declare A32 = -cos(phi_r) * sin(theta_r);\n"
645 " #declare A33 = cos(theta_r);\n"
646 "\n"
647 "#end\n"
648 "\n"
649 "\n"
650 "//************************************************************\n"
651 "// declare the periodic box macro\n"
652 "//************************************************************\n"
653 "\n"
654 "#macro makePeriodicBox( lengthX, lengthY, lengthZ )\n"
655 "\n"
656 " #local addX = lengthX / 2.0;\n"
657 " #local addY = lengthY / 2.0;\n"
658 " #local addZ = lengthZ / 2.0;\n"
659 "\n"
660 " #local colorR = 0.90;\n"
661 " #local colorG = 0.91;\n"
662 " #local colorB = 0.98;\n"
663 "\n"
664 " #local pipeWidth = 0.4;\n"
665 "\n"
666 " // 1\n"
667 " cylinder{\n"
668 " < boxCenterX-addX, boxCenterY-addY, boxCenterZ-addZ >,\n"
669 " < boxCenterX-addX, boxCenterY+addY, boxCenterZ-addZ >,\n"
670 " pipeWidth\n"
671 " texture{\n"
672 " pigment{ rgb < colorR, colorG, colorB > }\n"
673 " finish{\n"
674 " ambient .2\n"
675 " diffuse .6\n"
676 " specular 1\n"
677 " roughness .001\n"
678 " metallic\n"
679 " }\n"
680 " }\n"
681 " }\n"
682 "\n"
683 " // 2\n"
684 " cylinder{\n"
685 " < boxCenterX-addX, boxCenterY-addY, boxCenterZ+addZ >,\n"
686 " < boxCenterX-addX, boxCenterY+addY, boxCenterZ+addZ >,\n"
687 " pipeWidth\n"
688 " texture{\n"
689 " pigment{ rgb < colorR, colorG, colorB > }\n"
690 " finish{\n"
691 " ambient .2\n"
692 " diffuse .6\n"
693 " specular 1\n"
694 " roughness .001\n"
695 " metallic\n"
696 " }\n"
697 " }\n"
698 " }\n"
699 "\n"
700 " // 3\n"
701 " cylinder{\n"
702 " < boxCenterX+addX, boxCenterY-addY, boxCenterZ-addZ >,\n"
703 " < boxCenterX+addX, boxCenterY+addY, boxCenterZ-addZ >,\n"
704 " pipeWidth\n"
705 " texture{\n"
706 " pigment{ rgb < colorR, colorG, colorB > }\n"
707 " finish{\n"
708 " ambient .2\n"
709 " diffuse .6\n"
710 " specular 1\n"
711 " roughness .001\n"
712 " metallic\n"
713 " }\n"
714 " }\n"
715 " }\n"
716 "\n"
717 " // 4\n"
718 " cylinder{\n"
719 " < boxCenterX+addX, boxCenterY-addY, boxCenterZ+addZ >,\n"
720 " < boxCenterX+addX, boxCenterY+addY, boxCenterZ+addZ >,\n"
721 " pipeWidth\n"
722 " texture{\n"
723 " pigment{ rgb < colorR, colorG, colorB > }\n"
724 " finish{\n"
725 " ambient .2\n"
726 " diffuse .6\n"
727 " specular 1\n"
728 " roughness .001\n"
729 " metallic\n"
730 " }\n"
731 " }\n"
732 " }\n"
733 "\n"
734 " // 5\n"
735 " cylinder{\n"
736 " < boxCenterX-addX, boxCenterY-addY, boxCenterZ-addZ >,\n"
737 " < boxCenterX-addX, boxCenterY-addY, boxCenterZ+addZ >,\n"
738 " pipeWidth\n"
739 " texture{\n"
740 " pigment{ rgb < colorR, colorG, colorB > }\n"
741 " finish{\n"
742 " ambient .2\n"
743 " diffuse .6\n"
744 " specular 1\n"
745 " roughness .001\n"
746 " metallic\n"
747 " }\n"
748 " }\n"
749 " }\n"
750 "\n"
751 " // 6\n"
752 " cylinder{\n"
753 " < boxCenterX-addX, boxCenterY-addY, boxCenterZ+addZ >,\n"
754 " < boxCenterX+addX, boxCenterY-addY, boxCenterZ+addZ >,\n"
755 " pipeWidth\n"
756 " texture{\n"
757 " pigment{ rgb < colorR, colorG, colorB > }\n"
758 " finish{\n"
759 " ambient .2\n"
760 " diffuse .6\n"
761 " specular 1\n"
762 " roughness .001\n"
763 " metallic\n"
764 " }\n"
765 " }\n"
766 " }\n"
767 "\n"
768 " // 7\n"
769 " cylinder{\n"
770 " < boxCenterX+addX, boxCenterY-addY, boxCenterZ+addZ >,\n"
771 " < boxCenterX+addX, boxCenterY-addY, boxCenterZ-addZ >,\n"
772 " pipeWidth\n"
773 " texture{\n"
774 " pigment{ rgb < colorR, colorG, colorB > }\n"
775 " finish{\n"
776 " ambient .2\n"
777 " diffuse .6\n"
778 " specular 1\n"
779 " roughness .001\n"
780 " metallic\n"
781 " }\n"
782 " }\n"
783 " }\n"
784 "\n"
785 " // 8\n"
786 " cylinder{\n"
787 " < boxCenterX+addX, boxCenterY-addY, boxCenterZ-addZ >,\n"
788 " < boxCenterX-addX, boxCenterY-addY, boxCenterZ-addZ >,\n"
789 " pipeWidth\n"
790 " texture{\n"
791 " pigment{ rgb < colorR, colorG, colorB > }\n"
792 " finish{\n"
793 " ambient .2\n"
794 " diffuse .6\n"
795 " specular 1\n"
796 " roughness .001\n"
797 " metallic\n"
798 " }\n"
799 " }\n"
800 " }\n"
801 "\n"
802 " // 9\n"
803 " cylinder{\n"
804 " < boxCenterX-addX, boxCenterY+addY, boxCenterZ-addZ >,\n"
805 " < boxCenterX-addX, boxCenterY+addY, boxCenterZ+addZ >,\n"
806 " pipeWidth\n"
807 " texture{\n"
808 " pigment{ rgb < colorR, colorG, colorB > }\n"
809 " finish{\n"
810 " ambient .2\n"
811 " diffuse .6\n"
812 " specular 1\n"
813 " roughness .001\n"
814 " metallic\n"
815 " }\n"
816 " }\n"
817 " }\n"
818 "\n"
819 " // 10\n"
820 " cylinder{\n"
821 " < boxCenterX-addX, boxCenterY+addY, boxCenterZ+addZ >,\n"
822 " < boxCenterX+addX, boxCenterY+addY, boxCenterZ+addZ >,\n"
823 " pipeWidth\n"
824 " texture{\n"
825 " pigment{ rgb < colorR, colorG, colorB > }\n"
826 " finish{\n"
827 " ambient .2\n"
828 " diffuse .6\n"
829 " specular 1\n"
830 " roughness .001\n"
831 " metallic\n"
832 " }\n"
833 " }\n"
834 " }\n"
835 "\n"
836 " // 11\n"
837 " cylinder{\n"
838 " < boxCenterX+addX, boxCenterY+addY, boxCenterZ+addZ >,\n"
839 " < boxCenterX+addX, boxCenterY+addY, boxCenterZ-addZ >,\n"
840 " pipeWidth\n"
841 " texture{\n"
842 " pigment{ rgb < colorR, colorG, colorB > }\n"
843 " finish{\n"
844 " ambient .2\n"
845 " diffuse .6\n"
846 " specular 1\n"
847 " roughness .001\n"
848 " metallic\n"
849 " }\n"
850 " }\n"
851 " }\n"
852 "\n"
853 " // 12\n"
854 " cylinder{\n"
855 " < boxCenterX+addX, boxCenterY+addY, boxCenterZ-addZ >,\n"
856 " < boxCenterX-addX, boxCenterY+addY, boxCenterZ-addZ >,\n"
857 " pipeWidth\n"
858 " texture{\n"
859 " pigment{ rgb < colorR, colorG, colorB > }\n"
860 " finish{\n"
861 " ambient .2\n"
862 " diffuse .6\n"
863 " specular 1\n"
864 " roughness .001\n"
865 " metallic\n"
866 " }\n"
867 " }\n"
868 " }\n"
869 "\n"
870 "#end\n"
871 "\n"
872 "\n");
873
874
875
876
877 make_header_macros(out_file);
878
879 fclose(out_file);
880 }
881
882 return 0;
883
884 }
885
886
887
888 /***************************************************************************
889 * prints out the usage for the command line arguments, then exits.
890 ***************************************************************************/
891
892 void usage(){
893 (void)fprintf(stderr,
894 "The proper usage is: %s [options] <xyz_file>\n"
895 "\n"
896 "Options:\n"
897 "\n"
898 " -o <prefix> the output file prefix\n"
899 " -H generate a pov-ray header file\n"
900 " -i <#> number of frames to interpolate\n"
901 " -h draw hydrogens\n"
902 " -b draw bonds\n"
903 " -a draw atoms\n"
904 " -p draw periodic box\n"
905 " -r regenerate bond\n"
906 " -f <#> render frame <#> only\n"
907 " -s <#> begin at frame <#> (inclusive)\n"
908 " -e <#> end at frame <#> (inclusive)\n"
909 "\n",
910 program_name);
911 exit(8);
912 }