# calc_dislocation_periodic_array.py

## Calculation script functions

anneal_info(temperature=0.0, runsteps=None, randomseed=None, units='metal')

Generates LAMMPS commands for thermo anneal.

Parameters
• temperature (float, optional) – The temperature to relax at (default is 0.0).

• randomseed (int or None, optional) – Random number seed used by LAMMPS in creating velocities and with the Langevin thermostat. (Default is None which will select a random int between 1 and 900000000.)

• units (str, optional) – The LAMMPS units style to use (default is ‘metal’).

Returns

The generated LAMMPS input lines for performing a dynamic relax. Will be ‘’ if temperature==0.0.

Return type

str

disl_relax(lammps_command, system, potential, mpi_command=None, annealtemp=0.0, annealsteps=None, randomseed=None, etol=0.0, ftol=1e-06, maxiter=10000, maxeval=100000, dmax=0.01)

Sets up and runs the disl_relax.in LAMMPS script for relaxing a dislocation monopole system.

Parameters
• lammps_command (str) – Command for running LAMMPS.

• system (atomman.System) – The system to perform the calculation on.

• potential (atomman.lammps.Potential) – The LAMMPS implemented potential to use.

• mpi_command (str, optional) – The MPI command for running LAMMPS in parallel. If not given, LAMMPS will run serially.

• annealtemp (float, optional) – The temperature to perform a dynamic relaxation at. Default is 0.0, which will skip the dynamic relaxation.

• annealsteps (int, optional) – The number of time steps to run the dynamic relaxation for. Default is None, which will run for 10000 steps if annealtemp is not 0.0.

• randomseed (int or None, optional) – Random number seed used by LAMMPS in creating velocities and with the Langevin thermostat. Default is None which will select a random int between 1 and 900000000.

• etol (float, optional) – The energy tolerance for the structure minimization. This value is unitless. Default is 0.0.

• ftol (float, optional) – The force tolerance for the structure minimization. This value is in units of force. Default is 0.0.

• maxiter (int, optional) – The maximum number of minimization iterations to use default is 10000.

• maxeval (int, optional) – The maximum number of minimization evaluations to use default is 100000.

• dmax (float, optional) – The maximum distance in length units that any atom is allowed to relax in any direction during a single minimization iteration default is 0.01 Angstroms.

Returns

Dictionary of results consisting of keys:

• ’logfile’ (str) - The name of the LAMMPS log file.

• ’dumpfile’ (str) - The name of the LAMMPS dump file for the relaxed system.

• ’E_total’ (float) - The total potential energy for the relaxed system.

Return type

dict

dislocationarray(lammps_command, ucell, potential, C, burgers, ξ_uvw, slip_hkl, mpi_command=None, m=[0, 1, 0], n=[0, 0, 1], sizemults=None, amin=None, bmin=None, cmin=None, shift=None, shiftscale=False, shiftindex=None, tol=1e-08, etol=0.0, ftol=0.0, maxiter=10000, maxeval=100000, dmax=0.01, annealtemp=0.0, annealsteps=None, randomseed=None, boundaryshape='cylinder', boundarywidth=0.0, boundaryscale=False, cutoff=None, linear=False)

Creates and relaxes a dislocation monopole system.

Parameters
• lammps_command (str) – Command for running LAMMPS.

• ucell (atomman.System) – The unit cell to use as the seed for generating the dislocation monopole system.

• potential (atomman.lammps.Potential) – The LAMMPS implemented potential to use.

• C (atomman.ElasticConstants) – The elastic constants associated with the bulk crystal structure for ucell.

• burgers (array-like object) – The dislocation’s Burgers vector given as a Miller or Miller-Bravais vector relative to ucell.

• ξ_uvw (array-like object) – The dislocation’s line direction given as a Miller or Miller-Bravais vector relative to ucell.

• slip_hkl (array-like object) – The dislocation’s slip plane given as a Miller or Miller-Bravais plane relative to ucell.

• mpi_command (str or None, optional) – The MPI command for running LAMMPS in parallel. If not given, LAMMPS will run serially.

• m (array-like object, optional) – The m unit vector for the dislocation solution. m, n, and ξ (dislocation line) should be right-hand orthogonal. Default value is [0,1,0] (y-axis).

• n (array-like object, optional) – The n unit vector for the dislocation solution. m, n, and ξ (dislocation line) should be right-hand orthogonal. Default value is [0,0,1] (z-axis). n is normal to the dislocation slip plane.

• sizemults (tuple, optional) – The size multipliers to use when generating the system. Values are limited to being positive integers. The multipliers for the two non-periodic directions must be even. If not given, the default multipliers will be 2 for the non-periodic directions and 1 for the periodic direction.

• amin (float, optional) – A minimum thickness to use for the a box vector direction of the final system. Default value is 0.0. For the non-periodic directions, the resulting vector multiplier will be even. If both amin and sizemults is given, then the larger multiplier for the two will be used.

• bmin (float, optional) – A minimum thickness to use for the b box vector direction of the final system. Default value is 0.0. For the non-periodic directions, the resulting vector multiplier will be even. If both bmin and sizemults is given, then the larger multiplier for the two will be used.

• cmin (float, optional) – A minimum thickness to use for the c box vector direction of the final system. Default value is 0.0. For the non-periodic directions, the resulting vector multiplier will be even. If both cmin and sizemults is given, then the larger multiplier for the two will be used.

• shift (float, optional) – A rigid body shift to apply to the rotated cell prior to inserting the dislocation. Should be selected such that the ideal slip plane does not correspond to any atomic planes. Is taken as absolute if shiftscale is False, or relative to the rotated cell’s box vectors if shiftscale is True. Cannot be given with shiftindex. If neither shift nor shiftindex is given then shiftindex = 0 is used.

• shiftindex (float, optional) – The index of the identified optimum shifts based on the rotated cell to use. Different values allow for the selection of different atomic planes neighboring the slip plane. Note that shiftindex values only apply shifts normal to the slip plane; best shifts for non-planar dislocations (like bcc screw) may also need a shift in the slip plane. Cannot be given with shiftindex. If neither shift nor shiftindex is given then shiftindex = 0 is used.

• shiftscale (bool, optional) – If False (default), a given shift value will be taken as absolute Cartesian. If True, a given shift will be taken relative to the rotated cell’s box vectors.

• tol (float) – A cutoff tolerance used with obtaining the dislocation solution. Only needs to be changed if there are issues with obtaining a solution.

• etol (float, optional) – The energy tolerance for the structure minimization. This value is unitless. Default is 0.0.

• ftol (float, optional) – The force tolerance for the structure minimization. This value is in units of force. Default is 0.0.

• maxiter (int, optional) – The maximum number of minimization iterations to use. Default is 10000.

• maxeval (int, optional) – The maximum number of minimization evaluations to use. Default is 100000.

• dmax (float, optional) – The maximum distance in length units that any atom is allowed to relax in any direction during a single minimization iteration. Default is 0.01 Angstroms.

• annealtemp (float, optional) – The temperature to perform a dynamic relaxation at. Default is 0.0, which will skip the dynamic relaxation.

• annealsteps (int, optional) – The number of time steps to run the dynamic relaxation for. Default is None, which will run for 10000 steps if annealtemp is not 0.0.

• randomseed (int or None, optional) – Random number seed used by LAMMPS in creating velocities and with the Langevin thermostat. Default is None which will select a random int between 1 and 900000000.

• boundarywidth (float, optional) – The width of the boundary region to apply. Default value is 0.0, i.e. no boundary region. All atoms in the boundary region will have their atype values changed.

• boundaryscale (bool, optional) – If False (Default), the boundarywidth will be taken as absolute. If True, the boundarywidth will be taken relative to the magnitude of the unit cell’s a box vector.

• linear (bool, optional) – If True, then only linear displacements will be used and not the dislocation solution. Using only linear displacements is useful for screw dislocations and dislocations with large stacking fault distances. If False (default) then the dislocation solution will be used for the middle displacements and linear displacements only in the boundary region.

• cutoff (float, optional) – Cutoff distance to use for identifying duplicate atoms to remove. For dislocations with an edge component, applying the displacements creates an extra half-plane of atoms that will have (nearly) identical positions with other atoms after altering the boundary conditions. Default value is 0.5 Angstrom.

Returns

Dictionary of results consisting of keys:

• ’dumpfile_base’ (str) - The filename of the LAMMPS dump file for the relaxed base system.

• ’symbols_base’ (list of str) - The list of element-model symbols for the Potential that correspond to the base system’s atypes.

• ’dumpfile_disl’ (str) - The filename of the LAMMPS dump file for the relaxed dislocation monopole system.

• ’symbols_disl’ (list of str) - The list of element-model symbols for the Potential that correspond to the dislocation monopole system’s atypes.

• ’dislocation’ (atomman.defect.Dislocation) - The Dislocation object used to generate the monopole system.

• ’E_total_disl’ (float) - The total potential energy of the dislocation monopole system.

Return type

dict

main(*args)

Main function called when script is executed directly.

process_input(input_dict, UUID=None, build=True)

Processes str input parameters, assigns default values if needed, and generates new, more complex terms as used by the calculation.

Parameters
• input_dict (dict) – Dictionary containing the calculation input parameters with string values. The allowed keys depends on the calculation style.

• UUID (str, optional) – Unique identifier to use for the calculation instance. If not given and a ‘UUID’ key is not in input_dict, then a random UUID4 hash tag will be assigned.

• build (bool, optional) – Indicates if all complex terms are to be built. A value of False allows for default values to be assigned even if some inputs required by the calculation are incomplete. (Default is True.)