|
| 1 | +import os |
| 2 | + |
| 3 | +import mala |
| 4 | + |
| 5 | +from mala.datahandling.data_repo import data_path |
| 6 | + |
| 7 | +""" |
| 8 | +Shows how ACE descriptors can be calculated with MALA. ACE descriptors |
| 9 | +hold the promise of being more descriptive and accurate than bispectrum |
| 10 | +descriptors and are currently being investigated by the MALA team. |
| 11 | +MALA already implements most functionalities of bispectrum descriptors for |
| 12 | +ACE descriptors. |
| 13 | +After preprocessing data to ACE descriptors with this example, all other |
| 14 | +examples can be run with the ACE descriptors by simply pointing to the |
| 15 | +appropriate ACE descriptor numpy files. |
| 16 | +
|
| 17 | +REQUIRES LAMMPS. |
| 18 | +""" |
| 19 | + |
| 20 | + |
| 21 | +#################### |
| 22 | +# 1. PARAMETERS |
| 23 | +# Compare to the bispectrum descriptors, ACE descriptors have slightly more |
| 24 | +# hyperparameters to consider. For more information on the hyperparameters, |
| 25 | +# please refer to https://arxiv.org/abs/2411.19617. |
| 26 | +# ACE_DOCS_MISSING: Is it enough to refer to the paper here or should |
| 27 | +# we include more information here? |
| 28 | +#################### |
| 29 | + |
| 30 | +parameters = mala.Parameters() |
| 31 | +# Bispectrum parameters. |
| 32 | +parameters.descriptors.descriptor_type = "ACE" |
| 33 | +parameters.descriptors.ace_cutoff_factor = 5.8 |
| 34 | +parameters.descriptors.ace_included_expansion_ranks = [1, 2, 3] |
| 35 | +parameters.descriptors.ace_maximum_l_per_rank = [0, 1, 1] |
| 36 | +parameters.descriptors.ace_maximum_n_per_rank = [1, 1, 1] |
| 37 | +parameters.descriptors.ace_minimum_l_per_rank = [0, 0, 0] |
| 38 | + |
| 39 | +#################### |
| 40 | +# 2. ADDING DATA FOR DATA CONVERSION |
| 41 | +# As detailed in the basic preprocessing example, we can process |
| 42 | +# input and output data separately. This example only computes descriptor data |
| 43 | +# as it is assumed that the LDOS data has already been processed in an earlier |
| 44 | +# example. |
| 45 | +#################### |
| 46 | + |
| 47 | +data_converter = mala.DataConverter(parameters) |
| 48 | +outfile = os.path.join(data_path, "Be_snapshot0.out") |
| 49 | + |
| 50 | +# Converting a snapshot for training on precomputed descriptor data. |
| 51 | +data_converter.add_snapshot( |
| 52 | + descriptor_input_type="espresso-out", |
| 53 | + descriptor_input_path=outfile, |
| 54 | +) |
| 55 | + |
| 56 | +#################### |
| 57 | +# 3. Converting the data |
| 58 | +# Since we are only converting descriptor data here, target and simulation |
| 59 | +# output paths can be ommitted. |
| 60 | +#################### |
| 61 | + |
| 62 | +data_converter.convert_snapshots( |
| 63 | + descriptor_save_path="./", |
| 64 | + naming_scheme="Be_snapshot*_ACE.npy", |
| 65 | + descriptor_calculation_kwargs={"working_directory": data_path}, |
| 66 | +) |
0 commit comments