pyiron/pyiron_atomistics

[VASP] final_magmoms not parsed.

Closed this issue · 16 comments

pmrv commented

When running a spin polarized calculation (ISPIN=2, collinear) it seems that the optimized magnetic moments (output/generic/dft/final_magmoms) are never read back in to pyiron, only the total magnetization (output/generic/dft/magnetization).

@ligerzero-ai Have you ever run spin stuff via pyiron?

I have, and I think it should!? If not, I'll hop on this asap. I'll check and fix it this week

pmrv commented

It seems our code expects some per direction output in the OUTCAR that is not present or I'm missing some input flag that makes VASP write this only conditionally.

It must lie in the way it is written to hdf, since the infrastructure (i.e. the parser parses magmoms properly). So the breakdown must be between the parser and the hdf5 information writer

pmrv commented

This is my INCAR

['SYSTEM=test_ni #jobname\n',
 'PREC=Accurate\n',
 'ALGO=Fast\n',
 'LREAL=.FALSE.\n',
 'LWAVE=.FALSE.\n',
 'LORBIT=0\n',
 'ISIF=2\n',
 'IBRION=2\n',
 'NELM=400\n',
 'NSW=100\n',
 'EDIFFG=-0.01\n',
 'ISPIN=2\n',
 'MAGMOM=1   1   1   1\n']

Is the parser reading it from vasprun.xml or OUTCAR (it seems the latter). Do you know off hand where I can reach into the parser directly?

self.parse_dict["final_magmoms"] = final_magmom_lst

To access:

outcar = Outcar()
outcar.from_file(filename = outcar_path)
magmoms = np.array(outcar.parse_dict["final_magmoms"])
pmrv commented

Yeah, that one's empty, which is why it doesn't appear in the output. The pymatgen parser also doesn't return it for, so it does seem like I'm missing something when I start the run? :S

your magmoms look weird - are you sure that's an accepted format? can you send me the outcar, I'll scroll through

pmrv commented

Dunno, that's how pyiron writes it when I set the initial magmoms.

OUTCAR.txt

ahhhh lmfao, you need to set LORBIT = 10 in the INCAR to make sure magnetisation is actually written to the outcar, else it doesn't.

I'll patch it in when magmoms are specified.

pmrv commented

Ah, I thought it must be something like this. I do love how I even was on the correct page in the VASP wiki for LORBIT, but closed it again, because this is nowhere mentioned.

Anyway, thanks for your quick help!

I have suspicion that it's removed from the wiki because it is no longer a necessity in the latest vasp versions, but if you are running old vasp it will require it. I remember it being on their wiki but they must have removed it. I see that vasp 5.4.4 is specified on your OUTCAR.

Still really dumb, regardless

pmrv commented

I also checked it with 6.4.4, but maybe I didn't read carefully enough.

pmrv commented

It seems it was also discovered here: #1060 I'll add a FAQ entry for it tomorrow.

@pmrv How did you define the MAGMOM ? Did you manually set it? Did you set the magnetic moments using the ASE structure? Can you share the pyiron input script?

#1424 fixes this and #1060

pmrv commented

@pmrv How did you define the MAGMOM ? Did you manually set it? Did you set the magnetic moments using the ASE structure? Can you share the pyiron input script?

I used this line to set up the moments as is done also in our unit tests.

j.structure.set_initial_magnetic_moments(1.0 * np.random.rand(4))

So the MAGMOM was pyiron generated. Anyway it worked after setting LORBIT.