Open bonfus opened 4 years ago
Magnetism is specified through the parameters
input node of for example a PwCalculation
.
For example:
parameters = {
'SYSTEM': {
'npsin': 2,
'starting_magnetization': {
'Fe': 2.0
}
}
}
This of course only works in combination with a StructureData
that has a "kind" named Fe
. To check you can call structure.kinds
to get a list of kinds on the structure. The kind names function just as the different species in Quantum ESPRESSO. So imagine you have an iron structure with two different magnetic species Fe1
and Fe2
you could use
parameters = {
'SYSTEM': {
'npsin': 2,
'starting_magnetization': {
'Fe1': 2.0,
'Fe2': 3.0,
}
}
}
as inputs for the parameters. However, there is no cleverness in updating the StructureData
. In this case, you would have to construct a StructureData
with those explicit kind names. This is also the reason why the StructureData
class has "kinds" (which have a "name" and "symbol" which refers to the elemental symbol) and not just "element".
This should probably be explained properly and placed in the documentation.
Thanks for these information.
To start writing the magnetic structure conversion I digged a little bit into the source of AiiDA-core and I discovered that this is already done when importing structures from pymatgen.
This is supposed to work (using this as input):
from pymatgen.core.structure import Structure
from pymatgen.analysis.magnetism.analyzer import CollinearMagneticStructureAnalyzer
# Read this file: http://webbdcrista1.ehu.es/magndata/index.php?index=0.103
bulk_structure = Structure.from_file('0.103.mcif')
magnetic_structure = CollinearMagneticStructureAnalyzer(bulk_structure, make_primitive=False)
aiidastructure = StructureData(pymatgen=magnetic_structure.get_structure_with_spin())
aiidastructure.get_kind_names()
>>> Out[31]: [u'Mn2', u'Mn1', u'Ge', u'O']
But unfortunately the conversion is wrong because it only checks the sign (+ o -) of the spin and it does not recognize that there are three inequivalent Mn atoms (thus 6 different kinds are required).
My current attempt to workout the conversion is here: https://gist.github.com/bonfus/8bd6953745bec6199e846c6eebd6cc4c
One eventually needs to translate the magnetic moments (scalars(vectors) for collinear(non-collinear) simulations) to QE input, which is not immediate.
I searched the documentation, the tutorials and online, yet I could not find a comprehensive description of how magnetic systems are treated in AiiDA.
Here's some questions:
Thanks!
ps: I probably know the answer to some of the above questions but I think is good to clarify these points somewhere.