Setting Magnetic Moment on Atoms by Specie¶
1. Introduction¶
This page explains how to set atom-specific input flags based on material data. The template source presented below can be re-used (copied and inserted) during the workflow design stage.
2. Source¶
The template code below sets the value of magnetic moments for ferromagnetic elements present in a material structure to 5 and alternates the sign. Non-magnetic elements are set to zero. The rendered output is suitable for a VASP simulation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | |
Each line in the above block of statements is described in the following sections.
2.1. Define the MAGMOM variable¶
The "MAGMOM" variable 1 is defined for inclusion in the VASP "INCAR" input parameters file. The {% spaceless %} flag is explained here.
2.2. Define ferromagnetic elements¶
The ferromagnetic elements that need magnetic moments assigned are defined using the set statement: Vanadium (V), Chromium (Cr), Manganese (Mn), Iron (Fe), Cobalt (Co), and Nickel (Ni).
2.3. Read POSCAR content¶
The content of the POSCAR file used by VASP, containing the numerical data defining the crystal structure, is read and assigned to the variable "poscar_string".
2.4. Read atomic coordinates¶
The lines containing atomic coordinates and element chemical symbols within the POSCAR file are extracted by splitting the file contents following the "direct" line, and assigned to the "coordinates" variable.
2.5. Set the magnetic moments¶
The list of atomic coordinates is looped through using a for loop.
The element symbol at the end of each coordinate line is isolated and checked against the list of ferromagnetic elements through a conditional statement. If a positive match is detected, the element is assigned a magnetic moment value of ±5 in alternating order. Otherwise, a magnetic moment of zero is assigned.
2.6. Return the final output¶
The final "MAGMOM" variable is returned once the template is rendered, as a list of magnetic moment values.
3. Example output¶
Consider the following hypothetical example of a material structure (Cobalt Oxide) in POSCAR format:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | |
The rendered output for this case is the following line, since Cobalt is ferromagnetic and Oxygen is not:
1 | |
4. Video walkthrough¶
The animation below demonstrates switching between viewing the POSCAR structure file for Cobalt Oxide within Workflow Designer, viewing the template for adding the MAGMOM parameter to the INCAR input file, and its rendered output.