Skip to content

v4.0.3

Latest

Choose a tag to compare

@shyuep shyuep released this 02 Jul 00:45
· 17 commits to main since this release
a5d5afc
  • New: LAMMPS integration for TensorNet and M3GNet potentials (#815). matgl.ext.lammps.LAMMPSMatGLModel
    exports a PyG Potential to a TorchScript artifact (via the new mgl create-lammps-model CLI subcommand),
    consumed by a pair_matgl CPU pair style and a pair_matgl/kk Kokkos GPU pair style shipped under
    lammps/. The export wrapper uses a kernel-composition pattern (_TensorNetKernel / _M3GNetKernel)
    with the strain/autograd machinery in the outer module; M3GNet required pure-tensor, script-safe ports of
    the three-body indexer and basis (create_line_graph_torch, _m3gnet_three_body_basis_torch). Includes
    drop-in CMake snippets, build instructions, parity tests, and CI jobs. Single-GPU only for Kokkos
    (multi-rank Kokkos + libtorch is unreliable). Fixes a ghost-row folding bug that caused a ~30-42 eV energy
    gap vs the ASE calculator.
  • Fix: SoftExponential activation autograd correctness and NaN safety (#788). forward now selects
    its alpha < 0 / alpha > 0 / alpha ≈ 0 branches with torch.where instead of a Python if on the
    learnable alpha parameter. The old if self.alpha < 0.0 forced a host-device sync and dropped the
    branch from the autograd graph (so alpha was effectively trapped in its initial sign region); the
    alpha == 0.0 exact-float test was unreachable after the first optimizer step; and the alpha < 0
    formula produced NaN/Inf for sufficiently negative inputs. The log argument and denominators are now
    guarded so both the activation and alpha.grad stay finite. Values in the well-defined region are
    unchanged.
  • New: matgl.utils.MCDropoutWrapper for uncertainty-aware inference. Enables Monte Carlo Dropout
    (Gal & Ghahramani, 2016) on any pretrained MatGL model (CHGNet, M3GNet, TensorNet, …) without
    retraining: the backbone stays in eval() while only the readout dropout is sampled, and
    predict_uncertainty(structures, n_passes) returns per-structure (mean, std) for acquisition
    functions such as UCB (mean - lambda * std). See issue #800.
  • Perf: backbone-once fast path for predict_uncertainty (cache_backbone=True, default). Since
    MC Dropout only perturbs the readout, the deterministic backbone is evaluated once and only the
    cheap stochastic head is replayed n_passes times (vectorised), giving an ~n_passes× speed-up
    (~19× at n_passes=20 on M3GNet, GPU). Numerically equivalent to the naive loop; engaged only when
    a probe proves the head is the model's terminal op, otherwise falls back automatically (e.g. CHGNet,
    which pools after dropout).
  • Fix: training checkpoints loadable under torch.load(weights_only=True) (#802). ModelLightningModule
    / PotentialLightningModule pickled optimizer/scheduler objects (and a numpy element_refs array) into
    the checkpoint hyperparameters, so resuming via Trainer.fit(ckpt_path=...) broke under torch ≥ 2.6's
    weights_only=True default. Optimizer/scheduler are now excluded from save_hyperparameters (their state
    is already in optimizer_states / lr_schedulers) and element_refs is stored as a plain list.
  • Fix: silent mismatch between dataset and model element lists (#819). Added a guard that reads
    element_types from the dataset's converter (the actual source that stamps graph.node_type) and
    validates it against model.element_types, catching a common fine-tuning misconfiguration that
    previously failed silently.
  • Fix: load MatPES datasets from JSONL on Hugging Face. MGLDatasetLoader now downloads the
    line-delimited .jsonl files (dataset and per-element atomrefs) that materialyze/matpes moved to;
    monty's loadfn parses them transparently.
  • New: stress warning added to JAXPESCalculator.