Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SiteTypes] Add S2 operator for S=1 and update code style #1502

Merged
merged 5 commits into from
Jun 16, 2024

Conversation

emstoudenmire
Copy link
Collaborator

This PR fixes #1501 by defining the "S2" (aka "S²") operator for the "S=1" SiteType. It also updates the code for "S=1" operator definitions to use the op matrices approach rather than the op! functions. A unit test was added for the "S2" operator.

@emstoudenmire
Copy link
Collaborator Author

Hm, when I rerun JuliaFormatter on the code it doesn't make any changes, yet it failed the Format Check. This also happened to me another time recently. I wonder if the formatting styles are out of sync between the CI and the code repo somehow? Or maybe these are just one-offs.

@codecov-commenter
Copy link

Codecov Report

Attention: Patch coverage is 22.72727% with 17 lines in your changes missing coverage. Please review.

Project coverage is 60.84%. Comparing base (82cfd76) to head (98cc15a).
Report is 12 commits behind head on main.

Current head 98cc15a differs from pull request most recent head 74a1d49

Please upload reports for the commit 74a1d49 to get more accurate results.

Files Patch % Lines
src/lib/SiteTypes/src/sitetypes/spinone.jl 22.72% 17 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@             Coverage Diff             @@
##             main    #1502       +/-   ##
===========================================
- Coverage   78.05%   60.84%   -17.21%     
===========================================
  Files         148      148               
  Lines        9679     9634       -45     
===========================================
- Hits         7555     5862     -1693     
- Misses       2124     3772     +1648     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mtfishman
Copy link
Member

mtfishman commented Jun 16, 2024

What version of JuliaFormatter.jl do you have locally? Maybe you are using an older version locally.

The CI formatting suggestion looks correct to me:

julia> using JuliaFormatter

julia> format_text("1."; style=DefaultStyle())
"1.0"

julia> format_text("1."; style=BlueStyle())
"1.0"

julia> import Pkg; Pkg.status("JuliaFormatter")
Status `~/.julia/environments/v1.10/Project.toml`
  [98e50ef6] JuliaFormatter v1.0.56

See:

@mtfishman mtfishman changed the title [SiteType] Add S2 for S=1 and update code style [SiteTypes] Add S2 operator for S=1 and update code style Jun 16, 2024
@emstoudenmire
Copy link
Collaborator Author

I resolved the formatter issue, thanks.

I didn't realize about the aliases – nice pattern.
I defined aliases for the spin operators and updated both spinone.jl and qubit.jl (underlying "S=1/2") to use these.
Also I made an alias for "SpinOne" -> "S=1" inside spinone.jl.

@emstoudenmire
Copy link
Collaborator Author

Of course one could envision many improvements to this system, like maybe a more unified way of handling spin operators since e.g. some of the aliases are repeated a bit, but I think this PR is a good "maintenance" sort of PR.

@mtfishman
Copy link
Member

Yeah it would be good to step back and be a bit more systematic about the operator definitions code but that can be done in future work.

@mtfishman
Copy link
Member

Thanks!

@mtfishman mtfishman merged commit b739c40 into main Jun 16, 2024
16 checks passed
@mtfishman mtfishman deleted the fix_1501_spinone_S2 branch June 16, 2024 21:14
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.

[ITensors] [BUG] Operator "S2" does not work for SiteType "S=1"
3 participants