ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/group/trunk/xyz2pov/src/xyz2pov.c
(Generate patch)

Comparing trunk/xyz2pov/src/xyz2pov.c (file contents):
Revision 629 by mmeineke, Thu Jul 17 15:47:36 2003 UTC vs.
Revision 2750 by tim, Fri May 12 19:24:30 2006 UTC

# Line 1 | Line 1
1 + #define _FILE_OFFSET_BITS 64
2 +
3   #include <stdio.h>
4   #include <stdlib.h>
5   #include <string.h>
# Line 24 | Line 26 | int draw_atoms = 0; /*boolean to draw atoms */
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;
# Line 47 | Line 51 | int main(argc, argv)
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 */
# Line 66 | Line 71 | int main(argc, argv)
71    char current_flag;
72    int nFrames;
73    int nZeroes;
74 +  int nTokens;
75    double count;
76  
77    int startFrame = 1;
# Line 180 | Line 186 | int main(argc, argv)
186              // -a => draw the atoms
187  
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':
# Line 271 | Line 283 | int main(argc, argv)
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  
# Line 303 | Line 315 | int main(argc, argv)
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 );
# Line 376 | Line 388 | int main(argc, argv)
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 <      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 */
395 >      nTokens = count_tokens(read_buffer, " ,;\t");
396  
397 <      /* next we grab the positions */
398 <      
399 <      foo = strtok(NULL, " ,;\t");
393 <      if(foo == NULL){
394 <        printf("error in reading file\n");
395 <        exit(8);
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");
403 +      (void)strcpy(current_frame->r[i].name, foo); /*copy the atom name */
404 +
405 +      foo = strtok(NULL, " ,;\t");
406        (void)sscanf(foo, "%lf",&current_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", &current_frame->r[i].y);
408      if(current_frame->r[i].y > big_y) big_y = current_frame->r[i].y;
409      if(current_frame->r[i].y < small_y) small_y = current_frame->r[i].y;
410
411
409        foo = strtok(NULL, " ,;\t");
413      if(foo == NULL){
414        printf("error in reading file\n");
415        exit(8);
416      }
410        (void)sscanf(foo, "%lf", &current_frame->r[i].z);
411 <      if(current_frame->r[i].z > big_z) big_z = current_frame->r[i].z;
412 <      if(current_frame->r[i].z < small_z) small_z = current_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", &current_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", &current_frame->r[i].ux);
447 +        foo = strtok(NULL, " ,;\t");
448 +        (void)sscanf(foo, "%lf", &current_frame->r[i].uy);
449 +        foo = strtok(NULL, " ,;\t");
450 +        (void)sscanf(foo, "%lf", &current_frame->r[i].uz);
451 +        current_frame->r[i].hasVector = 1;
452 +      } else {
453 +        current_frame->r[i].hasVector = 0;
454 +      }
455 +
456 +      if (nTokens >= 10) {
457 +        foo = strtok(NULL, " ,;\t");
458 +        (void)sscanf(foo, "%lf", &current_frame->r[i].vx);
459 +        foo = strtok(NULL, " ,;\t");
460 +        (void)sscanf(foo, "%lf", &current_frame->r[i].vy);
461 +        foo = strtok(NULL, " ,;\t");
462 +        (void)sscanf(foo, "%lf", &current_frame->r[i].vz);
463 +        current_frame->r[i].hasSecondVector = 1;
464 +      } else {
465 +        current_frame->r[i].hasSecondVector = 0;
466 +      }
467 +
468 +
469 +
470      }
471      currentCount++;
472      
# Line 484 | Line 533 | int main(argc, argv)
533              out_coords[j].x = temp_frame->r[j].x + dx * (i+1);
534              out_coords[j].y = temp_frame->r[j].y + dy * (i+1);
535              out_coords[j].z = temp_frame->r[j].z + dz * (i+1);
536 +
537 +            if (current_frame->r[j].hasVector) {              
538 +              dx = current_frame->r[j].ux - temp_frame->r[j].ux;
539 +              dy = current_frame->r[j].uy - temp_frame->r[j].uy;
540 +              dz = current_frame->r[j].uz - temp_frame->r[j].uz;
541 +              
542 +              dx /= (double)(n_interpolate + 1);
543 +              dy /= (double)(n_interpolate + 1);
544 +              dz /= (double)(n_interpolate + 1);
545 +              
546 +              out_coords[j].hasVector = current_frame->r[j].hasVector;
547 +              out_coords[j].ux = temp_frame->r[j].ux + dx * (i+1);
548 +              out_coords[j].uy = temp_frame->r[j].uy + dy * (i+1);
549 +              out_coords[j].uz = temp_frame->r[j].uz + dz * (i+1);
550 +            }
551 +
552 +            if (current_frame->r[j].hasSecondVector) {              
553 +              dx = current_frame->r[j].vx - temp_frame->r[j].vx;
554 +              dy = current_frame->r[j].vy - temp_frame->r[j].vy;
555 +              dz = current_frame->r[j].vz - temp_frame->r[j].vz;
556 +              
557 +              dx /= (double)(n_interpolate + 1);
558 +              dy /= (double)(n_interpolate + 1);
559 +              dz /= (double)(n_interpolate + 1);
560 +              
561 +              out_coords[j].hasVector = current_frame->r[j].hasSecondVector;
562 +              out_coords[j].vx = temp_frame->r[j].vx + dx * (i+1);
563 +              out_coords[j].vy = temp_frame->r[j].vy + dy * (i+1);
564 +              out_coords[j].vz = temp_frame->r[j].vz + dz * (i+1);
565 +            }
566 +
567 +            if (current_frame->r[j].hasCharge) {              
568 +              dx = current_frame->r[j].charge - temp_frame->r[j].charge;
569 +              
570 +              dx /= (double)(n_interpolate + 1);
571 +              
572 +              out_coords[j].hasCharge = current_frame->r[j].hasCharge;
573 +              out_coords[j].charge = temp_frame->r[j].charge + dx * (i+1);
574 +            }
575 +
576            }
577            
578            pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds,
579 <                    draw_atoms);
579 >                    draw_atoms, draw_vectors);
580            free(out_coords);
581            (void)fclose(out_file);
582          }
# Line 511 | Line 600 | int main(argc, argv)
600        if( draw_box ){
601          
602          fprintf( out_file,
603 <                 "makePeriodicBox( %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf %lf )\n"
603 >                 "makePeriodicBox( %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf )\n"
604                   "\n",
605                   current_frame->Hmat[0][0],
606                   current_frame->Hmat[2][0],
# Line 534 | Line 623 | int main(argc, argv)
623          out_coords[i].x = current_frame->r[i].x;
624          out_coords[i].y = current_frame->r[i].y;
625          out_coords[i].z = current_frame->r[i].z;
626 +
627 +        if (current_frame->r[i].hasVector) {              
628 +          out_coords[i].hasVector = current_frame->r[i].hasVector;
629 +          out_coords[i].ux = current_frame->r[i].ux;
630 +          out_coords[i].uy = current_frame->r[i].uy;
631 +          out_coords[i].uz = current_frame->r[i].uz;
632 +        }
633 +
634 +        if (current_frame->r[i].hasSecondVector) {              
635 +          out_coords[i].hasSecondVector = current_frame->r[i].hasSecondVector;
636 +          out_coords[i].vx = current_frame->r[i].vx;
637 +          out_coords[i].vy = current_frame->r[i].vy;
638 +          out_coords[i].vz = current_frame->r[i].vz;
639 +        }
640 +
641 +        if (current_frame->r[i].hasCharge) {              
642 +          out_coords[i].hasCharge = current_frame->r[i].hasCharge;
643 +          out_coords[i].charge = current_frame->r[i].charge;
644 +        }
645        }
646        pov_write(out_file, out_coords, n_atoms, draw_hydrogens, draw_bonds,
647 <                draw_atoms);
647 >                draw_atoms, draw_vectors);
648        free(out_coords);
649        
650        (void)fclose(out_file);
# Line 599 | Line 707 | int main(argc, argv)
707      fprintf(out_file,
708              "// The following script was automatically generated by:\n"
709              "// xyz2pov Copyright 2001 by MATTHEW A. MEINEKE\n"
710 +            "#include \"colors.inc\"\n"
711 +            "#include \"math.inc\"\n"
712              "\n"
713              "\n"
714              "background { rgb <1.0, 1.0, 1.0> }\n"
# Line 621 | Line 731 | int main(argc, argv)
731              "\n"
732              "#declare ATOM_SPHERE_FACTOR = 0.2;\n"
733              "#declare BOND_RADIUS = 0.1;\n"
734 +            "#declare VECTOR_SCALE = 1.0;\n"    
735 +            "#declare STICK_RADIUS = 0.5 * BOND_RADIUS;\n"
736 +            "#declare CONE_RADIUS = 2.0 * STICK_RADIUS;\n"
737 +            "#declare CONE_FRACTION = 0.15;\n"
738              "\n"
739              "// declare camera, light, and system variables\n"
740              "\n"
# Line 638 | Line 752 | int main(argc, argv)
752              "#declare cameraLookY = sysCenterY;\n"
753              "#declare cameraLookZ = sysCenterZ;\n"
754              "\n"
755 +            "#declare rotatePointX = cameraLookX;\n"
756 +            "#declare rotatePointY = cameraLookY;\n"
757 +            "#declare rotatePointZ = cameraLookZ;\n"
758 +            "\n"
759              "#declare cameraX = cameraLookX;\n"
760              "#declare cameraY = cameraLookY;\n"
761              "#declare cameraZ = cameraLookZ - zoom;\n"
# Line 653 | Line 771 | int main(argc, argv)
771              "#declare boxCenterX = cameraLookX;\n"
772              "#declare boxCenterY = cameraLookY;\n"
773              "#declare boxCenterZ = cameraLookZ;\n"
774 +            "#declare fn = function(x,y,z) {(y+1)/2}\n"
775 +            "#declare grad1 = pigment { function { fn(x, y, z) } color_map {[0.0 rgb <0,0,0>] [1.0 rgb <3,0,0>]}  };\n"
776 +            "#declare grad2 = pigment { function { fn(x, y, z) } rotate 120*z color_map {[0.0 rgb <0,0,0>] [1.0 rgb <0,3,0>]}  };\n"
777 +            "#declare grad3 = pigment { function { fn(x, y, z) } rotate 240*z color_map {[0.0 rgb <0,0,0>] [1.0 rgb <0,0,3>]}  };\n"
778 +            "#declare fnz = function(x,y,z) {(z+1)/2}\n"
779 +            "#declare gradz = pigment { function { fnz(x, y, z) } color_map {[0.0 rgb <0,0,0>] [1.0 rgb <1,1,1>]}  };\n"
780              "\n"
781              "// declare the cameras and the light sources\n"
782              "\n"
# Line 737 | Line 861 | int main(argc, argv)
861              "  #local pHx = boxCenterX + bx1 + bx2 + bx3 - bcx;\n"
862              "  #local pHy = boxCenterY + by1 + by2 + by3 - bcy;\n"
863              "  #local pHz = boxCenterZ + bz1 + bz2 + bz3 - bcz;\n"
864 +            "\n"
865 +            "  #if(ROTATE)\n"
866 +            "    #local pAx_new = rotatePointX + A11 * (pAx-rotatePointX) + A12 * (pAy-rotatePointY) + A13 * (pAz-rotatePointZ);\n"
867 +            "    #local pAy_new = rotatePointY + A21 * (pAx-rotatePointX) + A22 * (pAy-rotatePointY) + A23 * (pAz-rotatePointZ);\n"
868 +            "    #local pAz_new = rotatePointZ + A31 * (pAx-rotatePointX) + A32 * (pAy-rotatePointY) + A33 * (pAz-rotatePointZ);\n"
869              "\n"
870 +            "    #local pBx_new = rotatePointX + A11 * (pBx-rotatePointX) + A12 * (pBy-rotatePointY) + A13 * (pBz-rotatePointZ);\n"
871 +            "    #local pBy_new = rotatePointY + A21 * (pBx-rotatePointX) + A22 * (pBy-rotatePointY) + A23 * (pBz-rotatePointZ);\n"
872 +            "    #local pBz_new = rotatePointZ + A31 * (pBx-rotatePointX) + A32 * (pBy-rotatePointY) + A33 * (pBz-rotatePointZ);\n"
873 +            "\n"
874 +            "    #local pCx_new = rotatePointX + A11 * (pCx-rotatePointX) + A12 * (pCy-rotatePointY) + A13 * (pCz-rotatePointZ);\n"
875 +            "    #local pCy_new = rotatePointY + A21 * (pCx-rotatePointX) + A22 * (pCy-rotatePointY) + A23 * (pCz-rotatePointZ);\n"
876 +            "    #local pCz_new = rotatePointZ + A31 * (pCx-rotatePointX) + A32 * (pCy-rotatePointY) + A33 * (pCz-rotatePointZ);\n"
877 +            "\n"
878 +            "    #local pDx_new = rotatePointX + A11 * (pDx-rotatePointX) + A12 * (pDy-rotatePointY) + A13 * (pDz-rotatePointZ);\n"
879 +            "    #local pDy_new = rotatePointY + A21 * (pDx-rotatePointX) + A22 * (pDy-rotatePointY) + A23 * (pDz-rotatePointZ);\n"
880 +            "    #local pDz_new = rotatePointZ + A31 * (pDx-rotatePointX) + A32 * (pDy-rotatePointY) + A33 * (pDz-rotatePointZ);\n"
881 +            "\n"
882 +            "    #local pEx_new = rotatePointX + A11 * (pEx-rotatePointX) + A12 * (pEy-rotatePointY) + A13 * (pEz-rotatePointZ);\n"
883 +            "    #local pEy_new = rotatePointY + A21 * (pEx-rotatePointX) + A22 * (pEy-rotatePointY) + A23 * (pEz-rotatePointZ);\n"
884 +            "    #local pEz_new = rotatePointZ + A31 * (pEx-rotatePointX) + A32 * (pEy-rotatePointY) + A33 * (pEz-rotatePointZ);\n"
885 +            "\n"
886 +            "    #local pFx_new = rotatePointX + A11 * (pFx-rotatePointX) + A12 * (pFy-rotatePointY) + A13 * (pFz-rotatePointZ);\n"
887 +            "    #local pFy_new = rotatePointY + A21 * (pFx-rotatePointX) + A22 * (pFy-rotatePointY) + A23 * (pFz-rotatePointZ);\n"
888 +            "    #local pFz_new = rotatePointZ + A31 * (pFx-rotatePointX) + A32 * (pFy-rotatePointY) + A33 * (pFz-rotatePointZ);\n"
889 +            "\n"
890 +            "    #local pGx_new = rotatePointX + A11 * (pGx-rotatePointX) + A12 * (pGy-rotatePointY) + A13 * (pGz-rotatePointZ);\n"
891 +            "    #local pGy_new = rotatePointY + A21 * (pGx-rotatePointX) + A22 * (pGy-rotatePointY) + A23 * (pGz-rotatePointZ);\n"
892 +            "    #local pGz_new = rotatePointZ + A31 * (pGx-rotatePointX) + A32 * (pGy-rotatePointY) + A33 * (pGz-rotatePointZ);\n"
893 +            "\n"
894 +            "    #local pHx_new = rotatePointX + A11 * (pHx-rotatePointX) + A12 * (pHy-rotatePointY) + A13 * (pHz-rotatePointZ);\n"
895 +            "    #local pHy_new = rotatePointY + A21 * (pHx-rotatePointX) + A22 * (pHy-rotatePointY) + A23 * (pHz-rotatePointZ);\n"
896 +            "    #local pHz_new = rotatePointZ + A31 * (pHx-rotatePointX) + A32 * (pHy-rotatePointY) + A33 * (pHz-rotatePointZ);\n"
897 +            "\n"
898 +            "  #else\n"
899 +            "    #local pAx_new = pAx;"
900 +            "    #local pAy_new = pAy;"
901 +            "    #local pAz_new = pAz;"
902 +            "\n"
903 +            "    #local pBx_new = pBx;"
904 +            "    #local pBy_new = pBy;"
905 +            "    #local pBz_new = pBz;"
906 +            "\n"
907 +            "    #local pCx_new = pCx;"
908 +            "    #local pCy_new = pCy;"
909 +            "    #local pCz_new = pCz;"
910 +            "\n"
911 +            "    #local pDx_new = pDx;"
912 +            "    #local pDy_new = pDy;"
913 +            "    #local pDz_new = pDz;"
914 +            "\n"
915 +            "    #local pEx_new = pEx;"
916 +            "    #local pEy_new = pEy;"
917 +            "    #local pEz_new = pEz;"
918 +            "\n"
919 +            "    #local pFx_new = pFx;"
920 +            "    #local pFy_new = pFy;"
921 +            "    #local pFz_new = pFz;"
922 +            "\n"
923 +            "    #local pGx_new = pGx;"
924 +            "    #local pGy_new = pGy;"
925 +            "    #local pGz_new = pGz;"
926 +            "\n"
927 +            "    #local pHx_new = pHx;"
928 +            "    #local pHy_new = pHy;"
929 +            "    #local pHz_new = pHz;"
930 +            "\n"
931 +            "  #end\n"
932 +            "  #local pAx = pAx_new;"
933 +            "  #local pAy = pAy_new;"
934 +            "  #local pAz = pAz_new;"
935 +            "\n"                    
936 +            "  #local pBx = pBx_new;"
937 +            "  #local pBy = pBy_new;"
938 +            "  #local pBz = pBz_new;"
939 +            "\n"                    
940 +            "  #local pCx = pCx_new;"
941 +            "  #local pCy = pCy_new;"
942 +            "  #local pCz = pCz_new;"
943 +            "\n"                    
944 +            "  #local pDx = pDx_new;"
945 +            "  #local pDy = pDy_new;"
946 +            "  #local pDz = pDz_new;"
947 +            "\n"                    
948 +            "  #local pEx = pEx_new;"
949 +            "  #local pEy = pEy_new;"
950 +            "  #local pEz = pEz_new;"
951 +            "\n"                    
952 +            "  #local pFx = pFx_new;"
953 +            "  #local pFy = pFy_new;"
954 +            "  #local pFz = pFz_new;"
955 +            "\n"                    
956 +            "  #local pGx = pGx_new;"
957 +            "  #local pGy = pGy_new;"
958 +            "  #local pGz = pGz_new;"
959 +            "\n"                    
960 +            "  #local pHx = pHx_new;"
961 +            "  #local pHy = pHy_new;"
962 +            "  #local pHz = pHz_new;"
963 +            "\n"
964              "  #local colorR = 0.90;\n"
965              "  #local colorG = 0.91;\n"
966              "  #local colorB = 0.98;\n"
# Line 982 | Line 1205 | void usage(){
1205                  "   -h            draw hydrogens\n"
1206                  "   -b            draw bonds\n"
1207                  "   -a            draw atoms\n"
1208 +                "   -v            draw vectors\n"
1209                  "   -p            draw periodic box\n"
1210                  "   -r            regenerate bond\n"
1211                  "   -f <#>        render frame <#> only\n"
# Line 990 | Line 1214 | void usage(){
1214                  "\n",
1215                  program_name);
1216    exit(8);
1217 + }
1218 +
1219 + int count_tokens(line, delimiters)
1220 +     /* PURPOSE: RETURN A COUNT OF THE NUMBER OF TOKENS ON THE LINE. */
1221 +     char *line;                /* LINE CONTAINING TOKENS. */
1222 +     char *delimiters;  /* POSSIBLE TOKEN DELIMITERS TO USE. */
1223 + {
1224 +  char *working_line;   /* WORKING COPY OF LINE. */
1225 +  int ntokens;          /* NUMBER OF TOKENS FOUND IN LINE. */
1226 +  char *strtok_ptr;     /* POINTER FOR STRTOK. */
1227 +  
1228 +  strtok_ptr= working_line= strdup(line);
1229 +  
1230 +  ntokens=0;
1231 +  while (strtok(strtok_ptr,delimiters)!=NULL)
1232 +    {
1233 +      ntokens++;
1234 +      strtok_ptr=NULL;
1235 +    }
1236 +  
1237 +  free(working_line);
1238 +  return(ntokens);
1239   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines