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

Catch errors during show(System) #234

Merged
merged 2 commits into from
Feb 7, 2024

Conversation

Lazersmoke
Copy link
Contributor

Now that energy(sys) sometimes errors (e.g. if dipoles are not normalized), typing in sys at the REPL can clobber the terminal with a huge error message. This PR makes it so the error message is relatively tame

@kbarros
Copy link
Member

kbarros commented Feb 7, 2024

I modified the PR slightly so that it has the following behavior:

sys = System(cryst, dims, [SpinInfo(1; S, g=1)], :dipole)
display(sys)
#=
System [Dipole mode]
Lattice (1×1×1)×1
Energy per site 0
=#

sys.dipoles[1,1,1,1] *= 2
display(sys)
#=
System [Dipole mode]
Lattice (1×1×1)×1
[Incorrectly normalized spin state!]
=#

@kbarros kbarros merged commit c8e75bd into SunnySuite:main Feb 7, 2024
2 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.

2 participants