Skip to content

Fix pd#220

Merged
srmnitc merged 15 commits intomainfrom
fix_pd
Mar 4, 2026
Merged

Fix pd#220
srmnitc merged 15 commits intomainfrom
fix_pd

Conversation

@srmnitc
Copy link
Copy Markdown
Member

@srmnitc srmnitc commented Mar 4, 2026

This pull request introduces significant improvements and bug fixes to the handling of structure file writing for different calculation modes, enhances the postprocessing smoothing and correction logic, and makes job script output handling more robust. The main themes are improved support for "fe mode" in structure writing, more robust and physically meaningful postprocessing, and better test coverage for these features.

srmnitc added 15 commits March 3, 2026 15:00
… smoothing in clean_df and fix_composition_scaling
- _get_free_energy_fit gains method='redlich-kister' option
- New _eval_free_energy_fit dispatches between polynomial and RK
- get_phase_free_energy gains method parameter (default 'polynomial')
- Fully backward compatible: default behavior unchanged
The Redlich-Kister xi*(1-xi) prefactor forces F_excess=0 at both
endpoints.  This is correct when both endpoints are pure components
(x=0 or x=1), but wrong for partial-range phases like agfcc (0.7-1.0)
where x=0.7 is NOT a pure component.

Fix: detect which endpoints are actual pure components (within tol=1e-3
of 0 or 1) and use appropriate basis functions:
- Both pure: standard xi*(1-xi)*(1-2xi)^k  (classic RK)
- Only right pure: (1-xi)*xi^k  (excess free at left boundary)
- Only left pure: xi*(1-xi)^k  (excess free at right boundary)
- Neither pure: xi^k  (unconstrained polynomial for excess)
- Two-phase regions rendered as filled polygons with coloured borders
- fill=True by default; fill=False reverts to legacy horizontal lines
- Configurable alpha, border_lw, figsize, external ax support
- Auto-labels axes and calls tight_layout
- Fully backward-compatible signature
Trim composition edges of partial-range phases before convex hull
construction.  Removes artefactual F_mix dips at boundaries where
the global linear reference does not match the phase's natural
endpoint, preventing false tangent contacts near the eutectic.
… ax)

- Switch from material-design colours to Tableau 10 qualitative palette
- Legend now only shows two-phase regions that actually appear in the data
- Deduplicate reversed phase pairs (e.g. lqd-agfcc == agfcc-lqd)
- Return (fig, ax) tuple instead of fig alone
…_boundary option

- Use the user-specified composition_interval (instead of min/max of
  available data) for the compfine evaluation grid.  This prevents
  discontinuities when endpoint data appears/disappears at certain
  temperatures (e.g. lqd x=0 only available above 900K).

- Add smooth_boundary parameter to plot_phase_diagram: applies a
  Savitzky-Golay filter to polygon boundary curves to remove
  remaining data-edge kinks.  Default 0 (disabled).
Wraps data gathering, cleaning, free-energy fitting, common-tangent
construction, and plotting into a single class.

Methods:
  - calculate(): compute tangents across temperature range
  - plot(): full phase diagram with filled polygons
  - plot_free_energy(T): F(x) curves at one temperature
  - plot_free_energy_mixing(T): F_mix(x) + tangent lines
  - plot_data_vs_fit(phase, T): raw data vs fitted curve
  - plot_convergence(): overview of succeeded/failed calculations
@srmnitc srmnitc merged commit 402f104 into main Mar 4, 2026
4 checks passed
@srmnitc srmnitc deleted the fix_pd branch March 4, 2026 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant