Skip to content

Commit c42173f

Browse files
Merge branch 'ace_develop_local' into ace_docs
# Conflicts: # mala/common/parameters.py # mala/descriptors/ace.py
2 parents 34a1397 + 0e2839f commit c42173f

File tree

6 files changed

+256
-175
lines changed

6 files changed

+256
-175
lines changed

docs/source/advanced_usage/descriptors.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,10 +149,10 @@ with code such as this
149149
150150
parameters.descriptors.descriptor_type = "ACE"
151151
parameters.descriptors.ace_cutoff = 5.8
152-
parameters.descriptors.ace_ranks = [1, 2, 3]
153-
parameters.descriptors.ace_lmax = [0, 1, 1]
154-
parameters.descriptors.ace_nmax = [1, 1, 1]
155-
parameters.descriptors.ace_lmin = [0, 0, 0]
152+
parameters.descriptors.ace_included_expansion_ranks = [1, 2, 3]
153+
parameters.descriptors.ace_maximum_l_per_rank = [0, 1, 1]
154+
parameters.descriptors.ace_maximum_n_per_rank = [1, 1, 1]
155+
parameters.descriptors.ace_minimum_l_per_rank = [0, 0, 0]
156156
157157
ACE descriptors will be used in your processing/training/testing scripts.
158158
ACE_DOCS_MISSING: Describe what the parameters mean/how to best tune them.

examples/advanced/ex11_preprocess_ace_descriptors.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@
3030
parameters = mala.Parameters()
3131
# Bispectrum parameters.
3232
parameters.descriptors.descriptor_type = "ACE"
33-
parameters.descriptors.ace_cutoff = 5.8
34-
parameters.descriptors.ace_ranks = [1, 2, 3]
35-
parameters.descriptors.ace_lmax = [0, 1, 1]
36-
parameters.descriptors.ace_nmax = [1, 1, 1]
37-
parameters.descriptors.ace_lmin = [0, 0, 0]
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]
3838

3939
####################
4040
# 2. ADDING DATA FOR DATA CONVERSION

mala/common/parameters.py

Lines changed: 90 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -470,48 +470,67 @@ class ParametersDescriptors(ParametersBase):
470470
WILL BE DEPRECATED IN MALA v1.4.0 - polynomial degree for minterpy
471471
descriptor calculation.
472472
473-
ace_ranks : list
474-
Orders of the expansion, referred to as `N` in Drautz 2019, of the
475-
descriptors to be enumerated
476-
477-
ace_nmax : list
478-
Maximum radial basis function index per descriptor rank
479-
480-
ace_lmax : list
481-
Maximum angular momentum number per descriptor rank (maximum angular function index)
482-
483-
ace_lmin : list
484-
Lower bound on angular momentum quantum number per rank.
485-
486-
ace_nshell : list
487-
Number(s) to multiply atomic radii by to get radial cutoffs
488-
489-
ace_apply_shift : list
490-
Constants to shift radial cutoffs by (useful for small elements like H).
491-
492-
ace_metal_max : list
493-
Maximize radial cutoffs for "metals", effectively increases radial cutoffs for certain elements.
494-
495-
ace_use_vdw : list
496-
Flag to use vdW radii (larger automated radial cutoffs generated).
497-
498-
ace_L_R : list
499-
Resultant angular momentum quantum number. This determines the equivariant
500-
character of the rank N descriptor after reduction. L_R=0 corresponds to
501-
a rotationally invariant feature, L_R=1 corresponds to a feature that
502-
transforms like a vector, L_R=2 a tensor, etc.
503-
504-
ace_M_R : list
505-
Resultant projection quantum number. This also determines the equivariant
506-
character of the rank N descriptor after reduction. M_R must obey
507-
-L_R <= M_R <= L_R
508-
509-
ace_coupling_type : str
473+
ace_included_expansion_ranks : list
474+
List of all included expansion ranks for the ACE descriptors.
475+
These expansion ranks correspond to the many body order in the
476+
expansion of the atomic energy in many body terms. The list does
477+
can exclude terms, i.e., [1,2,4] is a valid option.
478+
Lengths have to be consistent between ace_included_expansion_ranks,
479+
ace_maximum_n_per_rank, ace_maximum_l_per_rank and
480+
ace_minimum_l_per_rank.
481+
482+
ace_maximum_n_per_rank : list
483+
Maximum n for each expansion rank in the ACE descriptors. These
484+
n correspond to the n starting from equation 27 in the original
485+
ACE paper (doi.org/10.1103/PhysRevB.99.014104)
486+
Lengths have to be consistent between ace_included_expansion_ranks,
487+
ace_maximum_n_per_rank, ace_maximum_l_per_rank and
488+
ace_minimum_l_per_rank.
489+
490+
ace_maximum_l_per_rank : list
491+
Maximum l for each expansion rank in the ACE descriptors. These
492+
n correspond to the n starting from equation 27 in the original
493+
ACE paper (doi.org/10.1103/PhysRevB.99.014104).
494+
Lengths have to be consistent between ace_included_expansion_ranks,
495+
ace_maximum_n_per_rank, ace_maximum_l_per_rank and
496+
ace_minimum_l_per_rank.
497+
498+
ace_minimum_l_per_rank : list
499+
Minimum l for each expansion rank in the ACE descriptors. These
500+
n correspond to the n starting from equation 27 in the original
501+
ACE paper (doi.org/10.1103/PhysRevB.99.014104)
502+
Lengths have to be consistent between ace_included_expansion_ranks,
503+
ace_maximum_n_per_rank, ace_maximum_l_per_rank and
504+
ace_minimum_l_per_rank.
505+
506+
ace_balance_cutoff_radii_for_elements : bool
507+
If True, cutoff radii will be balanced between element types.
508+
This is helpful when dealing with elements varying drastically in size.
509+
510+
ace_larger_cutoff_for_metals : list
511+
If True (default) a slightly larger cutoff is used for metals. This
512+
is recommended.
513+
514+
ace_use_maximum_cutoff_per_element : list
515+
If True, the maximum chemically reasonable cutoff will be used
516+
for all bonds. These maximum cutoff radii are based on the
517+
Van-der-Waals radii. Note that this may increase computation time!
518+
519+
ace_coupling_coefficients_type : str
510520
Coupling type used for reduction of spherical harmonic products.
511-
Can be "clebsch_gordan" or "wigner_3j".
512-
513-
ace_reduction_coefficients_lmax : int
514-
Global maximum angular momentum for precalculating generalized coupling coefficients.
521+
These come into play starting from equation 28 in the original
522+
ACE paper (doi.org/10.1103/PhysRevB.99.014104).
523+
Can be "clebsch_gordan" or "wigner_3j". This parameter usually does
524+
not have to be changed. The default is "clebsch_gordan".
525+
526+
ace_coupling_coefficients_maximum_l : int
527+
The maximum l up to which to precompute the Clebsch-Gordan/Wigner 3j
528+
symbols. These are precomputed within MALA to reduce overall
529+
computation time, but to save on storage space, precomputation is only
530+
done to a certain l (for the meaning of l, refer to the original ACE
531+
paper, doi.org/10.1103/PhysRevB.99.014104, page 5). MALA automatically
532+
recomputes the coefficients if ace_coupling_coefficients_maximum_l is
533+
increased.
515534
"""
516535

517536
def __init__(self):
@@ -551,26 +570,22 @@ def __init__(self):
551570
self.minterpy_lp_norm = 2
552571

553572
# Everything pertaining to the ACE descriptors.
554-
self.ace_cutoff = None
573+
self.ace_cutoff_factor = 2.0
555574

556-
self.ace_ranks = [1, 2, 3]
557-
self.ace_nmax = [6, 2, 2]
558-
self.ace_lmax = [0, 2, 2]
559-
self.ace_lmin = [0, 0, 0]
575+
# Many body orders
576+
self.ace_included_expansion_ranks = [1, 2, 3]
577+
self.ace_maximum_n_per_rank = [6, 2, 2]
578+
self.ace_maximum_l_per_rank = [0, 2, 2]
579+
self.ace_minimum_l_per_rank = [0, 0, 0]
560580

561581
# Flavors/extra options for the ACE descriptors.
562-
self.ace_nshell = 2.0
563-
self.ace_apply_shift = False
564-
self.ace_metal_max = True
565-
self.ace_use_vdw = False
566-
567-
# ???
568-
self.ace_L_R = 0
569-
self.ace_M_R = 0
582+
self.ace_balance_cutoff_radii_for_elements = False
583+
self.ace_larger_cutoff_for_metals = True
584+
self.ace_use_maximum_cutoff_per_element = False
570585

571586
# Other value could be "wigner3j".
572-
self.ace_coupling_type = "clebsch_gordan"
573-
self.ace_reduction_coefficients_lmax = 12
587+
self.ace_coupling_coefficients_type = "clebsch_gordan"
588+
self.ace_coupling_coefficients_maximum_l = 12
574589

575590
@property
576591
def use_z_splitting(self):
@@ -622,19 +637,30 @@ def bispectrum_cutoff(self, value):
622637
self.atomic_density_cutoff = value
623638

624639
@property
625-
def ace_cutoff(self):
640+
def ace_cutoff_factor(self):
626641
"""
627-
Cutoff radius for ACE descriptor calculation.
642+
Cutoff radius factor for ACE descriptor calculation.
628643
629-
May be dynamically increased during descriptor calculation
630-
(MALA will notify you, if this is necessary)
644+
This is NOT a cutoff radius itself. Rather, ACE computes on cutoff
645+
radius for every bond between element types (with grid points counting
646+
as an element type). These cutoff radii are then multiplied by this
647+
factor to get the actual cutoff radii. This factor is a global factor,
648+
and by default 2.0. Chage it carefully, since changing it may lead to
649+
an increase in computation time.
631650
"""
632651
return self._ace_cutoff
633652

634-
@ace_cutoff.setter
635-
def ace_cutoff(self, value):
636-
self._ace_cutoff = value
637-
self.atomic_density_cutoff = value
653+
@ace_cutoff_factor.setter
654+
def ace_cutoff_factor(self, value):
655+
if value <= 0.0:
656+
printout(
657+
"ACE cutoff factor must be larger than 0.0, defaulting"
658+
" to 2.0.",
659+
min_verbosity=0,
660+
)
661+
self._ace_cutoff = 2.0
662+
else:
663+
self._ace_cutoff = value
638664

639665
@property
640666
def bispectrum_switchflag(self):

0 commit comments

Comments
 (0)