[gpaw-users] Dipole correction breaks restart
Ask Hjorth Larsen
askhl at fysik.dtu.dk
Thu Oct 14 13:09:15 CEST 2010
Hi Andy
On Wed, 13 Oct 2010, Andrew Peterson wrote:
> Hi again,
>
> I've discovered that implementing the dipole correction breaks the
> restart function of the GPAW calculator. I've attached a simple script
> that has a dipole correction. Trying to use restart('calc.gpw') on the
> output file results in the below error. (This doesn't happen on the same
> script if the dipole parts are removed.)
>
> thanks,
> Andy
>
> ===== Error message from gpaw.restart:
> >>> from gpaw import restart
> >>> atoms, calc = restart('calc.gpw')
>
> ___ ___ ___ _ _ _
> | | |_ | | | |
> | | | | | . | | | |
> |__ | _|___|_____| 0.7.6383
> |___|_|
>
> User: aap at suncat0073
> Date: Wed Oct 13 15:31:34 2010
> Arch: x86_64
> Pid: 6584
> Dir: /afs/slac/g/suncat/vol1/gpawv3/install/lib64/python/gpaw
> ase: /afs/slac/g/suncat/vol1/gpawv3/ase/ase version: 3.4.1
> numpy:
> /afs/slac/g/suncat/vol1/gpawv3/numpy-1.4.1/build/lib.linux-x86_64-2.4/numpy
> units: Angstrom and eV
> Memory usage: 23.12 MB
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> File
> "/afs/slac/g/suncat/vol1/gpawv3/install/lib64/python/gpaw/__init__.py",
> line 261, in restart
> calc = Class(filename, **kwargs)
> File
> "/afs/slac/g/suncat/vol1/gpawv3/install/lib64/python/gpaw/paw.py", line
> 116, in __init__
> self.initialize()
> File
> "/afs/slac/g/suncat/vol1/gpawv3/install/lib64/python/gpaw/paw.py", line
> 580, in initialize
> par.external)
> File
> "/afs/slac/g/suncat/vol1/gpawv3/install/lib64/python/gpaw/hamiltonian.py",
> line 69, in __init__
> self.poisson.set_grid_descriptor(finegd)
> File
> "/afs/slac/g/suncat/vol1/gpawv3/install/lib64/python/gpaw/poisson.py",
> line 52, in set_grid_descriptor
> self.operators = [Laplace(gd, scale, self.nn, allocate=False)]
> File
> "/afs/slac/g/suncat/vol1/gpawv3/install/lib64/python/gpaw/fd_operators.py",
> line 154, in Laplace
> return NewGUCLaplace(gd, scale, n, dtype, allocate)
> File
> "/afs/slac/g/suncat/vol1/gpawv3/install/lib64/python/gpaw/fd_operators.py",
> line 270, in __init__
> coefs = [laplace[n][0] * a_d.sum()]
> IndexError: list index out of range
>
>
>
> ===== Input script:
> #!/usr/bin/env python
>
> from ase.data.molecules import molecule
> from ase.visualize import view
>
> from gpaw import GPAW
> from gpaw.poisson import PoissonSolver
> from gpaw.dipole_correction import DipoleCorrectionPoissonSolver
>
> atoms = molecule('H2O')
> atoms.set_cell([12.,12.,12.])
> atoms.center()
>
> p = PoissonSolver()
> calc = GPAW(txt='H2O.txt',
> poissonsolver=DipoleCorrectionPoissonSolver(p, 2),
> )
>
> atoms.set_calculator(calc)
>
> energy = atoms.get_potential_energy()
>
> calc.write('calc.gpw')
>
>
> _______________________________________________
> gpaw-users mailing list
> gpaw-users at listserv.fysik.dtu.dk
> https://listserv.fysik.dtu.dk/mailman/listinfo/gpaw-users
>
Yes, the restart code is not aware of dipole corrections. You're more
than welcome to fix it. Another possibility is to supply a new Poisson
solver when restarting:
calc = GPAW(filename, poissonsolver=OtherPoissonSolver())
By the way, it would probably be wise to verify that e.g. the dipole
moment of water corresponds to the correct shift in potential for a dipole
moment of that size. (I'll keep suggesting this until someone actually
does it :))
Regards
Ask
More information about the gpaw-users
mailing list