Grid Search Example
This example demonstrates how to run grid search script and interpret the results.
Open grid_search.py and input the Gb information and grid search parameters
Here is the source code of the example script:
Open GB_kinetics.py and input Gb information, displacements recorded earlier and parameters for optimal transport calculations. Start with specifing the parameters required to identify the material and GB such as sigma number, misorientation, inclination, material symbol, and tilt axis.
size_along_gb_period
determines the length of the box along the gb period. The length of the box generated is 2*period*size_along_gb_period.size_along_tilt_axis
determines the length of the box along the tilt axis. The length of the box generated is 2*(CSL length along tilt axis)*size_along_tilt_axis.lattive_Vectors
determine what crystal system is under consideration.
1#---------- Input parameters for GB in question ---------------#
2# Element
3element = "Cu"
4# Sigma value of Gb under consideration
5sigma = 17
6# Misorientation of the Gb
7misorientation = 28.0
8# Inclination of the GB
9inclination = 0.0
10# Lattice parameter of the element (try using the lat par corresponding to the potential you intend to use)
11lattice_parameter = 3.615
12# Tilt axis of GB
13axis = [0, 0, 1]
14# Size of system along the GB period in terms of 2*CSL period
15size_y = 1
16# Size of system along the tilt axis in terms of 2*CSL period
17size_z = 1
18# Lattice Vectors for the crystal system (current implementation is tested for fcc only)
19lattice_vector = np.array([[0.5, 0.5, 0.0],
20 [0.0, 0.5, 0.5],
21 [0.5, 0.0,0.5]])
22
Specify the file that contains bicrystallography data from oilab output in
oilab_output_file
. Current implementation has output files included for 3 tilt axes ([001],[110],[111]), stored inData
folder.output_folder
is the folder in which the output of this program is stored.
1# ------------- Input and output folders (do not change) -------------------- #
2# Location of bicrystallographic data obtained using oILAB
3oilab_output_file = "data/fcc0-10.txt"
4# Location of directory where output is to be stored, the program creates subdirectories
5# for each element, sigma value , misorientation and disconnection mode within it
6output_folder = "output/"
7
Specify locations of external programs needed for running this code. This includes location of lammps installation, mpi installation. Also indicate the full path to the lammps potential file you want to use.
1# ---------- Location of programs needed to run this (change these) ----------------------#
2# Location of directory where lmp_serial and lmp_mpi are stored
3lammps_location = "/opt/homebrew/bin"
4# Location of directory where mpirun is stored
5mpi_location = "/opt/homebrew/bin"
6# Full path to the potential to be used
7lammps_potential = "/opt/homebrew/Cellar/lammps/20240829-update1/share/lammps/potentials/Cu_mishin1.eam.alloy"
8
Specify the parameters that control the scope of gridsearch and number of cores to be used.
num_cores
is the number of cores to be used when calling lammps.step_increments
determines the resolution of the grid used in this grid search.limit
is the highest extend upto which the code explores.
1# Number of cores to be used for grid search simulation
2num_cores = os.cpu_count()-2
3# Increments in displacements to be used for grid search
4# Defines how fine you want the grid to be for the grid search
5step_increments = 1
6# Highest displacement to be used for grid search
7# Defines how large of a space you want to explore in terms of Angstroms
8limit = 1
9# Setting that decides if you want dump files to be created along with the text output
10# 1 --> Create dump files that show GB configs
11# 0 --> Does not create dump files, only the text file that contains displacements and GB energy
12output_setting = 1
13# Setting that allows for user to choose which disconnection mode is to be used
14# Keep this to False as grid search is done for flat GB anyway
15choose_disconnection = False
Finally call the function that calls the required functions.
1# Run
2if __name__ == "__main__":
3 results_folder_path = runGridSearch(sigma,
4 misorientation,
5 inclination,
6 lattice_parameter,
7 lattice_vector,
8 axis,
9 size_y,
10 size_z,
11 element,
12 lammps_location,
13 mpi_location,
14 output_folder,
15 lammps_potential,
16 oilab_output_file,
17 choose_disconnection,
18 num_cores,
19 step_increments,
20 limit,
21 output_setting)
Save and run grid_search.py
$ python3 grid_search.py
Output
The script will generate several outputs, including:
Atomic structure snapshots

Contour plot of Energy landspace with displacements

Record the displacement that gets the system to lowest energy state. This serves as an input to
GB_kinetics.py
script.