Code for performing adversarial attacks on atomistic systems using NN potentials. The software was based on the paper "Differentiable sampling of molecular geometries with uncertainty-based adversarial attacks", and implemented by Daniel Schwalbe-Koda and Aik Rui Tan.
The folder examples
contains several Jupyter notebooks that illustrate the examples shown in the manuscript:
- 1D double well potential
- 2D double well potential
- Performing adversarial attacks on ammonia
- Performing adversarial attacks on alanine dipeptide
- Performing adversarial attacks on zeolites
- Performing NNMD simulations on ammonia
- Performing NNMD simulations on zeolites
- Adversarial attack on ANI force field
The folder data
contains three datasets used in the paper: the DFT energies/forces of ammonia, OPLS energies/forces of alanine dipeptide, and zeolites occluded with neutral molecules, in the format readable by the Neural Force Field repo.
The full atomistic data is available at the Materials Cloud Archive on the link https://doi.org/10.24435/materialscloud:2w-6h.
This software was tested with PyTorch 1.4. The installation time highly depends on your internet connection and availability of a conda
installation, but should not take more than an hour.
We recommend creating a conda
environment to run the code. To do that, follow the setup instructions at the Neural Force Field repository.
conda upgrade conda
conda create -n nff python=3.7 scikit-learn pytorch=1.4.0 cudatoolkit=10.0 ase pandas pymatgen sympy rdkit hyperopt jq openbabel -c pytorch -c conda-forge -c rdkit -c openbabel
Then, install the remaining requirements using pip
:
conda activate nff
pip install ipykernel nglview sigopt e3fp
To ensure that the nff
environment is accessible through Jupyter, add the the nff
display name:
python -m ipykernel install --user --name nff --display-name "nff"
More tutorials are available on the Neural Force Field repository
The reference for the paper is the following:
@article{schwalbe2021differentiable,
title={Differentiable sampling of molecular geometries with uncertainty-based adversarial attacks},
author={Schwalbe-Koda, Daniel and Tan, Aik Rui and G{\'o}mez-Bombarelli, Rafael},
journal={Nature Communications},
volume={12},
pages={5104},
year={2021},
publisher={Nature Publishing Group}
}