spirit-code / spirit

Atomistic Spin Simulation Framework
http://spirit-code.github.io
MIT License
117 stars 52 forks source link

Bug: When a vacancy is set and then removed mu_s stays zero #513

Open MSallermann opened 5 years ago

MSallermann commented 5 years ago

When an atom type different from a vacancy is set the magnetic moment should be restored.

MSallermann commented 5 years ago

It would maybe be better not to set mu_s=0 for a vacancy. In the most general case, one has to then store the previous mu_s in case the vacancy is removed. Setting mu_s=0 for a vacancy is, as far as I am aware, only needed for the DDI. But there one could also achieve the desired behaviour by checking for the atom_type (like it is done for the other interactions). Overall this would likely be less cumbersome.

GPMueller commented 5 years ago

While I would not say this is a bug, as it was designed this way, I agree with your suggestion to change the behaviour. As far as I remember, something other than DDI was the reason, but I can currently not think of any reason to keep the current behaviour. Note that the calculation of the magnetisation is another example where vacancies are not properly treated - especially if mu_s is nonzero. The topological charge could use a corresponding if-statement as well.