Skip to content

[Breaking] Redefine functions to take symmetries as argument#149

Merged
VictorVanthilt merged 31 commits into
QuantumKitHub:masterfrom
borisdevos:bd/symmetries
Mar 19, 2026
Merged

[Breaking] Redefine functions to take symmetries as argument#149
VictorVanthilt merged 31 commits into
QuantumKitHub:masterfrom
borisdevos:bd/symmetries

Conversation

@borisdevos
Copy link
Copy Markdown
Member

@borisdevos borisdevos commented Mar 17, 2026

Things this PR achieves:

  • Many models have functionname and functionname_symmetric functions to differ between whether symmetries are used or not. This PR changes this such that only the original non-symmetric functionname remains, but takes a new positional argument that determines the symmetry.
    E.g. classical_ising_symmetric(...) becomes classical_ising(Z2Irrep, ...) = classical_ising(...), where I've also chosen default symmetries to be the maximal symmetry.
    I made a stylistic choice in this, feel free to chime in on the argument order.
  • I also did some refactoring here and there, let's see if I didn't break anything with that.
  • I added to the models tests. In particular, the XY model was untested. I also added 3D Ising square lattice tests, but they may already be tested elsewhere. It's hard to track what's being tested and what not 😅

This is very breaking.

EDIT: some things have been added during the lifetime of this PR:

  • Element types of the tensors can now be chosen through a keyword argument. They default to the element type that was being used in the function prior.
  • A bunch of methods have been added to deal with keyword arguments being passed or not, along with positional arguments being passed or not. In particular, when no temperature is given, many models will pass the critical one.
  • Added the reference and test of classical XY model #152 added XY tests, so I disabled the ones I added for now which checks free energies. This is because I can't find a value in any paper for this, and I just filled in one that I got from running the code here.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 17, 2026

Your PR no longer requires formatting changes. Thank you for your contribution!

Comment thread src/models/ising.jl Outdated
Comment thread src/models/ising.jl Outdated
Comment thread src/models/ising.jl Outdated
Comment thread src/models/ising_honeycomb.jl Outdated
Comment thread src/models/phi4_real.jl Outdated
Comment thread src/models/phi4_real.jl Outdated
Comment thread src/models/sixvertex.jl Outdated
@Chenqitrg
Copy link
Copy Markdown
Contributor

Thank you @borisdevos for pointing out the XY model. I will try to add a test to that.

@VictorVanthilt
Copy link
Copy Markdown
Member

Test failures are now related to the scalartype being determined by beta for the Ising model. Adding elt as a kwarg to all models to choose the scalartype, remembering to restrict them to Complex where needed, should fix this issue.

Copy link
Copy Markdown
Member

@VictorVanthilt VictorVanthilt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All comments are about also adding the signatures without symmetry types to the docstring explicitly.
One comment is about restricting the eltype of the gross neveu tensor to be <:Complex.

Comment thread src/models/clock.jl Outdated
Comment thread src/models/gross-neveu.jl Outdated
Comment thread src/models/gross-neveu.jl Outdated
Comment thread src/models/gross-neveu.jl Outdated
Comment thread src/models/ising.jl
Comment thread src/models/phi4_real.jl
Comment thread src/models/phi4_complex.jl Outdated
Comment thread src/models/potts.jl Outdated
Comment thread src/models/sixvertex.jl
Comment thread src/models/XY.jl
@VictorVanthilt VictorVanthilt self-requested a review March 19, 2026 13:38
Copy link
Copy Markdown
Member

@VictorVanthilt VictorVanthilt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you very much for your contribution. Merging this ASAP.

@VictorVanthilt VictorVanthilt merged commit a64c12a into QuantumKitHub:master Mar 19, 2026
8 checks passed
@borisdevos borisdevos deleted the bd/symmetries branch March 19, 2026 13:47
@Chenqitrg
Copy link
Copy Markdown
Contributor

We (Weizhen Jia and I) are working on to study the low-temporature phase of XY model. A precise free energy at the transition point might be available later.

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