How to parse the AFM structure and save structure treating the site with different magnetic moment as if different elements


I am wondering if anybody can help solve the problem in handling the AFM calculation using pymatgen with atomate. My problem was met in calculating the double layer fcc AFM as stated below, i.e,

If one sets in line 6-7 in the POSCAR file as together with MAGMOM=3*-2 3*2:


Sometimes the VASP AFM calculation did not converge correctly. In contrast, if one sets

Fe Fe
2 2

together with MAGMOM=3*-2 3*2, VASP converge better to AFM.

the question is that how to store the structure in later format, i.e., separating the Fe into as if two kinds of elements into momgoDB.


Yi Wang

Hi @Yi_Wang,

Conventionally we store magnetic moments as a “site property” in pymatgen/atomate, e.g. your_structure.site_properties['magmom']. This should already be stored in the MongoDB database.

Alternatively, you can store a Species object with a spin attribute e.g. Fe,spin=2 and Fe,spin=-2 rather than the Element Fe.




Thank you so much!


I am not quite familiar on using the species object. Could you kindly give me a code example on how insert the Species object into a pymagen structure.



Sure thing!

When you construct a Structure you will give it a list of elements or species.

Typically, you can give it a list like ["Fe", "O"] for example. Behind the scenes, these are converted to Element("Fe") and Element("O") but you could also have supplied these as a list directly, [Element("Fe"), Element("O")].

Species allow extra information to be included, for example spin or oxidation state. There are also DummySpecies for things like vacancies.

To use, you would:

from pymatgen.core.periodic_table import Species

and then when you construct your structure, you would use the list [Species("Fe"), Species("O")].

To include oxidation state, you could do Species("O", oxidation_state=-2).

To include spin, you could do Species("Fe", properties={"spin":5}).

But, again, this information is just metadata. It annotates your Structure object but it does not do anything on its own. If you have already run, for example, a VASP calculation and you have that calculation in your MongoDB database, you may want to instead look at the your_structure.site_properties, since magnetic moments are often stored there with the magmom key.

Hope this helps!



Thanks! let me try it.