Changeset 355

Show
Ignore:
Timestamp:
03/27/08 18:02:07 (8 months ago)
Author:
powell
Message:

Better check of whether hull facet is in one-phase region.

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

Legend:

Unmodified
Added
Removed
  • trunk/matml/src/ternary/ChangeLog

    r354 r355  
    66  * Moved many O(N) functions from main() out to new book.c file. 
    77  * Multiple free energy functions work. 
    8   * TODO: better single-phase check in ternary.c; 0.3 refine qhull concave 
    9     facets. 
     8  * Better check to determine whether hull facets are in one-phase region. 
    109 
    1110 -- 
  • trunk/matml/src/ternary/ternary.c

    r354 r355  
    3131  char gv_version[100], *qh_version; 
    3232  FILE *pfd = NULL; 
    33   double T=1.5; 
     33  double T=0.75; 
    3434  ternary_point *points; 
    3535  /* eparams: R,T0, G1@T0,G2,G3, C1,C2,C3, M1,M2,M3, O12,O13,O23,O123 */ 
     
    7676  /* Scale all free energy values to (0->1) */ 
    7777  if (i=scale_energy_array ((loop_max+1)*(loop_max+2), points, 
    78                               0., -1.5, 1., 1., NULL, NULL)) 
     78                              0., -.2, 1., .9, NULL, NULL)) 
    7979    { printf ("main: Error %d in scale_triangle_array\n", i); exit (i); } 
    8080 
     
    9494  for (i=0; i<hullnumverts; i++) 
    9595    { 
    96       double x0 = points [hullverts [3*i]].C2, 
    97         y0 = points [hullverts [3*i]].C3, 
    98         x1 = points [hullverts [3*i+1]].C2, 
    99         y1 = points [hullverts [3*i+1]].C3, 
    100         x2 = points [hullverts [3*i+2]].C2, 
    101         y2 = points [hullverts [3*i+2]].C3; 
     96      double Gav = (points [hullverts [3*i]].G + 
     97                    points [hullverts [3*i+1]].G + 
     98                    points [hullverts [3*i+2]].G)/3., 
     99        C2av = (points [hullverts [3*i]].C2 + 
     100                points [hullverts [3*i+1]].C2 + 
     101                points [hullverts [3*i+2]].C2)/3., 
     102        C3av = (points [hullverts [3*i]].C3 + 
     103                points [hullverts [3*i+1]].C3 + 
     104                points [hullverts [3*i+2]].C3)/3.; 
     105 
    102106#ifdef DEBUG 
    103107      printf ("Facet %d vertices: %d %d %d\n", i, hullverts[3*i], 
    104108              hullverts[3*i+1], hullverts[3*i+2]); 
    105109#endif 
    106       /* XY-projection area test (only works for uniform triangles) */ 
    107       /* Better test: is free energy at centroid above or below the facet? */ 
    108       if (fabs ((x1-x0)*(y2-y0) - (x2-x0)*(y1-y0)) <= 1.1/loop_max/loop_max) 
     110 
     111      /* Test whether hull facet is in one-phase region: free energy at 
     112         centroid is below facet; if so, remove it */ 
     113      if (fmin (free_energy (C2av, C3av, T, &eparams1), 
     114                free_energy (C2av, C3av, T, &eparams2)) < Gav) 
    109115        { 
    110116          for (j=i; j<hullnumverts-1; j++)