{"id":16554425,"url":"https://github.com/tkphd/ternary-phase-diagram","last_synced_at":"2025-10-28T19:30:40.518Z","repository":{"id":45298873,"uuid":"176835968","full_name":"tkphd/ternary-phase-diagram","owner":"tkphd","description":"Derivation and construction of a thermodynamic phase diagram for ternary alloy systems with 2 or 3 phases","archived":false,"fork":false,"pushed_at":"2020-06-16T14:57:07.000Z","size":398,"stargazers_count":11,"open_issues_count":0,"forks_count":3,"subscribers_count":4,"default_branch":"main","last_synced_at":"2023-03-27T15:56:11.538Z","etag":null,"topics":["constrained-optimization","lagrange-multipliers","materials-science","phase-diagram","phase-field","thermodynamics"],"latest_commit_sha":null,"homepage":null,"language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tkphd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-03-21T00:04:23.000Z","updated_at":"2023-01-23T16:29:16.000Z","dependencies_parsed_at":"2022-07-13T14:21:11.151Z","dependency_job_id":null,"html_url":"https://github.com/tkphd/ternary-phase-diagram","commit_stats":null,"previous_names":[],"tags_count":null,"template":null,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkphd%2Fternary-phase-diagram","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkphd%2Fternary-phase-diagram/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkphd%2Fternary-phase-diagram/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tkphd%2Fternary-phase-diagram/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tkphd","download_url":"https://codeload.github.com/tkphd/ternary-phase-diagram/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":219858938,"owners_count":16556039,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["constrained-optimization","lagrange-multipliers","materials-science","phase-diagram","phase-field","thermodynamics"],"created_at":"2024-10-11T19:51:27.082Z","updated_at":"2025-10-28T19:30:35.236Z","avatar_url":"https://github.com/tkphd.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ternary-phase-diagram\n\nThis repository presents the math and code required to construct the\nthermodynamic phase diagram for a ternary alloy system containing two or three\nphases.\n\n![example-diagram](example-diagram.png)\n\n*A ternary phase diagram, for example.*\n\nA Makefile is provided to build both the documentation and a shared library\nrequired to efficiently crunch the numbers. The\n[derivation](ternary-diagram.tex) is written in LaTeX, while the\n[implementation](phase-diagram.py) is in Python.\n\n## Dependencies\n\n- To use the Makefile, you will need [make](https://www.gnu.org/software/make/).\n- To build the derivation, you will need a LaTeX distribution.\n- To build the shared library, you will need a scientific Python distribution\n  (*e.g.*, [Anaconda](https://store.continuum.io/cshop/anaconda/),\n  [Canopy](https://enthought.com/products/canopy/),\n  [Python(x,y)](https://python-xy.github.io/)) and\n  [SymPy](https://www.sympy.org), which is available from\n  [GitHub](https://github.com/sympy/sympy) or\n  [PyPI](https://pypi.org/project/sympy/) (`pip install sympy`).\n\n## Usage\n\nWith these dependencies met, you can regenerate the example phase diagram with\n\n```bash\n  $ make\n```\n\nThis triggers a three-stage process:\n\n1. Evaluate [free-energies.py](free-energies.py) to write three paraboloid\n   free energies (one per phase) to C expressions:\n    ```bash\n    $ python free-energies.py\n    ```\n2. Compile the C expressions to a shared library:\n    ```bash\n    $ gcc -Wall -fPIC -shared paraboloids.c -o paraboloids.so\n    ```\n3. Execute [phase-diagram.py](phase-diagram.py) to draw the pretty picture:\n    ```bash\n    $ python phase-diagram.py\n    ```\n\nTo rebuild the documentation, simply\n\n```bash\n  $ make docs\n```\n\n## Reuse\n\nTo make this code your own, edit [free-energies.py](free-energies.py) and refine\n(or redefine) the three pure-phase free energy expressions: `GA`, `GB`, and\n`GC`. Perhaps start with increasing curvatures, or change `skew` to change the\namount of \"squish\" along the $x_1 = x_2$ line. If you change the arguments\nrequired to evaluate a function, you will also need to modify\n[pyCinterface.py](pyCinterface.py) accordingly. When you're done, simply\n\n```bash\n  $ make\n```\n\nIf things aren't making sense, it might make sense to visualize your free\nenergy landscape. The utility file [ternary-landscape.py](ternary-landscape.py)\nwill convert your free energy landscape to a grayscale contour plot. Run\n\n```bash\n  $ python ternary-landscape.py\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkphd%2Fternary-phase-diagram","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftkphd%2Fternary-phase-diagram","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftkphd%2Fternary-phase-diagram/lists"}