Skip to content

[ENH]: Function to dump tb2j files or a universal yaml/hdf5 #16

@oashour

Description

@oashour

What are you missing?

Hi Andrey,

I just discovered rad-tools last week, and I'm a huge fan. I want to use it as part of the backend of a package I'm working on to compute Magnon-dark matter interactions (similar to how I'm using phonopy for phonon-DM interactions).

Spin Hamiltonians can come from many sources. For example, they could be defined via the rad-tools Python API from parameters fitted to experiments, using parameters computed from magnetic force theorem in FLEUR, or an exchange.out TB2J file with W90/SIESTA, etc. It would be nice to have a unified format. That way, the users only have to provide one file that can be loaded to populate a SpinHamiltonian object, completely agnostic to its source (similar to a properly generated phonopy.yaml file, if you're familiar with phonopy).

What would you like to have?

I see that rad-tools has a template feature. It seems that it only lists the neighbor pairs so that the information would be incomplete regarding the exchange/SIA/DMI parameters, unit cell, atom positions, etc. Since rad-tools can already read TB2J files, it might be useful to be able to dump them as well. That's one option, but I'm personally not a fan of text files, and it would be better to use a format better suited for numerical data.

YAML would be one option, but I'm also not a fan of using that format for numerical data (which is not what it was designed for). I am partial to HDF5: it was designed for scientific computing/numerical data, and the tools to read and write it are ubiquitous, mature, and easy to use (e.g., h5py). Further, many first principles packages are (slowly) moving towards HDF5 already (e.g., VASP and Quantum ESPRESSO). It's not human-readable, but the dump_spinham_txt function works beautifully for such files.

Do you want to add anything?

I'd like to know your thoughts regarding this. I would be 100% interested in implementing this myself, and it shouldn't be too difficult. (Although it would have to wait until after the March Meeting...) Let me know what you think and what design guidelines you'd suggest for this.

OS

Linux

RAD-tools version

0.8.12

Git commit hash

No response

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions