[ase-users] VASP module in ASE

Jens Jørgen Mortensen jensj at fysik.dtu.dk
Mon Sep 1 17:18:09 CEST 2008


>From Jonas Björk:

In Vasp when writing out the k-points explicitly you can decide whether
writing them in Cartesian coordinates (units of 2pi/a) or in reciprocal
coordinates (units b1, b2, b3). What is the standard in ASE?

> +
> +        # How can this ever work?  In ASE, we don't assume that the
> +        # atoms are ordered in any way?
> +        atom_num=[[num[0],1]]                 ???
> +        for m in range(1,len(num)):           ???
> +            if num[m]==atom_num[-1][0]:       ???
> +                atom_num[-1][1]+=1            ???
> +            else:                             ???
> +                atom_num.append([num[m], 1])  ???
> 
> ??? Here you are assuming that the atoms are ordered after atomic
number
> - right?  We should fix that!

I am not assuming anything about the ordering of the atoms here, at
least not if I understand ASE right:


First I get a list of the chemical symbols of each atom. I should change
the name 'num' to 'symbols' or something else more appropriate. 

        num = atoms.get_chemical_symbols()

        # How can this ever work?  In ASE, we don't assume that the
        # atoms are ordered in any way?

Then count how many atoms of the SAME species in a row in the Atoms
list. 

For example if the get_chemical_symbols() gives a list like this:

['C', 'C', 'C', 'H', 'H', 'H', 'C', 'C', 'O']
the atom_num will take the form:

[['C', 6], ['H', 3], ['C', 2], ['O',1]]

and the first rows in the Vasp atomic position file (POSCAR) will look
like this:

  C H C O
    1.0
    1.0 0 0
    0 1.0 0
    0 0 1.0 
  6 3 2 1

The first row is just a label, standard is to write out the atomic
species here (makes it possible for e.g. VMD to figure out the atomic
species from just the POSCAR file).
The next four rows has the unit cell vectors and a scaling parameter.
The sixth row has information about the number of atomic species of each
kind. In this case, first there will be 6 atoms of the same kind,
followed by 3 atoms of same kind, 2 atoms of same kind and 1 single
atom.

When Vasp runs it will look in what order the POTCAR file is built to
figure out which pseudo potential should be assigned to which group of
atoms. In this case it will build the POTCAR file by joining a carbon
POTCAR file, hydrogen POTCAR file, carbon (again), oxygen. With this
order. 

It would be possible to build the POSCAR and POTCAR file only using the
get_chemical_symbols() and assign a pseudo potential to each individual
atom. But what we would end up with is a really messy POSCAR file with a
number 1 for each atom in the sixth row, and an unnecessary large POTCAR
file. 

So what the following does is to go through the Atoms list, if the
chemical symbol of the current atom is the same as previous atom, add 1
to this 'group' of atoms, otherwise create a new 'group' with value 1. 

        atom_num=[[num[0],1]]                 ???
        for m in range(1,len(num)):           ???
            if num[m]==atom_num[-1][0]:       ???
                atom_num[-1][1]+=1            ???
            else:                             ???
                atom_num.append([num[m], 1])  ???

Maybe it is more abvious what it does if ot looks like:

symbols = atoms.get_chemical_symbols()
atom_num=[[symbols[0],1]]
for m in range(1,len(num)): 
    if symbols[m]==symbols[m-1]:
        atoms_num[-1][1]+=1
    else:
        atoms_num.append([symbols[m], 1])

which does exactly the same thing. I hope this makes things clearer what
is going on.

Best regards,
Jonas





More information about the ase-users mailing list