[ase-users] Getting magnetic moments from vasp

Protik Das protik77 at gmail.com
Tue May 23 01:30:12 CEST 2017


Yes you are right. The calculation should be with ispin=2.

But I think vasp do give atomic magnetic moments. If a calculation is run
with ispin=2 and lorbit=11, then the final moment is given in the output
with "magnetization (x)". And there is already a function
read_magnetic_moments which reads that. But it seems the information is not
updated after calculation. Also I cannot assign the values from the
read_magnetic_moments to my atoms object as the atoms are sorted
differently than the atoms object for calculation.

I am relaxing a atoms object with some initial magnetic moments with vasp.
After relaxation I am writing the atoms object to a trajectory file. I was
hoping the atoms object or the trajectory file will have the final magnetic
moments from the calculation. But after the calculation the atoms object is
not updated. I am working with a magnetic system with a large supercell. If
the magnetic moments information is lost after relaxation, it is hard to
assign magnetic moments for later calculations as I will be reading from
the relaxed structure.

On Mon, May 22, 2017 at 2:44 PM Protik Das <protik77 at gmail.com> wrote:

> No really. I am constructing the calculaor object on the fly.
>
> Your script works for me too. It prints out the final total magnetic
> moment. But I need the final magnetic moment of the individual atoms. I
> tried to do that by using the following script,
>
>
> from ase.calculators.vasp import Vasp
> from ase.build.surface import fcc111
> calc = Vasp(prec='Normal', xc='PBE', lreal=False, kpts=(3,3,1),
> algo='Fast',
>             nelm=120, ibrion=-1, nsw=0, lorbit=0)
> slab = fcc111('Ni', size=(1, 1, 1), vacuum=10.0)
> slab.set_initial_magnetic_moments([1.]*len(slab))
> slab.set_calculator(calc)
> slab.get_potential_energy()
> print(slab.get_magnetic_moment())
> print(slab.get_magnetic_moments())
>
> It only printed out 'None'. It seems the atoms object does not update the
> initial magnetic moments. Any idea about how I can get the final magnetic
> moments?
>
> Thanks.
>
> On Mon, May 22, 2017 at 6:55 AM Kondov, Ivan (SCC) via ase-users <
> ase-users at listserv.fysik.dtu.dk> wrote:
>
>> Hello,
>>
>> I just tried to reproduce with this short script:
>>
>> from ase.calculators.vasp import Vasp
>> from ase.build.surface import fcc111
>> calc = Vasp(prec='Normal', xc='PBE', lreal=False, kpts=(3,3,1),
>> algo='Fast',
>> nelm=120)
>> slab = fcc111('Ni', size=(1, 1, 3), vacuum=10.0)
>> slab.set_initial_magnetic_moments([1.]*len(slab))
>> slab.set_calculator(calc)
>> print(slab.get_magnetic_moment())
>>
>> It does not complain and prints the magmom on the screen. The method
>> calc.get_property('magmom', slab) also instantly updates and returns the
>> magmom. Quite notable from your error output below is that you do not use
>> an
>> instance of the Vasp calculator but one derived
>> from ->SinglePointCalculator->Calculator classes (in singlepoint and
>> calculator modules). They are actually not used by the Vasp calculator.
>> Probably your calc object was (incompletely) constructed or read from a
>> database?
>>
>> Best regards,
>> Ivan
>>
>>
>> From: ase-users-bounces at listserv.fysik.dtu.dk
>> [mailto:ase-users-bounces at listserv.fysik.dtu.dk] On Behalf Of Protik Das
>> via
>> ase-users
>> Sent: Monday, May 22, 2017 9:10 AM
>> To: ase-users at listserv.fysik.dtu.dk
>> Subject: [ase-users] Getting magnetic moments from vasp
>>
>> Hi,
>> I am running a spin polarized calculation using vasp as a calculator. But
>> it
>> seems the atoms object is not updated with the magnetic moments from the
>> calculator when the calculation is done. I am getting the following error
>> when
>> I try to get the magnetic moments from the atoms or the calculator object.
>>
>>   File
>>
>> "/home/protik/anaconda3/envs/ase/lib/python3.6/site-packages/ase/calculators/calculator.py",
>> line 441, in get_magnetic_moment
>>     return self.get_property('magmom', atoms)
>>   File
>>
>> "/home/protik/anaconda3/envs/ase/lib/python3.6/site-packages/ase/calculators/singlepoint.py",
>> line 34, in get_property
>>     'The property "{0}" is not available.'.format(name))
>> ase.calculators.calculator.PropertyNotImplementedError: The property
>> "magmom"
>> is not available.
>>
>> Is there a way to update the magnetic moments of the elements from the
>> calculation? I am using ase 3.13.0.
>> Thanks.
>> --
>> Protik Das,
>> ECE Graduate Student,
>> LATTE (http://latte.ece.ucr.edu),
>> University of California, Riverside.
>> _______________________________________________
>> ase-users mailing list
>> ase-users at listserv.fysik.dtu.dk
>> https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
>
> --
> Protik Das,
> ECE Graduate Student,
> LATTE (http://latte.ece.ucr.edu),
> University of California, Riverside.
>
-- 
Protik Das,
ECE Graduate Student,
LATTE (http://latte.ece.ucr.edu),
University of California, Riverside.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170522/5eff5536/attachment.html>


More information about the ase-users mailing list