[ase-users] VASP(restart=True) spin-polarization issue
Joel Varley
jvarley at stanford.edu
Tue Aug 9 18:40:30 CEST 2011
Hi,
I just wanted to notify the admins of a small bug in how the
vasp.spinpol is defined in the vasp calculator (vasp.py)
For a non-spin-polarized calculation, if you want to read the OUTCAR:
>>> from ase import *
>>> from ase.calculators.vasp import *
>>> calc = Vasp(restart=True)
>>> calc.get_number_of_spins()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/Users/jvarley/ase/ase/calculators/vasp.py", line 652, in
get_number_of_spins
return 1 + int(self.spinpol)
TypeError: int() argument must be a string or a number, not 'NoneType
this is a result of self.spinpol being defined poorly in the vasp.py
(it assumes magnetic moments are already defined)
below is a suggestion for a more robust definition if the Vasp
calculator is getting the info from the OUTCAR (like with
restart=True). I just made it similar to how other parameters are
defined in the vasp.py:
for line in open('OUTCAR'):
if line.find('spin polarized calculation?') != -1:
self.nspins = int(line.split('=')[1].split()[0])
Joel
--
Joel Varley
Department of Chemical Engineering
Stanford University
Stanford, CA 94305-5025
Keck 261
Ph. (650) 725-9176
e-mail: jvarley at stanford.edu
More information about the ase-users
mailing list