How to perform LatticeFinder with VASP calculations

In this article, we will look at how to run LatticeFinder where VASP is used to calculate the energies of systems at various lattice constants. The Run_LatticeFinder.py python script that is used is the same as shown previously in Run_LatticeFinder.py - How to run LatticeFinder, but with an extra component. An example of a Run_LatticeFinder.py python script that uses VASP is shown below:

Run_LatticeFinder.py
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
from LatticeFinder import LatticeFinder_Program
import numpy as np

symbol = 'Au'
lattice_type = 'FaceCenteredCubic'

lattice_constant_parameters = (2.0,6.0,0.1)

calculator = 'VASP'
slurm_information = {}
slurm_information['project'] = 'uoo02568'
slurm_information['time'] = '2:00:00'
slurm_information['nodes'] = 1
slurm_information['ntasks_per_node'] = 8
slurm_information['mem-per-cpu'] = '3G'
slurm_information['partition'] = 'large'
slurm_information['email'] = 'geoffreywealslurmnotifications@gmail.com'
slurm_information['python_version'] = 'Python/3.6.3-gimkl-2017a'
slurm_information['vasp_version'] = 'VASP/5.4.4-intel-2017a'
slurm_information['vasp_execution'] = 'vasp_std'

slurm_information['Make individual or packet submitSL files'] = 'packets'
slurm_information['Number of VASP calculations to run per packet'] = 25

size=(1,1,1)

directions = []
miller = []

limit = None
make_svg_eps_files = False

no_of_cpus = 1

LatticeFinder_Program(symbol, lattice_type, lattice_constant_parameters, calculator, size=size, directions=directions, miller=miller, limit=limit, make_svg_eps_files=make_svg_eps_files, no_of_cpus=no_of_cpus, slurm_information=slurm_information)

The slurm_information parameter

The extra parameter that is included when performing VASP calculations is the slurm_information parameter, which is a dictionary that holds all the information that is needed to create the submit.sl files required to submit VASP calculations to slurm. The following information is needed in the 'slurm_information' dictionary:

  • project (str.): This is the name of the project that you want to submit this job to.

  • time (str.): This is the amount of time you want to give to your slurm jobs, given as 'HH:MM:SS', where 'HH:MM:SS' is the hours, minutes, and seconds you want to give to a job.

  • nodes (str.): This is the number of nodes that you would like to give to a job.

  • ntasks_per_node (str./int): This is the number of cpus that you give to a job.

  • mem-per-cpu (str.): This is the amount of momeory you are giving to your job per cpu

The following can also be included in 'slurm_information' dictionary, but these are default value for these if you do not give a value for them.

  • partition (str.): This is the partition that is given to your job. See Mahuika Slurm Partitions for more information about partition on NeSI (Default: 'large').

  • email (str.): This is the email address you would like notifications about your slurm job to be sent to (Default: '').

  • vasp_version (str.): This is the version of VASP that you would like to load in on slurm (Default: 'VASP/5.4.4-intel-2017a').

  • vasp_execution (str.): This is the name of the vasp program that you execute (Default: 'vasp_std').

Commonly in VASP you will only need to use a (1,1,1) cell since VASP performs calculations with periodic boundary conditions. Because of this, you will be performing many small VASP calculations. As you may be performing many short VASP calculations, it is possible to break the slurm management system as slurm can get confused when its accepts many jobs at once which then finish very quickly. NeSI (support.nesi.org.nz) suggest that you should instead run packets of short VASP calculation in serial to minimise this happening. In this case, there are two additional setting to give the slurm_information dictionary:

  • Make individual or packet submitSL files (str.): Determines how jobs are submitted to slurm. If 'individual': a slurm.sl file is created for each VASP job to run; if 'packet': Several individual VASP jobs will be packaged together and run one after the other (serial) in slurm (Default: 'individual').

  • Number of VASP calculations to run per packet (int): If you choose slurm_information['Make individual or packet submitSL files'] = 'packets', this is the number of individual VASP jobs that will be packaged together and run one after the other (serial) in slurm.

See an example of the slurm_information parameter below:

Run_LatticeFinder.py
10
11
12
13
14
15
16
17
18
19
20
21
22
23
slurm_information = {}
slurm_information['project'] = 'uoo02568'
slurm_information['time'] = '2:00:00'
slurm_information['nodes'] = 1
slurm_information['ntasks_per_node'] = 8
slurm_information['mem-per-cpu'] = '3G'
slurm_information['partition'] = 'large'
slurm_information['email'] = 'geoffreywealslurmnotifications@gmail.com'
slurm_information['python_version'] = 'Python/3.6.3-gimkl-2017a'
slurm_information['vasp_version'] = 'VASP/5.4.4-intel-2017a'
slurm_information['vasp_execution'] = 'vasp_std'

slurm_information['Make individual or packet submitSL files'] = 'packets'
slurm_information['Number of VASP calculations to run per packet'] = 25

Make sure that you include 'slurm_information' in the final line of Run_LatticeFinder.py in LatticeFinder_Program. See the following code before to see this:

Run_LatticeFinder.py
35
LatticeFinder_Program(symbol, lattice_type, lattice_constant_parameters, calculator, size=size, directions=directions, miller=miller, limit=limit, make_svg_eps_files=make_svg_eps_files, no_of_cpus=no_of_cpus, slurm_information=slurm_information)

Other files that you will need

You will also need to give LatticeFinder some other files that are needed by VASP to perform calculations. In the same place where you place your Run_LatticeFinder.py file, you want to create another folder called VASP_Files. In this VASP_Files folder you want to include the following files:

  • POTCAR: This is the file that contains the information required to locally optimise a nanocluster with DFT using a certain functional.

  • KPOINTS: This contain the information used to specify the Bloch vectors (k-points) that will be used to sample the Brillouin zone in your calculation.

  • INCAR: This contains all the setting that are required by VASP to perform calculations. Note that in the INCAR you must set NSW = 0. This prevents VASP from performing a local optimisation which you do not need to do in this program.

These files will be copied by LatticeFinder into each nanocluster folder. See an example of a setup of LatticeFinder for VASP here.

What to do after you have run LatticeFinder

After you run LatticeFinder, this will create a new folder called VASP_Systems, which contains subfolders of your system at all the lattice constants that you want to examine. Each subfolder will contain a POSCAR, INCAR, POTCAR, KPOINTS, and submit.sl that are needed by VASP to perform DFT calculations. Each system is ready to be calculated by VASP.

You will find that there are many systems are created by LatticeFinder. To submit all of these system to slurm to calculate energies for by VASP, you can execute the program called Run_LatticeFinder_submitSL_slurm.py which will execute all of DFT VASP jobs in slurm. To run this script, type Run_submitSL_slurm.py into the terminal inside of your newly created VASP_Systems folder.

Output files that are created by LatticeFinder

The LatticeFinder program will create a number of plots and text documents when it is run. See Examples of Running LatticeFinder with Run_LatticeFinder.py and LatticeFinder examples here to see the types of plots and text documents that LatticeFinder will make.