DeepCDP: Deep learning Charge Density Prediction
Code and examples for predicting electron density of atomistic systems using NNs. This work is based on our paper "Machine Learning Electron Density Prediction Using Weighted Smooth Overlap of Atomic Positions".
Having access to accurate electron densities in chemical systems, especially for dynamical systems involving chemical reactions, ion transport, and other charge transfer processes, is crucial for numerous applications in materials chemistry. Traditional methods for computationally predicting electron density data for such systems include quantum mechanical (QM) techniques, such as density functional theory. However, poor scaling of these QM methods restricts their use to relatively small system sizes and short dynamic time scales. To overcome this limitation, we have developed a deep neural network machine learning formalism, which we call deep charge density prediction (DeepCDP), for predicting charge densities by only using atomic positions for molecules and condensed phase (periodic) systems. Our method uses the weighted smooth overlap of atomic positions to fingerprint environments on a grid-point basis and map it to electron density data generated from QM simulations. %please confirm intended meaning has been retained with punctuation
We trained models for bulk systems of copper, LiF, and silicon; for a molecular system, water; and for two-dimensional charged and uncharged systems, hydroxyl-functionalized graphane, with and without an added proton. We showed that DeepCDP achieves prediction
We provide examples of building and training a DeepCDP network that is capable of predicting electron density data. These examples are demonstrated in Jupyter notebooks. We have validated our method by successfully predicting charge densities for a bulk metal, Cu; a covalently bound semiconductor, bulk Si; an ionic insulator, LiF; an inorganic molecular fluid, H2O; and an organic-like 2-D material, graphanol. Selected notebooks are:
- Bulk metal: Cu
- Covalently bound semiconductor: Si
- Ionic insulator: LiF
- Inorganic molecular fluid: Water molecules
- Organic-like 2-D material: Graphanol
These notebooks demonstrate from start to finish, how one can use .cube
file data to train machine learning models that can predict electron density data of a system. We provide training data for each system as well as CP2K input scripts to generate it. Input structures as .xyz
files are provided in example/structures and cube file predictions from our examples are provided in example/predictions. Images that are used in the manuscript are generated from one of these notebooks and are stored in Images.
We have tested DeepCDP with Pytorch 2.0. Calculations were performed on an M1 Mac GPU. The device was specified using the command device = 'mps' if torch.backends.mps.is_available() else 'cpu'
. We have also used MLPs in Scikit Learn to train some test models. We recommend creating a virtual environment and install all dependencies there. For instance:
- Create a virtual environment called
deepcdp-env
and activate it:
python3 -m venv deepcdp-env
source deepcdp/bin/activate
- Install DeepCDP dependencies:
pip install matplotlib
pip install dscribe
pip install torch
pip install py3Dmol
pip install rdkit
pip install IPython
In your python script, make sure to sys.path.append('deepcdp/')
the deepcdp folder to use the DeepCDP functions.
@Article{achar2023DeepCDP,
AUTHOR = {Achar, Siddarth K. and Bernasconi, Leonardo and Johnson, J. Karl},
TITLE = {Machine Learning Electron Density Prediction Using Weighted Smooth Overlap of Atomic Positions},
JOURNAL = {Nanomaterials},
VOLUME = {13},
YEAR = {2023},
NUMBER = {12},
ARTICLE-NUMBER = {1853},
URL = {https://doi.org/10.3390/nano13121853},
ISSN = {2079-4991},
DOI = {10.3390/nano13121853}
}
Contact Siddarth Achar for questions regarding this project.