Changeset 350
- Timestamp:
- 03/27/08 15:47:10 (8 months ago)
- Location:
- trunk/matml/src/ternary
- Files:
-
- 1 added
- 2 modified
-
Makefile.am (modified) (2 diffs)
-
book.c (added)
-
ternary.c (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/matml/src/ternary/Makefile.am
r342 r350 11 11 bin_PROGRAMS = ternary 12 12 noinst_HEADERS = ternary.h 13 ternary_SOURCES = ternary.c geomview.c qhull.c freenergy.c13 ternary_SOURCES = ternary.c geomview.c qhull.c book.c freenergy.c 14 14 ternary_CFLAGS = -DGEOMVIEW=\"@GEOMVIEW@\" # -DDEBUG 15 15 ternary_LDADD = -lm -lqhull … … 25 25 $(top_srcdir)/geomview.c.tex \ 26 26 $(top_srcdir)/qhull.c.tex \ 27 $(top_srcdir)/book.c.tex \ 27 28 $(top_srcdir)/freenergy.c.tex 28 29 -
trunk/matml/src/ternary/ternary.c
r349 r350 7 7 8 8 9 #include "ternary.h" 10 #include <stdlib.h> 11 #include <math.h> 9 #include "ternary.h" /*+ Ternary prototypes, typedefs, etc. +*/ 10 #include <stdlib.h> /*+ For calloc +*/ 12 11 13 12 … … 31 30 char gv_version[100], *qh_version; 32 31 FILE *pfd = NULL; 33 double Gmin, Gmax ;32 double Gmin, Gmax, T=1.; 34 33 ternary_point *points; 35 energy_params eparams={1.,1., 0.2,0.1,0., 1.,1.,1., 1.,2.,5., -.5,2.,.2, 0.}; 34 /* eparams: R,T0, G1@T0,G2,G3, C1,C2,C3, M1,M2,M3, O12,O13,O23,O123 */ 35 energy_params /* Solid, liquid */ 36 eparams1 = {1.,1., 0.,-.1,-.2, 1.,1.1,1.2, 1.,2.,5., -.5,2.,.2, 0.}, 37 eparams2 = {1.,1., .3,.1,-.1, 2.2,2.,1.8, 1.,1.,1.5, -.3,-.4,-.1, -.5}; 36 38 37 39 if (argc>1) … … 47 49 /* Start Geomview process */ 48 50 if (i=GeomviewBegin (&pfd, gv_version)) 49 { printf ("main: Error %d in Geomview Begin\n", i); exit (i); }51 { printf ("main: Error %d in GeomviewBegin\n", i); exit (i); } 50 52 printf("Geomview version: %s\n", gv_version); 53 54 /* Calculate free energies, including upper and lower bounds for coloring */ 55 if (i=init_triangle_array (loop_max, points)) 56 { printf ("main: Error %d in init_triangle_array\n", i); exit (i); } 51 57 52 58 #define ROWSTART(row) ((row)*(loop_max+1) - ((row)*((row)-1))/2) 53 59 54 /* Calculate free energies, including upper and lower bounds for coloring */ 55 Gmin = Gmax = free_energy (0., 0., 1., &eparams); 60 Gmin = Gmax = free_energy (0., 0., T, &eparams1); 56 61 for (i=0; i<=loop_max; i++) 57 62 for (j=0; j<=loop_max-i; j++) … … 59 64 index = (ROWSTART (i) + j); 60 65 61 points[index].C2 = (double)i/loop_max; 62 points[index].C3 = (double)j/loop_max; 63 points[index].G = free_energy (points[index].C2, points[index].C3, 1., &eparams); 66 points[index].G = 67 free_energy (points[index].C2, points[index].C3, T, &eparams1); 64 68 Gmin = (points[index].G<Gmin) ? points[index].G : Gmin; 65 69 Gmax = (points[index].G>Gmax) ? points[index].G : Gmax; … … 78 82 79 83 /* Switch y and z because geomview uses z as depth */ 80 points[index].x = points[index].C2 + 0.5 * points[index].C3;81 84 points[index].y = Grel(points[index].G); 82 points[index].z = (1. - points[index].C3) * sqrt(3)/2.;83 85 84 86 points[index].red = RED (Grel (points[index].G));