[gpaw-users] : gpaw.KohnShamConvergenceError: Did not converge!

Yuelin Li ylli at aps.anl.gov
Thu Dec 2 15:30:49 CET 2010


Taking all the advice, I expanded the cell and removed the periodicity. 
Now I cannot even get the ground state to converge. Here is the script 
and the error message. I did try different nband and cell size and 
resolution. There might be something I overlooked?

----------------------------------------------------------------
from gpaw import setup_paths
setup_paths.insert(0, '.')

from ase import Atoms, Atom
from gpaw import GPAW

from ase.visualize import view
from ase.io import write
a = 3.937
d = a /2
slab = Atoms(symbols='Ca8MnO6',
         positions=[(0, 0, 0),
         (d, d, d),(d, d, -d),(d, -d, d),(-d, d, d),
         (-d,-d,-d),(-d, -d, d),(-d, d,-d),(d,-d,-d),
         (d, 0, 0),(0, d, 0),(0, 0, d),
         (-d, 0, 0), (0, -d, 0), (0, 0, -d)],
         cell=(4*a, 4*a, 4*a),
         pbc=(0, 0, 0))
slab.center()

write('slab.xyz', slab)
view(slab)

# gpaw calculator:
# calc = GPAW(h=0.18, nbands=100, xc='PBE', txt='CMO.out')
calc = GPAW(txt='CMO.out')
slab.set_calculator(calc)

e1 = slab.get_potential_energy()
calc.write('CMO.gpw',mode='all')

---------------------------------------------------------------------------
Traceback (most recent call last):
   File "test0.py", line 29, in <module>
     e1 = slab.get_potential_energy()
   File "/home/ylli/ase/ase/atoms.py", line 503, in get_potential_energy
     return self.calc.get_potential_energy(self)
   File "/usr/lib/python2.6/dist-packages/gpaw/aseinterface.py", line 
32, in get_potential_energy
     self.calculate(atoms, converge=True)
   File "/usr/lib/python2.6/dist-packages/gpaw/paw.py", line 279, in 
calculate
     raise KohnShamConvergenceError('Did not converge!')
gpaw.KohnShamConvergenceError: Did not converge!




On 11/24/2010 17:26, Mathias Ljungberg wrote:
> Also, are you sure that your total magnetic moment should be 0? Often 
> in a spin polarized calculation you need to set the inital magnetic 
> moments ( atoms.set_initial_magnetic_moments() ) for the system to 
> converge to the right magnetic state. With the core hole and an extra 
> electron the magnetic moment will be around +1 or -1 from that of the 
> ground state.
>
> The methodology of putting the extra electron in a predetermined spin 
> orbital works well for isolated molecules, however, for periodic 
> systems things are not as simple. The examples on the GPAW web page 
> are for insulators / non-magnetic systems and things might work a bit 
> differently for magnetic systems.  Observe that fixing the magnetic 
> moment will prevent relaxation due to the core hole and I'm not sure 
> this is an advisable procedure for magnetic systems.
>
> For convergence with the cell size for the actual spectrum 
> calculation, see
>
> PHYSICAL REVIEW B *66*, 195107 (2002)
>
> the take home message being that you need a pretty big supercell for 
> convergence! For the delta Kohn Sham calculation the convergence is 
> about the same.
>
> Just a few caveats...
>
> Mathias
>
> On Nov 24, 2010, at 12:54 PM, Jens Jørgen Mortensen wrote:
>
>> On Mon, 2010-11-22 at 16:36 -0600, Yuelin Li wrote:
>>> Nic,
>>>
>>> I am pretty sure I tried, then I tried again after seeing you email, 
>>> and
>>> there is no luck. here is the python script
>>
>> You are doing a gamma-point calculation with a *very* small grid
>> spacing.  It works fine for me if I use kpts=(2,2,2) and h=0.2.
>>
>> You may want to do the calculation in a bigger cell so that the
>> core-holes are more separated.
>>
>> Jens Jørgen
>>
>>> -----------------------
>>> from gpaw import setup_paths
>>> setup_paths.insert(0, '.')
>>>
>>>
>>> from math import pi, cos, sin
>>> from ase import Atoms
>>> from gpaw import GPAW, FermiDirac
>>>
>>> a = 3.937
>>> d = a /2
>>> atoms = Atoms(symbols='CaMnO3',
>>>                 positions=[(d, d, d),(0, 0, 0),(d, 0, 0),(0, d, 0),(0,
>>> 0, d)],
>>>                 cell=(a,a,a),pbc=(1,1,1))
>>>
>>> calc3 = GPAW(nbands=36,h=0.1,setups={2: 'fch1s'})
>>>
>>> atoms.set_calculator(calc3)
>>>
>>> e2 = atoms.get_potential_energy() + calc3.get_reference_energy()
>>>
>>> print 'Energy difference' , e2 - e1
>>>
>>> -----------------------
>>>
>>> And here is the error message,
>>> -----------------------------------
>>> Traceback (most recent call last):
>>>   File "xas2a.py", line 19, in <module>
>>>     e2 = atoms.get_potential_energy() + calc3.get_reference_energy()
>>>   File "/soft/ase/ase-3.4.1/ase/atoms.py", line 494, in
>>> get_potential_energy
>>>     return self.calc.get_potential_energy(self)
>>>   File "/soft/gpaw/gpaw-0.7.2/gpaw/aseinterface.py", line 32, in
>>> get_potential_energy
>>>     self.calculate(atoms, converge=True)
>>>   File "/soft/gpaw/gpaw-0.7.2/gpaw/paw.py", line 279, in calculate
>>>     raise KohnShamConvergenceError('Did not converge!')
>>> gpaw.KohnShamConvergenceError: Did not converge!
>>>
>>>
>>>
>>>
>>> Ph. D
>>> Advanced Photon Source, Argonne National Laboratory
>>> 630 252 7863
>>> http://sector7.xor.aps.anl.gov/~ylli/ 
>>> <http://sector7.xor.aps.anl.gov/%7Eylli/>
>>>
>>> On 11/22/2010 1:28 PM, Nichols A. Romero wrote:
>>>> Yuelin,
>>>>
>>>> Can you try without spin polarization altogether? Will that converge?
>>>>
>>>> ----- Original Message -----
>>>>> Thanks for offering the help.
>>>>>
>>>>> To clarify,
>>>>> - For a periodic system I should not specify charge?
>>>>> - The charge should actually be the opposite of the charge of the
>>>>> system?
>>>>>
>>>>> In any case, I did try GPAW with no option but the core hole like
>>>>> GPAW(setups={2: 'fch1s'}), as well as charge =-1, all reaches the same
>>>>> convergence problem.
>>>>>
>>>>> What to do next? Thanks.
>>>>>
>>>>> Yuelin
>>>>>
>>>>>
>>>>> On 11/19/2010 6:59 PM, Mathias Ljungberg wrote:
>>>>>> Hi Yuelin,
>>>>>>
>>>>>> I think you want to put charge=-1, with the core hole you will get a
>>>>>> neutral system
>>>>>>
>>>>>> Mathias
>>>>>>
>>>>>>
>>>>>> On Nov 20, 2010, at 12:50 AM, Nichols A. Romero wrote:
>>>>>>
>>>>>>> Yuelin,
>>>>>>>
>>>>>>> You have a periodic system with a net charge = 1. Is this what you
>>>>>>> want?
>>>>>>> I am not sure that its possible to converge this for anything but
>>>>>>> a finite system. I think this maybe your biggest problem. Try
>>>>>>> removing
>>>>>>> the charge keyword and seeing if it converges.
>>>>>>>
>>>>>>> Also, I recommend using the default eigensolver.
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> ----- Original Message -----
>>>>>>>> Hi,
>>>>>>>>
>>>>>>>> in the past few days I was struggling with this problem on the
>>>>>>>> following
>>>>>>>> calculation.
>>>>>>>>
>>>>>>>> The problem is whatever I try, it always fail to converge as long
>>>>>>>> as I
>>>>>>>> include the core hole state, the things I tried include
>>>>>>>> - nbands up to 120
>>>>>>>> - using done to 0.1
>>>>>>>> - both eigensolvers
>>>>>>>> - all 3 elements
>>>>>>>> - room temperature
>>>>>>>> - xc='LDA', etc
>>>>>>>>
>>>>>>>> I wonder what else can still be done?
>>>>>>>>
>>>>>>>> Please help,
>>>>>>>>
>>>>>>>> thanks
>>>>>>>>
>>>>>>>> Yuelin
>>>>>>>>
>>>>>>>> ----------------------------------------------------------------
>>>>>>>> from math import pi, cos, sin
>>>>>>>> from ase import Atoms
>>>>>>>> from gpaw import GPAW, FermiDirac
>>>>>>>>
>>>>>>>> t = pi / 180 * 104.51
>>>>>>>> a = 3.937
>>>>>>>> d = a /2
>>>>>>>> atoms = Atoms(symbols='CaMnO3',
>>>>>>>> positions=[(d, d, d),(0, 0, 0),(d, 0, 0),(0, d, 0),(0,
>>>>>>>> 0, d)],
>>>>>>>> cell=(a,a,a),pbc=(1,1,1))
>>>>>>>> atoms.center()
>>>>>>>>
>>>>>>>> calc2 = GPAW(nbands=36,
>>>>>>>> h=0.18,
>>>>>>>> txt='CMO_exc.txt',
>>>>>>>> xc='PBE',
>>>>>>>> charge=1,
>>>>>>>> spinpol=True,
>>>>>>>> eigensolver='cg',
>>>>>>>> occupations=FermiDirac(0.00, fixmagmom=True),
>>>>>>>> mixer=MixerSum(0.05,5,weight=100),
>>>>>>>> setups={2: 'fch1s'})
>>>>>>>> atoms[2].magmom = 1
>>>>>>>> atoms.set_calculator(calc2)
>>>>>>>> e2 = calc2.get_reference_energy()
>>>>>>>> --------------------------------------------------------------------
>>>>>>>>
>>>>>>>> The core holes are generated using
>>>>>>>>
>>>>>>>> --------------------------------------------------------------------
>>>>>>>> import os
>>>>>>>>
>>>>>>>> from gpaw import Calculator
>>>>>>>> from gpaw.atom.generator import Generator
>>>>>>>> from gpaw.atom.generator import parameters
>>>>>>>>
>>>>>>>> # Generate setups with 0.5, 1.0, 0.0 core holes in 1s
>>>>>>>> elements = ['Mn', 'O']
>>>>>>>> coreholes = [0.5, 1.0, 0.0]
>>>>>>>> names = ['hch1s', 'fch1s', 'xes1s']
>>>>>>>> functionals = ['LDA', 'PBE']
>>>>>>>>
>>>>>>>> for el in elements:
>>>>>>>>
>>>>>>>> for name, ch in zip(names, coreholes):
>>>>>>>>
>>>>>>>> for funct in functionals:
>>>>>>>>
>>>>>>>> g = Generator(el, scalarrel=True, xcname=funct,
>>>>>>>> corehole=(1, 0, ch), nofiles=True)
>>>>>>>>
>>>>>>>> g.run(name=name, **parameters[el])
>>>>>>>> --------------------------------------------------------------------
>>>>>>>> and
>>>>>>>> --------------------------------------------------------------------
>>>>>>>> from gpaw import Calculator
>>>>>>>> from gpaw.atom.generator import Generator
>>>>>>>> from gpaw.atom.generator import parameters
>>>>>>>>
>>>>>>>> # Generate setups with 0.5, 1.0, 0.0 core holes in 1s
>>>>>>>> elements = ['Ca']
>>>>>>>> coreholes = [0.5, 1.0, 0.0]
>>>>>>>> names = ['hch1s', 'fch1s', 'xes1s']
>>>>>>>> functionals = ['LDA', 'PBE']
>>>>>>>>
>>>>>>>> for el in elements:
>>>>>>>>
>>>>>>>> for name, ch in zip(names, coreholes):
>>>>>>>>
>>>>>>>> for funct in functionals:
>>>>>>>>
>>>>>>>> g = Generator(el, scalarrel=True, xcname=funct,
>>>>>>>> corehole=(1, 0, ch), nofiles=True)
>>>>>>>>
>>>>>>>> g.run(name=name, empty_states='3d',**parameters[el])
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> gpaw-users mailing list
>>>>>>>> gpaw-users at listserv.fysik.dtu.dk 
>>>>>>>> <mailto:gpaw-users at listserv.fysik.dtu.dk>
>>>>>>>> https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users
>>>>>>>
>>>>>>> --
>>>>>>> Nichols A. Romero, Ph.D.
>>>>>>> Argonne Leadership Computing Facility
>>>>>>> Argonne National Laboratory
>>>>>>> Building 240 Room 2-127
>>>>>>> 9700 South Cass Avenue
>>>>>>> Argonne, IL 60490
>>>>>>> (630) 252-3441
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> gpaw-users mailing list
>>>>>>> gpaw-users at listserv.fysik.dtu.dk 
>>>>>>> <mailto:gpaw-users at listserv.fysik.dtu.dk>
>>>>>>> https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users
>>>>>>
>>>>
>>> _______________________________________________
>>> gpaw-users mailing list
>>> gpaw-users at listserv.fysik.dtu.dk 
>>> <mailto:gpaw-users at listserv.fysik.dtu.dk>
>>> https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users
>>
>> _______________________________________________
>> gpaw-users mailing list
>> gpaw-users at listserv.fysik.dtu.dk 
>> <mailto:gpaw-users at listserv.fysik.dtu.dk>
>> https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://listserv.fysik.dtu.dk/pipermail/gpaw-users/attachments/20101202/3c3a539e/attachment-0001.html 


More information about the gpaw-users mailing list