1 |
+ |
#define _FILE_OFFSET_BITS 64 |
2 |
+ |
|
3 |
|
#include <stdio.h> |
4 |
|
#include <stdlib.h> |
5 |
|
#include <string.h> |
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; |
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; |
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 |
|
|
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 |
|
|
315 |
|
if( draw_box ){ |
316 |
|
foo = strtok(read_buffer, " ,;\t"); |
317 |
|
if(foo == NULL){ |
318 |
< |
printf("error in reading file\n"); |
318 |
> |
printf("error in reading file time\n"); |
319 |
|
exit(8); |
320 |
|
} |
321 |
|
|
322 |
|
foo = strtok(NULL, " ,;\t"); |
323 |
|
if(foo == NULL){ |
324 |
< |
printf("error in reading file\n"); |
324 |
> |
printf("error in reading file h00\n"); |
325 |
|
exit(8); |
326 |
|
} |
327 |
|
current_frame->Hmat[0][0] = atof( foo ); |
328 |
|
|
329 |
|
foo = strtok(NULL, " ,;\t"); |
330 |
|
if(foo == NULL){ |
331 |
< |
printf("error in reading file\n"); |
331 |
> |
printf("error in reading file h10\n"); |
332 |
|
exit(8); |
333 |
|
} |
334 |
|
current_frame->Hmat[1][0] = atof( foo ); |
335 |
|
|
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 |
|
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 |
|
current_frame->Hmat[0][1] = atof( foo ); |
349 |
|
|
350 |
|
foo = strtok(NULL, " ,;\t"); |
351 |
|
if(foo == NULL){ |
352 |
< |
printf("error in reading file\n"); |
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 |
|
current_frame->Hmat[2][1] = atof( foo ); |
363 |
|
|
364 |
|
foo = strtok(NULL, " ,;\t"); |
365 |
|
if(foo == NULL){ |
366 |
< |
printf("error in reading file\n"); |
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\n"); |
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\n"); |
380 |
> |
printf("error in reading file h22\n"); |
381 |
|
exit(8); |
382 |
|
} |
383 |
|
current_frame->Hmat[2][2] = atof( foo ); |
388 |
|
|
389 |
|
eof_test = fgets(read_buffer, sizeof(read_buffer), in_file); |
390 |
|
if(eof_test == NULL){ |
391 |
< |
printf("error in reading file\n"); |
391 |
> |
printf("error in reading file line at atom %d\n", i); |
392 |
|
exit(8); |
393 |
+ |
} |
394 |
+ |
|
395 |
+ |
nTokens = count_tokens(read_buffer, " ,;\t"); |
396 |
+ |
|
397 |
+ |
if (nTokens < 4) { |
398 |
+ |
printf("Not enough tokens while parsing file at atom %d\n", i); |
399 |
+ |
exit(8); |
400 |
|
} |
401 |
|
|
402 |
|
foo = strtok(read_buffer, " ,;\t"); |
384 |
– |
if(foo == NULL){ |
385 |
– |
printf("error in reading file\n"); |
386 |
– |
exit(8); |
387 |
– |
} |
403 |
|
(void)strcpy(current_frame->r[i].name, foo); /*copy the atom name */ |
404 |
|
|
390 |
– |
/* next we grab the positions */ |
391 |
– |
|
405 |
|
foo = strtok(NULL, " ,;\t"); |
393 |
– |
if(foo == NULL){ |
394 |
– |
printf("error in reading file\n"); |
395 |
– |
exit(8); |
396 |
– |
} |
406 |
|
(void)sscanf(foo, "%lf",¤t_frame->r[i].x); |
398 |
– |
if(current_frame->r[i].x > big_x) big_x = current_frame->r[i].x; |
399 |
– |
if(current_frame->r[i].x < small_x) small_x = current_frame->r[i].x; |
400 |
– |
|
401 |
– |
|
407 |
|
foo = strtok(NULL, " ,;\t"); |
403 |
– |
if(foo == NULL){ |
404 |
– |
printf("error in reading file\n"); |
405 |
– |
exit(8); |
406 |
– |
} |
408 |
|
(void)sscanf(foo, "%lf", ¤t_frame->r[i].y); |
409 |
< |
if(current_frame->r[i].y > big_y) big_y = current_frame->r[i].y; |
410 |
< |
if(current_frame->r[i].y < small_y) small_y = current_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 |
|
|
412 |
– |
foo = strtok(NULL, " ,;\t"); |
413 |
– |
if(foo == NULL){ |
414 |
– |
printf("error in reading file\n"); |
415 |
– |
exit(8); |
433 |
|
} |
417 |
– |
(void)sscanf(foo, "%lf", ¤t_frame->r[i].z); |
418 |
– |
if(current_frame->r[i].z > big_z) big_z = current_frame->r[i].z; |
419 |
– |
if(current_frame->r[i].z < small_z) small_z = current_frame->r[i].z; |
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 |
|
|
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); |
549 |
> |
draw_atoms, draw_vectors); |
550 |
|
free(out_coords); |
551 |
|
(void)fclose(out_file); |
552 |
|
} |
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); |
610 |
> |
draw_atoms, draw_vectors); |
611 |
|
free(out_coords); |
612 |
|
|
613 |
|
(void)fclose(out_file); |
692 |
|
"\n" |
693 |
|
"#declare ATOM_SPHERE_FACTOR = 0.2;\n" |
694 |
|
"#declare BOND_RADIUS = 0.1;\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" |
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" |
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" |
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" |
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 |
|
} |