jkitchin / vasp

New ASE compliant Python interface to VASP
122 stars 58 forks source link

Atom sorting issue #8

Closed jboes closed 8 years ago

jboes commented 8 years ago

There seems to be a sorting related issue with the following example:

from vasp import Vasp
from ase.lattice.surface import fcc111

# Create surface image
atoms = fcc111('Cu', size=(3, 3, 5), vacuum=6.0, a=3.628)
atoms[40].symbol = 'Pd'

calc = Vasp('impurity-calc',
        xc='PBE',
        kpts=[2, 2, 1],
        encut=250,
        atoms=atoms)
calc.write_input()

Running the block twice results in the following error:

Traceback (most recent call last):
  File "<stdin>", line 13, in <module>
  File "/home-research/jboes/python/vasp/vasp/vasp.py", line 44, in inner
    return func(self, *args, **kwargs)
  File "/home-research/jboes/python/vasp/vasp/vasp_core.py", line 237, in __init__
    str(label), atoms)
  File "/home-research/jboes/python/vasp/vasp/vasp.py", line 50, in inner
    return self.exception_handler(self, *sys.exc_info())
  File "/home-research/jboes/python/vasp/vasp/vasp.py", line 47, in inner
    return func(self, *args, **kwargs)
  File "/home-research/jboes/python/ase/ase/calculators/calculator.py", line 513, in __init__
    atoms, **kwargs)
  File "/home-research/jboes/python/vasp/vasp/vasp.py", line 50, in inner
    return self.exception_handler(self, *sys.exc_info())
  File "/home-research/jboes/python/vasp/vasp/vasp.py", line 47, in inner
    return func(self, *args, **kwargs)
  File "/home-research/jboes/python/ase/ase/calculators/calculator.py", line 207, in __init__
    raise RuntimeError('Atoms not compatible with file')
RuntimeError: Atoms not compatible with file

The Pd in VASPSUM ends up as index 43, rather than 40 as assigned in the code block.

jkitchin commented 8 years ago

ug... tricky.. this isn't fixed yet.

jkitchin commented 8 years ago

This one is bad. I bet this is why there were two lists in ase-sort.dat. One for resorting vasp, and one for resorting atoms. I think I have fixed it for now (by reading the atoms from the ase-db. Jake Boes for the win on that suggestion.) I have some residual concerns though that the atoms are read too many times from different places, e.g. in read_results also. I think the DB.db file should be up to date since we rewrite it after a calculation is done with the results from vasprun.xml

this needs some thorough testing.

jboes commented 8 years ago

I believe this is fixed now.