[ase-users] VASP module in ASE
Jonas Björk
j.bjork at liverpool.ac.uk
Tue Sep 2 09:34:14 CEST 2008
Hi,
Jussi Enkovaara wrote:
> Jonas Björk wrote:
> >> Let's say I want to do 256 water molecules, and the order is
> >> HHOHHOHHOHHO ..., then I will also get a HUGE POTCAR file. I think it
> >> would be best if the ASE Vasp interface could be intelligent and reorder
> >> things so that the POTCAR file only has two setups.
> >
> > I agree, lets do it this way.
>
> Hi,
> if you look how I was constructing POSCAR and POTCAR (svn revision 508) one should
> get in the above example POTCAR with only two setups:
>
> First I was construcytig a dictionary of atomic species, where the key is the
> atomic symbol and value the number of this species:
>
> # Determine the number of atomic species
> self.symbols = {}
> for atom in atoms:
> symbol = atom.get_symbol()
> if not self.symbols.has_key(symbol):
> self.symbols[symbol] = 1
> else:
> self.symbols[symbol] += 1
>
>
> POTCAR can then be constructed just with loop over symbols:
>
> for symbol in self.symbols:
> try:
> name = symbol + '_' + p['setups'][symbol]
> except (TypeError, KeyError):
> name = symbol
> name += '/POTCAR.Z'
> found = False
> for path in pppaths:
> filename = join(path, name)
> if isfile(filename) or islink(filename):
> found = True
> self.ppp_list.append(filename)
> break
> if not found:
> raise RuntimeError('No pseudopotential for %s!' % symbol)
>
>
> After writing the unit cell information in POSCAR, the number of atomic species can
> be written:
>
> for nspecies in self.symbols.values():
> poscar.write('%i ' % nspecies)
> poscar.write('\n')
>
> and the actual positions:
>
> for symbol in self.symbols.keys():
> mask = [asymbol == symbol for asymbol in self.all_symbols]
> ind = npy.asarray(mask, bool)
> for pos in self.positions[ind]:
> poscar.write('%.14f %.14f %.14f\n' % tuple(pos))
>
> I do not know if this is the optimal way, but it seemed to be working.
I think the main problem then is to know how the Atoms object is ordered
relative to the POSCAR file, because we want to assign the forces from
Vasp to the right atoms in ASE. However, I think it is possible to solve
this by using the argsort() method in NumPy.
Jonas
>
> Best regards,
> Jussi
More information about the ase-users
mailing list