Changeset 418 for trunk

Show
Ignore:
Timestamp:
02/22/2009 11:07:57 AM (3 years ago)
Author:
powell
Message:

Update to use the latest API changes and additions.

Files:
1 modified

Legend:

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

    r413 r418  
    2828int main (int argc, char *argv[]) 
    2929{ 
    30   int i,j, index, loop_max=20, numpoints, *verts, hullnumverts,*hullverts=NULL; 
     30  int i,j, index, loop_max=20, numpoints, *verts, 
     31    hullnumverts,*hullverts=NULL; 
     32  facet_type *hulltypes=NULL; 
    3133  char gv_version[100]; 
    3234  FILE *pfd = NULL; 
     
    5658 
    5759  /* Initialize coordinates of both triangle array halves */ 
    58   if (i=init_triangle_array (loop_max, points, 0)) 
     60  if (i=init_triangle_array (loop_max, points, 0, 0.,0., 1.,0., 0.,1.)) 
    5961    { printf ("main: Error %d in init_triangle_array\n", i); exit (i); } 
    60   if (i=init_triangle_array (loop_max, points+numpoints/2, 1)) 
     62  if (i=init_triangle_array (loop_max, points+numpoints/2, 1, 0.,0., 1.,0., 0.,1.)) 
    6163    { printf ("main: Error %d in init_triangle_array\n", i); exit (i); } 
    6264 
     
    6971 
    7072  /* Calculate free energies */ 
    71   if (i=free_energies (points, numpoints/2, T,P, allparams,0,STANDARD)) 
     73  if (i=free_energies (points, numpoints/2, T,P, allparams,1,WITH_DERIVATIVES_NO_INFINITY)) 
    7274    { printf ("main: Error %d in free_energies\n", i); exit (i); } 
    73   if (i=free_energies (points+numpoints/2, numpoints/2, T,P, allparams,1, 
    74                        STANDARD)) 
     75  if (i=free_energies (points+numpoints/2, numpoints/2, T,P, allparams,0, 
     76                       WITH_DERIVATIVES_NO_INFINITY)) 
    7577    { printf ("main: Error %d in free_energies\n", i); exit (i); } 
     78 
     79  // Calculate the spinodal: first with no return, then more accurate with one 
     80  if (i=calc_spinodal (&points, &numpoints, verts, loop_max*loop_max*2, T, P, 
     81                       allparams, 0, &solid_spinodal)) 
     82    { printf ("main: error %d in spinodal calculation\n", i); exit (i); } 
     83 
     84  printf ("First edge: %d %d\n", solid_spinodal.edges [0], solid_spinodal.edges [1]); 
    7685 
    7786  /* Scale all free energy values */ 
     
    8594    { printf ("main: Error %d in Geomview Display\n", i); exit (i); } 
    8695 
    87   // Calculate and display the spinodal 
    88   if (i=calc_spinodal (&points, &numpoints, verts, loop_max*loop_max*2, T, P, 
    89                        allparams, 0, &solid_spinodal)) 
    90     { printf ("main: error %d in spinodal calculation\n", i); exit (i); } 
     96  if (i=GeomviewDisplayPhaseBoundary 
     97      (pfd, "Spinodal", "spin", "-face +edge", 
     98       numpoints, points, &solid_spinodal)) 
     99    { printf ("main: Error %d in Geomview Display\n", i); exit (i); } 
    91100 
    92101  /* Calculate and refine the lower convex hull */ 
     
    103112                    1e-10, 1e-7, 0)) 
    104113    { printf ("main: error %d in hullRefine\n", i); exit (i); } 
    105   if (i=hullReturnFacets (&hullnumverts, &hullverts)) 
     114  if (i=hullReturnFacets (allparams, 2, T, P, &hullnumverts, &hullverts, 
     115                          &hulltypes)) 
    106116    { printf ("main: Error %d in hullReturnFacets\n", i); exit (i); } 
    107117 
     
    109119  for (i=0; i<hullnumverts; i++) 
    110120    { 
    111       double Gav = (points [hullverts [3*i]].G + 
     121      /* double Gav = (points [hullverts [3*i]].G + 
    112122                    points [hullverts [3*i+1]].G + 
    113123                    points [hullverts [3*i+2]].G)/3., 
     
    122132      printf ("Facet %d vertices: %d %d %d\n", i, hullverts[3*i], 
    123133              hullverts[3*i+1], hullverts[3*i+2]); 
    124 #endif 
     134              #endif */ 
    125135 
    126136      /* Test whether hull facet is in one-phase region: free energy at 
    127137         centroid is below facet; if so, remove it */ 
    128       if (fmin (free_energy (C2av, C3av, T, P, allparams), 
    129                 free_energy (C2av, C3av, T, P, allparams+1)) < Gav) 
     138      /*if (fmin (free_energy (C2av, C3av, T, P, allparams), 
     139        free_energy (C2av, C3av, T, P, allparams+1)) < Gav)*/ 
     140      if (hulltypes [i] == ONE_PHASE) 
    130141        { 
    131142          for (j=i; j<hullnumverts-1; j++) 
     
    134145              hullverts [3*j+1] = hullverts [3*j+4]; 
    135146              hullverts [3*j+2] = hullverts [3*j+5]; 
     147              hulltypes [j] = hulltypes [j+1]; 
    136148            } 
    137149          hullnumverts--;