- Timestamp:
- 02/22/2009 11:07:57 AM (3 years ago)
- Files:
-
- 1 modified
-
trunk/matml/src/ternary/ternary.c (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/matml/src/ternary/ternary.c
r413 r418 28 28 int main (int argc, char *argv[]) 29 29 { 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; 31 33 char gv_version[100]; 32 34 FILE *pfd = NULL; … … 56 58 57 59 /* 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.)) 59 61 { 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.)) 61 63 { printf ("main: Error %d in init_triangle_array\n", i); exit (i); } 62 64 … … 69 71 70 72 /* 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)) 72 74 { 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)) 75 77 { 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]); 76 85 77 86 /* Scale all free energy values */ … … 85 94 { printf ("main: Error %d in Geomview Display\n", i); exit (i); } 86 95 87 // Calculate and display the spinodal88 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); } 91 100 92 101 /* Calculate and refine the lower convex hull */ … … 103 112 1e-10, 1e-7, 0)) 104 113 { 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)) 106 116 { printf ("main: Error %d in hullReturnFacets\n", i); exit (i); } 107 117 … … 109 119 for (i=0; i<hullnumverts; i++) 110 120 { 111 double Gav = (points [hullverts [3*i]].G +121 /* double Gav = (points [hullverts [3*i]].G + 112 122 points [hullverts [3*i+1]].G + 113 123 points [hullverts [3*i+2]].G)/3., … … 122 132 printf ("Facet %d vertices: %d %d %d\n", i, hullverts[3*i], 123 133 hullverts[3*i+1], hullverts[3*i+2]); 124 #endif 134 #endif */ 125 135 126 136 /* Test whether hull facet is in one-phase region: free energy at 127 137 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) 130 141 { 131 142 for (j=i; j<hullnumverts-1; j++) … … 134 145 hullverts [3*j+1] = hullverts [3*j+4]; 135 146 hullverts [3*j+2] = hullverts [3*j+5]; 147 hulltypes [j] = hulltypes [j+1]; 136 148 } 137 149 hullnumverts--;