# `06_PolymerSystems`

`06_PolymerSystems` covers PNIPAAm solution calculations, including polymer
binodals, density comparisons, optimized PNIPAAm-water parameter variants, and
small ternary tracing examples.

## Prerequisites

Install and activate the repository environment from
[`../README.md`](../README.md). Run scripts from this directory because outputs
and saved parameter files use relative paths.

## Scripts And Files

- [`plot_polymer_lle.py`](plot_polymer_lle.py): compares PNIPAAm-water binodals
  and density predictions for selected parameter sets
- [`plot_polymer_lle_waters.py`](plot_polymer_lle_waters.py): compares
  PNIPAAm-water predictions across the archived optimized water parameter sets
- [`plot_polymer_lle_T_scale_study.py`](plot_polymer_lle_T_scale_study.py):
  compares the temperature-scaling variants of the bahrabadi-based fit
- [`tracing_example_polymer.py`](tracing_example_polymer.py): concise ternary
  PNIPAAm-water-ethanol tracing example
- [`optimize_parameters_example_constant_m_transition.py`](optimize_parameters_example_constant_m_transition.py):
  fits constant-`m` PNIPAAm-water parameter sets and writes JSON/CSV outputs to
  [`optimization_water_models/`](optimization_water_models/README.md)
- [`PC_Saft_Parameters.json`](PC_Saft_Parameters.json): standalone parameter
  export kept with the polymer workflow for inspection or ad hoc reuse

## Commands

Generate the main archived figures and tables:

```bash
cd 06_PolymerSystems
python plot_polymer_lle.py
python plot_polymer_lle_waters.py
python plot_polymer_lle_T_scale_study.py
```

Run the tracing example:

```bash
cd 06_PolymerSystems
python tracing_example_polymer.py
```

Refresh optimized parameter archives only when intentionally rerunning the fit:

```bash
cd 06_PolymerSystems
python optimize_parameters_example_constant_m_transition.py
```

## Outputs

- [`figures/`](figures/): PNIPAAm-water PDF figures, density comparisons, and
  compact TOC-style variants
- [`tables/`](tables/): parameter summary tables written by the plotting
  scripts
- [`optimization_water_models/`](optimization_water_models/README.md): saved
  JSON parameter variants and differential-evolution histories

## Notes

- The plotting scripts use files in `optimization_water_models/` for the water-
  model comparisons and the `T_scale` study.
- The optimizer can take a long time because each objective evaluation traces
  phase behavior before scoring against experiment.
