This repository contains the gaptrain module for generating datasets, training GAPs and running simulations using Atomic Simulation Environment (ASE) to drive dynamics and electronic structure packages for reference energies and forces.
To install gaptrain in one line:
wget https://raw.githubusercontent.com/t-young31/gap-train/master/scripts/INSTALL.sh && bash INSTALL.sh
NOTE: ORCA cannot be installed with this script.
Otherwise, from source:
git clone https://github.com/t-young31/gap-train.git
cd gap-train
conda install --file requirements.txt -c conda-forge
python setup.py install
where the electronic structure packages (GPAW, DFTB+, XTB, ORCA) and QUIP need to be installed manually.
See examples for a selection of examples using active learning. A minimal example to train a GAP on 10 random configurations of a water box:
import gaptrain as gt
system = gt.System(box_size=[10, 10, 10])
system.add_solvent('h2o', n=20)
training_data = gt.Data()
for i in range(10):
training_data += system.random()
training_data.parallel_dftb()
gap = gt.GAP(name='random', system=system)
gap.train(training_data)
NOTE: This will not be a stable water potential!
Different environments are handled with gt.GTConfig
and/or environment variables.
DFTB+ requires an executable path and a parameter path, which can be set (in bash) with:
export DFTB_COMMAND=/path/to/dftb-install/bin/dftb+
export DFTB_PREFIX=/path/to/dftb-params/
GPAW similarly requires a parameter path with e.g.
export GPAW_SETUP_PATH=/path/to/gpaw-install/share/gpaw-setups-0.9.20000
gaptrain is unit tested with pytest, run them with
py.test tests/
in the top level gap-train directory. To run the DFTB+, GAP and GROMACS tests set the $GT_DFTB, $GT_GAP, $GT_GMX environment variables to True as appropriate (if they're installed)
export GT_DFTB=True
export GT_ORCA=True
export GT_XTB=True
export GT_GAP=True
export GT_GMX=True
If gaptrain is used in a publication please consider citing the paper:
@article{GAPTraining2021,
doi = {10.1039/d1sc01825f},
url = {https://doi.org/10.1039/d1sc01825f},
year = {2021},
publisher = {Royal Society of Chemistry ({RSC})},
author = {Tom Young and Tristan Johnston-Wood and Volker L. Deringer and Fernanda Duarte},
title = {A transferable active-learning strategy for reactive molecular force fields},
journal = {Chemical Science}
}