PACMOF2 is a Python package designed to predict partial atomic charges in Metal-Organic Frameworks (MOFs) with Density Functional Theory (DFT) level accuracy. It includes two pre-trained machine learning models: PACMOF2_neutral for neutral MOFs and PACMOF2_ionic for ionic MOFs. Detailed methods and implementation can be found in our upcoming publication.
Associated data (models, DDEC6 data, PACMOF2 prediction data) for the project is available on Zenodo: https://zenodo.org/records/12747095
PACMOF2 has been tested with Python 3.9 and requires the following dependencies. Newer versions of these dependencies may work as well, but we did not test them.
- Pymatgen (2023.10.4)
- Atomic Simulation Environment (ASE) (3.22.1)
- Scikit-Learn (1.3.2)
First, clone the repository:
git clone https://github.com/tdpham2/pacmof2conda create -n pacmof2 python==3.9
conda activate pacmof2
conda install -c conda-forge pymatgen=2023.10.4
conda install -c conda-forge ase=3.22.1
conda install -c conda-forge scikit-learn=1.3.2
pip install buildAlternatively, install dependencies via pip:
pip install -r requirements.txtPACMOF2 models are available on HuggingFace and Zenodo. Download the models and store them under pacmof2/models/ directory:
wget -P pacmof2/models/ https://huggingface.co/tdphamm/PACMOF2/resolve/main/PACMOF2_ionic.gz
wget -P pacmof2/models/ https://huggingface.co/tdphamm/PACMOF2/resolve/main/PACMOF2_neutral.gzOR
# From Zenodo
wget -P pacmof2/models/ https://zenodo.org/records/12747095/files/PACMOF2_ionic.gz
wget -P pacmof2/models/ https://zenodo.org/records/12747095/files/PACMOF2_neutral.gzAfter setting up the dependencies and downloading the models, install PACMOF2:
pip install -e .PACMOF2 can predict partial atomic charges for both neutral and ionic MOFs. It can be used either as a command-line tool or as a Python library. Example scripts and CIF files are available in the examples/ directory.
After installation, the pacmof2 command is available:
# Single neutral MOF
pacmof2 path/to/file.cif -o output_dir/
# Multiple neutral MOFs in a directory
pacmof2 path/to/cifs/ -o output_dir/ --multiple
# Single ionic MOF with known net charge
pacmof2 path/to/file.cif -o output_dir/ --net-charge -2
# Multiple ionic MOFs with net charges from a JSON file
pacmof2 path/to/cifs/ -o output_dir/ --multiple --net-charges net_charges.json
# Show all options
pacmof2 --helpfrom pacmof2 import get_charges
# Single CIF
get_charges('path/to/file.cif', 'output_dir/', identifier="_pacmof")
# Multiple CIFs in a folder
get_charges('path/to/cifs/', 'output_dir/', identifier='_pacmof', multiple_cifs=True)from pacmof2 import get_charges
# Single ionic MOF
get_charges('path/to/file.cif', 'output_dir/', identifier='_pacmof', net_charge=-2)For multiple ionic MOFs with net charges specified in a JSON file:
from pacmof2 import get_charges
import json
with open('net_charges.json', 'r') as f:
net_charges = json.load(f)
get_charges('path/to/cifs/', 'output_dir/', identifier='_pacmof', multiple_cifs=True, net_charge=net_charges)Our work is available on JPCC: https://pubs.acs.org/doi/10.1021/acs.jpcc.4c04879#