1 |
+ |
#define _FILE_OFFSET_BITS 64 |
2 |
+ |
|
3 |
|
#include <stdio.h> |
4 |
|
#include <stdlib.h> |
5 |
|
#include <string.h> |
18 |
|
|
19 |
|
struct linked_xyz{ |
20 |
|
struct coords *r; |
21 |
+ |
double Hmat[3][3]; |
22 |
|
struct linked_xyz *next; |
23 |
|
}; |
24 |
|
|
26 |
|
int draw_bonds = 0; /* boolean to draw bonds or not */ |
27 |
|
int draw_hydrogens = 0; /*boolean to draw hydrogens */ |
28 |
|
int draw_atoms = 0; /*boolean to draw atoms */ |
29 |
+ |
int draw_vectors = 0; /*boolean to draw vectors */ |
30 |
+ |
int draw_box = 0; // boolean to draw the periodic Box |
31 |
|
int regenerateBonds = 0; // boolean to regenearate bonds each frame |
32 |
|
|
33 |
|
void usage(void); |
34 |
+ |
int count_tokens(char *line, char *delimiters); |
35 |
|
|
36 |
|
int main(argc, argv) |
37 |
|
int argc; |
41 |
|
|
42 |
|
struct coords *out_coords; |
43 |
|
|
44 |
< |
int i,j; /* loop counters */ |
44 |
> |
int i,j,k; /* loop counters */ |
45 |
|
mode_t dir_mode = S_IRWXU; |
46 |
|
|
47 |
|
int generate_header = 0; /* boolean for generating the pov ray header */ |
51 |
|
double small_x = 0; |
52 |
|
double small_y = 0; /* lets me know the smallest x, y, z */ |
53 |
|
double small_z = 0; |
54 |
+ |
int extremaSet = 0; |
55 |
|
double rsqr; /* the square of the diagonal */ |
56 |
|
double diagonal; /* the diagonal length of the sim box */ |
57 |
|
|
58 |
|
unsigned int n_atoms; /*the number of atoms in each time step */ |
59 |
< |
char read_buffer[120]; /*the line buffer for reading */ |
59 |
> |
char read_buffer[2000]; /*the line buffer for reading */ |
60 |
|
char *eof_test; /*ptr to see when we reach the end of the file */ |
61 |
|
char *foo; /*the pointer to the current string token */ |
62 |
|
FILE *in_file; /* the input file */ |
71 |
|
char current_flag; |
72 |
|
int nFrames; |
73 |
|
int nZeroes; |
74 |
+ |
int nTokens; |
75 |
|
double count; |
76 |
|
|
77 |
+ |
int startFrame = 1; |
78 |
+ |
int endFrame; |
79 |
+ |
int span = 0; |
80 |
+ |
int currentCount = 0; |
81 |
+ |
int haveEnd = 0; |
82 |
+ |
|
83 |
|
struct linked_xyz *current_frame; |
84 |
|
struct linked_xyz *temp_frame; |
85 |
|
|
86 |
|
unsigned int n_interpolate = 0; /* number of frames to interpolate */ |
87 |
|
double dx, dy, dz; /* temp variables for interpolating distances */ |
88 |
+ |
double dm[3][3]; |
89 |
+ |
|
90 |
|
|
91 |
|
char pov_dir[500]; /* the pov_dir */ |
92 |
|
|
137 |
|
done = 1; |
138 |
|
break; |
139 |
|
|
140 |
+ |
case 'f': |
141 |
+ |
// -f <#> => frame to render |
142 |
+ |
|
143 |
+ |
i++; |
144 |
+ |
startFrame = atoi( argv[i] ); |
145 |
+ |
endFrame = startFrame; |
146 |
+ |
haveEnd = 1; |
147 |
+ |
done = 1; |
148 |
+ |
break; |
149 |
+ |
|
150 |
+ |
case 's': |
151 |
+ |
// -s <#> => frame to start |
152 |
+ |
|
153 |
+ |
i++; |
154 |
+ |
startFrame = atoi( argv[i] ); |
155 |
+ |
done = 1; |
156 |
+ |
break; |
157 |
+ |
|
158 |
+ |
case 'e': |
159 |
+ |
// -e <#> => frame to end |
160 |
+ |
|
161 |
+ |
i++; |
162 |
+ |
endFrame = atoi( argv[i] ); |
163 |
+ |
haveEnd = 1; |
164 |
+ |
done = 1; |
165 |
+ |
break; |
166 |
+ |
|
167 |
|
case 'H': |
168 |
|
// -h => generate a pov-ray Header |
169 |
|
|
188 |
|
draw_atoms = 1; |
189 |
|
break; |
190 |
|
|
191 |
+ |
case 'v': |
192 |
+ |
// -v => draw the vectors |
193 |
+ |
|
194 |
+ |
draw_vectors = 1; |
195 |
+ |
break; |
196 |
+ |
|
197 |
|
case 'r': |
198 |
|
// -r => regenerate bonds |
199 |
|
|
200 |
|
regenerateBonds = 1; |
201 |
|
break; |
202 |
|
|
203 |
+ |
case 'p': |
204 |
+ |
// -r => draw periodic box |
205 |
+ |
|
206 |
+ |
draw_box = 1; |
207 |
+ |
break; |
208 |
+ |
|
209 |
|
default: |
210 |
|
|
211 |
|
(void)fprintf(stderr, "Bad option \"-%c\"\n", current_flag); |
283 |
|
out_prefix = strtok(in_name, "."); |
284 |
|
} |
285 |
|
|
286 |
< |
sprintf( out_format, "%s%s%%0%dd.pov", pov_dir, out_prefix, nZeroes ); |
286 |
> |
sprintf( out_format, "%s%s-%%0%dd.pov", pov_dir, out_prefix, nZeroes ); |
287 |
|
|
288 |
|
// start reading the first frame |
289 |
|
|
293 |
|
current_frame->next = NULL; |
294 |
|
|
295 |
|
|
296 |
< |
while(eof_test != NULL){ |
296 |
> |
if( haveEnd ) span = endFrame - startFrame; |
297 |
> |
done = 0; |
298 |
> |
if( span < 0 ) done = 1; |
299 |
> |
while( (eof_test != NULL) && !done ){ |
300 |
|
|
301 |
|
(void)sscanf(read_buffer, "%d", &n_atoms); |
302 |
|
current_frame->r = |
309 |
|
printf("error in reading file\n"); |
310 |
|
exit(8); |
311 |
|
} |
312 |
< |
|
313 |
< |
for( i=0; i < n_atoms; i++){ |
312 |
> |
|
313 |
> |
// unless we need to get the box size |
314 |
> |
|
315 |
> |
if( draw_box ){ |
316 |
> |
foo = strtok(read_buffer, " ,;\t"); |
317 |
> |
if(foo == NULL){ |
318 |
> |
printf("error in reading file time\n"); |
319 |
> |
exit(8); |
320 |
> |
} |
321 |
|
|
322 |
< |
eof_test = fgets(read_buffer, sizeof(read_buffer), in_file); |
323 |
< |
if(eof_test == NULL){ |
324 |
< |
printf("error in reading file\n"); |
322 |
> |
foo = strtok(NULL, " ,;\t"); |
323 |
> |
if(foo == NULL){ |
324 |
> |
printf("error in reading file h00\n"); |
325 |
|
exit(8); |
326 |
|
} |
327 |
+ |
current_frame->Hmat[0][0] = atof( foo ); |
328 |
|
|
329 |
< |
foo = strtok(read_buffer, " ,;\t"); |
330 |
< |
(void)strcpy(current_frame->r[i].name, foo); /*copy the atom name */ |
329 |
> |
foo = strtok(NULL, " ,;\t"); |
330 |
> |
if(foo == NULL){ |
331 |
> |
printf("error in reading file h10\n"); |
332 |
> |
exit(8); |
333 |
> |
} |
334 |
> |
current_frame->Hmat[1][0] = atof( foo ); |
335 |
|
|
266 |
– |
/* next we grab the positions */ |
267 |
– |
|
336 |
|
foo = strtok(NULL, " ,;\t"); |
337 |
|
if(foo == NULL){ |
338 |
< |
printf("error in reading file\n"); |
338 |
> |
printf("error in reading file h20\n"); |
339 |
|
exit(8); |
340 |
|
} |
341 |
< |
(void)sscanf(foo, "%lf",¤t_frame->r[i].x); |
342 |
< |
if(current_frame->r[i].x > big_x) big_x = current_frame->r[i].x; |
275 |
< |
if(current_frame->r[i].x < small_x) small_x = current_frame->r[i].x; |
276 |
< |
|
277 |
< |
|
341 |
> |
current_frame->Hmat[2][0] = atof( foo ); |
342 |
> |
|
343 |
|
foo = strtok(NULL, " ,;\t"); |
344 |
|
if(foo == NULL){ |
345 |
< |
printf("error in reading file\n"); |
345 |
> |
printf("error in reading file h01\n"); |
346 |
|
exit(8); |
347 |
|
} |
348 |
< |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].y); |
284 |
< |
if(current_frame->r[i].y > big_y) big_y = current_frame->r[i].y; |
285 |
< |
if(current_frame->r[i].y < small_y) small_y = current_frame->r[i].y; |
348 |
> |
current_frame->Hmat[0][1] = atof( foo ); |
349 |
|
|
350 |
+ |
foo = strtok(NULL, " ,;\t"); |
351 |
+ |
if(foo == NULL){ |
352 |
+ |
printf("error in reading file h11\n"); |
353 |
+ |
exit(8); |
354 |
+ |
} |
355 |
+ |
current_frame->Hmat[1][1] = atof( foo ); |
356 |
|
|
357 |
|
foo = strtok(NULL, " ,;\t"); |
358 |
|
if(foo == NULL){ |
359 |
< |
printf("error in reading file\n"); |
359 |
> |
printf("error in reading file h21\n"); |
360 |
|
exit(8); |
361 |
|
} |
362 |
< |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].z); |
294 |
< |
if(current_frame->r[i].z > big_z) big_z = current_frame->r[i].z; |
295 |
< |
if(current_frame->r[i].z < small_z) small_z = current_frame->r[i].z; |
362 |
> |
current_frame->Hmat[2][1] = atof( foo ); |
363 |
|
|
364 |
+ |
foo = strtok(NULL, " ,;\t"); |
365 |
+ |
if(foo == NULL){ |
366 |
+ |
printf("error in reading file h02\n"); |
367 |
+ |
exit(8); |
368 |
+ |
} |
369 |
+ |
current_frame->Hmat[0][2] = atof( foo ); |
370 |
+ |
|
371 |
+ |
foo = strtok(NULL, " ,;\t"); |
372 |
+ |
if(foo == NULL){ |
373 |
+ |
printf("error in reading file h12\n"); |
374 |
+ |
exit(8); |
375 |
+ |
} |
376 |
+ |
current_frame->Hmat[1][2] = atof( foo ); |
377 |
+ |
|
378 |
+ |
foo = strtok(NULL, " ,;\t"); |
379 |
+ |
if(foo == NULL){ |
380 |
+ |
printf("error in reading file h22\n"); |
381 |
+ |
exit(8); |
382 |
+ |
} |
383 |
+ |
current_frame->Hmat[2][2] = atof( foo ); |
384 |
+ |
|
385 |
|
} |
386 |
< |
|
387 |
< |
if(n_interpolate && current_frame->next != NULL){ |
386 |
> |
|
387 |
> |
for( i=0; i < n_atoms; i++){ |
388 |
|
|
389 |
< |
temp_frame = current_frame->next; |
390 |
< |
|
391 |
< |
for(i = 0; i < n_interpolate; i++){ |
392 |
< |
|
393 |
< |
/* open the new output file */ |
306 |
< |
|
307 |
< |
sprintf(out_name, out_format, n_out ); |
308 |
< |
out_file = fopen(out_name, "w"); |
309 |
< |
n_out++; |
310 |
< |
if(out_file == NULL){ |
311 |
< |
printf("error opening output file: %s\n", out_name); |
312 |
< |
exit(8); |
313 |
< |
} |
314 |
< |
(void)fprintf(out_file, |
315 |
< |
"// The following script was automatically generated by:\n" |
316 |
< |
"// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n" |
317 |
< |
"\n" |
318 |
< |
"#include \"pov_header.pov\"\n" |
319 |
< |
"\n"); |
389 |
> |
eof_test = fgets(read_buffer, sizeof(read_buffer), in_file); |
390 |
> |
if(eof_test == NULL){ |
391 |
> |
printf("error in reading file line at atom %d\n", i); |
392 |
> |
exit(8); |
393 |
> |
} |
394 |
|
|
395 |
< |
out_coords = |
322 |
< |
(struct coords *)calloc(n_atoms, sizeof(struct coords)); |
323 |
< |
|
324 |
< |
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; |
395 |
> |
nTokens = count_tokens(read_buffer, " ,;\t"); |
396 |
|
|
397 |
< |
dx /= (double)(n_interpolate + 1); |
398 |
< |
dy /= (double)(n_interpolate + 1); |
399 |
< |
dz /= (double)(n_interpolate + 1); |
332 |
< |
|
333 |
< |
strcpy(out_coords[j].name, temp_frame->r[j].name); |
334 |
< |
out_coords[j].x = temp_frame->r[j].x + dx * (i+1); |
335 |
< |
out_coords[j].y = temp_frame->r[j].y + dy * (i+1); |
336 |
< |
out_coords[j].z = temp_frame->r[j].z + dz * (i+1); |
337 |
< |
} |
338 |
< |
|
339 |
< |
pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds, |
340 |
< |
draw_atoms); |
341 |
< |
free(out_coords); |
342 |
< |
(void)fclose(out_file); |
397 |
> |
if (nTokens < 4) { |
398 |
> |
printf("Not enough tokens while parsing file at atom %d\n", i); |
399 |
> |
exit(8); |
400 |
|
} |
344 |
– |
} |
401 |
|
|
402 |
< |
/* open the new output file */ |
403 |
< |
|
404 |
< |
sprintf(out_name, out_format, n_out ); |
405 |
< |
out_file = fopen(out_name, "w"); |
406 |
< |
n_out++; |
407 |
< |
if(out_file == NULL){ |
408 |
< |
printf("error opening output file: %s\n", out_name); |
409 |
< |
exit(8); |
410 |
< |
} |
411 |
< |
(void)fprintf(out_file, |
412 |
< |
"// The following script was automatically generated by:\n" |
413 |
< |
"// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n" |
414 |
< |
"\n" |
415 |
< |
"#include \"pov_header.pov\"\n" |
416 |
< |
"\n"); |
417 |
< |
|
418 |
< |
out_coords = |
419 |
< |
(struct coords *)calloc(n_atoms, sizeof(struct coords)); |
402 |
> |
foo = strtok(read_buffer, " ,;\t"); |
403 |
> |
(void)strcpy(current_frame->r[i].name, foo); /*copy the atom name */ |
404 |
> |
|
405 |
> |
foo = strtok(NULL, " ,;\t"); |
406 |
> |
(void)sscanf(foo, "%lf",¤t_frame->r[i].x); |
407 |
> |
foo = strtok(NULL, " ,;\t"); |
408 |
> |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].y); |
409 |
> |
foo = strtok(NULL, " ,;\t"); |
410 |
> |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].z); |
411 |
> |
|
412 |
> |
if (extremaSet) { |
413 |
> |
if(current_frame->r[i].x > big_x) big_x = current_frame->r[i].x; |
414 |
> |
if(current_frame->r[i].x < small_x) small_x = current_frame->r[i].x; |
415 |
> |
|
416 |
> |
if(current_frame->r[i].y > big_y) big_y = current_frame->r[i].y; |
417 |
> |
if(current_frame->r[i].y < small_y) small_y = current_frame->r[i].y; |
418 |
> |
|
419 |
> |
if(current_frame->r[i].z > big_z) big_z = current_frame->r[i].z; |
420 |
> |
if(current_frame->r[i].z < small_z) small_z = current_frame->r[i].z; |
421 |
> |
} else { |
422 |
> |
big_x = current_frame->r[i].x; |
423 |
> |
small_x = current_frame->r[i].x; |
424 |
> |
|
425 |
> |
big_y = current_frame->r[i].y; |
426 |
> |
small_y = current_frame->r[i].y; |
427 |
> |
|
428 |
> |
big_z = current_frame->r[i].z; |
429 |
> |
small_z = current_frame->r[i].z; |
430 |
> |
|
431 |
> |
extremaSet = 1; |
432 |
> |
|
433 |
> |
} |
434 |
> |
|
435 |
> |
if (nTokens == 5 || nTokens > 7) { |
436 |
> |
foo = strtok(NULL, " ,;\t"); |
437 |
> |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].charge); |
438 |
> |
current_frame->r[i].hasCharge = 1; |
439 |
> |
} else { |
440 |
> |
current_frame->r[i].hasCharge = 0; |
441 |
> |
} |
442 |
> |
|
443 |
> |
|
444 |
> |
if (nTokens >= 7) { |
445 |
> |
foo = strtok(NULL, " ,;\t"); |
446 |
> |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].ux); |
447 |
> |
foo = strtok(NULL, " ,;\t"); |
448 |
> |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].uy); |
449 |
> |
foo = strtok(NULL, " ,;\t"); |
450 |
> |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].uz); |
451 |
> |
current_frame->r[i].hasVector = 1; |
452 |
> |
} else { |
453 |
> |
current_frame->r[i].hasVector = 0; |
454 |
> |
} |
455 |
> |
} |
456 |
> |
currentCount++; |
457 |
|
|
458 |
< |
for(i = 0; i < n_atoms; i++){ |
459 |
< |
strcpy(out_coords[i].name, current_frame->r[i].name); |
460 |
< |
out_coords[i].x = current_frame->r[i].x; |
461 |
< |
out_coords[i].y = current_frame->r[i].y; |
462 |
< |
out_coords[i].z = current_frame->r[i].z; |
458 |
> |
|
459 |
> |
if( currentCount >= startFrame ){ |
460 |
> |
if(n_interpolate && current_frame->next != NULL){ |
461 |
> |
|
462 |
> |
temp_frame = current_frame->next; |
463 |
> |
|
464 |
> |
for(i = 0; i < n_interpolate; i++){ |
465 |
> |
|
466 |
> |
/* open the new output file */ |
467 |
> |
|
468 |
> |
sprintf(out_name, out_format, currentCount ); |
469 |
> |
out_file = fopen(out_name, "w"); |
470 |
> |
currentCount++; |
471 |
> |
if(out_file == NULL){ |
472 |
> |
printf("error opening output file: %s\n", out_name); |
473 |
> |
exit(8); |
474 |
> |
} |
475 |
> |
(void)fprintf(out_file, |
476 |
> |
"// The following script was automatically generated by:\n" |
477 |
> |
"// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n" |
478 |
> |
"\n" |
479 |
> |
"#include \"pov_header.pov\"\n" |
480 |
> |
"\n"); |
481 |
> |
if( draw_box ){ |
482 |
> |
|
483 |
> |
for (j = 0; j < 3; j++) { |
484 |
> |
for (k = 0; k < 3; k++) { |
485 |
> |
dm[j][k] = current_frame->Hmat[j][k] - temp_frame->Hmat[j][k]; |
486 |
> |
dm[j][k] /= (double)(n_interpolate + 1); |
487 |
> |
} |
488 |
> |
} |
489 |
> |
|
490 |
> |
fprintf( out_file, |
491 |
> |
"makePeriodicBox( %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf)\n" |
492 |
> |
"\n", |
493 |
> |
temp_frame->Hmat[0][0] + dm[0][0] * (i+1), |
494 |
> |
temp_frame->Hmat[2][0] + dm[2][0] * (i+1), |
495 |
> |
temp_frame->Hmat[1][0] + dm[1][0] * (i+1), |
496 |
> |
temp_frame->Hmat[0][1] + dm[0][1] * (i+1), |
497 |
> |
temp_frame->Hmat[2][1] + dm[2][1] * (i+1), |
498 |
> |
temp_frame->Hmat[1][1] + dm[1][1] * (i+1), |
499 |
> |
temp_frame->Hmat[0][2] + dm[0][2] * (i+1), |
500 |
> |
temp_frame->Hmat[2][2] + dm[2][2] * (i+1), |
501 |
> |
temp_frame->Hmat[1][2] + dm[1][2] * (i+1) ); |
502 |
> |
} |
503 |
> |
|
504 |
> |
|
505 |
> |
out_coords = |
506 |
> |
(struct coords *)calloc(n_atoms, sizeof(struct coords)); |
507 |
> |
|
508 |
> |
for(j=0; j < n_atoms; j++){ |
509 |
> |
dx = current_frame->r[j].x - temp_frame->r[j].x; |
510 |
> |
dy = current_frame->r[j].y - temp_frame->r[j].y; |
511 |
> |
dz = current_frame->r[j].z - temp_frame->r[j].z; |
512 |
> |
|
513 |
> |
dx /= (double)(n_interpolate + 1); |
514 |
> |
dy /= (double)(n_interpolate + 1); |
515 |
> |
dz /= (double)(n_interpolate + 1); |
516 |
> |
|
517 |
> |
strcpy(out_coords[j].name, temp_frame->r[j].name); |
518 |
> |
out_coords[j].x = temp_frame->r[j].x + dx * (i+1); |
519 |
> |
out_coords[j].y = temp_frame->r[j].y + dy * (i+1); |
520 |
> |
out_coords[j].z = temp_frame->r[j].z + dz * (i+1); |
521 |
> |
|
522 |
> |
if (current_frame->r[j].hasVector) { |
523 |
> |
dx = current_frame->r[j].ux - temp_frame->r[j].ux; |
524 |
> |
dy = current_frame->r[j].uy - temp_frame->r[j].uy; |
525 |
> |
dz = current_frame->r[j].uz - temp_frame->r[j].uz; |
526 |
> |
|
527 |
> |
dx /= (double)(n_interpolate + 1); |
528 |
> |
dy /= (double)(n_interpolate + 1); |
529 |
> |
dz /= (double)(n_interpolate + 1); |
530 |
> |
|
531 |
> |
out_coords[j].hasVector = current_frame->r[j].hasVector; |
532 |
> |
out_coords[j].ux = temp_frame->r[j].ux + dx * (i+1); |
533 |
> |
out_coords[j].uy = temp_frame->r[j].uy + dy * (i+1); |
534 |
> |
out_coords[j].uz = temp_frame->r[j].uz + dz * (i+1); |
535 |
> |
} |
536 |
> |
|
537 |
> |
if (current_frame->r[j].hasCharge) { |
538 |
> |
dx = current_frame->r[j].charge - temp_frame->r[j].charge; |
539 |
> |
|
540 |
> |
dx /= (double)(n_interpolate + 1); |
541 |
> |
|
542 |
> |
out_coords[j].hasCharge = current_frame->r[j].hasCharge; |
543 |
> |
out_coords[j].charge = temp_frame->r[j].charge + dx * (i+1); |
544 |
> |
} |
545 |
> |
|
546 |
> |
} |
547 |
> |
|
548 |
> |
pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds, |
549 |
> |
draw_atoms, draw_vectors); |
550 |
> |
free(out_coords); |
551 |
> |
(void)fclose(out_file); |
552 |
> |
} |
553 |
> |
} |
554 |
> |
|
555 |
> |
/* open the new output file */ |
556 |
> |
|
557 |
> |
sprintf(out_name, out_format, currentCount ); |
558 |
> |
out_file = fopen(out_name, "w"); |
559 |
> |
if(out_file == NULL){ |
560 |
> |
printf("error opening output file: %s\n", out_name); |
561 |
> |
exit(8); |
562 |
> |
} |
563 |
> |
(void)fprintf(out_file, |
564 |
> |
"// The following script was automatically generated by:\n" |
565 |
> |
"// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n" |
566 |
> |
"\n" |
567 |
> |
"#include \"pov_header.pov\"\n" |
568 |
> |
"\n"); |
569 |
> |
|
570 |
> |
if( draw_box ){ |
571 |
> |
|
572 |
> |
fprintf( out_file, |
573 |
> |
"makePeriodicBox( %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf )\n" |
574 |
> |
"\n", |
575 |
> |
current_frame->Hmat[0][0], |
576 |
> |
current_frame->Hmat[2][0], |
577 |
> |
current_frame->Hmat[1][0], |
578 |
> |
current_frame->Hmat[0][1], |
579 |
> |
current_frame->Hmat[2][1], |
580 |
> |
current_frame->Hmat[1][1], |
581 |
> |
current_frame->Hmat[0][2], |
582 |
> |
current_frame->Hmat[2][2], |
583 |
> |
current_frame->Hmat[1][2] ); |
584 |
> |
} |
585 |
> |
|
586 |
> |
|
587 |
> |
|
588 |
> |
out_coords = |
589 |
> |
(struct coords *)calloc(n_atoms, sizeof(struct coords)); |
590 |
> |
|
591 |
> |
for(i = 0; i < n_atoms; i++){ |
592 |
> |
strcpy(out_coords[i].name, current_frame->r[i].name); |
593 |
> |
out_coords[i].x = current_frame->r[i].x; |
594 |
> |
out_coords[i].y = current_frame->r[i].y; |
595 |
> |
out_coords[i].z = current_frame->r[i].z; |
596 |
> |
|
597 |
> |
if (current_frame->r[i].hasVector) { |
598 |
> |
out_coords[i].hasVector = current_frame->r[i].hasVector; |
599 |
> |
out_coords[i].ux = current_frame->r[i].ux; |
600 |
> |
out_coords[i].uy = current_frame->r[i].uy; |
601 |
> |
out_coords[i].uz = current_frame->r[i].uz; |
602 |
> |
} |
603 |
> |
|
604 |
> |
if (current_frame->r[i].hasCharge) { |
605 |
> |
out_coords[i].hasCharge = current_frame->r[i].hasCharge; |
606 |
> |
out_coords[i].charge = current_frame->r[i].charge; |
607 |
> |
} |
608 |
> |
} |
609 |
> |
pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds, |
610 |
> |
draw_atoms, draw_vectors); |
611 |
> |
free(out_coords); |
612 |
> |
|
613 |
> |
(void)fclose(out_file); |
614 |
|
} |
371 |
– |
pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds, |
372 |
– |
draw_atoms); |
373 |
– |
free(out_coords); |
615 |
|
|
375 |
– |
(void)fclose(out_file); |
376 |
– |
|
616 |
|
/*free up memory */ |
617 |
|
|
618 |
|
temp_frame = current_frame->next; |
632 |
|
|
633 |
|
eof_test = fgets(read_buffer, sizeof(read_buffer), in_file); |
634 |
|
|
635 |
+ |
if( haveEnd ){ |
636 |
+ |
if( currentCount >= (endFrame + n_interpolate * span) ) done = 1; |
637 |
+ |
} |
638 |
|
} |
639 |
|
|
640 |
|
(void)fclose(in_file); |
650 |
|
diagonal = sqrt(rsqr); |
651 |
|
diagonal *= 0.5; |
652 |
|
|
653 |
+ |
// calculate the center |
654 |
+ |
|
655 |
+ |
dx = big_x + small_x; |
656 |
+ |
dy = big_y + small_y; |
657 |
+ |
dz = big_z + small_z; |
658 |
+ |
|
659 |
|
dx /= 2.0; |
660 |
|
dy /= 2.0; |
661 |
|
dz /= 2.0; |
662 |
< |
|
415 |
< |
dx += small_x; |
416 |
< |
dy += small_y; |
417 |
< |
dz += small_z; |
418 |
< |
|
662 |
> |
|
663 |
|
|
664 |
|
/*note the y and z axis is exchanged for the different coordinate |
665 |
|
system in pov-ray*/ |
690 |
|
"#declare Height = 480.0;\n" |
691 |
|
"#declare Ratio = Width / Height;\n" |
692 |
|
"\n" |
449 |
– |
"#declare zoom = %lf;\n" |
450 |
– |
"\n" |
693 |
|
"#declare ATOM_SPHERE_FACTOR = 0.2;\n" |
694 |
|
"#declare BOND_RADIUS = 0.1;\n" |
695 |
< |
"\n" |
696 |
< |
"camera{\n" |
697 |
< |
" location < %lf, %lf, %lf - zoom>\n" |
698 |
< |
" right < Ratio , 0, 0>\n" |
699 |
< |
" look_at < %lf, %lf, %lf >\n" |
700 |
< |
"}\n" |
695 |
> |
"#declare VECTOR_SCALE = 1.0;\n" |
696 |
> |
"#declare STICK_RADIUS = 0.5 * BOND_RADIUS;\n" |
697 |
> |
"#declare CONE_RADIUS = 2.0 * STICK_RADIUS;\n" |
698 |
> |
"#declare CONE_FRACTION = 0.15;\n" |
699 |
> |
"\n" |
700 |
> |
"// declare camera, light, and system variables\n" |
701 |
> |
"\n" |
702 |
> |
"#declare sysCenterX = %lf;\n" |
703 |
> |
"#declare sysCenterY = %lf;\n" |
704 |
> |
"#declare sysCenterZ = %lf;\n" |
705 |
> |
"\n" |
706 |
> |
"#declare zoom = %lf;\n" |
707 |
|
"\n", |
460 |
– |
diagonal, |
708 |
|
dx, dz, dy, |
709 |
< |
dx, dz, dy); |
710 |
< |
|
709 |
> |
diagonal ); |
710 |
> |
|
711 |
|
fprintf(out_file, |
712 |
+ |
"#declare cameraLookX = sysCenterX;\n" |
713 |
+ |
"#declare cameraLookY = sysCenterY;\n" |
714 |
+ |
"#declare cameraLookZ = sysCenterZ;\n" |
715 |
+ |
"\n" |
716 |
+ |
"#declare rotatePointX = cameraLookX;\n" |
717 |
+ |
"#declare rotatePointY = cameraLookY;\n" |
718 |
+ |
"#declare rotatePointZ = cameraLookZ;\n" |
719 |
+ |
"\n" |
720 |
+ |
"#declare cameraX = cameraLookX;\n" |
721 |
+ |
"#declare cameraY = cameraLookY;\n" |
722 |
+ |
"#declare cameraZ = cameraLookZ - zoom;\n" |
723 |
+ |
"\n" |
724 |
+ |
"#declare lightAx = cameraX;\n" |
725 |
+ |
"#declare lightAy = cameraY;\n" |
726 |
+ |
"#declare lightAz = cameraZ;\n" |
727 |
+ |
"\n" |
728 |
+ |
"#declare lightBx = cameraX - zoom;\n" |
729 |
+ |
"#declare lightBy = cameraY + zoom;\n" |
730 |
+ |
"#declare lightBz = cameraZ;\n" |
731 |
+ |
"\n" |
732 |
+ |
"#declare boxCenterX = cameraLookX;\n" |
733 |
+ |
"#declare boxCenterY = cameraLookY;\n" |
734 |
+ |
"#declare boxCenterZ = cameraLookZ;\n" |
735 |
+ |
"\n" |
736 |
+ |
"// declare the cameras and the light sources\n" |
737 |
+ |
"\n" |
738 |
+ |
"camera{\n" |
739 |
+ |
" location < cameraX, cameraY, cameraZ>\n" |
740 |
+ |
" right < Ratio , 0, 0>\n" |
741 |
+ |
" look_at < cameraLookX, cameraLookY, cameraLookZ >\n" |
742 |
+ |
"}\n" |
743 |
+ |
"\n" |
744 |
|
"light_source{\n" |
745 |
< |
" < %lf, %lf, %lf - zoom >\n" |
746 |
< |
" rgb < 1.0, 1.0, 1.0 > }\n", |
747 |
< |
dx, dz, dy); |
469 |
< |
|
470 |
< |
fprintf(out_file, |
745 |
> |
" < lightAx, lightAy, lightAz >\n" |
746 |
> |
" rgb < 1.0, 1.0, 1.0 > }\n" |
747 |
> |
"\n" |
748 |
|
"light_source{\n" |
749 |
< |
" < %lf - zoom , %lf + zoom, %lf - zoom >\n" |
749 |
> |
" < lightBx, lightBy, lightBz >\n" |
750 |
|
" rgb < 1.0, 1.0, 1.0 > }\n" |
751 |
|
"\n" |
752 |
< |
"\n", |
476 |
< |
dx, dz, dy); |
477 |
< |
|
478 |
< |
fprintf(out_file, |
752 |
> |
"\n" |
753 |
|
"//************************************************************\n" |
754 |
|
"// Set whether or not to rotate the system.\n" |
755 |
|
"//\n" |
778 |
|
" #declare A31 = sin(phi_r) * sin(theta_r);\n" |
779 |
|
" #declare A32 = -cos(phi_r) * sin(theta_r);\n" |
780 |
|
" #declare A33 = cos(theta_r);\n" |
781 |
+ |
"\n" |
782 |
+ |
"#end\n" |
783 |
+ |
"\n" |
784 |
+ |
"\n" |
785 |
+ |
"//************************************************************\n" |
786 |
+ |
"// declare the periodic box macro\n" |
787 |
+ |
"//************************************************************\n" |
788 |
+ |
"\n" |
789 |
+ |
"#macro makePeriodicBox( bx1, by1, bz1, bx2, by2, bz2, bx3, by3, bz3 )\n" |
790 |
+ |
"\n" |
791 |
+ |
" #local bcx = (bx1 + bx2 + bx3) / 2.0;\n" |
792 |
+ |
" #local bcy = (by1 + by2 + by3) / 2.0;\n" |
793 |
+ |
" #local bcz = (bz1 + bz2 + bz3) / 2.0;\n" |
794 |
+ |
"\n" |
795 |
+ |
" #local pAx = boxCenterX - bcx;\n" |
796 |
+ |
" #local pAy = boxCenterY - bcy;\n" |
797 |
+ |
" #local pAz = boxCenterZ - bcz;\n" |
798 |
+ |
" #local pBx = boxCenterX + bx1 - bcx;\n" |
799 |
+ |
" #local pBy = boxCenterY + by1 - bcy;\n" |
800 |
+ |
" #local pBz = boxCenterZ + bz1 - bcz;\n" |
801 |
+ |
" #local pCx = boxCenterX + bx2 - bcx;\n" |
802 |
+ |
" #local pCy = boxCenterY + by2 - bcy;\n" |
803 |
+ |
" #local pCz = boxCenterZ + bz2 - bcz;\n" |
804 |
+ |
" #local pDx = boxCenterX + bx3 - bcx;\n" |
805 |
+ |
" #local pDy = boxCenterY + by3 - bcy;\n" |
806 |
+ |
" #local pDz = boxCenterZ + bz3 - bcz;\n" |
807 |
+ |
" #local pEx = boxCenterX + bx1 + bx2 - bcx;\n" |
808 |
+ |
" #local pEy = boxCenterY + by1 + by2 - bcy;\n" |
809 |
+ |
" #local pEz = boxCenterZ + bz1 + bz2 - bcz;\n" |
810 |
+ |
" #local pFx = boxCenterX + bx1 + bx3 - bcx;\n" |
811 |
+ |
" #local pFy = boxCenterY + by1 + by3 - bcy;\n" |
812 |
+ |
" #local pFz = boxCenterZ + bz1 + bz3 - bcz;\n" |
813 |
+ |
" #local pGx = boxCenterX + bx2 + bx3 - bcx;\n" |
814 |
+ |
" #local pGy = boxCenterY + by2 + by3 - bcy;\n" |
815 |
+ |
" #local pGz = boxCenterZ + bz2 + bz3 - bcz;\n" |
816 |
+ |
" #local pHx = boxCenterX + bx1 + bx2 + bx3 - bcx;\n" |
817 |
+ |
" #local pHy = boxCenterY + by1 + by2 + by3 - bcy;\n" |
818 |
+ |
" #local pHz = boxCenterZ + bz1 + bz2 + bz3 - bcz;\n" |
819 |
+ |
"\n" |
820 |
+ |
" #if(ROTATE)\n" |
821 |
+ |
" #local pAx_new = rotatePointX + A11 * (pAx-rotatePointX) + A12 * (pAy-rotatePointY) + A13 * (pAz-rotatePointZ);\n" |
822 |
+ |
" #local pAy_new = rotatePointY + A21 * (pAx-rotatePointX) + A22 * (pAy-rotatePointY) + A23 * (pAz-rotatePointZ);\n" |
823 |
+ |
" #local pAz_new = rotatePointZ + A31 * (pAx-rotatePointX) + A32 * (pAy-rotatePointY) + A33 * (pAz-rotatePointZ);\n" |
824 |
+ |
"\n" |
825 |
+ |
" #local pBx_new = rotatePointX + A11 * (pBx-rotatePointX) + A12 * (pBy-rotatePointY) + A13 * (pBz-rotatePointZ);\n" |
826 |
+ |
" #local pBy_new = rotatePointY + A21 * (pBx-rotatePointX) + A22 * (pBy-rotatePointY) + A23 * (pBz-rotatePointZ);\n" |
827 |
+ |
" #local pBz_new = rotatePointZ + A31 * (pBx-rotatePointX) + A32 * (pBy-rotatePointY) + A33 * (pBz-rotatePointZ);\n" |
828 |
+ |
"\n" |
829 |
+ |
" #local pCx_new = rotatePointX + A11 * (pCx-rotatePointX) + A12 * (pCy-rotatePointY) + A13 * (pCz-rotatePointZ);\n" |
830 |
+ |
" #local pCy_new = rotatePointY + A21 * (pCx-rotatePointX) + A22 * (pCy-rotatePointY) + A23 * (pCz-rotatePointZ);\n" |
831 |
+ |
" #local pCz_new = rotatePointZ + A31 * (pCx-rotatePointX) + A32 * (pCy-rotatePointY) + A33 * (pCz-rotatePointZ);\n" |
832 |
+ |
"\n" |
833 |
+ |
" #local pDx_new = rotatePointX + A11 * (pDx-rotatePointX) + A12 * (pDy-rotatePointY) + A13 * (pDz-rotatePointZ);\n" |
834 |
+ |
" #local pDy_new = rotatePointY + A21 * (pDx-rotatePointX) + A22 * (pDy-rotatePointY) + A23 * (pDz-rotatePointZ);\n" |
835 |
+ |
" #local pDz_new = rotatePointZ + A31 * (pDx-rotatePointX) + A32 * (pDy-rotatePointY) + A33 * (pDz-rotatePointZ);\n" |
836 |
+ |
"\n" |
837 |
+ |
" #local pEx_new = rotatePointX + A11 * (pEx-rotatePointX) + A12 * (pEy-rotatePointY) + A13 * (pEz-rotatePointZ);\n" |
838 |
+ |
" #local pEy_new = rotatePointY + A21 * (pEx-rotatePointX) + A22 * (pEy-rotatePointY) + A23 * (pEz-rotatePointZ);\n" |
839 |
+ |
" #local pEz_new = rotatePointZ + A31 * (pEx-rotatePointX) + A32 * (pEy-rotatePointY) + A33 * (pEz-rotatePointZ);\n" |
840 |
+ |
"\n" |
841 |
+ |
" #local pFx_new = rotatePointX + A11 * (pFx-rotatePointX) + A12 * (pFy-rotatePointY) + A13 * (pFz-rotatePointZ);\n" |
842 |
+ |
" #local pFy_new = rotatePointY + A21 * (pFx-rotatePointX) + A22 * (pFy-rotatePointY) + A23 * (pFz-rotatePointZ);\n" |
843 |
+ |
" #local pFz_new = rotatePointZ + A31 * (pFx-rotatePointX) + A32 * (pFy-rotatePointY) + A33 * (pFz-rotatePointZ);\n" |
844 |
+ |
"\n" |
845 |
+ |
" #local pGx_new = rotatePointX + A11 * (pGx-rotatePointX) + A12 * (pGy-rotatePointY) + A13 * (pGz-rotatePointZ);\n" |
846 |
+ |
" #local pGy_new = rotatePointY + A21 * (pGx-rotatePointX) + A22 * (pGy-rotatePointY) + A23 * (pGz-rotatePointZ);\n" |
847 |
+ |
" #local pGz_new = rotatePointZ + A31 * (pGx-rotatePointX) + A32 * (pGy-rotatePointY) + A33 * (pGz-rotatePointZ);\n" |
848 |
+ |
"\n" |
849 |
+ |
" #local pHx_new = rotatePointX + A11 * (pHx-rotatePointX) + A12 * (pHy-rotatePointY) + A13 * (pHz-rotatePointZ);\n" |
850 |
+ |
" #local pHy_new = rotatePointY + A21 * (pHx-rotatePointX) + A22 * (pHy-rotatePointY) + A23 * (pHz-rotatePointZ);\n" |
851 |
+ |
" #local pHz_new = rotatePointZ + A31 * (pHx-rotatePointX) + A32 * (pHy-rotatePointY) + A33 * (pHz-rotatePointZ);\n" |
852 |
+ |
"\n" |
853 |
+ |
" #else\n" |
854 |
+ |
" #local pAx_new = pAx;" |
855 |
+ |
" #local pAy_new = pAy;" |
856 |
+ |
" #local pAz_new = pAz;" |
857 |
+ |
"\n" |
858 |
+ |
" #local pBx_new = pBx;" |
859 |
+ |
" #local pBy_new = pBy;" |
860 |
+ |
" #local pBz_new = pBz;" |
861 |
+ |
"\n" |
862 |
+ |
" #local pCx_new = pCx;" |
863 |
+ |
" #local pCy_new = pCy;" |
864 |
+ |
" #local pCz_new = pCz;" |
865 |
+ |
"\n" |
866 |
+ |
" #local pDx_new = pDx;" |
867 |
+ |
" #local pDy_new = pDy;" |
868 |
+ |
" #local pDz_new = pDz;" |
869 |
+ |
"\n" |
870 |
+ |
" #local pEx_new = pEx;" |
871 |
+ |
" #local pEy_new = pEy;" |
872 |
+ |
" #local pEz_new = pEz;" |
873 |
+ |
"\n" |
874 |
+ |
" #local pFx_new = pFx;" |
875 |
+ |
" #local pFy_new = pFy;" |
876 |
+ |
" #local pFz_new = pFz;" |
877 |
+ |
"\n" |
878 |
+ |
" #local pGx_new = pGx;" |
879 |
+ |
" #local pGy_new = pGy;" |
880 |
+ |
" #local pGz_new = pGz;" |
881 |
+ |
"\n" |
882 |
+ |
" #local pHx_new = pHx;" |
883 |
+ |
" #local pHy_new = pHy;" |
884 |
+ |
" #local pHz_new = pHz;" |
885 |
+ |
"\n" |
886 |
+ |
" #end\n" |
887 |
+ |
" #local pAx = pAx_new;" |
888 |
+ |
" #local pAy = pAy_new;" |
889 |
+ |
" #local pAz = pAz_new;" |
890 |
+ |
"\n" |
891 |
+ |
" #local pBx = pBx_new;" |
892 |
+ |
" #local pBy = pBy_new;" |
893 |
+ |
" #local pBz = pBz_new;" |
894 |
+ |
"\n" |
895 |
+ |
" #local pCx = pCx_new;" |
896 |
+ |
" #local pCy = pCy_new;" |
897 |
+ |
" #local pCz = pCz_new;" |
898 |
+ |
"\n" |
899 |
+ |
" #local pDx = pDx_new;" |
900 |
+ |
" #local pDy = pDy_new;" |
901 |
+ |
" #local pDz = pDz_new;" |
902 |
+ |
"\n" |
903 |
+ |
" #local pEx = pEx_new;" |
904 |
+ |
" #local pEy = pEy_new;" |
905 |
+ |
" #local pEz = pEz_new;" |
906 |
+ |
"\n" |
907 |
+ |
" #local pFx = pFx_new;" |
908 |
+ |
" #local pFy = pFy_new;" |
909 |
+ |
" #local pFz = pFz_new;" |
910 |
+ |
"\n" |
911 |
+ |
" #local pGx = pGx_new;" |
912 |
+ |
" #local pGy = pGy_new;" |
913 |
+ |
" #local pGz = pGz_new;" |
914 |
+ |
"\n" |
915 |
+ |
" #local pHx = pHx_new;" |
916 |
+ |
" #local pHy = pHy_new;" |
917 |
+ |
" #local pHz = pHz_new;" |
918 |
+ |
"\n" |
919 |
+ |
" #local colorR = 0.90;\n" |
920 |
+ |
" #local colorG = 0.91;\n" |
921 |
+ |
" #local colorB = 0.98;\n" |
922 |
+ |
"\n" |
923 |
+ |
" #local pipeWidth = 0.4;\n" |
924 |
+ |
"\n" |
925 |
+ |
" // 1\n" |
926 |
+ |
" cylinder{\n" |
927 |
+ |
" < pAx, pAy, pAz >,\n" |
928 |
+ |
" < pBx, pBy, pBz >,\n" |
929 |
+ |
" pipeWidth\n" |
930 |
+ |
" texture{\n" |
931 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
932 |
+ |
" finish{\n" |
933 |
+ |
" ambient .2\n" |
934 |
+ |
" diffuse .6\n" |
935 |
+ |
" specular 1\n" |
936 |
+ |
" roughness .001\n" |
937 |
+ |
" metallic\n" |
938 |
+ |
" }\n" |
939 |
+ |
" }\n" |
940 |
+ |
" }\n" |
941 |
|
"\n" |
942 |
+ |
" // 2\n" |
943 |
+ |
" cylinder{\n" |
944 |
+ |
" < pAx, pAy, pAz >,\n" |
945 |
+ |
" < pCx, pCy, pCz >,\n" |
946 |
+ |
" pipeWidth\n" |
947 |
+ |
" texture{\n" |
948 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
949 |
+ |
" finish{\n" |
950 |
+ |
" ambient .2\n" |
951 |
+ |
" diffuse .6\n" |
952 |
+ |
" specular 1\n" |
953 |
+ |
" roughness .001\n" |
954 |
+ |
" metallic\n" |
955 |
+ |
" }\n" |
956 |
+ |
" }\n" |
957 |
+ |
" }\n" |
958 |
+ |
"\n" |
959 |
+ |
" // 3\n" |
960 |
+ |
" cylinder{\n" |
961 |
+ |
" < pAx, pAy, pAz >,\n" |
962 |
+ |
" < pDx, pDy, pDz >,\n" |
963 |
+ |
" pipeWidth\n" |
964 |
+ |
" texture{\n" |
965 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
966 |
+ |
" finish{\n" |
967 |
+ |
" ambient .2\n" |
968 |
+ |
" diffuse .6\n" |
969 |
+ |
" specular 1\n" |
970 |
+ |
" roughness .001\n" |
971 |
+ |
" metallic\n" |
972 |
+ |
" }\n" |
973 |
+ |
" }\n" |
974 |
+ |
" }\n" |
975 |
+ |
"\n" |
976 |
+ |
" // 4\n" |
977 |
+ |
" cylinder{\n" |
978 |
+ |
" < pBx, pBy, pBz >,\n" |
979 |
+ |
" < pEx, pEy, pEz >,\n" |
980 |
+ |
" pipeWidth\n" |
981 |
+ |
" texture{\n" |
982 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
983 |
+ |
" finish{\n" |
984 |
+ |
" ambient .2\n" |
985 |
+ |
" diffuse .6\n" |
986 |
+ |
" specular 1\n" |
987 |
+ |
" roughness .001\n" |
988 |
+ |
" metallic\n" |
989 |
+ |
" }\n" |
990 |
+ |
" }\n" |
991 |
+ |
" }\n" |
992 |
+ |
"\n" |
993 |
+ |
" // 5\n" |
994 |
+ |
" cylinder{\n" |
995 |
+ |
" < pCx, pCy, pCz >,\n" |
996 |
+ |
" < pEx, pEy, pEz >,\n" |
997 |
+ |
" pipeWidth\n" |
998 |
+ |
" texture{\n" |
999 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
1000 |
+ |
" finish{\n" |
1001 |
+ |
" ambient .2\n" |
1002 |
+ |
" diffuse .6\n" |
1003 |
+ |
" specular 1\n" |
1004 |
+ |
" roughness .001\n" |
1005 |
+ |
" metallic\n" |
1006 |
+ |
" }\n" |
1007 |
+ |
" }\n" |
1008 |
+ |
" }\n" |
1009 |
+ |
"\n" |
1010 |
+ |
" // 6\n" |
1011 |
+ |
" cylinder{\n" |
1012 |
+ |
" < pBx, pBy, pBz >,\n" |
1013 |
+ |
" < pFx, pFy, pFz >,\n" |
1014 |
+ |
" pipeWidth\n" |
1015 |
+ |
" texture{\n" |
1016 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
1017 |
+ |
" finish{\n" |
1018 |
+ |
" ambient .2\n" |
1019 |
+ |
" diffuse .6\n" |
1020 |
+ |
" specular 1\n" |
1021 |
+ |
" roughness .001\n" |
1022 |
+ |
" metallic\n" |
1023 |
+ |
" }\n" |
1024 |
+ |
" }\n" |
1025 |
+ |
" }\n" |
1026 |
+ |
"\n" |
1027 |
+ |
" // 7\n" |
1028 |
+ |
" cylinder{\n" |
1029 |
+ |
" < pCx, pCy, pCz >,\n" |
1030 |
+ |
" < pGx, pGy, pGz >,\n" |
1031 |
+ |
" pipeWidth\n" |
1032 |
+ |
" texture{\n" |
1033 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
1034 |
+ |
" finish{\n" |
1035 |
+ |
" ambient .2\n" |
1036 |
+ |
" diffuse .6\n" |
1037 |
+ |
" specular 1\n" |
1038 |
+ |
" roughness .001\n" |
1039 |
+ |
" metallic\n" |
1040 |
+ |
" }\n" |
1041 |
+ |
" }\n" |
1042 |
+ |
" }\n" |
1043 |
+ |
"\n" |
1044 |
+ |
" // 8\n" |
1045 |
+ |
" cylinder{\n" |
1046 |
+ |
" < pDx, pDy, pDz >,\n" |
1047 |
+ |
" < pGx, pGy, pGz >,\n" |
1048 |
+ |
" pipeWidth\n" |
1049 |
+ |
" texture{\n" |
1050 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
1051 |
+ |
" finish{\n" |
1052 |
+ |
" ambient .2\n" |
1053 |
+ |
" diffuse .6\n" |
1054 |
+ |
" specular 1\n" |
1055 |
+ |
" roughness .001\n" |
1056 |
+ |
" metallic\n" |
1057 |
+ |
" }\n" |
1058 |
+ |
" }\n" |
1059 |
+ |
" }\n" |
1060 |
+ |
"\n" |
1061 |
+ |
" // 9\n" |
1062 |
+ |
" cylinder{\n" |
1063 |
+ |
" < pDx, pDy, pDz >,\n" |
1064 |
+ |
" < pFx, pFy, pFz >,\n" |
1065 |
+ |
" pipeWidth\n" |
1066 |
+ |
" texture{\n" |
1067 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
1068 |
+ |
" finish{\n" |
1069 |
+ |
" ambient .2\n" |
1070 |
+ |
" diffuse .6\n" |
1071 |
+ |
" specular 1\n" |
1072 |
+ |
" roughness .001\n" |
1073 |
+ |
" metallic\n" |
1074 |
+ |
" }\n" |
1075 |
+ |
" }\n" |
1076 |
+ |
" }\n" |
1077 |
+ |
"\n" |
1078 |
+ |
" // 10\n" |
1079 |
+ |
" cylinder{\n" |
1080 |
+ |
" < pEx, pEy, pEz >,\n" |
1081 |
+ |
" < pHx, pHy, pHz >,\n" |
1082 |
+ |
" pipeWidth\n" |
1083 |
+ |
" texture{\n" |
1084 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
1085 |
+ |
" finish{\n" |
1086 |
+ |
" ambient .2\n" |
1087 |
+ |
" diffuse .6\n" |
1088 |
+ |
" specular 1\n" |
1089 |
+ |
" roughness .001\n" |
1090 |
+ |
" metallic\n" |
1091 |
+ |
" }\n" |
1092 |
+ |
" }\n" |
1093 |
+ |
" }\n" |
1094 |
+ |
"\n" |
1095 |
+ |
" // 11\n" |
1096 |
+ |
" cylinder{\n" |
1097 |
+ |
" < pFx, pFy, pFz >,\n" |
1098 |
+ |
" < pHx, pHy, pHz >,\n" |
1099 |
+ |
" pipeWidth\n" |
1100 |
+ |
" texture{\n" |
1101 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
1102 |
+ |
" finish{\n" |
1103 |
+ |
" ambient .2\n" |
1104 |
+ |
" diffuse .6\n" |
1105 |
+ |
" specular 1\n" |
1106 |
+ |
" roughness .001\n" |
1107 |
+ |
" metallic\n" |
1108 |
+ |
" }\n" |
1109 |
+ |
" }\n" |
1110 |
+ |
" }\n" |
1111 |
+ |
"\n" |
1112 |
+ |
" // 12\n" |
1113 |
+ |
" cylinder{\n" |
1114 |
+ |
" < pGx, pGy, pGz >,\n" |
1115 |
+ |
" < pHx, pHy, pHz >,\n" |
1116 |
+ |
" pipeWidth\n" |
1117 |
+ |
" texture{\n" |
1118 |
+ |
" pigment{ rgb < colorR, colorG, colorB > }\n" |
1119 |
+ |
" finish{\n" |
1120 |
+ |
" ambient .2\n" |
1121 |
+ |
" diffuse .6\n" |
1122 |
+ |
" specular 1\n" |
1123 |
+ |
" roughness .001\n" |
1124 |
+ |
" metallic\n" |
1125 |
+ |
" }\n" |
1126 |
+ |
" }\n" |
1127 |
+ |
" }\n" |
1128 |
+ |
"\n" |
1129 |
|
"#end\n" |
1130 |
+ |
"\n" |
1131 |
|
"\n"); |
1132 |
< |
|
1133 |
< |
|
1132 |
> |
|
1133 |
> |
|
1134 |
> |
|
1135 |
> |
|
1136 |
|
make_header_macros(out_file); |
1137 |
|
|
1138 |
|
fclose(out_file); |
1160 |
|
" -h draw hydrogens\n" |
1161 |
|
" -b draw bonds\n" |
1162 |
|
" -a draw atoms\n" |
1163 |
+ |
" -v draw vectors\n" |
1164 |
+ |
" -p draw periodic box\n" |
1165 |
|
" -r regenerate bond\n" |
1166 |
+ |
" -f <#> render frame <#> only\n" |
1167 |
+ |
" -s <#> begin at frame <#> (inclusive)\n" |
1168 |
+ |
" -e <#> end at frame <#> (inclusive)\n" |
1169 |
|
"\n", |
1170 |
|
program_name); |
1171 |
|
exit(8); |
1172 |
|
} |
1173 |
+ |
|
1174 |
+ |
int count_tokens(line, delimiters) |
1175 |
+ |
/* PURPOSE: RETURN A COUNT OF THE NUMBER OF TOKENS ON THE LINE. */ |
1176 |
+ |
char *line; /* LINE CONTAINING TOKENS. */ |
1177 |
+ |
char *delimiters; /* POSSIBLE TOKEN DELIMITERS TO USE. */ |
1178 |
+ |
{ |
1179 |
+ |
char *working_line; /* WORKING COPY OF LINE. */ |
1180 |
+ |
int ntokens; /* NUMBER OF TOKENS FOUND IN LINE. */ |
1181 |
+ |
char *strtok_ptr; /* POINTER FOR STRTOK. */ |
1182 |
+ |
|
1183 |
+ |
strtok_ptr= working_line= strdup(line); |
1184 |
+ |
|
1185 |
+ |
ntokens=0; |
1186 |
+ |
while (strtok(strtok_ptr,delimiters)!=NULL) |
1187 |
+ |
{ |
1188 |
+ |
ntokens++; |
1189 |
+ |
strtok_ptr=NULL; |
1190 |
+ |
} |
1191 |
+ |
|
1192 |
+ |
free(working_line); |
1193 |
+ |
return(ntokens); |
1194 |
+ |
} |