Miniff Design Documentation¶
Structure¶
The project includes several modules performing energy and gradients computations, potential parameter optimization through machine learning, simple geometry optimization and presentation utilities.
potentials: a core module implementing smooth classical interatomic potentials and descriptors. The module includesLocalPotentialFamily: a factory for constructing parameterizedLocalPotentialobjects which, in turn, include all necessary data and interfaces to compute atomic energies and gradients. Several pre-built potential forms are provided through instantiatingLocalPotentialFamily: for example,lj_potential_family(Lenard-Jones pair potential) orbehler5_descriptor_family(Behler type 5 angular descriptor).kernel: implements aNeighborWrapperclass which computes neighbor information from atomic coordinate data and prepares contiguous data buffers which can be processed byLocalPotential``s. ``NeighborWrapperis implemented with 3D periodic boundary conditions in mind to model amorphous materials. However, it also supports molecular systems without any overhead.NeighborWrapperalso implements a key interfaceNeighborWrapper.evalwhich, for a given structure and a list of potentials, computes total energy and gradients.NeighborWrapper.relaxintroduces a toy interface for structural relaxation usingscipyminimizers.ml: implements machine learning potentials.ml.Datasetis the key container for atomic descriptors, energies and gradients. It ensures that all dataset pieces aretorch.Tensor``s compatible with each other. ``ml.Datasetincludes two large blocks of data, namely oneml.PerCellDatasetblock with target energies and energy gradients, and one or more ``ml.PerPointDataset``s with descriptor information.ml.Normalizationimplements normalization of datasets in a physically reasonable way.ml.learn_cauldronis a typical entry point for dataset creation which includes reasonable default values.ml.SequentialSoleEnergyNNis Behler et al. suggestion for the neural network potential form.ml.forward_cauldronis the core routine for machine-learning optimization. It combines dataset and neural-network models to produce the energy and gradients prediction.ml.NNPotentialis a neural-network potential subclassingpotentials.LocalPotential.
miniff.mlis built aroundpytorch.ml_util: includes reasonable recipes for optimizing neural networks fromml.ml_util.simple_energy_closureprovides defaults for running the optimization with LBFGS.ml_util.*Workfloware workflow classes for optimizing neural-network potentials. These classes accumulate and re-distribute many parameters related to the dataset organization, potential form and optimizatin process.
presentation: various handy plotting routines to present potentials and visualize machine learning optimization process.
Deployment¶
miniff can be deployed on high-performance computing (HPC) clusters.
Parallelism¶
minifftakes a full advantage of GPU parallelism inpytorch. Please note that it is often not enough to install pre-built bundles ofpytorchas they support only a limited set of (very recent) GPU drivers. If your HPC hardware does not feature those you have several options:It is best to ask your HPC support team for a suitable
pytorchbuild specifically for the HPC machine. Such builds may be available throughmodulescript or other ways to manage the runtime environment on the cluster: please investigate such options first.The second possibility is to use an older
pytorchversion which bundles kernels for older GPUs.miniffdoes its best to support a wide range ofpytorchversions but you have to test the compatibility manually in your case.The last possibility is to build
pytorchmanually. This is the most tedious approach, thus, not recommended for unexperienced users.
OpenMP threading support is present in potential and gradient computations. This may be useful for computing energies and gradients in large atomic systems. The number of threads is controlled by usual means such as
OMP_NUM_THREADSenvironment variable. For small atomic systems~100atoms up to 2-4 threads are beneficial: make sure your parallel cluster setup is reasonable.