If you make use of the ænet-PyTorch interface, please cite the following reference:
J. Lopez-Zorrilla*, X.M. Aretxabaleta, I.W. Yeu, I. Etxebarria, H. Manzano, N. Artrith*, ænet-PyTorch: A GPU-Supported Implementation for Machine Learning Atomic Potentials Training, J. Chem. Phys. 158, 164105 (2023). DOI: https://doi.org/10.1063/5.0146803 OpenAccess
*Contact: [email protected] or [email protected]
The Atomic Energy NETwork (ænet) package (http://ann.atomistic.net) is a collection of tools for the construction and application of atomic interaction potentials based on artificial neural networks (ANN). ANN potentials generated with ænet can then be used in larger scale atomistic simulations.
ænet-PyTorch is an extension of that code to allow GPU-support for the training process of ænet, substituting the train.x
training step. It is enterily written in PyTorch and includes new features that the previous code did not: the ability to fit reference forces in addition to energies with GPU support. ænet-PyTorch is fully compatible with all the ænet tools: interfaces with LAMMPS and TINKER, and ASE.
M.S. Chen*, T. Morawietz, H. Mori, T.E. Markland, N. Artrith*, AENET-LAMMPS and AENET-TINKER: Interfaces for Accurate and Efficient Molecular Dynamics Simulations with Machine Learning Potentials, J. Chem. Phys. 155, 074801 (2021). doi: https://doi.org/10.1063/5.0063880
The modified version of ænet can be installed the same way as ænet. See its documentation or any of the tutorials available in the ænet for a comprehensive guide on how to install it. In short, these are the steps to follow:
-
Compile the L-BFGS-B library
-
Enter the directory “aenet_modified/lib”
$ cd aenet_modified/lib
-
Adjust the compiler settings in the “Makefile” and compile the library with
$ make
The library file
liblbfgsb.a
, required for compiling ænet, will be created. -
-
Compile the ænet package
-
Enter the directory “aenet_modified/src”
$ cd aenet_modified/src
-
Compile the ænet source code with an approproiate
Makefile.XXX
$ make -f makefiles/Makefile.XXX
The following executables will be generated in “./bin”:
generate.x
: generate training sets from atomic structure filestrain.x
: train new neural network potentialspredict.x
: use existing ANN potentials for energy/force prediction
-
ænet-PyTorch is enterily written in Python, using the PyTorch framework. In the following the required packages will be listed. It is highly recommended to install all the packages in an isolated Python environment, using tools such as virtual-env (https://virtualenv.pypa.io/en/latest/) or a conda environment (https://conda.io/projects/conda/en/latest/user-guide/tasks/manage-environments.html) .
Python
: 3.7 or higherNumpy
: 1.19 or higherPyTorch
: 1.10 or higherCUDA
: 10.2 or higher (optional for GPU support)
We will assume that CUDA
and Python 3.7 are already installed.
-
Install PyTorch 1.10
-
Installation using pip with CUDA support
$ pip install torch==1.10.1+cu102 -f https://download.pytorch.org/whl/cu102/torch_stable.html
or for only CPU usage
$ pip install torch==1.10.1+cpu -f https://download.pytorch.org/whl/cpu/torch_stable.html
-
-
Install Numpy
- Numpy should be automatically installed when installing PyTorch.
Compile the tools needed to make ænet-PyTorch compatible with ænet
-
Enter the directory "pytorch-aenet/tools"
cd tools
-
Compile the tools
make
The following exacutables will be generated in the same "tools/" directory:
trainbin2ASCII.x
: convert the output from generate.x (XXX.train
) to a format readable by ænet-PyTorch (XXX.train.ascii
).nnASCII2bin.x
: convert the ænet-PyTorch output files (XXX.nn.ascii
) to the usual binary files (XXX.nn
).
ænet-PyTorch is used in multiple steps:
- ænet's regular
generate.x
is used to featurize the atomic structures in the reference data set; - The tool
trainbin2ASCII.x
is used to convert the training set file generated bygenerate.x
(XXX.train
) to a format readable by ænet-PyTorch (XXX.train.ascii
); - Training is performed using ænet-PyTorch;
- The trained potentials (
XXX.nn.ascii
) are converted back to the binary format used by ænet withnnASCII2bin.x
(XXX.nn
); - The potential can then be used by ænet's
predict.x
and other compatible interfaces, such as ænet-LAMMPS
An explanation of the input parameters can be found in the documentation in the doc/
directory. An example of the usage of the code can be found in the example/
directory.