Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ammber/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
A Python package for parametrizing gibbs free energy curves for phase-field modeling.
"""

__version__ = "0.1.6"
__version__ = "0.1.7"
__author__ = 'W. Beck Andrews, Xander Mensah, Katsuyo Thornton'
__credits__ = 'University of Michigan'
52 changes: 26 additions & 26 deletions ammber/utils.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
def add_to_dict(binaryIsothermalSys, dict, add_templates=False, c0={}, Vm=None, convert_to_volumetric_energy=True):
def add_to_dict(binaryIsothermalSys, system_dict, add_templates=False, c0={}, Vm=None, convert_to_volumetric_energy=True):
"""
Adds the parameters of a BinaryIsothermal2ndOrderSystem to a dictionary
Parameters
----------
binaryIsothermalSys : BinaryIsothermal2ndOrderSystem
system to draw parameters from
dict : dict
system_dict : dict
dictionary to add parameters to
add_templates : bool
add templates or additional values needed for kinetics simulation
Expand All @@ -16,36 +16,36 @@ def add_to_dict(binaryIsothermalSys, dict, add_templates=False, c0={}, Vm=None,
convert_to_volumetric_energy : bool
a setting for AMMBER kinetics. true if binaryIsothermalSys composition axes are number fraction
"""
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"] = {}
system_dict["solution_component"] = binaryIsothermalSys.solution_component
system_dict["components"] = [binaryIsothermalSys.component]
system_dict["convert_fractional_to_volumetric_energy"] = convert_to_volumetric_energy
if "phases" not in system_dict:
system_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 phase_name not in system_dict["phases"]:
system_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]["f_min"] = phase.fmin
if comp not in system_dict["phases"][phase_name]:
system_dict["phases"][phase_name][comp] = {}
system_dict["phases"][phase_name][comp]["k_well"] = phase.kwell
system_dict["phases"][phase_name][comp]["c_min"] = phase.cmin
system_dict["phases"][phase_name]["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
if "x0" not in system_dict["phases"][phase_name][comp]:
system_dict["phases"][phase_name][comp]["x0"] = 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 phase_prop not in system_dict["phases"][phase_name]:
system_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())
if "dimensions" not in dict:
dict["dimensions"] = { "length_scale": 0.0, "time_scale": 0.0, "energy_density_scale": 0.0 }
if "l_int" not in system_dict:
system_dict["l_int"] = -1.0
if "Vm" not in system_dict:
system_dict["Vm"] = Vm if Vm is not None else -1.0
if "order_parameters" not in system_dict:
system_dict["order_parameters"] = list(binaryIsothermalSys.phases.keys())
if "dimensions" not in system_dict:
system_dict["dimensions"] = { "length_scale": 0.0, "time_scale": 0.0, "energy_density_scale": 0.0 }
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "ammber"
version = "0.1.6"
version = "0.1.7"
description = "A Python package for parametrizing Gibbs free energy curves for phase-field modeling"
authors = [
{ name = "W. Beck Andrews", email = "wband@umich.edu" },
Expand Down