11"""
22ACE potential class.
33
4- Computes the coupling coefficients. ACE_DOCS_MISSING: Why is this called
5- "potential" - would this work as an actual ACE potential or is this just the
6- expansion coefficients?
4+ It writes a .yace file (ACE potential file) that is readable by LAMMPS. When only the
5+ coupling coefficients are saved to the .yace file, this acts as a parameter
6+ file with which one can evaluate ACE descriptors.
77"""
88
99import itertools
1616
1717class ACEPotential :
1818 """
19- Class for calculation of ACE coupling coefficients.
20-
21- ACE_DOCS_MISSING: Explain scope of class. I think we always assume PA
22- basis, but I don't know what that is.
23-
19+ Class to manage interface between ACE descriptor enumeration library and
20+ LAMMPS. By default, it will enumerate ACE descriptors according to the
21+ Permutation-adapted approach described in https://doi.org/10.1016/j.jcp.2024.113073.
22+ However, there are options for assigning descriptor labels if desired, manually
23+ for example.
24+
25+ After enumerating descriptors, it assigns all relevant hyperparamters needed
26+ to evaluate the ACE descriptors in LAMMPS. It saves a .yace file needed to
27+ evaluate ACE descriptors in LAMMPS (containing coupling coefficients). It does this
28+ by writing an ACE potential file, readable by LAMNMPS, that contains only
29+ information to evaluate descriptors, not energy models.
30+
2431 Parameters
2532 ----------
2633 elements : List
27- List of elements (symbols)
34+ List of elements (symbols), including 'G' for the grid points. In ACE, all possible
35+ combinations of these elements determine the "bond types" spanned by the ACE chemical
36+ basis (the chemical basis is the delta function basis used in Drautz 2019). For
37+ example, the "bond types" resulting from all possible combinations of ['Al','G'] are
38+ determined with :code:`itertools.product()` in python. They are (Al,Al)(Al,G)(G,Al)(G,G).
39+ For mala, only those of type (G,X) are kept, (grid-atom interactions) and only a placeholder
40+ is kept for other interaction types.
2841
2942 reference_ens : List
30- List of floats, has same dimensions as elements. ACE_DOCS_MISSING:
31- What does it do?
43+ List of reference energies. (To be applied only for linear models) with a constant
44+ shift to the energy per element type. Values other than 0 not be necessary in MALA.
3245
3346 ranks : List
34- ACE_DOCS_MISSING
47+ Orders of the expansion, referred to as `N` in Drautz 2019, of the
48+ descriptors to be enumerated
3549
3650 nmax: List
37- ACE_DOCS_MISSING
51+ Maximum radial basis function index per descriptor rank
3852
3953 lmax: List
40- ACE_DOCS_MISSING
54+ Maximum angular momentum number per descriptor rank (maximum angular function index)
4155
4256 nradbase : int
43- ACE_DOCS_MISSING
57+ Maximum radial basis function index OVERALL: max(nmax) - in the future, may be used
58+ to define the number of g_k(r) comprising R_nl from Drautz 2019 radial basis.
4459
45- rcut : float
46- ACE_DOCS_MISSING
60+ rcut : float/list
61+ radial basis function cutoff per bond type. For example, if elements are ['Al','G']
62+ then rcut must be supplied for each:(Al,Al)(Al,G)(G,Al)(G,G)
4763
48- lmbda : float
49- ACE_DOCS_MISSING
64+ lmbda : float/list
65+ Exponential factor for scaled distance in Drautz 2019 used in the radial basis
66+ functions. As with the radial cutoff, lambda must be supplied per bond type. For
67+ example, if elements are ['Al','G'] then lambda must be supplied for
68+ each:(Al,Al)(Al,G)(G,Al)(G,G)
5069
5170 css : dict
52- ACE_DOCS_MISSING
71+ Dictionary of coupling coefficients of the format: {rank:{l:{m:coupling_coefficient}}
5372
5473 rcutinner : List
55- ACE_DOCS_MISSING
74+ Inner cutoff to turn on soft-core repulsions. This parameter should be 0.0 (OFF) for
75+ each bond type in MALA.
5676
5777 drcutinner : List
58- ACE_DOCS_MISSING
78+ Parameter for soft-core repulsions. This parameter should not matter if rcutinner is
79+ 0.0 (OFF) for each bond type in MALA.
5980
60- lmin : int
61- ACE_DOCS_MISSING
81+ lmin : int/list
82+ lower bound on angular momentum quantum number per rank.
6283
6384 manual_labels : str
6485 File for loading labels. If not None, then labels will be loaded from
@@ -89,15 +110,22 @@ def __init__(
89110 if kwargs is not None :
90111 self .__dict__ .update (kwargs )
91112
92- # ACE_DOCS_MISSING: Explain what all these variables do, at least
93- # briefly, and give them more meaningful names.
113+ #NOTE Our unused variable names here match exactly what is in LAMMPS
114+ # I'm hesitant to change these to something else. We wont use them in MALA
115+ # and if people are really interested, they can find them in the lammps
116+ # source code directly
117+ #coupling coefficients (generalized Wigner symbols or Generalized Clebsch-Gordan coefficients)
94118 self .__global_ccs = css
95119 self .__global_ccs [1 ] = {"0" : {tuple ([]): {"0" : 1.0 }}}
120+ #0th-order expansion term in ACE (e.g., constant energy shift)
96121 self .__E0 = reference_energy
97122 self .__ranks = ranks
98123 self .__elements = elements
124+ #linear model coefficients
99125 self .__betas = None
126+ #descriptor labels in FitSNAP/LAMMPS format - as described elsewhere
100127 self .__nus = None
128+ #hyperparameters for ACE basis (relevant for density embeddings)
101129 self .__deltaSplineBins = 0.001
102130 self .__global_ndensity = 1
103131 self .__global_rhocut = 100000
@@ -203,17 +231,17 @@ def __init__(
203231
204232 def __set_embeddings (self , npoti = "FinnisSinclair" , FSparams = [1.0 , 1.0 ]):
205233 """
206- Set embeddings.
207-
208- ACE_DOCS_MISSING
234+ Set ' embeddings' in the .yace file for lammps. Some terms here control
235+ if a square-root embedding term is added. This should always be OFF
236+ for descriptor calculations in MALA
209237
210238 Parameters
211239 ----------
212240 npoti : str
213- ACE_DOCS_MISSING
241+ paramter to specify descriptor type in LAMMPS
214242
215243 FSparams : List
216- ACE_DOCS_MISSING
244+ parameters to specify embedding terms in LAMMPS
217245 """
218246 # embeddings =dict()#OrderedDict() #{ind:None for ind in range(len(self.elements))}
219247 embeddings = {ind : None for ind in range (len (self .__elements ))}
@@ -235,9 +263,13 @@ def __set_bonds(self):
235263
236264 def __set_bond_base (self ):
237265 """
238- Set bond base.
266+ Set the per-bond radial basis parameters. The 'bonds' are determined based
267+ on the elements. If the elements are ['Al','G'], the bonds may be
268+ determined with :code:`itertools.product()` in python. They are
269+ (Al,Al)(Al,G)(G,Al)(G,G). Some hyperparameters must be specified per bond
270+ label shown here.
239271
240- ACE_DOCS_MISSING - what does that mean, what does this function do?
272+
241273 """
242274 bondstrs = ["[%d, %d]" % (b [0 ], b [1 ]) for b in self .__bondlsts ]
243275 bonds = {bondstr : None for bondstr in bondstrs }
@@ -320,17 +352,19 @@ def __set_bond_base(self):
320352
321353 def set_funcs (self , nulst = None , print_0s = True ):
322354 """
323- Set functions.
324-
325- ACE_DOCS_MISSING - what does this function do?
355+ Set ctilde 'functions' in the .yace file, used to calculate
356+ descriptors in lammps
326357
327358 Parameters
328359 ----------
329360 nulst : List
330- List of nus ACE_DOCS_MISSING - what are those?
361+ List of nus, a.k.a. ACE descriptor labels to write to
362+ the .yace file.
331363
332364 print_0s : bool
333- ACE_DOCS_MISSING - what does this do?
365+ Logical to include 0-valued descriptors, this should always
366+ be True in MALA as 0-valued descriptors only arise after
367+ training linear models with sparsifying solvers like LASSO
334368 """
335369 if nulst is None :
336370 if self .__nus is not None :
0 commit comments