aiidateam / aiida-core

The official repository for the AiiDA code
https://aiida-core.readthedocs.io
Other
429 stars 186 forks source link

Support for magnetic structure #4866

Open flavianojs opened 3 years ago

flavianojs commented 3 years ago

Currently, we provide information on the magnetic structure as input parameters for the calculation (#854), such as the initial magnetic moment. However, for a more complex magnetic structure, you might need to specify as well the local magnetic moment axes for a noncollinear magnetic calculation. Also thinking in high-throughput, it would be useful to store this magnetic structure info associated with a particular instance of the StructureData.

For example, one might want to start a calculation from a mcif file, which provides both the atomic and the magnetic structures of the material.

I believe the solution could be to create a new data class, e.g., MagStructureData, that inherits from StructureData. However, this may imply a lot of modifications for the AiiDA-core. Alternatively, we could store this info in the extras of StructureData.

flavianojs commented 3 years ago

@sphuber @mbercx @bastonero

bosonie commented 3 years ago

Hi @flavianojs. You might be interested in reading here https://github.com/aiidateam/aiida-common-workflows/issues/38

sphuber commented 3 years ago

I would definitely not store this in the extras, because they are mutable. Since the magnetic information is important for the provenance one would lose the provenance if the extras get modified, either on purpose or by accident. Introducing a new MagneticStructureData that adds the relevant data to the attributes, would be a possibility and not be a problem for aiida-core. However, the challenge would be to add support for this to all the plugins that probably at the same time still need to support the old StructureData with magnetization data in the parameters.

mbercx commented 3 years ago

I've had the same idea of creating a new MagneticStructureData class that adds the magnetic configuration, and adding this to a new plugin called e.g. aiida-matsci (if we want to start moving materials science related classes out of AiiDA).

Adding support to e.g. aiida-quantumespresso would mean checking if the provided StructureData is of type MagneticStructureData and writing the magnetization input based on this information. Either we also allow supplying the magnetic configuration in the parameters, which overrides that stored on MagneticStructureData, or we add some validation and raise. Work chains that have an output_structure can then also return a MagneticStructureData.

For some plugins, there is also the question on how to deal with the kinds. Might be interesting to read the discussion here:

https://github.com/aiidateam/aiida-quantumespresso/pull/640

I really like the suggestion of @greschd of pushing down the logic of creating new kind names based on the magnetic configuration to the input generation of the pw.x code, instead of creating a new (Magnetic)StructureData class which only differs in its kinds.