[ase-users] magnetic moments

Jens Jørgen Mortensen jensj at fysik.dtu.dk
Mon Jan 19 11:51:59 CET 2009


On Fri, 2009-01-16 at 11:16 +0100, Carsten Rostgaard wrote:
> No, they are written / read correctly, but a few weird things happen. 
> Consider the follwing
> 
> from ase import *
> from gpaw import *
> 
> calc = GPAW()
> atoms = molecule('CH', calculator=calc, cell=[5, 6, 7])
> atoms.center()
> atoms.get_potential_energy()
> 
> print atoms.get_magnetic_moment() # 1
> print atoms.get_magnetic_moments() # array([ 1.01433322, -0.01433322])
> print atoms.get_initial_magnetic_moments() # array([ 1.,  0.])
> 
> calc.write('test.gpw')
> 
> atoms, calc = restart('test.gpw')
> print atoms.get_magnetic_moment() # 0
> print atoms.get_magnetic_moments() # array([ 1.01433322, -0.01433322])
> print atoms.get_initial_magnetic_moments() # array([ 1.01433322, 
> -0.01433322])
> 
> The commented values are the outputs.
> 
> As you see, the total magnetic moment is lost when writing a gpw file 
> (this is a bug I reported back in May 2008 
> https://trac.fysik.dtu.dk/projects/gpaw/ticket/43).

This has been fixed in the next version of GPAW.

> The second weird thing is that the initial magnetic moments property on 
> the atoms gets changed to the calculated local magnetic moments after 
> dumping to file. I think this is intentional though, as this will be a 
> better starting guess if you restart a calculation.
> 
> Cheers,
> Carsten
> 
> 
> Vivien Petzold wrote:
> > Dear ASE users,
> >
> > I have made some mysterious observations by doing the following:
> >
> > > from gpaw import restart
> > > atoms, calc = restart(<myfile>)
> >
> > <myfile> is a gpw-file containing an originally spin-polarized 
> > calculation of a Cl2 molecule. Both atoms had magmom=1 in the 
> > calculation that generated myfile.
> >
> > > atoms.get_magnetic_moments()
> > array([ 0.,  0.])
> > > atoms[0]
> > Atom('Cl', [6.0, 6.5, 8.007541], tag=0, magmom=0.0, index=0)
> > > atoms[1]
> > Atom('Cl', [6.0, 6.5, 5.992459], tag=0, magmom=0.0, index=1)
> >
> > The information of the initial magmoms is apparently lost. So, I am 
> > setting them again:
> >
> > > atoms.set_magnetic_moments((1,1))
> > > atoms.get_magnetic_moments()
> > array([ 0.,  0.])
> >
> > Hmmm ...? But, interestingly
> >
> > > atoms[0]
> > Atom('Cl', [6.0, 6.5, 8.007541], tag=0, magmom=1.0, index=0)
> > > atoms[1]
> > Atom('Cl', [6.0, 6.5, 5.992459], tag=0, magmom=1.0, index=1)
> >
> > What is going on? Are the magnetic moments set or not? And why are 
> > they not stored in the gpw-file (a question that should rather go to 
> > the gpaw mailing list)?
> >
> > Thanks for any help,
> > Vivien
> > _______________________________________________
> > ase-users mailing list
> > ase-users at listserv.fysik.dtu.dk
> > https://listserv.fysik.dtu.dk/mailman/listinfo/ase-users
> 




More information about the ase-users mailing list