# ---------------------------------------------------------------------------
# RECONSTRUCTED ALM input for the PUBLISHED sixth-order force constants of
# Phys. Rev. Lett. 120, 105901 (2018)  -  file BGG_FPMD800K_random*_lasso1.xml
#
# No ALM input file or log carrying PREFIX = BGG_FPMD800K_random2_lasso1 survived
# in the working directory.  This input was RECOVERED by refitting and comparing
# against the published XML.  It is a reconstruction, not an original file.
#
# How each setting was established
# --------------------------------
#   NORDER = 5          The published XML contains FC2...FC6 and no FC7, and
#                       pattern files exist for HARMONIC + ANHARM3...ANHARM6 only.
#                       (NORDER = 1 is harmonic, so sixth order => NORDER = 5.)
#
#   NBODY, &cutoff      Taken from the surviving tenth-order input (input_alm.txt
#                       in ../lasso_crossval/), columns 1-4 of its &cutoff block.
#                       Validated three independent ways:
#                         - irreducible IFC counts 320 / 1317 / 6420 / 2480 / 4803
#                           reproduce the tenth-order fit log exactly for orders 2-6;
#                         - the published XML itself records NFC2 = 320, NFC3 = 1317;
#                         - the number of suggested displacement patterns reproduces
#                           the published pattern files exactly:
#                           12 / 499 / 8936 / 5244 / 9524.
#
#   FC2FIX              The FC2 block of the published XML is identical, to the last
#                       printed digit, to BGG_cell0_harm.xml (../harmonic/).
#
#   L1_ALPHA            NOT recorded anywhere.  A scan from 5.7e-05 down to 3e-08
#                       shows the published file corresponds to the weakly
#                       regularised end: at 3e-08 the expanded cubic-term count
#                       reproduces the published 164073 exactly.  The value below is
#                       therefore an inferred lower bound on the regularisation, not
#                       a recovered original.  Note 5.71638e-05 (the cross-validation
#                       optimum in ../lasso_crossval/cvscore.dat) belongs to the
#                       TENTH-order model and over-shrinks this one.
#
# Quality of the reproduction (cell0, refit vs published cubic IFCs)
#   Pearson r = 0.9991 ; least-squares slope through origin = 0.975 ;
#   median ratio on terms with |FC3| > 1e-3 = 0.998 (167 terms).
#   Expanded counts: FC2 28994 (exact), FC3 164073 (exact),
#                    FC4 977586 vs 978714, FC5 310272 vs 322656, FC6 645444 vs 669780.
#   The small higher-order shortfall reflects the 2017 solver, which is not
#   available: no surviving ALM build supports the MODE = lasso syntax (the oldest
#   is 1.3.0; the fit was done with 1.0.0RC).  Exact bit-level reproduction is
#   therefore not possible, but the model is unambiguous.
#
# Training data: ../../03_training_data/disp_random_0.dat + force_random_0.dat
#   (140 configurations; AIMD at 800 K on the +4 % cell plus 0.1 A random
#   displacements - see README section 2.7 on the SI temperature typo).
#   Of the two surviving sets, disp_random_0 matches the published cell0 file
#   slightly better (median ratio 0.998 vs 0.982 for disp_random).
# ---------------------------------------------------------------------------

# ===== ORIGINAL-ERA SYNTAX (ALAMODE 1.0.0RC, as used in 2017) =====

&general
PREFIX = BGG_FPMD800K_random2_lasso1
MODE = lasso
NAT = 54; NKD = 3
KD = Ba Ga Ge
/

&interaction
NORDER = 5
NBODY = 2 3 3 2 2
/

&cell
 20.70
  1.0 0.0 0.0
  0.0 1.0 0.0
  0.0 0.0 1.0
/

&cutoff
Ba-Ba None 0.1 0.1 0.1 0.1
Ba-Ga None 8.0 8.0 8.0 8.0
Ba-Ge None 8.32 8.32 8.32 8.32
Ga-Ga None 8.1 8.1 8.1 8.1
Ga-Ge None 8.1 8.1 8.1 8.1
Ge-Ge None 9.0 9.0 9.0 9.0
/

&fitting
NDATA = 140
DFILE = disp_random_0.dat
FFILE = force_random_0.dat
FC2XML = BGG_cell0_harm.xml
ICONST = 11
STANDARDIZE = 1
LASSO_ALPHA = 3.0e-08     # inferred; see header
LASSO_DNORM = 0.4
LASSO_MAXITER = 1000000
LASSO_TOL = 1.0e-7
/

# &position block: identical to ../lasso_crossval/input_alm.txt

# ===== MODERN EQUIVALENT (ALAMODE >= 1.1; this is what was actually run) =====
#
# &general
#   PREFIX = refit_cell0 ; MODE = optimize ; NAT = 54 ; NKD = 3 ; KD = Ba Ga Ge
#   FCSYM_BASIS = Cartesian        # 2017 used Cartesian; >=1.9 defaults to Lattice
# /
# &interaction   NORDER = 5 ; NBODY = 2 3 3 2 2 /
# &optimize
#   LMODEL = enet ; FC2FIX = BGG_cell0_harm.xml ; DFSET = DFSET ; NDATA = 140
#   L1_ALPHA = 3.0e-08 ; L1_RATIO = 1.0 ; STANDARDIZE = 1 ; ICONST = 11
#   ENET_DNORM = 0.4 ; MAXITER = 1000000 ; CONV_TOL = 1.0e-7
# /
# &cell, &cutoff, &position as above.
#
# DFSET replaces DFILE/FFILE: one line per atom per configuration,
#   ux uy uz fx fy fz   (Bohr and Ry/Bohr, the defaults in both versions).
