VOLARE: VOlume cALculator for pARtial and Excess volumes
Version 1.0 — 20250813
Author: Dr. Alessandro Mariani
Description VOLARE.py is a Python tool for calculating partial molar volumes of binary mixtures from experimental density data. It uses numerical derivatives and model fitting (including the Redlich–Kister polynomial) to extract excess molar volumes and their derivatives. The code also allows visualization and export of all calculated quantities, including tangent lines to the V^E curve at selected mole fractions.
The program is configured entirely through a user-editable config.ini file, avoiding the need to pass multiple command-line arguments.
Main Features • Calculates excess molar volume (V^E) from density data. • Calculates partial molar volumes from V^E using finite difference derivatives (findiff package). • Fits V^E to widely used thermodynamic models: • Redlich–Kister (up to 4 terms, with Akaike Information Criterion to select optimal number of terms). • Margules model. • Regular solution theory model. • Plots and saves: • Experimental and fitted V^E curves. • Partial molar volumes for each component. • Tangent lines to V^E at user-selected mole fractions. • Rejects artefactual negative partial molar volumes in results. • Allows custom naming of the system and components in all plots and outputs. • Saves results and plots automatically to the output directory specified in the config file. • Logs all operations for traceability and debugging.
Version History
v1.0 (2025-08-13) • Script renamed to VOLARE.py (core name fixed). • Fully config.ini-driven execution (no manual CLI arguments except the config file path). • Improved logging and error handling. • Output file names standardized and automatically generated.
v0.7 (2023-11-22) • Added user-specified names for the system and both components. • Added option to specify mole fraction(s) at which to plot V^E tangent lines.
v0.6 • Refactored code, fixed multiple bugs. • Switched to findiff for numerical derivatives. • Automatic rejection of negative artefact partial molar volumes. • Code made PEP 8 compliant.
v0.5 • Added automatic visualization and saving of V^E and partial molar volume plots.
v0.4 • Code refactored and extensively documented.
v0.3 • Allowed Redlich–Kister model up to 4 parameters. • Implemented Akaike Information Criterion (AIC) for optimal parameter selection.
v0.2 • Removed 6-term polynomial fitting. • Added Margules and Regular Solution Theory fitting options.
v0.1 • First implementation: extracted V^E and partial molar volumes from density data.
Usage 1. Requirements Python 3.x with: pip install numpy matplotlib argparse configparser findiff 2. Prepare the Input File All parameters are set in config.ini.
Main sections in config.ini: • [INPUT] • density_file_path — path to the experimental density data file. • mole_fraction_start, mole_fraction_end, mole_fraction_step — mole fraction range for calculations. • tangent_mole_fractions — comma-separated list of mole fractions where tangent lines should be drawn. • output_directory — where results and plots will be saved. • [MOLECULAR_WEIGHTS] • component1, component2 — molecular weights (g/mol). • [PURE_COMPONENT_DENSITIES] • component1, component2 — pure component densities (g/cm³). • [NAMES] • system, component1, component2 — custom names for outputs and plots. • [FITTING_MODEL] • model — one of Redlich-Kister, Margules, RegularSolution.
3. Running the Program
From the terminal: python VOLARE.py path/to/config.ini
Outputs • Data files: fitted V^E values and partial molar volumes. • Plots: • Experimental and fitted V^E curves. • Partial molar volumes. • Tangent lines at selected mole fractions. • Log file: records all steps, warnings, and errors for reproducibility.
Notes • Ensure all file paths in config.ini are valid. • Units must be consistent across all input values. • If results look unreasonable, check input density data for accuracy.