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

Comparing trunk/xyz2pov/src/pov_writer.c (file contents):
Revision 2749 by mmeineke, Mon Apr 5 19:34:21 2004 UTC vs.
Revision 2750 by tim, Fri May 12 19:24:30 2006 UTC

# Line 33 | Line 33 | void pov_write(FILE *out_file, struct coords *the_coor
33  
34    int i,j; /*loop counters */
35    int skip_atom, skip_bond, test1, test2; /*booleans */
36 +  int gb_atom, gbdp_atom;
37    double dx, dy, dz; /* used in making the bonds */
38    
39    struct linked_bond_list *current_bond; /*keeps track of the linked list*/
# Line 60 | Line 61 | void pov_write(FILE *out_file, struct coords *the_coor
61        
62        if(!skip_atom){          
63          
64 <        fprintf(out_file,
65 <                "make_%s_atom( %lf, %lf, %lf )\n",
66 <                the_coords[i].name,
67 <                the_coords[i].x,
68 <                the_coords[i].z,
69 <                the_coords[i].y);
64 >        gb_atom = !strcmp("GB", the_coords[i].name);
65 >        gbdp_atom = !strcmp("GBDP", the_coords[i].name);
66 >        
67 >        if (gb_atom) {
68 >          fprintf(out_file,
69 >                  "make_%s_ellipse( %lf, %lf, %lf, %lf, %lf, %lf, %lf)\n",
70 >                  the_coords[i].name,
71 >                  the_coords[i].x,
72 >                  the_coords[i].z,
73 >                  the_coords[i].y,
74 >                  the_coords[i].charge,
75 >                  the_coords[i].ux,
76 >                  the_coords[i].uz,
77 >                  the_coords[i].uy);
78 >        } else {
79 >          if (gbdp_atom) {
80 >            fprintf(out_file,
81 >                    "make_%s_shaded_ellipse( %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf, %lf)\n",
82 >                    the_coords[i].name,
83 >                    the_coords[i].x,
84 >                    the_coords[i].z,
85 >                    the_coords[i].y,
86 >                    the_coords[i].charge,
87 >                    the_coords[i].ux,
88 >                    the_coords[i].uz,
89 >                    the_coords[i].uy,
90 >                    the_coords[i].vx,
91 >                    the_coords[i].vz,
92 >                    the_coords[i].vy);
93 >          } else {
94 >            fprintf(out_file,
95 >                    "make_%s_atom( %lf, %lf, %lf )\n",
96 >                    the_coords[i].name,
97 >                    the_coords[i].x,
98 >                    the_coords[i].z,
99 >                    the_coords[i].y);
100 >          }
101 >        }
102        }
103      }
104 <
104 >    
105      fprintf(out_file,
106              "\n"
107              "\n");
# Line 347 | Line 380 | void make_header_macros(FILE *out_file){
380              "    ATOM_SPHERE_FACTOR * %lf\n"
381              "    texture{\n"
382              "      pigment{ rgb < %lf, %lf, %lf > }\n"
383 +            "      finish{\n"
384 +            "        ambient .2\n"
385 +            "        diffuse .6\n"
386 +            "        specular 1\n"
387 +            "        roughness .001\n"
388 +            "        metallic\n"
389 +            "      }\n"
390 +            "    }\n"
391 +            "  }\n"
392 +            "#end\n"
393 +            "#macro make_%s_ellipse "
394 +            "(center_x, center_y, center_z, ecc, u_x, u_y, u_z)\n"
395 +                    "\n"
396 +            "  #local x1 = center_x;\n"
397 +            "  #local y1 = center_y;\n"
398 +            "  #local z1 = center_z;\n"
399 +            "  #local x2 = u_x;\n"
400 +            "  #local y2 = u_y;\n"
401 +            "  #local z2 = u_z;\n"
402 +            "\n"
403 +            "  #if(ROTATE)\n"
404 +            "\n"
405 +            "    #local x1_new = rotatePointX + A11 * (x1-rotatePointX) + A12 * (y1-rotatePointY) + A13 * (z1-rotatePointZ);\n"
406 +            "    #local y1_new = rotatePointY + A21 * (x1-rotatePointX) + A22 * (y1-rotatePointY) + A23 * (z1-rotatePointZ);\n"
407 +            "    #local z1_new = rotatePointZ + A31 * (x1-rotatePointX) + A32 * (y1-rotatePointY) + A33 * (z1-rotatePointZ);\n"
408 +            "\n"
409 +            "    #local x2_new = rotatePointX + A11 * (x2-rotatePointX) + A12 * (y2-rotatePointY) + A13 * (z2-rotatePointZ);\n"
410 +            "    #local y2_new = rotatePointY + A21 * (x2-rotatePointX) + A22 * (y2-rotatePointY) + A23 * (z2-rotatePointZ);\n"
411 +            "    #local z2_new = rotatePointZ + A31 * (x2-rotatePointX) + A32 * (y2-rotatePointY) + A33 * (z2-rotatePointZ);\n"
412 +            "\n"
413 +            "  #else\n"
414 +            "\n"
415 +            "    #local x1_new = x1;"
416 +            "    #local y1_new = y1;"
417 +            "    #local z1_new = z1;"
418 +            "\n"
419 +            "    #local x2_new = x2;"
420 +            "    #local y2_new = y2;"
421 +            "    #local z2_new = z2;"
422 +            "\n"
423 +            "  #end\n"
424 +            "\n"
425 +            "    #local myUlen = sqrt(x2_new*x2_new + y2_new*y2_new + z2_new*z2_new);\n"
426 +            "    #local uux = x2_new / myUlen;\n"
427 +            "    #local uuy = y2_new / myUlen;\n"
428 +            "    #local uuz = z2_new / myUlen;\n"
429 +            "    #local myTheta = -degrees(acos(uuz));\n"
430 +            "    #local myPsi = -degrees(atan(uux/uuy));\n"
431 +            "    #local myScale = ATOM_SPHERE_FACTOR * %lf;\n"
432 +            "\n"
433 +            "  sphere{\n"
434 +            "    < 0, 0, 0 >, 1\n"
435 +            "    texture{\n"
436 +            "      pigment{\n"
437 +            "        average\n"
438 +            "        pigment_map{\n"
439 +            "          [1.0 grad1]\n"
440 +            "          [1.0 grad2]\n"
441 +            "          [1.0 grad3]\n"
442 +            "          [5.0 gradz]\n"
443 +            "        }\n"
444 +            "      }\n"
445              "      finish{\n"
446              "        ambient .2\n"
447              "        diffuse .6\n"
# Line 355 | Line 450 | void make_header_macros(FILE *out_file){
450              "        metallic\n"
451              "      }\n"
452              "    }\n"
453 +            "    scale<myScale,myScale,ecc*myScale>\n"
454 +            "    rotate<myTheta,0,myPsi>\n"
455 +            "    translate< x1_new, y1_new, z1_new>\n"
456              "  }\n"
457              "#end\n"
458 +            "#macro make_%s_shaded_ellipse "
459 +            "(center_x, center_y, center_z, ecc, u_x, u_y, u_z, v_x, v_y, v_z)\n"
460 +                    "\n"
461 +            "  #local x1 = center_x;\n"
462 +            "  #local y1 = center_y;\n"
463 +            "  #local z1 = center_z;\n"
464 +            "  #local x2 = u_x;\n"
465 +            "  #local y2 = u_y;\n"
466 +            "  #local z2 = u_z;\n"
467 +            "  #local x3 = v_x;\n"
468 +            "  #local y3 = v_y;\n"
469 +            "  #local z3 = v_z;\n"
470 +            "\n"
471 +            "  #if(ROTATE)\n"
472 +            "\n"
473 +            "    #local x1_new = rotatePointX + A11 * (x1-rotatePointX) + A12 * (y1-rotatePointY) + A13 * (z1-rotatePointZ);\n"
474 +            "    #local y1_new = rotatePointY + A21 * (x1-rotatePointX) + A22 * (y1-rotatePointY) + A23 * (z1-rotatePointZ);\n"
475 +            "    #local z1_new = rotatePointZ + A31 * (x1-rotatePointX) + A32 * (y1-rotatePointY) + A33 * (z1-rotatePointZ);\n"
476 +            "\n"
477 +            "    #local x2_new = rotatePointX + A11 * (x2-rotatePointX) + A12 * (y2-rotatePointY) + A13 * (z2-rotatePointZ);\n"
478 +            "    #local y2_new = rotatePointY + A21 * (x2-rotatePointX) + A22 * (y2-rotatePointY) + A23 * (z2-rotatePointZ);\n"
479 +            "    #local z2_new = rotatePointZ + A31 * (x2-rotatePointX) + A32 * (y2-rotatePointY) + A33 * (z2-rotatePointZ);\n"
480 +            "\n"
481 +            "    #local x3_new = rotatePointX + A11 * (x3-rotatePointX) + A12 * (y3-rotatePointY) + A13 * (z3-rotatePointZ);\n"
482 +            "    #local y3_new = rotatePointY + A21 * (x3-rotatePointX) + A22 * (y3-rotatePointY) + A23 * (z3-rotatePointZ);\n"
483 +            "    #local z3_new = rotatePointZ + A31 * (x3-rotatePointX) + A32 * (y3-rotatePointY) + A33 * (z3-rotatePointZ);\n"
484 +            "\n"
485 +            "  #else\n"
486 +            "\n"
487 +            "    #local x1_new = x1;"
488 +            "    #local y1_new = y1;"
489 +            "    #local z1_new = z1;"
490 +            "\n"
491 +            "    #local x2_new = x2;"
492 +            "    #local y2_new = y2;"
493 +            "    #local z2_new = z2;"
494 +            "\n"
495 +            "    #local x3_new = x3;"
496 +            "    #local y3_new = y3;"
497 +            "    #local z3_new = z3;"
498 +            "\n"
499 +            "  #end\n"
500 +            "\n"
501 +            "    #local myUlen = sqrt(x2_new*x2_new + y2_new*y2_new + z2_new*z2_new);\n"
502 +            "    #local uux = x2_new / myUlen;\n"
503 +            "    #local uuy = y2_new / myUlen;\n"
504 +            "    #local uuz = z2_new / myUlen;\n"
505 +            "    #local myVlen = sqrt(x3_new*x3_new + y3_new*y3_new + z3_new*z3_new);\n"
506 +            "    #local vvx = x3_new / myVlen;\n"
507 +            "    #local vvy = y3_new / myVlen;\n"
508 +            "    #local vvz = z3_new / myVlen;\n"
509 +            "\n"
510 +            "    #local myTheta = degrees(acos(uuz));\n"
511 +            "    #local myPsi = -degrees(atan(uux/uuy));\n"
512 +            "    #local myPhi = degrees(acos(vvz));\n"
513 +            "    #local myScale = ATOM_SPHERE_FACTOR * %lf;\n"
514 +            "\n"
515 +            "  sphere{\n"
516 +            "    < 0, 0, 0 >, 1\n"
517 +            "    texture{\n"
518 +            "      pigment{\n"
519 +            "        average\n"
520 +            "        pigment_map{\n"
521 +            "          [1.0 grad1]\n"
522 +            "          [1.0 grad2]\n"
523 +            "          [1.0 grad3]\n"
524 +            "          [5.0 gradz]\n"
525 +            "        }\n"
526 +            "      }\n"
527 +            "      finish{\n"
528 +            "        ambient .2\n"
529 +            "        diffuse .6\n"
530 +            "        specular 1\n"
531 +            "        roughness .001\n"
532 +            "        metallic\n"
533 +            "      }\n"
534 +            "    }\n"
535 +            "    scale<myScale,myScale,ecc*myScale>\n"
536 +            "    rotate<myTheta,myPhi,myPsi>\n"
537 +            "    translate< x1_new, y1_new, z1_new>\n"
538 +            "  }\n"
539 +            "#end\n"
540              "#macro make_%s_vector "
541              "(center_x, center_y, center_z, ux, uy, uz)\n"
542              "\n"
# Line 442 | Line 622 | void make_header_macros(FILE *out_file){
622              radius,
623              red, green, blue,
624              name,
625 +            radius,
626 +            name,
627 +            radius,
628 +            name,
629              red, green, blue,
630              red, green, blue);
631      

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines