Changeset 431 for trunk/matml/src

Show
Ignore:
Timestamp:
03/06/2009 04:46:13 PM (3 years ago)
Author:
powell
Message:

Allow the user to visualize composition on a square, not triangle, array.

Location:
trunk/matml/src/ternary
Files:
3 modified

Legend:

Unmodified
Added
Removed
  • trunk/matml/src/ternary/book.c

    r416 r431  
    174174  double *Gmax Optional address to store the maximum free energy in the array 
    175175  on return (NULL if unwanted), used as G1 if both G0 and G1 are zero. 
     176 
     177  int square Flag: zero for triangle composition representation, non-zero for 
     178  square. 
    176179  ++++++++++++++++++++++++++++++++++++++*/ 
    177180 
    178181int scale_energy_array (int num_points, ternary_point *points, 
    179                           double y0, double G0, double y1, double G1, 
    180                           double *Gmin, double *Gmax) 
     182                        double y0, double G0, double y1, double G1, 
     183                        double *Gmin, double *Gmax, int square) 
    181184{ 
    182185  int i; 
     
    218221  for (i=0; i<num_points; i++) 
    219222    { 
    220       points[i].x = points[i].C2 + 0.5*points[i].C3; 
     223      if (square) 
     224        { 
     225          points[i].x = points[i].C2; 
     226          points[i].z = 1.-points[i].C3; 
     227        } 
     228      else 
     229        { 
     230          points[i].x = points[i].C2 + 0.5*points[i].C3; 
     231          points[i].z = (1. - points[i].C3) * sqrt(3)/2.; 
     232        } 
    221233      points[i].y = Grel(points[i].G); 
    222       points[i].z = (1. - points[i].C3) * sqrt(3)/2.; 
    223234      points[i].red   = RED   (Grel (points[i].G)); 
    224235      points[i].green = GREEN (Grel (points[i].G)); 
  • trunk/matml/src/ternary/ternary.c

    r430 r431  
    8282 
    8383  /* Scale all free energy values */ 
    84   if (i=scale_energy_array (numpoints, points, 0., -.2, 1., .9, NULL, NULL)) 
     84  if (i=scale_energy_array (numpoints, points, 0., -.2, 1., .9, NULL, NULL, 0)) 
    8585    { printf ("main: Error %d in scale_triangle_array\n", i); exit (i); } 
    8686 
     
    112112 
    113113  /* Scale and display everything */ 
    114   if (i=scale_energy_array (numpoints, points, 0., -.2, 1., .9, NULL, NULL)) 
     114  if (i=scale_energy_array (numpoints, points, 0., -.2, 1., .9, NULL, NULL, 0)) 
    115115    { printf ("main: Error %d in scale_triangle_array\n", i); exit (i); } 
    116116 
  • trunk/matml/src/ternary/ternary.h

    r430 r431  
    186186int scale_energy_array (int num_points, ternary_point *points, 
    187187                        double y0, double G0, double y1, double G1, 
    188                         double *Gmin, double *Gmax); 
     188                        double *Gmin, double *Gmax, int square); 
    189189 
    190190#endif /* TERNARY_H */