one_plate_mgrf is a Python package for simulating the electrical double layer (EDL) structure near a single, uniformly charged plate using the modified Gaussian renormalized fluctuation (MGRF) theory. The code is built on top of the Dedalus spectral PDE solver and implements advanced iterative and parallel algorithms for high-accuracy EDL modeling.
This package enables researchers to:
- Solve the MGRF equations for planar EDLs with arbitrary salt mixtures and dielectric environments
- 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:
- Agrawal & Wang, Phys. Rev. Lett. 2022, 129, 228001
- Agrawal & Wang, J. Chem. Theory Comput. 2022, 18, 6271–6280
This code can reproduce data from:
- Agrawal, Duan, & Wang, J. Phys. Chem. B 2024, 128, 1, 303–311
- Agrawal & Wang, AIChE Journal 2023, 69 (12), e18269
- Full solution of the MGRF theory for planar EDLs
- 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
- Clone the repository:
git clone https://github.com/nikhil0165/one_plate_mgrf.git cd one_plate_mgrf - Set up a Python environment (recommended):
conda create -n mgrf python=3.8 conda activate mgrf pip install -r requirements.txt # Or install dependencies manually (see packages.py) - Install Dedalus: Follow Dedalus installation instructions.
You can run the main simulation scripts as follows:
# Run with a new initial guess (PB solution)
python simulator_pb.py physical_param.py
# Run using a saved MGRF solution as initial guess
python simulator.py physical_param.pyAll output is saved in the results* folders as HDF5 files, with all parameters and profiles included.
Note:
simulator_pb.py saves the solution of the modified Gaussian renormalized fluctuation theory in a .h5 file for the input parameters given in the two *_param.py files, using the PB solution as the initial guess. simulator.py uses a saved solution of mgrf_1plate.py as the initial guess. The physical variables for this saved solution and the final parameters for which you want the double-layer structure can be set separately using the file physical_param.py. The variables deciding which saved solution to choose as initial guess end with _in_d, for example: sigma_in_d.
Click to expand file/module descriptions
- numerical_param.py: Numerical parameters (grid size, tolerances, mixing ratios, etc.) for all solvers.
- physical_param.py: Physical system parameters (concentrations, valencies, radii, dielectric constants, etc.).
- dh_1plate.py: Linearized Debye–Hückel solver for initial guess.
- pb_1plate.py: Nonlinear Poisson–Boltzmann solver for mean-field EDL structure.
- mgrf_1plate.py: Main MGRF solver for 1-plate geometry.
- num_concn.py: Functions for computing ion concentration profiles and Jacobians.
- selfe_1plate.py: Self-energy calculations for the interface (1-plate).
- selfe_bulk.py: Self-energy calculations for the bulk.
- greens_function_1plate.py: Green’s function (Fourier transform) for the interface.
- greens_function_bulk.py: Green’s function for the bulk.
- calculate.py: Utility functions for screening length, ionic strength, charge density, interpolation, etc.
- energy_1plate.py: Grand free energy calculations for interface and bulk.
- simulator_pb.py: Script to solve and save MGRF solution using PB as initial guess.
- simulator.py: Script to solve and save MGRF solution using a previous MGRF result as initial guess.
- packages.py: Centralized imports for all required Python libraries.
Contributions, bug reports, and feature requests are welcome! Please open an issue or submit a pull request.
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