From 3b551bf8df1914ec8c613908ff96abf04f722565 Mon Sep 17 00:00:00 2001 From: Xander <102053371+fractalsbyx@users.noreply.github.com> Date: Sat, 5 Jul 2025 16:32:19 -0400 Subject: [PATCH 1/2] fixes to add_to_dict use x0 instead of c0, don't use keyword dict, corrected a template check --- ammber/utils.py | 52 ++++++++++++++++++++++++------------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/ammber/utils.py b/ammber/utils.py index 7f8c667..d3aedeb 100644 --- a/ammber/utils.py +++ b/ammber/utils.py @@ -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 @@ -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 } From d8ee5eb200983980c644a3246a92d1f77f696a05 Mon Sep 17 00:00:00 2001 From: Xander <102053371+fractalsbyx@users.noreply.github.com> Date: Sat, 5 Jul 2025 16:34:48 -0400 Subject: [PATCH 2/2] patch version --- ammber/__init__.py | 2 +- pyproject.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ammber/__init__.py b/ammber/__init__.py index a30502f..7949cdf 100644 --- a/ammber/__init__.py +++ b/ammber/__init__.py @@ -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' \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 8761829..ecfd568 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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" },