Skip to content

Adding a MACE-MDP foundation model calculator and supporting cueq=True for AtomicDielectricMACE#1439

Merged
aacostadiaz merged 21 commits into
ACEsuit:developfrom
Nilsgoe:main
Jul 1, 2026
Merged

Adding a MACE-MDP foundation model calculator and supporting cueq=True for AtomicDielectricMACE#1439
aacostadiaz merged 21 commits into
ACEsuit:developfrom
Nilsgoe:main

Conversation

@Nilsgoe

@Nilsgoe Nilsgoe commented Apr 14, 2026

Copy link
Copy Markdown
Contributor

This PR introduces [MACE-MDP](https://github.com/Nilsgoe/MACE-MDP) as a possible calculator for directly computing dipole moments and polarizabilities in organic systems (molecules and condensed phases).

Additionally, it supports cueq=True thanks to the new GatedEquivariantBlock added in the development branch; to ensure correctness, I have included an additional test.

Nilsgoe and others added 11 commits August 11, 2025 12:03
Cueq support for AtomicDielectricMACE
transpose_mul_ir converts CuEq linear output ir_mul→mul_ir before the
block, so hardcode layout="mul_ir" instead of get_layout(). Fixes
cueq=True/False inconsistency for models with non-scalar MLP_irreps.
Update cueq matrix test to use MLP_irreps with 1o+2e components and
add rotation equivariance checks for dipole and polarizability.
…ut blocks

GatedEquivariantBlock natively supports both "mul_ir" and "ir_mul" layouts,
so the transpose sandwich (ir_mul→mul_ir before gate, mul_ir→ir_mul after)
is unnecessary. Use get_layout(cueq_config) directly instead.
Adding the final version of MACE-MDP as a foundation model calculator and AtomicDielectricMACE with cueq=True working
Nilsgoe added 4 commits April 14, 2026 19:35
New --finetune_dipoles_polarizabilities flag enables fine-tuning a
pretrained MACE-MDP checkpoint on dipoles and polarizabilities:

- Validates that --model=AtomicDielectricMACE and --foundation_model
  are set; forces --loss=dipole_polar
- Loads the MDP checkpoint via the existing foundation_model path and
  copies all weights (incl. readouts) with load_foundations()
- After configure_model(), freezes all parameters except model.readouts
- Reuses existing DipolePolarLoss, data pipeline, and training loop
  without modification

Also adds tests/test_mdp_finetune.py verifying that non-readout params
are frozen and readout params update after a short fine-tuning run.
…order irreps

- Guard --E0s=foundation/estimated in MDP fine-tuning path (fall back to average)
- Replace load_foundations() call with new load_foundations_mdp() that handles
  higher-order irreps (0e+1o+2e) in skip_tp and transfers all angular momentum
  channels in symmetric_contractions for all product layers
- Guard scale_shift access in load_foundations_elements against MDP models
ilyes319 added a commit that referenced this pull request May 3, 2026
Adding Documentation for MACE-MDP for PR #1439
@ilyes319

ilyes319 commented May 3, 2026

Copy link
Copy Markdown
Contributor

Hey @Nilsgoe, the deletion of import torch._dynamo as dynamo in mace/calculators/mace_torchsim.py might unsafe — that import has the side effect of initializing Dynamo before torch.compile runs. Could you revert that one-line removal here? Everything else in the PR looks good.

@Nilsgoe

Nilsgoe commented May 4, 2026

Copy link
Copy Markdown
Contributor Author

Hey @ilyes319, I added the import torch._dynamo as dynamo back and added a pylint flag; some part of the pre-commit complained. This shouldn’t hurt.

@Nilsgoe

Nilsgoe commented Jun 25, 2026

Copy link
Copy Markdown
Contributor Author

With the newest changes also fine-tuning of MACE-MDP would be possible, it is still naive only ...

@aacostadiaz

Copy link
Copy Markdown
Collaborator

LGTM! Thanks for the PR

@aacostadiaz
aacostadiaz merged commit 0f3f828 into ACEsuit:develop Jul 1, 2026
21 of 26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants