Run_LatticeFinder.py - How to run LatticeFinder

In this article, we will look at how to run LatticeFinder. LatticeFinder is run through the Run_LatticeFinder.py python script. You can find examples of Run_LatticeFinder.py files at github.com/GardenGroupUO/LatticeFinder under Examples. Also, you can try out this program by running an example script through a Jupyter notebook. See Examples of running LatticeFinder to get access to examples of running LatticeFinder through this Jupyter notebook!

Running the Run_LatticeFinder.py script

We will explain how the Run_LatticeFinder.py code works by running though the example 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
from LatticeFinder import LatticeFinder_Program
import numpy as np

symbol = 'Au'
lattice_type = 'FaceCenteredCubic'

lattice_constant_parameters = list(np.arange(3.0,3.8,0.1))+list(np.arange(3.8,4.5,0.01))+list(np.arange(4.5,5.01,0.1))

from asap3.Internal.BuiltinPotentials import Gupta
# Parameter sequence: [p, q, a, xi, r0]
r0 = 4.07/(2.0 ** 0.5)
Au_parameters = {'Au': [10.53, 4.30, 0.2197, 1.855, r0]} # Baletto
cutoff = 8
calculator = Gupta(Au_parameters, cutoff=cutoff, debug=False)

size = (16,16,16)

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)

Lets go through each part of the Run_LatticeFinder.py file one by one to understand how to use it.

Input information for LatticeFinder

The following information is required by LatticeFinder:

  • symbol (str.): This is the element that makes up your 2D/3D system.

  • lattice_type (str.): This is the type of lattice that you which to obtain the optimal lattice constants for. See Available crystal lattices in ASE for more information.

  • lattice_constant_parameters (list of floats): These are the values of the lattice constant(s) that you would like to examine. There are two ways that this can be entered into LatticeFinder:

    • If you are locating the optimal lattice constant for a system that only contains one lattice constant, this can be entered in as a np.arange. For example, if you want to scan between a lattice constant of 3.0 Å to 5.0 Å in 0.1 Å segments, lattice_constant_parameters = np.arange(3.0,5.01,0.1). You can also have an irregular list. For example, if you want to look further between 3.8 Å and 4.5 Å in 0.01 segments, you can set lattice_constant_parameters = list(np.arange(3.0,3.8,0.1))+list(np.arange(3.8,4.5,0.01))+list(np.arange(4.5,5.01,0.1))

    • If you are locating the optimal lattice constanta for a system that only contains two lattice constants, this must be entered as a list, where each key is the name of the lattice constant. For example, for a hexagonal closed packed crystal, you can set lattice_constant_parameters = {'a': np.arange(2.0,5.01,0.1), 'c': np.arange(3.0,6.01,0.1)}. The lists for each lattice constant must be regularly spaced; you can not use irregular spacing in LatticeFinder for system with more than one lattice constant.

  • calculator (ase.calculator/str.): The calculator is used to calculate the energy of the 2D/3D system at various lattice constants. See Calculators in ASE for information about how calculators works in ASE.

    • You can also use VASP to perform DFT local optimisations on your clusters. Do this by setting calculator = 'VASP'. See How to perform LatticeFinder with VASP calculations to learn more about how to perform VASP calculations on clusters created using NISP.

    • You can also elect to manually enter in the energies of the clusters. To do this, enter in calculator = 'Manual Mode'. See How to manually enter energy results into LatticeFinder for more information about how to manually enter in energies for clusters into LatticeFinder.

  • size (list of ints): This is the size of the system within a cell. See Usage in Lattices for more infotmation about the size parameter.

  • directions (list of ints): Still figuring this out. See Usage in Lattices for more infotmation about the directions parameter.

  • miller (list of ints): Still figuring this out. See Usage in Lattices for more infotmation about the miller parameter.

Parameters required by LatticeFinder for plotting plots:

  • limit (dict.): This is the limits for plotting your lattice constant plots. For a lattice system with one lattice constant: give as {'c': (c_lower_limit, c_upper_limit)}. For a lattice system with two lattice constant: give as {'c': (c_lower_limit, c_upper_limit), 'a': (a_lower_limit, a_upper_limit)}. If no change to the plotting limits are needed, set this to None. Default: None.

  • make_svg_eps_files (bool): This tag tells LatticeFinder if you want to create svg and eps files of the plots made. Default: True.

Other parameters required by LatticeFinder:

  • no_of_cpus (int): This is the number of cpus that you would like to use to perform calculations of 2D/3D system of various lattice constants.

An example of these parameters in Run_LatticeFinder.py is given below:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
from LatticeFinder import LatticeFinder_Program
import numpy as np

symbol = 'Au'
lattice_type = 'FaceCenteredCubic'

lattice_constant_parameters = list(np.arange(3.0,3.8,0.1))+list(np.arange(3.8,4.5,0.01))+list(np.arange(4.5,5.01,0.1))

from asap3.Internal.BuiltinPotentials import Gupta
# Parameter sequence: [p, q, a, xi, r0]
r0 = 4.07/(2.0 ** 0.5)
Au_parameters = {'Au': [10.53, 4.30, 0.2197, 1.855, r0]} # Baletto
cutoff = 8
calculator = Gupta(Au_parameters, cutoff=cutoff, debug=False)

size = (16,16,16)

directions = []
miller = []

limit = None
make_svg_eps_files = False

no_of_cpus = 1

Run LatticeFinder!

You have got to the end of all the parameter setting stuff. Now on to running NISP. The next part of the Run_LatticeFinder.py script tells NISP to run. This is written as follows in the Run_LatticeFinder.py:

26
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)

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.