Skip to content

Commit c07a7af

Browse files
Changed meaning of parameter ace cutoff factor.
1 parent 2b0e24a commit c07a7af

3 files changed

Lines changed: 24 additions & 40 deletions

File tree

mala/common/parameters.py

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -554,7 +554,7 @@ def __init__(self):
554554
self.minterpy_lp_norm = 2
555555

556556
# Everything pertaining to the ACE descriptors.
557-
self.ace_cutoff = None
557+
self.ace_cutoff_factor = 2.0
558558

559559
# Many body orders
560560
self.ace_included_expansion_ranks = [1, 2, 3]
@@ -584,8 +584,8 @@ def __init__(self):
584584

585585
# Other value could be "wigner3j".
586586
self.ace_coupling_coefficients_type = "clebsch_gordan"
587-
588-
# TODO: Implement a check in the ace.py class, so that symbols
587+
588+
# TODO: Implement a check in the ace.py class, so that symbols
589589
# are recomputed if a larger lmax is requested.
590590
self.ace_coupling_coefficients_maximum_l = 12
591591

@@ -639,19 +639,30 @@ def bispectrum_cutoff(self, value):
639639
self.atomic_density_cutoff = value
640640

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

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

656667
@property
657668
def bispectrum_switchflag(self):

mala/descriptors/ace.py

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -243,25 +243,10 @@ def __calculate_lammps(self, outdir, **kwargs):
243243
if self.couplings_yace_file is None:
244244
self.couplings_yace_file = self._calculate_coupling_coeffs()
245245

246-
# Check the cutoff radius, i.e., compare that the user choice
247-
# is not too small compared to those requird by ACE.
248-
249-
# TODO: Not self.parameters.ace_cutoff will be passed to LAMMPS,
250-
# but rather self._maximum_cutoff_factor.
251-
# It is only used for the pair_style command in the LAMMPS input file.
252-
if self.parameters.ace_cutoff < self._maximum_cutoff_factor:
253-
printout(
254-
"One or more automatically generated ACE cutoff radii is "
255-
"larger than the input cutoff radius. Updating input cutoff "
256-
"radius stored in parameters.descriptors.ace_cutoff "
257-
"accordingly."
258-
)
259-
self.parameters.ace_cutoff = self._maximum_cutoff_factor
260-
261246
# Create LAMMPS instance.
262247
lammps_dict = {
263248
"ace_coeff_file": self.couplings_yace_file,
264-
"rcutfac": self.parameters.ace_cutoff,
249+
"rcutfac": self._maximum_cutoff_factor,
265250
}
266251
for idx, element in enumerate(sorted(list(set(self._atoms.numbers)))):
267252
lammps_dict["mass" + str(idx + 1)] = atomic_masses[element]
@@ -431,8 +416,6 @@ def _calculate_bonds_and_cutoff(self):
431416
lmb_default,
432417
) = self.__default_settings()
433418

434-
# TODO: Scale _cutoff_factors by * self.parameters.ace_cutoff
435-
# Make self.parameters.ace_cutoff 1.0 by default
436419
self._cutoff_factors = [float(k) for k in rc_default.split()[2:]]
437420
self._maximum_cutoff_factor = np.max(self._cutoff_factors)
438421
self.__lambdas = [float(k) for k in lmb_default.split()[2:]]
@@ -651,7 +634,7 @@ def __default_settings(self):
651634
rcmini
652635
) * 0.25 # 1/4 of shortest ionic bond length
653636
rc_range[bond] = [rcmini, rcmaxi]
654-
rc_def[bond] = defaultri * self.parameters.ace_nshell
637+
rc_def[bond] = defaultri * self.parameters.ace_cutoff_factor
655638
rin_def[bond] = defaultrcinner
656639
# shift = ( max(rc_def.values()) - min(rc_def.values()) )/2
657640
shift = np.std(list(rc_def.values()))

mala/descriptors/acelib/ace_potential.py

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -157,16 +157,6 @@ def __init__(
157157
with open(self.__manual_labels, "r") as readjson:
158158
labdata = json.load(readjson)
159159
nulst_1 = [list(ik) for ik in list(labdata.values())]
160-
161-
# TODO: This was for compatability to old ACE potentials, and is
162-
# no longer needed.
163-
# If I am not mistaken, then this option is currently incomplete.
164-
# I have commented it out, while also for now removing the option
165-
# that relied on FitSNAP, because we do not want to ship MALA with
166-
# FitSNAP as a requirement at the moment.
167-
# elif self.b_basis == "ysg_x_so3":
168-
#
169-
# nulst_1 = []
170160
else:
171161
nulst_1 = []
172162
for rank in self.__ranks:

0 commit comments

Comments
 (0)