#1436 OpenMX Spin input write: Preserve the sign of magnetic moments in the collinear spin case.
Here:
Patch for def get_up_down_spin(magmom, element, xc, data_path, year):
at ase/calculators/openmx/writer.py
https://gitlab.com/ase/ase/-/blob/master/ase/calculators/openmx/writer.py#L411
Differentiate between collinear (float or int type) and non-collinear spin (array) configurations based on the type of magmom
.
In the case of collinear spins, the sign of magnetic moments should be preserved without applying the norm.
Specifically, if magmom
is either a float or an int, it is explicitly cast to float to maintain consistency.
Checklist
- [v] I am familiar with ASE's contribution guidelines.
- [v] Doc strings in code changed in this MR are up to date.
-
Unit tests have been added for new or changed code. - [v] Issue is resolved via "closes #XXXX" if applicable.