Guide · VASP · 12 min read
How do I set up a magnetic calculation in VASP?
Checked against the docs · VASP wiki and VASP tutorial Magnetism parts 1 and 2 · Last checked 11 November 2026 · Spot a mistake? Tell us
Short answer
Turn on spin polarisation with ISPIN = 2 and give MAGMOM one starting moment per atom, in POSCAR order, with N*value to repeat a value. Use the same sign on every magnetic atom for a ferromagnet and opposite signs for an antiferromagnet, in a cell large enough to hold both, and start slightly above the moment you expect. The final state depends on the start, so read the moments in OSZICAR and OUTCAR and compare the energies of the orders you tried.
What is a spin-polarised calculation?
Electrons carry spin, which can point up or down. In most materials there are as many of one as the other, and they can share one charge density. In a magnetic material they do not: more electrons point one way than the other, and the difference gives each atom a magnetic moment, measured in Bohr magnetons (μB).
By default, VASP treats up and down electrons together (ISPIN = 1). With ISPIN = 2, it treats them separately, as two spin channels, each free to have its own density and occupations. This is a collinear calculation: every moment points either up or down along one shared axis.
MAGMOM gives each atom its starting moment: a guess VASP begins from, which the calculation is then free to change. The sign of each number says which way that atom's moment points relative to the others.
When do I need spin polarisation?
For magnetic materials. The ISPIN page names Fe, Co, Ni and magnetic oxides as the usual cases. Without ISPIN = 2 such a material is forced to be non-magnetic, and its energy, structure and electronic structure come out wrong.
Not for non-magnetic ones. The wiki says spin polarisation is generally unnecessary for a non-magnetic system and increases the computational cost: two spin channels to converge instead of one.
Whenever the magnetic state is the question. The MAGMOM page is emphatic that the final magnetic state strongly depends on the starting values, even with symmetry switched off, because spin-density functional theory has many local minima. A calculation finds a state near where you started it. Which order is the ground state is something you find out by trying the candidates and comparing their energies, not something VASP tells you from one run.
How do I write MAGMOM?
One number per atom, in the order the atoms appear in POSCAR:
ISPIN = 2
MAGMOM = 2.0 -2.0 2*0This is the INCAR of the wiki's NiO example: its POSCAR lists two nickel atoms, then two oxygen atoms. The first nickel starts at +2 μB, the second at -2 μB, and both oxygens at 0. What each part means:
N*valuerepeats a value.2*0is two zeros;4*5 4*0is5 5 5 5 0 0 0 0. The VASP tutorial uses this shorthand throughout.- The order is
POSCAR's. The first number belongs to the first atom in the file, and so on. Reorder the atoms and the moments land on different atoms. - Positive and negative are relative. In a collinear calculation the moments have no direction in real space; only whether they are parallel or antiparallel to each other matters.
- Long lines can be split with a backslash at the end of each line (no blank after it), as the
INCARpage shows.
The default. If you leave MAGMOM out with ISPIN = 2, every atom starts at 1.0 μB, all parallel.
MAGMOM also sets the symmetry. VASP removes any symmetry operation the moments break. Two iron atoms given 1.0 -1.0 are no longer equivalent, and VASP will not treat them as such. This is why the starting guess can steer which state a run can reach.
It is read only on a fresh start. On a magnetic calculation from scratch, MAGMOM sets the starting moments. When you restart from a converged WAVECAR or CHGCAR that already holds a magnetisation, MAGMOM is used only for the symmetry. The wiki warns that removing it before such a restart is likely to symmetrise the magnetisation away. See Should I start fresh or continue?
What starting moments should I use?
These are starting points from the wiki's guidance and examples. The run decides the final moments; your job is to start it near the state you want to test.
| What you want to test | MAGMOM | Why |
|---|---|---|
| A ferromagnet (all moments parallel) | The same positive value on every magnetic atom, 0 on non-magnetic ones | One sign for all; the wiki's fcc Ni example starts its one atom at 1.0 μB. |
| An antiferromagnet (moments alternating) | Opposite signs on the two sets of magnetic atoms, 0 on non-magnetic ones | The wiki's bcc example: 1.0 -1.0 on two atoms; its NiO example: 2.0 -2.0 2*0. |
| How large to make each value | Slightly above the moment you expect: the wiki suggests the experimental moment × 1.2 to 1.5 | Too small a start can fall to the non-magnetic state; the fcc Ni example started at 0 ends at 0.002 μB. |
| No experimental moment to go on | The procedure of Huebsch et al. (2021), which the MAGMOM page cites | A systematic way to generate candidate orders. |
The wiki points to the MAGNDATA collection of the Bilbao Crystallographic Server for measured magnetic structures and moments.
Choose yours:
| The wiki's example | Starting moments | Why |
|---|---|---|
| Ferromagnet: fcc Ni, 1 atom | MAGMOM = 1.0 | One atom in the primitive fcc cell, started at 1 μB. The wiki's run ends near 0.58 μB in OSZICAR (mag=); a start of 0 ends at 0.002 μB, practically non-magnetic. |
| Antiferromagnet: bcc, 2 atoms | MAGMOM = 1.0 -1.0 | The simplest antiferromagnetic input on the MAGMOM page: a simple cubic cell with one atom at the corner and one at the center, so that a bcc lattice holds one up and one down moment. The total moment comes out zero; the local ones need LORBIT. |
| Antiferromagnetic oxide: NiO, 4 atoms | MAGMOM = 2.0 -2.0 2*0 | Two nickel atoms with opposite moments, two oxygen atoms at zero, in a cell of 4 atoms where the rock-salt primitive cell has 2. OSZICAR should show mag= 0, and OUTCAR about ±1.2 μB on the nickels. |
What it depends on:
- Which atoms are magnetic. Typically the transition-metal or rare-earth atoms; oxygen and other non-magnetic atoms start at 0.
- The order you want to test. Each order is its own calculation with its own
MAGMOM, and often its own cell. - The expected size of the moment. Start slightly above it; a start that is too small risks the non-magnetic solution, and a poor start takes longer to converge.
Why does an antiferromagnet need a bigger cell?
An antiferromagnetic order needs at least one up and one down atom in the cell, because the cell is repeated in every direction and every copy must carry the same pattern. If the smallest cell of the crystal holds only one magnetic atom, no choice of MAGMOM can make neighbors point opposite ways: every repeated atom gets the same sign.
So the cell has to be chosen for the magnetic order, not only for the crystal:
- bcc iron has one atom in its primitive cell. The wiki's antiferromagnetic example uses the two-atom cubic cell, atom at the corner and atom at the center, so the two can take opposite signs.
- NiO has two atoms (one Ni, one O) in its rock-salt primitive cell. The wiki's NiO example says it in one line: antiferromagnetic coupling needs 4 atoms in the basis instead of 2.
- Different antiferromagnetic orders need different cells. The VASP magnetism tutorial compares a ferromagnetic order and two antiferromagnetic orders of NiO in cells of different sizes, and divides each total energy by the number of formula units before comparing them.
When you compare the energies of two orders, compare them per atom or per formula unit, and converge each one's k-point mesh on its own: the tutorial notes that converging each calculation matters more than matching the meshes, especially if one order is metallic and another has a gap.
How do I know the magnetic state is right?
Read the total moment in OSZICAR. At the end of each ionic step, the line with F= and E0= ends in mag=, the total moment of the cell in μB:
grep "mag=" OSZICAR | tail -1For a ferromagnet, it should be near the sum of the atoms' moments; for an antiferromagnet, the wiki's NiO example shows mag= 0.0000. A ferromagnet that ends near 0 has most likely fallen into the non-magnetic state.
Read each atom's moment in OUTCAR. Set LORBIT = 11 (any value from 10 up uses the PAW projectors; below 10 you must also give RWIGS), and OUTCAR gets a block headed magnetization (x) with one line per atom, split into s, p and d contributions, and a total. Find the last one with:
grep -n "magnetization (x)" OUTCAR | tail -1and read the lines after it. The wiki notes these moments come from a projection onto spheres around each atom, a good estimate rather than an exact value. In the NiO example the two nickels carry about +1.22 and -1.22 μB and the oxygens nearly zero, which is what an antiferromagnet looks like: opposite local moments, zero in total.
Compare the orders by energy. The order with the lowest energy (per formula unit, with converged settings) is the best candidate among those you tried. For precise total energies in these comparisons, the VASP magnetism tutorial recommends ISMEAR = -5 and a tight EDIFF; see Which smearing should I use?
Check that VASP read what you wrote. OUTCAR starts with VASP's reading of your INCAR:
grep -E "ISPIN|MAGMOM" OUTCARWhat if it will not converge, or lands in the wrong state?
The wiki's own suggestions:
- Start from the non-magnetic solution. Converge a run with
ISPIN = 1, then restart from itsWAVECARandCHGCARwithICHARG = 1,ISPIN = 2and yourMAGMOM. Because theCHGCARholds no magnetisation yet,MAGMOMsets the starting moments, and the wiki says this can improve convergence. - Raise the starting moments if the run keeps ending non-magnetic.
- Slow the mixing of the magnetisation. The wiki's NiO example sets
AMIX = 0.2,BMIX = 0.00001,AMIX_MAG = 0.8andBMIX_MAG = 0.00001, which the page describes as linear mixing; part 1 of the VASP magnetism tutorial adds that for magnetic calculations very small (but not zero)BMIXandBMIX_MAGcan help. - Constrain the moments with
I_CONSTRAINED_Mif you need a particular state; theMAGMOMpage points to it.
Can I fix the total moment? (NUPDOWN)
NUPDOWN fixes the difference between the number of up and down electrons, so the cell's total moment stays at the value you give. Left unset (or -1, the default), the total moment is free to relax.
When you set it, start the moments consistently: from atomic densities (ICHARG = 2) VASP sets each atom's MAGMOM to NUPDOWN divided by the number of atoms, unless you give your own (which should add up to the same total). The wiki warns that starting from a CHGCAR (ICHARG = 1) usually gives the wrong initial moment, and that a mismatch slows convergence.
What about moments that point in any direction?
That is a noncollinear calculation, needed for spin spirals, canted moments and spin-orbit coupling. It is a different setup, only outlined here:
- Set
LNONCOLLINEAR = .TRUE.and run thevasp_nclexecutable.ISPINis then ignored, and from VASP 6.5 the run stops with an error ifISPIN = 2andMAGMOMare combined withLNONCOLLINEAR = .TRUE. MAGMOMtakes three numbers per atom (x, y, z), and its default becomes 1.0 for each of the three components of every atom.- With spin-orbit coupling (
LSORBIT), the direction relative to the lattice matters, and the components are given in the frame set bySAXIS. - The wiki recommends two steps: a non-magnetic run first, then a restart from its
WAVECARandCHGCARwith the moments set.
Start from the LNONCOLLINEAR page.
What goes wrong with magnetic calculations?
| Mistake | What you would see | What to do |
|---|---|---|
MAGMOM with a different count than the atoms in POSCAR | The wiki does not say what VASP does with too few or too many values, so do not count on an error: count the values against the atoms in POSCAR before you submit, and check the moments OUTCAR reports per atom after the run | One value per atom, in POSCAR order; N*value for runs of the same value. |
MAGMOM set but ISPIN = 1 | Nothing magnetic: a collinear run reads MAGMOM only when spin is on. | ISPIN = 2. |
ISPIN = 2 with no MAGMOM | Every atom starts at 1 μB, parallel: fine for some ferromagnets, never an antiferromagnet. | Set MAGMOM for the order you want. |
| Starting moments too small | mag= near 0 at the end: the non-magnetic solution. | Start slightly above the expected moment. |
| An antiferromagnet in a cell with one magnetic atom | The run cannot become antiferromagnetic. | Build the larger cell the order needs. |
Atoms reordered in POSCAR, MAGMOM left as it was | Moments on the wrong atoms, often a different order than intended. | Rewrite MAGMOM whenever the atom order changes. |
Removing MAGMOM before a restart | The magnetisation is likely to be symmetrised away. | Keep MAGMOM in every restart of a magnetic run. |
| Comparing total energies of cells of different sizes | Differences of whole formula units, not of magnetic orders. | Divide by the number of atoms or formula units first. |
| Trusting one run as the ground state | The state found is near the start, one of several local minima. | Try each candidate order and compare energies. |
Try it
Try it: find the wrong moment
Each INCAR below goes with the VASP wiki's two-atom example cell for antiferromagnetic order, from the MAGMOM page. Each has one line that does not do what its first line asks. Choose the line you think it is.
Script 1.
# two atoms, antiferromagnetic
ISPIN = 2
MAGMOM = 1.0The problem is line 3, MAGMOM = 1.0: For ISPIN = 2, MAGMOM is a list of one value per atom (NIONS values), each positive or negative. This cell has two atoms, and the line gives one value. MAGMOM = 1.0 -1.0, the wiki's own example for this cell.
Script 2.
# two atoms, antiferromagnetic
ISPIN = 1
MAGMOM = 1.0 -1.0The problem is line 2, ISPIN = 1: ISPIN = 1, the default, is a calculation without spin polarization: spin-up and spin-down electrons share a single density. The wiki starts magnetic moments by combining MAGMOM with ISPIN = 2. ISPIN = 2.
Script 3.
# two atoms, antiferromagnetic, noncollinear
LNONCOLLINEAR = .TRUE.
MAGMOM = 1.0 -1.0The problem is line 3, MAGMOM = 1.0 -1.0: In a noncollinear calculation, each atom's starting moment has three components, so MAGMOM needs three values per atom. MAGMOM = 0 0 1.0 0 0 -1.0, as in the wiki's noncollinear example, and run it with the vasp_ncl executable.
Script 4.
# two atoms, antiferromagnetic, noncollinear
LNONCOLLINEAR = .TRUE.
ISPIN = 2
MAGMOM = 0 0 1.0 0 0 -1.0The problem is line 3, ISPIN = 2: The ISPIN page: noncollinear calculations ignore ISPIN, and since VASP 6.5.0 the calculation exits with an error if ISPIN = 2 and MAGMOM are used together with LNONCOLLINEAR = .TRUE.. Delete the ISPIN line.
Set up shows ISPIN as "Spin" and MAGMOM as "Starting moments", each with its explanation. Before you submit, pre-flight checks your starting moments.