Sie sind auf Seite 1von 6

Detailed steps illustrating how to use VASP For use in lab: Spring 2012 Original file by Dr.

Rachel Getman, 11/18/2007. Edited for use by Dorrell McCalman 11/09/2009. Edited by Jason Bray 03/26/2012.

Note on VASP usage


The VASP executable that we have available is compiled to run on computers with a specific Linux architecture. You will likely not be able to run this executable on any other computer. Materials that you may find helpful when working through this exercise: The VASP online manual (http://cms.mpi.univie.ac.at/vasp/vasp/vasp.html) VASP Wiki: http://cms.mpi.univie.ac.at/wiki/index.php/The_VASP_Manual The VASP input files for this example bulk calculation can be obtained from the course directory: /afs/crc.nd.edu/user/w/wschnei1/CBE547/Vasp_Lab In the bulk_example directory, you will find the 4 required input files to calculate bulk Platinum. You will also find the Birch-Murnaghan Equation of State fortran fitting script (called murg), a sample murg input file (called fort.2), the vaspgeom script, and a VASP submission script (vaspscript).

Introduction to VASP
VASP, or Vienna ab-initio Simulation Package, is a Density Functional Theory (DFT) package that utilizes a period supercell (periodic boundary condition) code and planewave basis sets. It is developed by the VASP group in the Theoretical Physics Department at the Institute for Materials Physics in Vienna, Austria. Periodic boundary condition, planewave basis set codes are very useful in describing the electronic structure of solid systems and have successfully been applied to propose bulk crystal structures and compute structure lattice parameters. Specifically, these codes are useful in describing metal systems. This exercise walks you through calculating the energy of a bulk metal system.

Developing the VASP input files


Unlike Gaussian, VASP requires four (not just one) input files. These are INCAR, KPOINTS, POSCAR, and POTCAR.

POSCAR
The system geometry goes into the POSCAR file (see the sample files.)

The format of the POSCAR file is as follows: The first line is a title card. Put the atomic symbols of each ion in your structure here. The second line is a scaling constant. For the gas phase calculation it multiplies the unit cell vectors to give the dimensions of the unit cell. For bulk calculations that you will do, it is the lattice constant in Angstroms. The 3rd, 4th, and 5th lines are the unit cell lattice vectors with respect to the Cartesian lattice. They are row vectors. Since the metals you will consider possess fcc (face centered cubic) structures, we can equate our lattice vectors to those of a face centered cubic lattice. New in VASP 5, the 6th line lists the identities of each atom. VASP 5 still accepts the old format without this line, but you will notice this line added in the CONTCAR file. The 7th line (formerly 6th) indicates the number of each type of ion. While the ordering is not important, it is important that it is kept consistent in the POSCAR, POTCAR, and sometimes INCAR files. The 8th line (formerly 7th) allows you to use Selective dynamics, which means that you can choose whether or not to relax each atom in all three lattice directions when performing geometry optimizations. Note: This flag is NOT necessary for the bulk calculation and is omitted. It is important in surface calculations, or otherwise constrained optimizations. Do not leave a blank line when this feature is not being used. Instead, shift all subsequent lines up one so there are no blank lines. The 9th line (formerly 8th) indicates that we are using a Direct lattice (instead of a Cartesian lattice), which means that we are going to give ion positions in fractional coordinates, which are in relation to the lattice specified in lines 3-5 multiplied by the scaling constant in the second line. If the flag Cartesian is used instead of direct then you must give cartesian coordinates. The 10th line (formerly 9th) and beyond give the fractional coordinates of our ions. If the Selective Dynamics flag is included on the 8th line three Ts separated by spaces might be added to the end of each line to tell VASP to relax each ion in all three lattice directions. Three F's would tell VASP to keep those coordinates fixed. A mixture of F and T can also be specified. Note that the coordinates must be ordered according the ordering on the 7th line.

Visualizing your POSCAR file with p4vasp


Just like with Gaussian, it is important to visualize your input and output geometries to ensure that they are reasonable before and after running. To visualize VASP geometries,

we can use a program called p4vasp, which is available on the CRC front end machines (e.g. opteron). To access it, first load the module by typing: module load p4vasp. You may then open a POSCAR file by typing: p4v POSCAR &. To view the structure, click on either the Show or Control buttons. The Control screen allows you to turn on or off the lines showing the unit cell, increase the number of periodic replicas of the unit cell, change the size of the spheres, etc. To view bond lengths, go to the Build screen and select the two atoms whose bond length you are interested in (hold down control to select more than one atom from the list). Then, with the atoms selected, choose Measure from the Structure drop -down menu. Select the distance radio button. Bond lengths must be multiplied by the scale factor given in the POSCAR file (line 2) to get the actual length in angstroms. This is not possible when there is only 1 atom in the unit cell.

KPOINTS
The k-points grid or generation scheme goes into the KPOINTS file. k-points, very basically, relate to the reciprocal lattice of the supercell. For our purposes: You want to have similar densities of k-points along all reciprocal dimensions. Since reciprocal dimensions are inversely proportional to real dimensions, this means that as your supercell size increases, your reciprocal lattice decreases, and thus the number of necessary k-points decreases. For small molecules and single atoms a k-point mesh of 1x1x1 is sufficient. The first thing you should do when starting calculations on a new supercell is converge the k-point grid. Once you have converged this grid, you can use it on all calculations that use the same supercell and (for the most part) structure. The KPOINTS file is set up to tell VASP to use a Monkhorst-Pack generation scheme. This is a fine scheme to use. Therefore, unless you want to change it, the only editing of the k-points file youll need to do is to change the grid dimensions (e.g. from 1x1x1to 10x10x10 etc.) When changing grid dimensions, make sure to alter dimensions on line 4 and not just the title card on line 1, which is not actually used by the program.

INCAR
The INCAR file contains information about computational parameters. Your files include several parameters and comments about them in the file. Note some of the values you can control: 1) The optimization algorithm for both the electronic and geometric convergence IALGO & ALGO (electronic), IBRION (geometric)

2) The kinetic energy cut-off for the valence electrons (really the highest energy plane wave to include) ENCUT 3) The electron smearing method and parameter ISMEAR, SIGMA 4) The maximum number of electronic and geometric iterations to take NELM (electronic), NSW (geometric) 5) Convergence criteria for the electronic and geometric relaxation EDIFF (electronic), EDIFFG (geometric) Most of these parameters, as well as others, will affect the electronic structure and energy outcome. Typically when you start doing calculations, it is wise to learn how each of these parameters affects your calculation and, to the extent possible, converge each one.

POTCAR
The POTCAR file contains the core potentials for each ion in the calculation. In some cases these are called pseudopotentials, but this term is a subset of core potentials. Core potentials are a topic of their own, but basically, they give the potential felt by the valence electrons from the ion nucleus and core electrons. The POTCAR file describes to VASP how to treat this potential when describing the motions of the valence electrons. The core potentials you are using (called projector augmented wave or PAW) are optimized for each atom and empirically based. In addition to providing the core potential, the POTCAR file also tells VASP how to describe the motions of the valence electrons, that is, it defines the electron exchange and correlation functional. The sample POTCAR for Pt uses the PW91 implementation of the GGA, or generalized gradient approximation, which treats exchange and correlation as a function of the electron local density and its local gradient. Two important things to note about the POTCAR file are: 1. It must contain an individual POTCAR piece for each ion 2. The individual POTCARs must be in the same order as the ions in the POSCAR For bulk Pt, the POTCAR contains only one piece, but when dealing with several types of atoms we first have get the POTCAR file for each and then concatenate them in to a single file. This can be done by using the cat command: cat First_POTCAR Second_POTCAR Third_POTCAR etc. > POTCAR Individual POTCAR files are located at /afs/crc.nd.edu/user/w/wschnei1/Group/POTCARs/. You will not have access to this directory, so in general, to obtain one, ask one of the TAs or Dr. Schneider to provide the needed files. There is a subdirectory for each type of core potential (PAW, USPP, LDA, GGA-PW91, GGA-PBE, etc.) within those additional directories for each element. In each subdirectory is a file called POTCAR.Z, which is a zipped POTCAR file. You would

generally copy that file to somewhere in your file space, then unzip it with the command gunzip. Its a good idea to rename the unzipped file, for example POTCAR_Pt, so that you can easily distinguish it, and so that POTCARs do not get overwritten.

Running VASP
To run VASP from the CRC front end machines, simply load the VASP module: module load vasp Put your INCAR, KPOINTS, POSCAR, and POTCAR files into some directory (name the directory something intelligent to help you remember what it is) by themselves. Move (cd) into that directory, and then type the following command at the command prompt: vasp This will run the code directly on the front end machine using a single processor core, which is generally not advisable for jobs that take more than a few seconds. To run on the supercomputers, you must prepare a submission script. An example script is available at: /afs/crc.nd.edu/user/w/wschnei1/CBE547/Vasp_Lab/vaspscript Before running this script, open it and change the name of the job (#$ - N jobname) and your email address (#$ -M youremail). This script does about the same thing as running directly on the front end, except that it calls VASP in parallel, which allows it to run faster on multiple cores. To submit the job, type: qsub vaspscript To check the status of your jobs, type: qstat u yournetid The bulk Pt calculation should finish in less than a minute. When its done, youll get several output files in your directory. Some of the key files are the OUTCAR file, which contains information about the electronic and geometric convergence, the CHGCAR file which gives the final charge density, and the CONTCAR file, which gives the final geometry of the supercell. You should check to see that all the electronic structures for each geometry step converged and that the geometry converged. To check the latter, you can run the vaspgeom script (available in the Vasp_Lab directory) on your OUTCAR file (simply type vaspgeom while in the same directory as the OUTCAR). You should also check your final geometry by visualizing your CONTCAR. Note that several of the VASP output files, e.g. CHG, CHGCAR, OUTCAR, vasprun.xml, WAVECAR, can have very large file sizes. You can tell VASP whether or not print these files by specifying in the INCAR.

Converging the bulk lattice parameter (optional)


One thing we might be interested in is finding the optimal bulk lattice constant for a particular material. You can run the bulk calculation several times with different lattice constant in order to find the optimized lattice constant. To do this, simply change the value of the scale factor (line 2) in the POSCAR and then re-run the calculation. You

should run each new calculation in a different directory so that you dont constantly overwrite files associated with older runs. Youll of course want to compare results from different runs, so youll need all your files! Once you have run 4 or 5 calculations, you might plot the results of energy vs. lattice constant to see where the energy appears to be near a minimum. Then continue running calculations at evenly spaced intervals of the lattice constant near this minimum. You then fit the energy vs. lattice constant results to some functional form to find the true minimum. You could use a quadratic fit, which might give a reasonable approximation of the minimum. An alternative is to use a functional form designed specifically for energy surfaces of this shape, the Birch-Murnaghan equation of state. You can fit your data to this function using the murg script (in the Vasp_Lab directory). The murg fitting script is executed on an appropriate fort.2 input file. An example of this file is given in the Vasp_Lab directory. The fort.2 file is set up as follows: The 1st line is a guess of the lattice constant (in a.u. (bohr) but note that VASP works with lengths in Angstroms) that minimizes the electronic energy of your structure. The 2nd through 4th lines are the lattice vectors of your supercell (same as in the POSCAR). Edit as necessary. The 5th line is an integer, N, which tells murg how many lattice constant/energy combinations you are going to enter. The 6th through [N+5]th lines give your trial lattice constants (in a.u.) and resultant supercell energies (in Rydberg, so you must convert from eV). The last line of fort.2 is a guess of the minimum supercell energy that corresponds to the lattice constant in the 1st line. Once you have created fort.2, simply run murg in the directory where fort.2 is located. (If it doesnt work, you may need to change its permissions so that you can execute it if it is not executable: chmod +x murg) It will prompt you to enter in a volume, amin, amax. For volume, enter in a guess as to the energy minimizing volume (corresponds to your guess of the energy minimizing lattice constant). For amin and amax, enter in the minimum and maximum lattice guesses to use in the Birch-Murnaghan fit. After that, the script will complete, and youll get two output files: fort.10 and fort.11. The former summarizes your fit parameters, including the optimized lattice parameter, at the bottom of the file. You could use these parameters along with the Birch-Murnaghan EOS to plot the electronic energy of your metal as a function of lattice parameter. The fort.11 file contains values of the energy and lattice constant corresponding to the best fit, which you could use to plot the results. Once you get the optimized lattice parameter, you should run VASP on your supercell at that lattice parameter to get your optimal bulk electronic energy and ensure the energy is lower than your other attempts.

Das könnte Ihnen auch gefallen