Changeset 313

Show
Ignore:
Timestamp:
03/25/08 18:20:58 (8 months ago)
Author:
powell
Message:

Convert to qhull coordT types throughout.

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

Legend:

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

    r310 r313  
    66 
    77 
    8 #include <math.h> 
     8#include "ternary.h" 
    99 
    1010 
     
    1212  This calculates the free energy. 
    1313 
    14   double free_energy It returns the free energy. 
     14  coordT free_energy It returns the free energy. 
    1515 
    16   double C2 Concentration of species 2. 
     16  coordT C2 Concentration of species 2. 
    1717 
    18   double C3 Concentration of species 3. 
     18  coordT C3 Concentration of species 3. 
    1919 
    20   double T Temperature (ignored for now). 
     20  coordT T Temperature (ignored for now). 
    2121  ++++++++++++++++++++++++++++++++++++++*/ 
    2222 
    23 double free_energy (double C2, double C3, double T) 
     23coordT free_energy (coordT C2, coordT C3, coordT T) 
    2424{ 
    25   double C1 = (1.-C2-C3 < 0.) ? 0. : 1.-C2-C3; 
    26   double m1=1., m2=2., m3=5.;  /* Flory-Huggins "Degree of polymerization" */ 
    27   double chi12 = -.5, chi13 = 2., chi23 = .2;      /* Interaction parameters */ 
     25  coordT C1 = (1.-C2-C3 < 0.) ? 0. : 1.-C2-C3; 
     26  coordT m1=1., m2=2., m3=5.;  /* Flory-Huggins "Degree of polymerization" */ 
     27  coordT chi12 = -.5, chi13 = 2., chi23 = .2;      /* Interaction parameters */ 
    2828 
    2929  return  ((C1==0.)?0.:C1/m1*log(C1)) + ((C2==0.)?0.:C2/m2*log(C2)) + 
  • trunk/matml/src/ternary/ternary.c

    r310 r313  
    77 
    88 
    9 #include <stdio.h> 
    10 #include <math.h> 
    11 #include <unistd.h> 
    129#include "ternary.h" 
    1310 
     
    1815  FILE *pfd = NULL; 
    1916  int i, j, loop_max=50, vertcolor=1; 
    20   double Gmin=1.e+100, Gmax=-1.e+100, centerG; 
     17  coordT Gmin=1.e+100, Gmax=-1.e+100, centerG; 
    2118 
    2219  pipe (gv_pipe); /* from geomview stdout */ 
     
    6057    for (j=0; j<=loop_max-i; j++) 
    6158      { 
    62         double C2=(double)i/loop_max, C3=(double)j/loop_max, G; 
     59        coordT C2=(coordT)i/loop_max, C3=(coordT)j/loop_max, G; 
    6360        G = free_energy (C2, C3, 0.); 
    6461        Gmin = (G<Gmin) ? G : Gmin; 
     
    7572    for (j=0; j<=loop_max-i; j++) 
    7673      { 
    77         double C2=(double)i/loop_max, C3=(double)j/loop_max, G, x,y,z; 
     74        coordT C2=(coordT)i/loop_max, C3=(coordT)j/loop_max, G, x,y,z; 
    7875 
    7976        G = free_energy (C2, C3, 0.); 
     
    9693      for (j=0; j<loop_max-1-i; j++) 
    9794        { 
    98           centerG = free_energy (((double)i+0.333333)/loop_max, 
    99                                  ((double)j+0.333333)/loop_max, 0.); 
     95          centerG = free_energy (((coordT)i+0.333333)/loop_max, 
     96                                 ((coordT)j+0.333333)/loop_max, 0.); 
    10097          fprintf (pfd, "3 %d %d %d", 
    10198                   ROWSTART(i)+j, ROWSTART(i)+j+1, ROWSTART(i+1)+j); 
     
    106103          fprintf (pfd, "\n"); 
    107104 
    108           centerG = free_energy (((double)i+0.666667)/loop_max, 
    109                                  ((double)j+0.666667)/loop_max, 0.); 
     105          centerG = free_energy (((coordT)i+0.666667)/loop_max, 
     106                                 ((coordT)j+0.666667)/loop_max, 0.); 
    110107          fprintf (pfd, "3 %d %d %d", 
    111108                   ROWSTART(i)+j+1, ROWSTART(i+1)+j, ROWSTART(i+1)+j+1); 
     
    116113          fprintf (pfd, "\n"); 
    117114        } 
    118       centerG = free_energy (((double)i+0.333333)/loop_max, 
    119                              ((double)j+0.333333)/loop_max, 0.); 
     115      centerG = free_energy (((coordT)i+0.333333)/loop_max, 
     116                             ((coordT)j+0.333333)/loop_max, 0.); 
    120117      fprintf (pfd, "3 %d %d %d", 
    121118               ROWSTART(i)+j, ROWSTART(i)+j+1, ROWSTART(i+1)+j); 
     
    126123      fprintf (pfd, "\n"); 
    127124    } 
    128   centerG = free_energy (((double)i+0.333333)/loop_max, 0.333333/loop_max, 0.); 
     125  centerG = free_energy (((coordT)i+0.333333)/loop_max, 
     126                         0.333333/loop_max, 0.); 
    129127  fprintf (pfd, "3 %d %d %d", 
    130128           ROWSTART(i), ROWSTART(i)+1, ROWSTART(i+1)); 
  • trunk/matml/src/ternary/ternary.h

    r310 r313  
    99#define TERNARY_H    /*+ To stop multiple inclusions. +*/ 
    1010 
    11 double free_energy (double C2, double C3, double T); 
     11#include <stdio.h> 
     12#include <math.h> 
     13#include <unistd.h> 
     14#include <qhull/qhull.h> 
     15 
     16coordT free_energy (coordT C2, coordT C3, realT T); 
    1217 
    1318#endif /* TERNARY_H */