[ase-users] Getting magnetic moments from vasp
Kondov, Ivan (SCC)
ivan.kondov at kit.edu
Tue May 23 09:45:30 CEST 2017
Dear Protik,
Yes, the vasp calculator sets ispin=2 and the MAGMOM string automatically if
we have defined the initial magnetic moments with
atoms.set_initial_magnetic_moments(). As this is the case in the example
below this is not the reason for the 'None' output. The total magnetic
moment is always available, the magnetic moments of individual atoms are
available only if we specify lorbit>=10. I modified the script like this
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=10)
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())
and got this output:
3.3235328
[ 1.12 1.047 1.122]
I hope this helps.
However I still cannot explain the PropertyNotImplementedError in your
original post. How did this come about? Do you have a script to show that
reproduces it?
Best regards,
Ivan
> From: Eric Hermes [mailto:ehermes at chem.wisc.edu]
> Sent: Tuesday, May 23, 2017 1:04 AM
> To: Protik Das; Kondov, Ivan (SCC)
> Subject: RE: [ase-users] Getting magnetic moments from vasp
>
> You need to run VASP with ispin=2 to enable spin polarization, otherwise
the spin is fixed to 0. VASP also does not assign atomic magnetic moments,
so get_magnetic_moments() will not work. If you want atomic magnetic
moments, you can do something like Bader analysis on the spin density, but
that will be a postprocessing step.
>
> I am uncertain if the VASP calculator parses the magnetic moments from
initial_magnetic_moments. You can explicitly set initial magnetic moments
with the Vasp keyword magmom. The default is 1. for each atom when spin
polarization is enabled (with ispin=2).
>
> Eric
>
> 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 4:44 PM
> To: Kondov, Ivan (SCC) <ivan.kondov at kit.edu>;
ase-users at listserv.fysik.dtu.dk
> Subject: Re: [ase-users] Getting magnetic moments from vasp
>
> 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.
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 6317 bytes
Desc: not available
URL: <http://listserv.fysik.dtu.dk/pipermail/ase-users/attachments/20170523/bdcc7d7a/attachment-0001.p7s>
More information about the ase-users
mailing list