-
Notifications
You must be signed in to change notification settings - Fork 1
Adds Zeeman (external field) term to calculation #74
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
base: main
Are you sure you want to change the base?
Conversation
38e2d6d
to
8a984dd
Compare
f4e50d1
to
d2674d0
Compare
d2674d0
to
6a96aa2
Compare
99b1ae2
to
cb7da39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Some minor comments about the constants (bohr magneton).
"""Mathematical constants used by pySpinW.""" | ||
|
||
# Bohr magneton in units meV/T | ||
MU_B = 0.05788382 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should probably use scipy.constants
instead - the syntax is a bit unwieldy though:
MU_B = scipy.constants.physical_constants['Bohr magneton in eV/T'][0] * 1000
Also, scipy.constants
is a bit of a big table and importing it takes ~1s - so it might be better for us to have our own table... I don't know, I'm 50-50 :/
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest we shelve that idea for now and if we need more constants in future we can switch to use scipy.constants
?
One of the strengths of SpinW was that it had a lot of examples for users to see and copy, but at the moment, the examples here are very opaque and geared towards testing the code. We should decide:
@RichardWaiteSTFC @lucas-wilkins what do you think? What prompted this was seeing the |
@mducle The impression I was working under is that we have the raw examples so that I can test the spinwave calculation routines while Lucas is still working on the API. Ideally, when the API is complete, these examples would be replaced with ones constructed using the user-facing classes and serve as both examples and test data, but right now they have to be written using internal classes because we don't have user-facing ones! As far as I'm aware the plan when pySpinW is complete is that we have the user-facing classes, and then we have an internal routine that converts them to the arguments used by the spinwave calculation. Maybe we should have an issue to put together an ADR on this? |
This PR makes it possible to provide an external magnetic field to the calculation. This is done via a new dataclass called MagneticField which contains a
vector
and ag_tensor
list of arrays. Fixes #72This PR also adds two examples:
antiferro_ef.py
, which is tutorial 29 for MATLAB spinW. This is the antiferro chain with added anisotropies and an external magnetic field applied.ferromagnet_gtensor.py
, an example for a simple ferromagnetic chain with an explicit field and g-tensor specified.