This repository contains a MATLAB implementation of the COSMO-SAC (COSMO Segment Activity Coefficient) model. The code calculates the thermodynamic activity coefficients of components in chemical mixtures based on their molecular surface charge distributions, known as
The model predicts the non-ideal behavior of liquid mixtures by analyzing the interaction energies between molecular surface segments. It accounts for:
- Electrostatic Misfit Energy: Interactions between segments with different charge densities.
- Hydrogen Bonding: Specific attractions between highly polar surface regions based on a cutoff value.
- Combinatorial Effects: Differences in molecular size and shape using the Staverman-Guggenheim term.
The calculation follows a multi-step thermodynamic workflow derived from the source code:
For each molecule, the code calculates the surface area distribution as a function of charge density
Where:
-
Term1 is the Euclidean distance between surface segments
$i$ and$j$ . -
REFF is the effective averaging radius (
$0.817642$ Å).
The exchange energy between two segments
-
Misfit term: Determined by
ALPHAPRIMEand the sum of charge densities. -
HB term: Active when charge densities exceed the threshold
SIGMAHB($0.0084$ e/Ų).
The activity coefficient of a segment is solved iteratively until the change is less than
The code computes this for both pure species (SEGGAMMAPR) and the mixture (SEGGAMMA).
The final activity coefficient for component
- Residual: Calculated by summing the difference between mixture and pure segment activity coefficients weighted by the sigma profile.
- Combinatorial (SG): Uses
COORD(coordination number),RNORM(normalized volume), andQNORM(normalized area) parameters.
| File | Description |
|---|---|
eqCOSMO.m |
Main script for Two Phase Equilibrium; defines temperature and components. |
Binary.m |
Primary function calculating mole fractions, pure/mixture segment gammas, and final |
SimgaProfileCalculator.m |
Manages the averaging of surface charges and calls the sorting logic. |
Library.m |
Reads geometry, volume, and charge data from inputQM.xlsx. |
paraCOSMO.m |
Provides universal constants ( |
SortSimgaProfile.m |
Bins segment data into a discrete density distribution from -0.025 to 0.025. |
ConvertAU2A.m |
Converts coordinates from Atomic Units to Angstroms. |
- MATLAB installed.
- An Excel file named
inputQM.xlsxin the working directory. - The Excel file must have sheets named after your components (e.g., '67-63-0-2d' or 'Z1') containing the required QM output data.
- Open
eqCOSMO.m. - Set your desired SYSTEMP (Temperature in K).
- Update ListCOMP with the sheet names from your Excel file.
- Run the script.
-
sProfiles.xlsx: Stores the calculated$\sigma$ -densities and profiles for each component. -
MixGamma.xlsx: Stores the final matrix containing mole fractions ($x$ ), activity coefficients ($\gamma$ ), and$\ln \gamma$ .