SDVPN

class atomman.defect.SDVPN(volterra: Optional[VolterraDislocation] = None, gamma: Optional[GammaSurface] = None, model: Optional[Union[str, IOBase, DataModelDict]] = None, tau: Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray] = array([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]), alpha: float = 0.0, beta: Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray] = array([[0.0, 0.0, 0.0], [0.0, 0.0, 0.0], [0.0, 0.0, 0.0]]), cutofflongrange: Optional[float] = None, fullstress: bool = True, cdiffelastic: bool = False, cdiffsurface: bool = True, cdiffstress: bool = False, min_method: str = 'Powell', min_kwargs: Optional[dict] = None, min_options: Optional[dict] = None)

Bases: object

Class representation of the semidiscrete variational Peierls-Nabarro dislocation model.

E_gsf_surface_plot(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, fmt: str = 'ro-', normalize: Optional[bool] = False, smooth: bool = True, a1vect: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, a2vect: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, xvect: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, length_unit: str = 'Å', energyperarea_unit: str = 'eV/Å^2', numx: int = 100, numy: int = 100, figsize: Optional[tuple] = None, **kwargs) figure

Extends the GammaSurface.E_gsf_surface_plot() method to plot the disregistry path on top of it.

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates. If x or disregistry are not set/given, then the disregistry path will not be added.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values. If x or disregistry are not set/given, then the disregistry path will not be added.

  • fmt (str, optional) – The matplotlib.pyplot.plot fmt parameter for the disregistry path line, i.e. color, marker and line style options. Default value is ‘ro-’: red with circle markers and solid line.

  • normalize (bool, optional) – Flag indicating if axes are Cartesian (False, default) or normalized by a1, a2 vectors (True).

  • smooth (bool, optional) – If True (default), then plot shows smooth interpolated values. If False, plot shows nearest raw data values.

  • a1vect (array-like object, optional) – Crystal vector for the a1 vector to use for plotting. Default value of None uses the saved a1vect.

  • a2vect (array-like object, optional) – Crystal vector for the a2 vector to use for plotting. Default value of None uses the saved a2vect.

  • xvect (array-like object, optional) – Crystal vector to align with the plotting x-axis for non-normalized plots. If not given, this is taken as the Cartesian of a1vect.

  • length_unit (str, optional) – The unit of length to display non-normalized axes values in. Default value is ‘Å’.

  • energyperarea_unit (str, optional) – The unit of energy per area to display the stacking fault energies in. Default value is ‘eV/Å^2’.

  • numx (int, optional) – The number of plotting points to use along the x-axis. Default value is 100.

  • numy (int, optional) – The number of plotting points to use along the y-axis. Default value is 100.

  • figsize (tuple or None, optional) – The figure’s x,y dimensions. If None (default), the values are scaled such that the x,y spacings are approximately equal, and the larger of the two values is set to 10.

  • **kwargs (dict, optional) – Additional keywords are passed into the underlying matplotlib.pyplot.pcolormesh(). This allows control of such things like the colormap (cmap).

Returns:

The generated figure allowing users to perform additional modifications.

Return type:

matplotlib.pyplot.figure

E_gsf_vs_x_plot(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, figsize: Optional[tuple] = None, length_unit: str = 'Å', energyperarea_unit: str = 'eV/Å^2') figure

Generates a plot of the stacking fault energy, i.e. misfit energy, associated with the disregistry values for each x coordinate.

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates. If x or disregistry are not set/given, then the disregistry path will not be added.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values. If x or disregistry are not set/given, then the disregistry path will not be added.

  • figsize (tuple or None, optional) – The figure’s x,y dimensions. If None (default), then a figure size of (10, 6) will be generated.

  • length_unit (str, optional) – The unit of length to display x coordinates in. Default value is ‘Å’.

  • energyperarea_unit (str, optional) – The unit of energy per area to display the stacking fault energies in. Default value is ‘eV/Å^2’.

Returns:

The generated figure allowing users to perform additional modifications.

Return type:

matplotlib.pyplot.figure

property K_tensor: ndarray

Dislocation energy coefficient tensor.

Type:

numpy.ndarray

property alpha: tuple

Coefficients for nonlocal energy correction.

Type:

tuple of float

property beta: ndarray

3x3 coefficients for gradient energy correction.

Type:

numpy.ndarray

property burgers: ndarray

Burgers vector.

Type:

numpy.ndarray

property cdiffelastic: bool

Flag indicating if elastic energy used central difference for computing the dislocation density.

Type:

bool

property cdiffstress: bool

Flag indicating if stress energy used central difference for computing the dislocation density.

Type:

bool

property cdiffsurface: bool

Flag indicating if surface energy used central difference for computing the dislocation density.

Type:

bool

check_energies(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, energyperlength_unit: str = 'eV/Å')

Prints a summary string of all computed energy components.

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values.

  • energyperlength_unit (str, optional) – The units of energy per length to report the dislocation line energies in. Default value is ‘eV/Å’.

property cutofflongrange: float

Cutoff distance for long-range elastic energy.

Type:

float

disldensity(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, cdiff: bool = False) Tuple[ndarray, ndarray]

Computes the dislocation density as the numerical derivative of disregistry with respect to x. Uses either neighboring values

ρ[i] = (δ[i] - δ[i-1]) / (x[i] - x[i-1])

or central difference

ρ[i] = (δ[i+1] - δ[i-1]) / (x[i+1] - x[i-1])

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values.

  • cdiff (bool, optional) – Flag indicating how to compute the derivative. A value of False (default) compares nearest values while a value of True compares next-nearest (i.e., central difference).

Returns:

  • newx (numpy.array) – The x positions corresponding to the dislocation density values.

  • rho (numpy.array) – The computed dislocation density.

property disregistry: ndarray

The disregistry vector for each x coordinate.

Type:

numpy.ndarray

disregistry_plot(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, figsize: Optional[tuple] = None, length_unit: str = 'Å') figure

Creates a simple matplotlib figure showing the disregistry profiles.

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values.

  • figsize (tuple, optional) – matplotlib figure figsize parameter. Default value is (10, 6).

  • length_unit (str, optional) – The unit of length to display positions and disregistry values in. Default value is ‘Å’.

Returns:

The generated figure allowing users to perform additional modifications.

Return type:

matplotlib.pyplot.figure

elastic_energy(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None) float

Computes the short-range configuration-dependent elastic energy term for the dislocation based on the dislocation density and K_tensor.

E_elastic = 1/(4π) Σ_i Σ_j χ(i,j,Δx) K_lm ρ_l[i] ρ_m[j]

χ(i,j,Δx) = (3/2) Δx² + ψ(i-1,j-1,Δx) + ψ(i,j,Δx) - ψ(i,j-1,Δx) - ψ(j,i-1,Δx)

ψ(i,j,Δx) = (1/2) (i-j)² Δx² ln(|i-j|Δx)

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values.

Returns:

The elastic energy for the dislocation.

Return type:

float

property fullstress: bool

Flag indicating which stress algorithm was used.

Type:

bool

property gamma: GammaSurface

The stacking fault map.

Type:

atomman.defect.GammaSurface

load(model: Union[str, IOBase, DataModelDict], gamma: Optional[GammaSurface] = None)

Load solution from a data model.

Parameters:
  • model (str, file-like object or DataModelDict) – The semi-discrete-Peierls-Nabarro data model to load.

  • gamma (atomman.defect.GammaSurface, optional) – The gamma surface to use. If not given, will check to see if the content is inside model.

Raises:

ValueError – If the gamma surface information is not given and it is not found in model.

longrange_energy() float

Computes the long-range elastic energy term for the dislocation using the K_tensor, Burgers vector and long-range cutoff. This term is configuration-independent and thus the method takes no parameters.

E_longrange = 1/(2π) K_lm b_l b_m ln(L)

Returns:

The long-range energy for the dislocation.

Return type:

float

property min_kwargs: dict

scipy.optimize.minimize keywords used.

Type:

dict

property min_method: str

scipy.optimize.minimize method used.

Type:

str

property min_options: dict

scipy.optimize.minimize options used.

Type:

dict

misfit_energy(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None) float

Computes the misfit energy for the disregistry using the stored gamma surface

E_misfit = Σ γ(δ)Δx

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values.

Returns:

The misfit energy for the dislocation.

Return type:

float

model(length_unit: str = 'Å', energyperarea_unit: str = 'eV/Å^2', pressure_unit: str = 'GPa', include_gamma: bool = False) DataModelDict

Generate a data model for the object.

Parameters:
  • length_unit (str, optional) – The unit of length to save values as. Default is ‘Å’.

  • energyperarea_unit (str, optional) – The unit of energy per area to save fault energy values as. Only used if the gamma surface information is included. Default value is ‘eV/Å^2’.

  • pressure_unit (str, optional) – The unit of pressure to save values as. Default is ‘GPa’.

  • include_gamma (bool, optional) – Flag indicating if the gamma surface data is to be included. Default value is False.

Returns:

The data model containing all input parameters and the current disregistry vectors.

Return type:

DataModelDict

nonlocal_energy(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None) float

Computes the nonlocal energy correction using alpha coefficient(s).

E_nonlocal = Σ_m α_m Σ_i δ[i] (δ[i] - (δ[i+m] + δ[i-m]) / 2) Δx

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values.

Returns:

The nonlocal energy for the dislocation.

Return type:

float

property res: OptimizeResult

scipy.optimize.minimize result.

Type:

OptimizeResult

solve(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, tau: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, alpha: Optional[list] = None, beta: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, cutofflongrange: Optional[float] = None, fullstress: Optional[bool] = None, cdiffelastic: Optional[bool] = None, cdiffsurface: Optional[bool] = None, cdiffstress: Optional[bool] = None, min_method: Optional[str] = None, min_kwargs: Optional[dict] = None, min_options: Optional[dict] = None)

Solves the semidiscrete variational Peierls-Nabarro dislocation disregistry through energy minimization using the set class properties. All parameters are optional keyword arguments that can be used to change any of the previous settings.

Parameters:
  • x (numpy.ndarray, optional) – An array of shape (N) giving the x coordinates corresponding to the disregistry solution.

  • disregistry (numpy.ndarray, optional) – A (N,3) array giving the initial disregistry vector guess at each x coordinate.

  • tau (numpy.ndarray, optional) – A (3,3) array giving the stress tensor to apply to the system using the stress energy term. Only the xy, yy, and yz components are used.

  • alpha (list of float, optional) – The alpha coefficient(s) used by the nonlocal energy term.

  • beta (numpy.ndarray, optional) – The (3,3) array of beta coefficient(s) used by the surface energy term.

  • cutofflongrange (float, optional) – The cutoff distance to use for computing the long-range energy.

  • fullstress (bool, optional) – Flag indicating which stress energy algorithm to use.

  • cdiffelastic (bool, optional) – Flag indicating if the dislocation density for the elastic energy component is computed with central difference (True) or simply neighboring values (False).

  • cdiffsurface (bool, optional) – Flag indicating if the dislocation density for the surface energy component is computed with central difference (True) or simply neighboring values (False).

  • cdiffstress (bool, optional) – Flag indicating if the dislocation density for the stress energy component is computed with central difference (True) or simply neighboring values (False). Only matters if fullstress is True.

  • min_method (str, optional) – The scipy.optimize.minimize method to use.

  • min_kwargs (dict, optional) – Any keyword arguments to pass on to scipy.optimize.minimize besides the coordinates, method and options.

  • min_options (dict, optional) – Any options to pass on to scipy.optimize.minimize.

stress_energy(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None) float

Computes the stress energy due to the applied stress, tau. If fullstress is True, the original stress expression by Bulatov and Kaxiras will be used:

E_stress = -1/2 Σ_i (x[i]² - x[i-1]²) ρ_l τ_2l

If fullstress is False, the alternate stress expression by Shen and Cheng 10.1016/j.scriptamat.2009.04.047 will be used:

E_stress = -1/2 Σ_i τ_2l (δ_l[i] + δ_l[i+1]) Δx

Note that the Shen and Cheng expression will have a constant error associated with it giving an incorrect overall energy, but should apply a similar force on the dislocation.

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values.

Returns:

The stress energy for the dislocation.

Return type:

float

surface_energy(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None) float

Computes the gradient surface energy correction using beta coefficients.

E_surface = Σ_j β_lj / 4 Σ_i ρ_l[i]² Δx

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values.

Returns:

The surface energy for the dislocation.

Return type:

float

property tau: ndarray

The applied 3x3 stress tensor.

Type:

numpy.ndarray

total_energy(x: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None, disregistry: Optional[Union[int, float, complex, str, bytes, generic, Sequence[Union[int, float, complex, str, bytes, generic]], Sequence[Sequence[Any]], _SupportsArray]] = None) float

Computes the total energy for the dislocation.

E_total = E_elastic + E_misfit + E_stress + E_surface + E_nonlocal

Parameters:
  • x (array-like object, optional) – x-coordinates. Default value is the stored x-coordinates.

  • disregistry (array-like object, optional) – (N, 3) shaped array of disregistry vectors at each x-coordinate. Default value is the stored disregistry values.

Returns:

The total energy for the dislocation.

Return type:

float

property transform: ndarray

Transformation matrix from standard crystal setting to dislocation solution setting.

Type:

numpy.ndarray

property x: ndarray

The x coordinates.

Type:

numpy.ndarray