Skip to content

Code to calculate the vapor-liquid interface in ionic fluids using modified Gaussian renormalized fluctuation theory

License

Notifications You must be signed in to change notification settings

nikhil0165/vapor_liquid_mgrf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

vapor_liquid_mgrf: Modern Python Package for Vapor-Liquid Interface Simulations

Python Version License Build Status


Overview

vapor_liquid_mgrf is a Python package for simulating the interface between coexisting vapor and liquid phases in ionic fluids using the modified Gaussian renormalized fluctuation (MGRF) theory. The code is based on the equations derived in:

This package enables researchers to:

  • Solve the MGRF equations for vapor-liquid interfaces with arbitrary salt mixtures
  • Reproduce published results from recent theoretical works
  • Extend and adapt the code for new physical scenarios
References & Citations

If you use this code, please cite:

This code can reproduce data from:


Features

  • Full solution of the MGRF theory for vapor-liquid interfaces
  • Support for arbitrary salt mixtures and dielectric contrasts
  • Parallelized Green’s function and self-energy calculations
  • Modular, extensible codebase with clear separation of physics and numerics
  • Output in HDF5 format for easy post-processing
  • Reproducibility: all parameters and results are saved for each run

Installation

  1. Clone the repository:
    git clone https://github.com/nikhil0165/vapor_liquid_mgrf.git
    cd vapor_liquid_mgrf
  2. Set up a Python environment (recommended):
    conda create -n vaporliquid python=3.8
    conda activate vaporliquid
    pip install -r requirements.txt
    # Or install dependencies manually (see packages.py)
  3. Install Dedalus: Follow Dedalus installation instructions.

Usage

You can run the main simulation scripts as follows:

# For symmetric salts
python simulator_symm.py physical_param_symm.py
# Or using a saved MGRF solution as initial guess
python simulator_symm_mgrf.py physical_param_symm.py

# For asymmetric salts
python simulator_asymm.py physical_param_asymm.py
# Or using a saved MGRF solution as initial guess
python simulator_asymm_mgrf.py physical_param_asymm.py

All output is saved in the results* folders as HDF5 files, with all parameters and profiles included.

Note: simulator_symm.py and simulator_asymm.py save the solution of the modified Gaussian renormalized fluctuation theory in a .h5 file for the input parameters given in the *_param.py files, using the tanh(x) as guess for concentration profle and corresponding PB solution as the initial guess for potential profile. The *_mgrf.py scripts use a saved solution as the initial guess. The physical variables for this saved solution and the final parameters for which you want the interface structure can be set separately using the file physical_param_symm.py or physical_param_asymm.py. The variables deciding which saved solution to choose as initial guess end with _in, for example: int_width_in or T_star_in.


File Structure & Module Guide

Click to expand file/module descriptions
  • numerical_param.py: Numerical parameters (grid size, tolerances, mixing ratios, etc.) for all solvers.
  • physical_param_symm.py / physical_param_asymm.py: Physical system parameters (concentrations, valencies, radii, dielectric constants, etc.) for symmetric/asymmetric salts.
  • coexist_symm.py / coexist_asymm.py: Bulk phase concentrations and electrostatic potentials for coexisting phases.
  • mgrf_symm.py / mgrf_asymm.py: Main MGRF solvers for symmetric/asymmetric salts.
  • num_concn.py: Functions for computing ion concentration profiles and Jacobians.
  • selfe_vap_liq.py: Self-energy calculations for the interface.
  • selfe_bulk.py: Self-energy calculations for the bulk.
  • greens_function_vap_liq.py / greens_function_bulk.py: Green’s function (Fourier transform) for the interface and bulk.
  • calculate.py: Utility functions for screening length, ionic strength, charge density, interpolation, etc.
  • energy_vap_liq.py: Grand free energy calculations for interface and bulk.
  • simulator_symm.py / simulator_asymm.py: Scripts to solve and save MGRF solution using PB as initial guess.
  • simulator_symm_mgrf.py / simulator_asymm_mgrf.py: Scripts to solve and save MGRF solution using a previous MGRF result as initial guess.
  • packages.py: Centralized imports for all required Python libraries.

Contributing

Contributions, bug reports, and feature requests are welcome! Please open an issue or submit a pull request.


Contact

Developed by Nikhil Agrawal in the lab of Prof. Rui Wang, Pitzer Center for Theoretical Chemistry, University of California, Berkeley, USA.

For questions, suggestions, or collaboration, contact: nikhilagrawal0165@gmail.com

About

Code to calculate the vapor-liquid interface in ionic fluids using modified Gaussian renormalized fluctuation theory

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages