Keep a merged Lorentz structure out of the UFO module, so customize_model accepts SMEFTatNLO-NLO - #182
Merged
Conversation
…odel accepts SMEFTatNLO-NLO `import model SMEFTatNLO-NLO` then `customize_model --save=NAME` was refused even with nothing changed: Two restrictions of the model done with different input values do not lead to the same model. Difference(s) found for: interactions ... InvalidCmd: customize_model can not be applied to this model. The two restrictions were the same model. The t t~ g g vertex differed by the name of one Lorentz structure -- FFVV1111 in the first, FFVV1112 in the second -- a name neither in the UFO: the restriction merges structures (RestrictModel.add_merge_lorentz) and names the result. The name moved because the first build leaked it. A UFO Lorentz registers itself in its object_library's all_lorentz on construction, and that list is a module global, cached in sys.modules for the rest of the process. RestrictModel.add_lorentz never took its structure back out, so every import of the same restricted model started with the previous one's merged structures already defined, grew by them again, and numbered its own one further on: import model SMEFTatNLO-NLO 658, then 661, then 664 Lorentz structures UFOMG5Converter.add_lorentz already keeps its structures out of that list; RestrictModel.add_lorentz now does the same, and the three imports give 658 each time. customize_model --save from SMEFTatNLO-NLO goes through and writes its restriction card. It worked from SMEFTatNLO, -NLO_no4q, -LO and sm already: those restrictions merge no structure. Beyond customize_model, this also stops a long session -- the tutorials, a script importing the same model twice -- from carrying one import's merged structures into the next. Test: a merged structure is added to the model and not to the UFO library it was built from (fails without the fix). The restriction-related unit tests (1464) are otherwise unchanged; the three TestRealRunNumbers failures need a madspace build this worktree does not have. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
oliviermattelaer
added a commit
that referenced
this pull request
Sep 18, 2026
The permutation check goes (`tutorial checks` is where the checks live); the
interference lesson now leads into a restriction of the reader's own:
customize_model --save=top at its question, the hint says what a top
pair never sees and how to switch it off:
set DIM64F2L all 0 two quarks, two leptons
set DIM64F4L all 0 four leptons
and warns off `set DIM6 all 0`: that block
holds Lambda, and a zero scale divides by zero
(which is what that looks like in practice)
-> "SMEFTatNLO-top is loaded: 22 particles, 1875 interactions", and where
the card was saved; plus the one thing to know -- customize_model starts
again from the full model, so what -NLO had switched off comes back on
import model SMEFTatNLO-top the same restriction, loaded by name, which
closes the tutorial with the EFT pitfalls
Needs the fix merged just before (#182): customize_model refused
SMEFTatNLO-NLO outright. Checked live, on a copy of the model so the
restriction card is not written into the real one.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This was referenced Sep 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The refusal
Only from
-NLO: fromSMEFTatNLO,-NLO_no4q,-LOorsmit works. Foundwhile adding a
customize_modelstep to thebsmtutorial (#165), which nowuses SMEFTatNLO-NLO.
What differed
Nothing physical. With
ADMIN_DEBUGon, the two restrictions had the samet t~ g gvertex, same couplings, same Lorentz structures but one:FFVV1111in the first build,FFVV1112in the second. Neither name is in theUFO — the restriction merges structures (
RestrictModel.add_merge_lorentz) andnames the result.
Why the name moved
The first build leaked it. A UFO
Lorentzregisters itself in itsobject_library.all_lorentzon construction — a module global, cached insys.modulesfor the rest of the process.RestrictModel.add_lorentznevertook its structure back out, so each import of the same restricted model
started with the previous one's merged structures already defined, grew by
them, and numbered its own one further on:
Instrumented: all three leaked structures per import come from
RestrictModel.add_lorentz; the 55 created byUFOMG5Converter.add_lorentzdon't, because it already swaps
all_lorentzout while constructing. Thisapplies the same guarantee to the restriction's own structures.
Effect
customize_model --savefromSMEFTatNLO-NLOgoes through and writes itsrestriction card (checked on a copy of the model;
mainstill refuses).longer carries one import's merged structures into the next.
Checked
test_import_ufo.py: a merged structure lands in the model andnot in the UFO library it was built from. It fails without the fix.
import model(1464 tests):unchanged. The 3
TestRealRunNumbersfailures need a madspace build thisworktree doesn't have.
🤖 Generated with Claude Code