site_position_modifier¶
-
site_position_modifier
()¶ Modify the position of lattice sites, e.g. to apply geometric deformations
Notes
The function parameters must be a combination of any number of the following:
- x, y, z : ndarray
- Lattice site position.
- sub_id : ndarray of int
- Sublattice identifier: can be checked for equality with sublattice names
specified in
Lattice
. For example,x[sub_id == 'A'] += 0.1
will only displace sites on sublattice A. - sites :
Sites
- Helper object. Can be used instead of
x, y, z, sub_id
. SeeSites
.
The function must return:
- tuple of ndarray
- Modified ‘x, y, z’ arguments or 3
ndarray
objects of the same dtype and shape.
Examples
def triaxial_displacement(c): @pb.site_position_modifier def displacement(x, y, z): ux = 2*c * x*y uy = c * (x**2 - y**2) return x + ux, y + uy, z return displacement model = pb.Model( ... # lattice, shape, etc. triaxial_displacement(c=0.15) )