Creating nanocrystalline materials
The module asap3.setup.nanocrystalline contains a number of
functions that can help setting up a nanocrystalline material.
- asap3.setup.nanocrystalline.make_nanocrystal(size, centres, rotations, min_dist=2.0, unit=None, symbol=None, latticeconstant=None)[source]
Create a nanocrystalline sample.
Either the
unitor thesymbolparameter must be specified.- Parameters:
size (float or sequence of float) – Size of the system in Angstrom, either a single number or three numbers.
centres (numpy.ndarray) – Positions of the grains, in scaled coordinates.
rotations (numpy.ndarray) – Rotation matrices for the grains.
min_dist (float, optional) – If two atoms are closer than this distance, one of them is removed. The default is 2.0.
unit (ase.Atoms, optional) – A unit cell for building the crystals. It MUST be orthorhombic.
symbol (str or int, optional) – If
unitisNone, an FCC crystal of this element is used.latticeconstant (float, optional) – If
symbolis specified, this overrides the default lattice constant.
- Returns:
ase.Atoms – The nanocrystalline sample.
There are also a number of “helper functions” that can be used to
help creating the material, either by generating some of the arrays
that make_nanocrystal needs as input, or by post-processing the
resulting Atoms object.
- asap3.setup.nanocrystalline.bcc_grains(gridsize, perturbation=0.0)[source]
Create a grain layout based on a perturbed BCC lattice.
Creates a set of grain centers in scaled space, i.e. with coordinates between 0.0 and 1.0, based on a regular BCC lattice, possibly with a random perturbation added.
- Parameters:
- Returns:
numpy.ndarray – An N x 3 array of grain centers.
- asap3.setup.nanocrystalline.random_rotations(ngrains)[source]
Return random grain rotations for all grains.
- Parameters:
ngrains (int) – The number of grains.
- Returns:
list of numpy.ndarray – A list of 3x3 rotation matrices taken from a uniform distribution of rotations.
- asap3.setup.nanocrystalline.minimize_energy(atoms, nstep, pressure_interval=10, bulkmodulus=1400000.0)[source]
Minimize the energy of a nanocrystalline structure.
Minimizes the energy while eliminating the diagonal components of the stress. The atomic positions are optimized using the FIRE algorithm, and the stress is minimized using the Inhomogeneous_NPTBerendsen algorithm.
- Parameters:
atoms (ase.Atoms) – The atoms object to be energy-minimized.
nstep (int) – Number of time steps in the FIRE algorithm.
pressure_interval (int, optional) – How often to call the stress minimizer. The default is 10.
bulkmodulus (float, optional) – The bulk modulus, in bar, used by the stress optimizer. The default value is for Cu and is useful for all metals. The value is uncritical, but the order of magnitude should be reasonable.
- asap3.setup.nanocrystalline.plot_voronoi_cells(centers, box, show=True, cellperplot=5)[source]
Plot a Voronoi tesselation.
Plots a Voronoi tesselation (nanocrystalline grain structure) using matplotlib.
- Parameters:
centers (numpy.ndarray) – An N x 3 array of the grain centers, in real space.
box (tuple of float) – The size of the computational box. It is assumed that the centers are inside the box, or at most slightly outside.
show (bool, optional) – Set to
Falseto skip the call tomatplotlib.pyplot.show. The default isTrue.cellperplot (int, optional) – The number of Voronoi cells drawn in each figure. The default is 5.
- Returns:
figures (list) – The matplotlib Figure objects.
axes (list) – The matplotlib Axes3D objects.
- asap3.setup.nanocrystalline.evaluate_voronoi_cells(centers, box)[source]
Calculate four parameters evaluating a Voronoi tesselation.
- Parameters:
centers (numpy.ndarray) – An N x 3 array of the grain centers, in real space.
box (tuple of float) – The size of the computational box. It is assumed that the centers are inside the box, or at most slightly outside.
- Returns:
area (float) – The total interfacial area. The cell surface area is a measure of the quality/regularity of the tesselation, and should decrease if Lloyd’s algorithm is applied.
volume (float) – The total cell volume. This should be the volume of the box, and is only included as a sanity check.
maxdist (float) – The largest lateral scaled distance from a cell center to an edge. It measures how close the most critical Voronoi cell is to touching itself through the periodic boundary conditions. The value is 0.5 if a cell touches itself; lower values show how far it is from doing so.
biggrains (int) – The number of Voronoi cells touching themselves through the periodic boundary conditions.
- asap3.setup.nanocrystalline.lloyd_step(centers, box, resolution=20, alpha=1.0, verbose=True)[source]
Take a single step of Lloyd’s algorithm.
Moves the Voronoi generators towards a centroid Voronoi tesselation.
- Parameters:
centers (numpy.ndarray) – The Voronoi centers (generators), as an N x 3 array.
box (sequence of float) – Three numbers giving the size of the computational box (with periodic boundary conditions).
resolution (int, optional) – Use
2**resolutionpoints in the Monte Carlo evaluation of the centroids. The default is 20.alpha (float, optional) – Acceleration factor in Lloyd’s algorithm. Values slightly below 2 are supposedly good. The default, 1.0, gives slow convergence.
verbose (bool, optional) – Print progress information. The default is
True.
- Returns:
numpy.ndarray – The updated Voronoi centers, with the same shape as
centers.
References