Easy and efficient way of creating surface/slabs for pwscf/quantum espresso
Easy and efficient way of creating surface/slabs for pwscf/quantum espresso
There are a few ways of creating surfaces for pwscf/quantum espresso input files. It is easy to write coordinates for surface manually, provided you know crystallography. Writing unusual surfaces may be difficult. Hence there one easy way of creating surfaces for beginners.
Atomic Simulation Environment (ASE) is a toolbox consisting of several tools and python modules can be used for setting up, manipulating, running, visualizing and analyzing atomistic simulations. First of all we need to set up ASE environment, the code is freely available under the GNU LGPL license. Install the ASE as mentioned in the ASE home page and run all the tests.
To create CuZn alloy 211 surface I will use https://wiki.fysik.dtu.dk/ase/ase/surface.html?highlight=surface#ase.lattice.surface web-page as a reference and you can find more details for creating various surfaces there. And here I will only emphasis on extracting the atomic coordinates and lattice information required for pwscf/quantum espresso.
After installing python-ase, all the following command should be executed from python terminal. After that, your terminal will look similar to the one mentioned below.
Import few modules necessary to build and visualize the create surface.
Type the following command not necessarily in the following order. And Define the lattice parameter of Cu from experiment, i.e, 3.61 A
from ase.lattice.surface import surface
from ase.lattice import bulk
from ase import Atoms
from ase.visualize import view
Define the crystal environment as follows
CuZnCu2=Atoms('CuZnCu2',
scaled_positions=[(0, 0, 0),
(0.5, 0.5, 0),
(0.5, 0, 0.5),
(0, 0.5, 0.5)],
cell=[a, a, a],
pbc=True)
create the surface of required CuZn alloy surface,
s1=surface(CuZnCu2, (2, 1, 1), 9)
This code creates the alloy surface in 211 facet with 9 layers of atoms, you can change this according to your requirement. Here Cu:Zn is 75:25, by changing the atom symbol sequence you can change the structure of the alloy. You can change the alloy composition by changing the symbols in the Atoms in the above section. In case you need Cu:Zn then change the Atoms ('CuZn') if you need Cu:Zn 25:75, give zinc lattice parameter instead of Cu. You can also optimize the lattice parameter in pwscf.
Visualize the created surface by
view(s1)
You will see a window like this, this window is called ase-gui
You can change the viewing direction by right mouse click and dragging it. There are lots of options here, you can check in case you require from the menu at the top.
For pwscf/quantum espresso, we need atomic coordinates and latices distance. To get this, save the file in abc.xyz format and another in abc.py format. You can give any name other than abc.
.xyz file consists of atomic coordinates required for pwscf input file, copy and paste to your input file. In the .py file, we have lattice information in angstroms convert this to bhor bohr and use in CELL_PARAMETERS of the input file. If you need the vacuum in specific direction increases the lattice in the required direction without changing the atomic coordinates.
To create surface of any metals
Import few modules necessary to build and visualize the create surface.
Type the following command not necessarily in the following order as mentioned before.
from ase.lattice.surface import surface
from ase.lattice import bulk
from ase import Atoms
from ase.visualize import view
Instead of defining the lattice parameter and crystal environment you can type
s1 = surface('Au', (2, 1, 1), 9)
Here it will produce the surface of gold in 211 direction with 9 layers. If you want Zn in 111 direction then just replace Au with Zn and 211 with 111, ASE will automatically take the experimental lattice parameter
Visualize and export the required data as before.





Nice. Thank you.
ReplyDeleteBut, you can change the 'bhor' to 'bohr' ( at about 6th page)
Thanks for reviewing, updated
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteI found the answer after a little searching... For Cu (211)...
ReplyDeletefrom ase.lattice.surface import surface
from ase.lattice import bulk
from ase.visualize import view
Custep = bulk('Cu', 'fcc', a=3.655,cubic=True)
s1 = surface(Custep, (2, 1, 1), 7)
view(s1)