diff --git a/ammber/BinarySystems.py b/ammber/BinarySystems.py index 821ae2f..8b05c38 100644 --- a/ammber/BinarySystems.py +++ b/ammber/BinarySystems.py @@ -3,20 +3,23 @@ from scipy.interpolate import CubicSpline import numpy as np from pycalphad import calculate -from ammber.utils import write_binary_isothermal_parabolic_parameters +from ammber.utils import add_to_dict class BinaryIsothermalDiscretePhase: "Class representing a single phase at one temperature described by a set of points in composition-Gibbs free energy space" - def __init__(self, xdata, Gdata): + def __init__(self, name, xdata, Gdata): """ Constructor. Initializes the phase object from points in composition-Gibbs free energy space. Parameters ---------- + name : string + name of phase to be added xdata : list, array compositions Gdata : list, array Gibbs free energies corresponding to compositions """ + self.name = name self.xdata, ordering = np.unique(xdata, return_index=True) self.Gdata = Gdata[ordering] @@ -36,7 +39,7 @@ def resample(self, xpoints): newx = xpoints[np.logical_and(xpoints >= self.xdata[0], xpoints <= self.xdata[-1])] if len(newx)>=3: spl = CubicSpline(self.xdata, self.Gdata) - return BinaryIsothermalDiscretePhase(newx, spl(newx)) + return BinaryIsothermalDiscretePhase(self.name, newx, spl(newx)) # Assume a line compound, don't resample return self @@ -82,14 +85,17 @@ def free_energy(self, x): print("Attempted to evaluate free energy of a compound outside its range. This will cause errors.") return None + class BinaryIsothermal2ndOrderPhase: "Class representing a single phase at one temperature described by a 2nd order polynomial (parabola)." - def __init__(self, fmin=0.0, kwell=1.0, cmin=0.5, discrete=None, kwellmax=1e9):#todo + def __init__(self, name, fmin=0.0, kwell=1.0, cmin=0.5, discrete=None, kwellmax=1e9):#todo """ Constructor. Parameters ---------- + name : string + name of phase to be added cmin : float composition of the parabolic free energy minimum fmin : float @@ -104,10 +110,12 @@ def __init__(self, fmin=0.0, kwell=1.0, cmin=0.5, discrete=None, kwellmax=1e9):# BinaryIsothermal2ndOrderPhase object """ if discrete is None: + self.name = name self.fmin = fmin self.kwell = kwell self.cmin = cmin else: + self.name = discrete.name self.fit_phase(discrete.xdata, discrete.Gdata, kwellmax=kwellmax) def fit_phase(self, xdata, Gdata, kwellmax=1e9): @@ -177,40 +185,52 @@ def discretize(self, xdata=None, xrange=(1e-14, 1.0 - 1e-14), npts=1001): """ if xdata is None: xdata = np.linspace(*xrange, npts) - return BinaryIsothermalDiscretePhase(xdata, self.free_energy(xdata)) + return BinaryIsothermalDiscretePhase(self.name, xdata, self.free_energy(xdata)) class BinaryIsothermalDiscreteSystem: "Class representing a seet of phases at one temperature described by a set of points in composition-Gibbs free energy space" - def __init__(self): - "Constructor. Initializes with an empty set of phases." + def __init__(self, component="", solution_component=""): + """ + Constructor. Initializes with an empty set of phases. + + Parameters + ---------- + component : string + name of the x-component + solution_component : string + name of the (1-x)-component + """ + self.component = component + self.solution_component = solution_component self.phases = {} self.lc_hull = None self._is_equilibrium_system = False - def fromTDB(self, db, elements, component, temperature, phase_list=None): + def fromTDB(self, db, component, solution_component, temperature, phase_list=None): """ Constructs discrete phase from all the phases specified in a pycalphad database Parameters ---------- db : pycalphad database - elements : list (string) - The space of compositions of interest (Binary). Element abbreviations must be all-caps. - componenet : string - Element abbreviation for element corresponding to x=1. + component : string + Element abbreviation for element corresponding to x. Element abbreviations must be all-caps. + solution_component : string + Element abbreviation for element corresponding to (1-x). Element abbreviations must be all-caps. phase_list : list (string) If specified, only listed phases will be constructed, otherwise, all available phases will be constructed. """ - if "VA" not in elements: - elements.append("VA") + elements = [component, solution_component, "VA"] + self.component = component + self.solution_component = solution_component if phase_list is None: phase_list = list(db.phases.keys()) cal = calculate(db, elements, phase_list, P=101325, T=temperature, output='GM', pdens=1001) phase_list = set(cal.Phase.data[0][0][0]) for phase_name in phase_list: result = calculate(db, elements, phase_name, P=101325, T=temperature, output='GM', pdens=1001) - self.phases[phase_name] = BinaryIsothermalDiscretePhase( + self.phases[phase_name] = BinaryIsothermalDiscretePhase(phase_name, result.X.sel(component=component).data[0][0][0], result.GM.data[0][0][0]) @@ -227,7 +247,7 @@ def add_phase(self, name, xdata, Gdata): Gdata : list, array Gibbs free energies corresponding to compositions """ - self.phases[name] = BinaryIsothermalDiscretePhase(xdata, Gdata) + self.phases[name] = BinaryIsothermalDiscretePhase(name, xdata, Gdata) def get_lc_hull(self, recalculate=False):#todo """ @@ -268,13 +288,14 @@ def get_equilibrium_system(self, miscibility_gap_threshold=0.1):#todo """ lc_hull = self.get_lc_hull() # print(lc_hull) - equilibrium_system = BinaryIsothermalDiscreteSystem() + equilibrium_system = BinaryIsothermalDiscreteSystem(component=self.component, + solution_component=self.solution_component) equilibrium_system._is_equilibrium_system = True for phase in self.phases: mask = np.logical_and(np.isin(self.phases[phase].xdata, lc_hull[:, 0]), np.isin(self.phases[phase].Gdata, lc_hull[:, 1])) if np.count_nonzero(mask) > 0: - equilibrium_system.phases[phase] = BinaryIsothermalDiscretePhase( + equilibrium_system.phases[phase] = BinaryIsothermalDiscretePhase(phase, self.phases[phase].xdata[mask], self.phases[phase].Gdata[mask]) # break apart phases that phase separate @@ -299,12 +320,12 @@ def get_equilibrium_system(self, miscibility_gap_threshold=0.1):#todo #print(start,end) if end - start >= 1: # phase is represented by multiple points - equilibrium_system.phases[phase +'_'+ str(i)] = BinaryIsothermalDiscretePhase( + equilibrium_system.phases[phase +'_'+ str(i)] = BinaryIsothermalDiscretePhase(phase +'_'+ str(i), phase_temp.xdata[start:end], phase_temp.Gdata[start:end]) elif(start == end): # phase is represented by single point print("phase "+phase+'_'+str(i)+" is represented by a single point, a finer discretization may be needed") - equilibrium_system.phases[phase +'_'+ str(i)] = BinaryIsothermalDiscretePhase( + equilibrium_system.phases[phase +'_'+ str(i)] = BinaryIsothermalDiscretePhase(phase +'_'+ str(i), phase_temp.xdata[start], phase_temp.Gdata[start]) return equilibrium_system @@ -363,7 +384,8 @@ def resample_near_equilibrium(self, x, xdist=0.001, npts=101): BinaryIsothermalDiscreteSystem object """ equilibrium = self.get_equilibrium(x) - new_system = BinaryIsothermalDiscreteSystem() + new_system = BinaryIsothermalDiscreteSystem(component=self.component, + solution_component=self.solution_component) for phase in equilibrium: if phase in self.phases: new_system.phases[phase] = self.phases[phase].resample_near_xpoint( @@ -378,12 +400,16 @@ def resample_near_equilibrium(self, x, xdist=0.001, npts=101): class BinaryIsothermal2ndOrderSystem: "Class representing a seet of phases at one temperature described by a second order polynomial (parabola)" - def __init__(self, phases=None): + def __init__(self, component="", solution_component="", phases=None): """ Constructor. Parameters ---------- + component : string + name of the x-component + solution_component : string + name of the (1-x)-component phases : dict {string phase_name : BinaryIsothermal2ndOrderPhase phase} (optional) composition to be sampled """ @@ -402,8 +428,10 @@ def from_discrete(self, discrete_system, kwellmax=1e6): kwellmax : float (optional) kwell to be used when fitting line compounds """ + self.component = discrete_system.component + self.solution_component = discrete_system.solution_component for phase_name in discrete_system.phases.keys(): - self.phases[phase_name] = BinaryIsothermal2ndOrderPhase() + self.phases[phase_name] = BinaryIsothermal2ndOrderPhase(phase_name) self.phases[phase_name].fit_phase(discrete_system.phases[phase_name].xdata, discrete_system.phases[phase_name].Gdata, kwellmax=kwellmax) @@ -441,7 +469,8 @@ def to_discrete(self, xdata=None, xrange=(1e-14, 1.0 - 1e-14), npts=1001): ------- BinaryIsothermalDiscretePhase object """ - discrete_system = BinaryIsothermalDiscreteSystem() + discrete_system = BinaryIsothermalDiscreteSystem(component=self.component, + solution_component=self.solution_component) for phase_name in self.phases.keys(): discrete_system.phases[phase_name] = self.phases[phase_name].discretize( xdata=xdata, xrange=xrange, npts=npts) diff --git a/ammber/utils.py b/ammber/utils.py index 50c92f0..bfc1a20 100644 --- a/ammber/utils.py +++ b/ammber/utils.py @@ -1,78 +1,50 @@ -def write_binary_isothermal_parabolic_parameters(binaryIsothermalSys, output_file, template_file, phases=None, component="comp_1"): +def add_to_dict(binaryIsothermalSys, dict, add_templates=False, c0={}, Vm=None, convert_to_volumetric_energy=True): """ - Creates a parameters file from a BinaryIsothermal2ndOrderSystem - + Adds the parameters of a BinaryIsothermal2ndOrderSystem to a dictionary Parameters ---------- binaryIsothermalSys : BinaryIsothermal2ndOrderSystem system to draw parameters from - output_file : string - path to file to create - template_file : string - path to template parameter file if needed - phases : list (string) - (optional) list of specific phases to copy to parameters - component : string - (optional) name of the x-component + dict : dict + dictionary to add parameters to + add_templates : bool + add templates or additional values needed for kinetics simulation + c0 : dict + phase-name keys, initial composition values. only used if add_templates==True + Vm : float + nominal number-volume (eg. molar volume) of system + convert_to_volumetric_energy : bool + a setting for AMMBER kinetics. true if binaryIsothermalSys composition axes are number fraction """ - if phases is None: - phase_list = binaryIsothermalSys.phases.keys() - else: - phase_list = phases - cmin = {} - fmin = {} - kwell= {} - for phase_name in phase_list: - cmin[phase_name] = {component : binaryIsothermalSys.phases[phase_name].cmin} - fmin[phase_name] = binaryIsothermalSys.phases[phase_name].fmin - kwell[phase_name] = {component : binaryIsothermalSys.phases[phase_name].kwell} - _PRISMS_parabolic_parameters(cmin=cmin, fmin=fmin, kwell=kwell, - phases = phase_list ,comps=[component], - template_file=template_file, output_file=output_file) - - -def _PRISMS_parabolic_parameters(cmin, fmin, kwell, phases, comps, output_file, template_file): - ## Step 2: Make necessary strings - num_phases = len(phases) - num_comps = len(comps)+1 - sf = 3 - fmin_str = "" - cmin_str = "" - kwell_str = "" - phase_names_str = "" - comp_names_str = "" - for phase in phases: - fmin_str += f'{fmin[phase]:.{sf}e}' + ", " - phase_names_str += phase + ", " - for comp in comps: - cmin_str += f'{cmin[phase][comp]:.{sf}f}' + "," - kwell_str += f'{kwell[phase][comp]:.{sf}e}' + "," - cmin_str += " " - kwell_str += " " - - for comp in comps: - comp_names_str += comp + ", " - - ## Step 3: read template and write prm - import re - with open(template_file, 'r') as f_in, open(output_file, 'w') as f_out: - for line in f_in: - if re.match(r'^set Model constant num_phases\b', line): - f_out.write("set Model constant num_phases = " + str(num_phases) + ", INT\n") - elif re.match(r'^set Model constant num_comps\b', line): - f_out.write("set Model constant num_comps = " + str(num_comps) + ", INT\n") - elif re.match(r'^set Model constant fWell\b', line): - f_out.write("set Model constant fWell = " + fmin_str + "DOUBLE ARRAY\n") - elif re.match(r'^set Model constant kWell\b', line): - f_out.write("set Model constant kWell = " + kwell_str + "DOUBLE ARRAY\n") - elif re.match(r'^set Model constant cmin\b', line): - f_out.write("set Model constant cmin = " + cmin_str + "DOUBLE ARRAY\n") - elif re.match(r'^set Model constant phase_names\b', line): - f_out.write("set Model constant phase_names = " + phase_names_str + "STRING ARRAY\n") - elif re.match(r'^set Model constant comp_names\b', line): - f_out.write("set Model constant comp_names = " + comp_names_str + "STRING ARRAY\n") - else: - f_out.write(line) - - print("Model Parameters written to " + output_file + "\n") + dict["solution_component"] = binaryIsothermalSys.solution_component + dict["components"] = [binaryIsothermalSys.component] + dict["convert_fractional_to_volumetric_energy"] = convert_to_volumetric_energy + if "phases" not in dict: + dict["phases"] = {} + comp = binaryIsothermalSys.component + for phase_name in binaryIsothermalSys.phases.keys(): + phase = binaryIsothermalSys.phases[phase_name] + if phase_name not in dict: + dict["phases"][phase_name] = {} + + if comp not in dict["phases"][phase_name]: + dict["phases"][phase_name][comp] = {} + dict["phases"][phase_name][comp]["k_well"] = phase.kwell + dict["phases"][phase_name][comp]["c_min"] = phase.cmin + dict["phases"][phase_name][comp]["f_min"] = phase.fmin + if add_templates: + c0_phase_keys = list(c0.keys()) + if "c0" not in dict["phases"][phase_name][comp]: + dict["phases"][phase_name][comp]["c0"] = c0[phase_name] if phase_name in c0_phase_keys else -1.0 + for phase_prop in ["mu_int", "D", "sigma"]: + if phase_prop not in dict["phases"][phase_name]: + dict["phases"][phase_name][phase_prop] = -1.0 + if add_templates: + if "l_int" not in dict: + dict["l_int"] = -1.0 + if "Vm" not in dict: + dict["Vm"] = Vm if Vm is not None else -1.0 + if "order_parameters" not in dict: + dict["order_parameters"] = list(binaryIsothermalSys.phases.keys()) + \ No newline at end of file diff --git a/test/databases/AlCu.TDB b/test/databases/AlCu.TDB new file mode 100644 index 0000000..998fb67 --- /dev/null +++ b/test/databases/AlCu.TDB @@ -0,0 +1,121 @@ +$**************************************************************** +$------------------- AL-CU TDB-----------------------------------* +$-------------------MADE BY Y. S-2015 year----------------------------* + + ELEMENT /- ELECTRON_GAS 0.0000E+00 0.0000E+00 0.0000E+00! + ELEMENT VA VACUUM 0.0000E+00 0.0000E+00 0.0000E+00! + ELEMENT AL FCC_A1 2.6982E+01 4.5773E+03 2.8322E+01! + ELEMENT CU FCC_A1 6.3546E+01 5.0041E+03 3.3150E+01! + +$------AL------- + FUNCTION GHSERAL 298.15 -7976.15+137.093038*T-24.3671976*T*LN(T) + -.001884662*T**2-8.77664E-07*T**3+74092*T**(-1); 700 Y + -11276.24+223.048446*T-38.5844296*T*LN(T)+.018531982*T**2 + -5.764227E-06*T**3+74092*T**(-1); 933.47 Y -11278.378 + +188.684153*T-31.748192*T*LN(T)-1.231E+28*T**(-9); 2900 N ! + +$------CU------- + FUNCTION GHSERCU 298.15 -7770.458+130.485235*T-24.112392*T*LN(T) + -.00265684*T**2+1.29223E-07*T**3+52478*T**(-1); 1357.77 Y + -13542.026+183.803828*T-31.38*T*LN(T)+3.642E+29*T**(-9); 3000 N ! + +FUNCTION ZERO 298.15 0.0; 6000.00 N ! +FUNCTION UN_ASS 298.15 0.0; 300 N ! + +$******************************************************** +TYPE_DEFINITION % SEQ * ! +TYPE-DEFINITION G SEQ * ! +DEFINE_SYSTEM_DEFAULT ELEMENT 2 ! +DEFAULT_COMMAND DEF_SYS_ELEMENT VA /- ! +$******************************************************** + +$---------LIQUID PHASE--------- +PHASE LIQUID:L % 1 1.0 ! + CONSTITUENT LIQUID:L :AL,CU: ! + PARAMETER G(LIQUID,AL;0) 298.15 +11005.029-11.841867*T + +7.93401E-20*T**7+GHSERAL#; 700 Y +11005.03-11.841867*T + +7.93401E-20*T**7+GHSERAL#; 933.47 Y +10482.382-11.253975*T + +1.231E+28*T**(-9)+GHSERAL#; 3000 N ! + PARAMETER G(LIQUID,CU;0) 298.15 +12964.735-9.511904*T-5.849E-21*T**7 + +GHSERCU#; 1357.77 Y 13495.481-9.922344*T-3.642E29*T**(-9) + +GHSERCU#; 3000 N ! + PARAMETER G(LIQUID,AL,CU;0) 298.15 -66622+8.1*T; 3000 N ! + PARAMETER G(LIQUID,AL,CU;1) 298.15 +46800-90.8*T+10*T*LN(T); + 3000 N ! + PARAMETER G(LIQUID,AL,CU;2) 298.15 -2812; 3000 N ! + +$---------FCC_A1 PHASE--------- +PHASE FCC_A1 % 2 1 1 ! + CONSTITUENT FCC_A1 : AL,CU : VA : ! + PARAMETER G(FCC_A1,AL:VA;0) 298.15 +GHSERAL#; 3000 N ! + PARAMETER G(FCC_A1,CU:VA;0) 298.15 +GHSERCU#; 3000 N ! + PARAMETER G(FCC_A1,AL,CU:VA;0) 298.15 -53520+2*T; 5000 N ! + PARAMETER G(FCC_A1,AL,CU:VA;1) 298.15 +38590-2*T; 5000 N ! + PARAMETER G(FCC_A1,AL,CU:VA;2) 298.15 1170; 5000 N ! + +$---------BCC_A2 PHASE--------- +PHASE BCC_A2 % 2 1 3 ! + CONSTITUENT BCC_A2 : AL,CU : VA : ! + PARAMETER G(BCC_A2,AL:VA;0) 298.15 +10083.4-4.813*T+GHSERAL#; + 3000 N ! + PARAMETER G(BCC_A2,CU:VA;0) 298.15 +4017-1.255*T+GHSERCU#; 3000 N ! + PARAMETER G(BCC_A2,AL,CU:VA;0) 298.15 -73554+4*T; 5000 N ! + PARAMETER G(BCC_A2,AL,CU:VA;1) 298.15 +51500-11.84*T; 5000 N ! + +$$$$ ================================================================== +$$ Al2Cu is isostructural with the C16 phase,Mg2Ni! + PHASE AL2CU % 2 0.66667 0.33333 ! + CONSTITUENT AL2CU :AL:AL,CU: ! + PARAMETER G(AL2CU,AL:AL;0) 298.15 +GHSERAL#+10083-4.6139*T; 5000 N ! + PARAMETER G(AL2CU,AL:CU;0) 298.15 0.33333*GHSERCU#+0.66667*GHSERAL# + -15802+2.25*T; 3000 N ! + PARAMETER G(AL2CU,AL:AL,CU;0) 298.15 2211; 3000 N ! + + PHASE ALCU2_ETA % 2 0.5 0.5 ! + CONSTITUENT ALCU2_ETA :AL,CU: CU : ! + PARAMETER G(ALCU2_ETA,AL:CU;0) 298.15 -20280+1.57*T + +0.5*GHSERAL#+0.5*GHSERCU#; 5000 N ! + PARAMETER G(ALCU2_ETA,CU:CU;0) 298.15 +4017-1.155*T + +GHSERCU#; 5000 N ! + PARAMETER G(ALCU2_ETA,AL,CU:CU;0) 298.15 -12870-10*T; 5000 N ! + + + PHASE AL9CU11_ZETA % 2 .55 .45 ! + CONSTITUENT AL9CU11_ZETA : CU : AL : ! + PARAMETER G(AL9CU11_ZETA,CU:AL;0) 298.15 -21000+0.9*T + +0.45*GHSERAL#+0.55*GHSERCU#; 3000 N ! + + + PHASE AL2CU3_DELTA % 2 0.4 0.6 ! + CONSTITUENT AL2CU3_DELTA :AL : CU : ! + PARAMETER G(AL2CU3_DELTA,AL:CU;0) 298.15 -21340+0.6*T + +0.4*GHSERAL#+0.6*GHSERCU#; 3000 N ! + + PHASE ALCU3_GAMAH % 3 4 1 8 ! + CONSTITUENT ALCU3_GAMAH :AL : AL,CU : CU : ! + PARAMETER G(ALCU3_GAMAH,AL:AL:CU;0) 298.15 -219258-45.5*T + +5*GHSERAL#+8*GHSERCU#; 5000 N ! + PARAMETER G(ALCU3_GAMAH,AL:CU:CU;0) 298.15 -200460-58.5*T + +4*GHSERAL#+9*GHSERCU#; 5000 N ! + + +$---------AL4CU9_GAMMA_BRASS PHASE--------- +PHASE AL4CU9_GAMMA_BRASS % 5 1 1 2 3 6 ! + CONSTITUENT AL4CU9_GAMMA_BRASS : AL,CU : CU : CU : CU : AL,CU : ! + PARAMETER G(AL4CU9_GAMMA_BRASS,AL:CU:CU:CU:AL;0) 2.98150E+02 + -128762.9+7*GHSERAL#+6*GHSERCU#; 3000 N ! + PARAMETER G(AL4CU9_GAMMA_BRASS,AL:CU:CU:CU:CU;0) 2.98150E+02 + 72595.8+GHSERAL#+12*GHSERCU#; 3000 N ! + PARAMETER G(AL4CU9_GAMMA_BRASS,AL:CU:CU:CU:AL,CU;0) 2.98150E+02 + -791861+0.001*T; 3000 N ! + PARAMETER G(AL4CU9_GAMMA_BRASS,CU:CU:CU:CU:AL,CU;0) + 2.98150E+02 0; 3000 N ! + PARAMETER G(AL4CU9_GAMMA_BRASS,CU:CU:CU:CU:AL;0) 2.98150E+02 + 265000+6*GHSERAL#+7*GHSERCU#; 3000 N ! + PARAMETER G(AL4CU9_GAMMA_BRASS,CU:CU:CU:CU:CU;0) 2.98150E+02 + 265000+13*GHSERCU#; 3000 N ! + PARAMETER G(AL4CU9_GAMMA_BRASS,AL,CU:CU:CU:CU:AL;0) + 2.98150E+02 0; 3000 N ! + PARAMETER G(AL4CU9_GAMMA_BRASS,AL,CU:CU:CU:CU:CU;0) + 2.98150E+02 0; 3000 N ! + diff --git a/test/test_1.py b/test/test_1.py index 75b726f..8cbabc2 100644 --- a/test/test_1.py +++ b/test/test_1.py @@ -6,5 +6,5 @@ def test_01(): - phase1 = BS.BinaryIsothermal2ndOrderPhase(fmin = 0, kwell= 1, cmin= 0.5) + phase1 = BS.BinaryIsothermal2ndOrderPhase("test_phase", fmin = 0, kwell= 1, cmin= 0.5) assert (phase1.free_energy(0.5) == 0) \ No newline at end of file diff --git a/test/test_AlCu.py b/test/test_AlCu.py new file mode 100644 index 0000000..5ab7af4 --- /dev/null +++ b/test/test_AlCu.py @@ -0,0 +1,55 @@ +import ammber.BinarySystems as bi +import matplotlib.pyplot as plt +from pycalphad import Database +from ammber.utils import add_to_dict +tdb_file = "test/databases/AlCu.TDB" +db = Database(tdb_file) +elements = ["AL", "CU"] +component = "CU" +solution_component = "AL" +temperature = 800 + +AlCu_Sys = bi.BinaryIsothermalDiscreteSystem() +AlCu_Sys.fromTDB(db, component, solution_component, temperature) +AlCu_Sys_neareq = AlCu_Sys.resample_near_equilibrium(0.1) + + +AlCu_Sys_neareq.phases['LIQUID'] = AlCu_Sys.phases['LIQUID'].resample_near_xpoint(0.1) +AlCu_Fit = bi.BinaryIsothermal2ndOrderSystem() +AlCu_Fit.from_discrete(AlCu_Sys_neareq) + +print(list(AlCu_Fit.phases.keys())) + +#x = AlCu_Sys.phases['FCC_A1'].xdata +#plt.plot(x, AlCu_Fit.phases['FCC_A1_0'].free_energy(x), +# linestyle=':', color='tab:orange', label="FCC_A1_0 fit",linewidth=1) +# +#plt.plot(AlCu_Sys.phases['FCC_A1'].xdata, AlCu_Sys.phases['FCC_A1'].Gdata, +# linestyle='-', color='tab:orange',label="FCC_A1",linewidth=1) +# +#plt.plot(x, AlCu_Fit.phases['AL2CU_1'].free_energy(x), +# linestyle=':', color='tab:green',linewidth=1, label="Al2Cu_C16 fit") +# +#plt.plot(AlCu_Sys.phases['AL2CU'].xdata, AlCu_Sys.phases['AL2CU'].Gdata, +# linestyle='-', color='tab:green',linewidth=1, label="Al2Cu") +# +#plt.plot(x, AlCu_Fit.phases['LIQUID'].free_energy(x), +# linestyle=':', color='tab:blue',linewidth=1, label="Liquid fit") +# +#plt.plot(AlCu_Sys.phases['LIQUID'].xdata, AlCu_Sys.phases['LIQUID'].Gdata, +# linestyle='-', color='tab:blue',linewidth=1, label="Liquid") +# +#plt.xlim([0.0, 0.4]) +#plt.ylim([-50000.0, -25000]) +#plt.xlabel("X_Cu") +#plt.ylabel("G (J/mol)") +#plt.savefig("AlCu_eutectic.png") + +output = {} + +add_to_dict(AlCu_Fit, output, add_templates=True, c0={"FCC_A1_0": 0.0, "LIQUID": 0.1, "AL2CU_1": 0.333}, Vm=1.0e-5) + +import json +print(output) +#with open("system.json", "w") as f: +# json.dump(output, f, indent=4) \ No newline at end of file