lattpy
Package for modeling Bravais lattices and finite lattice structures.
Submodules
Objects for representing atoms and the unitcell of a lattice. |
|
Basis object for defining the coordinate system and unit cell of a lattice. |
|
This module contains objects for low-level representation of lattice systems. |
|
Tools for dispersion computation and plotting. |
|
This module contains the main Lattice object. |
|
Objects for representing the shape of a finite lattice. |
|
Spatial algorithms and data structures. |
|
Lattice structure object for defining the atom basis and neighbor connections. |
|
Contains miscellaneous utility methods. |
- lattpy.simple_chain(a=1.0, atom=None, neighbors=1)[source]
Creates a 1D lattice with one atom at the origin of the unit cell.
- Parameters
- afloat, optional
The lattice constant (length of the basis-vector).
- atomstr or Atom, optional
The atom to add to the lattice. If a string is passed, a new
Atom
instance is created.- neighborsint, optional
The number of neighbor-distance levels, e.g. setting to 1 means only nearest neighbors. The default is nearest neighbors (1).
- Returns
- lattLattice
The configured lattice instance.
Examples
>>> import matplotlib.pyplot as plt >>> latt = lp.simple_chain() >>> latt.plot_cell() >>> plt.show()
- lattpy.alternating_chain(a=1.0, atom1=None, atom2=None, x0=0.0, neighbors=1)[source]
Creates a 1D lattice with two atoms in the unit cell.
- Parameters
- afloat, optional
The lattice constant (length of the basis-vector).
- atom1str or Atom, optional
The first atom to add to the lattice. If a string is passed, a new
Atom
instance is created.- atom2str or Atom, optional
The second atom to add to the lattice. If a string is passed, a new
Atom
instance is created.- x0float, optional
The offset of the atom positions in x-direction.
- neighborsint, optional
The number of neighbor-distance levels, e.g. setting to 1 means only nearest neighbors. The default is nearest neighbors (1).
- Returns
- lattLattice
The configured lattice instance.
Examples
>>> import matplotlib.pyplot as plt >>> latt = lp.alternating_chain() >>> latt.plot_cell() >>> plt.show()
- lattpy.simple_square(a=1.0, atom=None, neighbors=1)[source]
Creates a square lattice with one atom at the origin of the unit cell.
- Parameters
- afloat, optional
The lattice constant (length of the basis-vector).
- atomstr or Atom, optional
The atom to add to the lattice. If a string is passed, a new
Atom
instance is created.- neighborsint, optional
The number of neighbor-distance levels, e.g. setting to 1 means only nearest neighbors. The default is nearest neighbors (1).
- Returns
- lattLattice
The configured lattice instance.
Examples
>>> import matplotlib.pyplot as plt >>> latt = lp.simple_square() >>> latt.plot_cell() >>> plt.show()
- lattpy.simple_rectangular(a1=1.5, a2=1.0, atom=None, neighbors=2)[source]
Creates a rectangular lattice with one atom at the origin of the unit cell.
- Parameters
- a1float, optional
The lattice constant in the x-direction.
- a2float, optional
The lattice constant in the y-direction.
- atomstr or Atom, optional
The atom to add to the lattice. If a string is passed, a new
Atom
instance is created.- neighborsint, optional
The number of neighbor-distance levels, e.g. setting to 1 means only nearest neighbors. The default is nearest neighbors (2).
- Returns
- lattLattice
The configured lattice instance.
Examples
>>> import matplotlib.pyplot as plt >>> latt = lp.simple_rectangular() >>> latt.plot_cell() >>> plt.show()
- lattpy.simple_hexagonal(a=1.0, atom=None, neighbors=1)[source]
Creates a hexagonal lattice with one atom at the origin of the unit cell.
- Parameters
- afloat, optional
The lattice constant (length of the basis-vector).
- atomstr or Atom, optional
The atom to add to the lattice. If a string is passed, a new
Atom
instance is created.- neighborsint, optional
The number of neighbor-distance levels, e.g. setting to 1 means only nearest neighbors. The default is nearest neighbors (1).
- Returns
- lattLattice
The configured lattice instance.
Examples
>>> import matplotlib.pyplot as plt >>> latt = lp.simple_hexagonal() >>> latt.plot_cell() >>> plt.show()
- lattpy.honeycomb(a=1.0, atom=None)[source]
Creates a honeycomb lattice with two identical atoms in the unit cell.
- Parameters
- afloat, optional
The lattice constant (length of the basis-vector).
- atomstr or Atom, optional
The atom to add to the lattice. If a string is passed, a new
Atom
instance is created.
- Returns
- lattLattice
The configured lattice instance.
Examples
>>> import matplotlib.pyplot as plt >>> latt = lp.honeycomb() >>> latt.plot_cell() >>> plt.show()
- lattpy.graphene(a=1.0)[source]
Creates a hexagonal lattice with two atoms in the unit cell.
- Parameters
- afloat, optional
The lattice constant (length of the basis-vectors).
- Returns
- lattLattice
The configured lattice instance.
Examples
>>> import matplotlib.pyplot as plt >>> latt = lp.graphene() >>> latt.plot_cell() >>> plt.show()
- lattpy.simple_cubic(a=1.0, atom=None, neighbors=1)[source]
Creates a cubic lattice with one atom at the origin of the unit cell.
- Parameters
- afloat, optional
The lattice constant (length of the basis-vector).
- atomstr or Atom, optional
The atom to add to the lattice. If a string is passed, a new
Atom
instance is created.- neighborsint, optional
The number of neighbor-distance levels, e.g. setting to 1 means only nearest neighbors. The default is nearest neighbors (1).
- Returns
- lattLattice
The configured lattice instance.
Examples
>>> import matplotlib.pyplot as plt >>> latt = lp.simple_cubic() >>> latt.plot_cell() >>> plt.show()
- lattpy.nacl_structure(a=1.0, atom1='Na', atom2='Cl', neighbors=1)[source]
Creates a NaCl lattice structure.
- Parameters
- afloat, optional
The lattice constant (length of the basis-vector).
- atom1str or Atom, optional
The first atom to add to the lattice. If a string is passed, a new
Atom
instance is created. The default name is Na.- atom2str or Atom, optional
The second atom to add to the lattice. If a string is passed, a new
Atom
instance is created.. The default name is Cl.- neighborsint, optional
The number of neighbor-distance levels, e.g. setting to 1 means only nearest neighbors. The default is nearest neighbors (1).
- Returns
- lattLattice
The configured lattice instance.
Examples
>>> import matplotlib.pyplot as plt >>> latt = lp.nacl_structure() >>> latt.plot_cell() >>> plt.show()
- lattpy.finite_hypercubic(s, a=1.0, atom=None, neighbors=1, primitive=True, periodic=None)[source]
Creates a d-dimensional finite lattice model with one atom in the unit cell.
- Parameters
- sfloat or Sequence[float] or AbstractShape
The shape of the finite lattice. This also defines the dimensionality.
- afloat, optional
The lattice constant (length of the basis-vectors).
- atomstr or Atom, optional
The atom to add to the lattice. If a string is passed, a new
Atom
instance is created.- neighborsint, optional
The number of neighbor-distance levels, e.g. setting to 1 means only nearest neighbors. The default is nearest neighbors (1).
- primitivebool, optional
If True the shape will be multiplied by the cell size of the model. The default is True.
- periodicbool or int or (N, ) array_like
One or multiple axises to apply the periodic boundary conditions. If the axis is
None
no perodic boundary conditions will be set.
- Returns
- lattLattice
The configured lattice instance.
Examples
Simple chain:
>>> import matplotlib.pyplot as plt >>> latt = lp.finite_hypercubic(4) >>> latt.plot() >>> plt.show()
Simple square:
>>> import matplotlib.pyplot as plt >>> latt = lp.finite_hypercubic((4, 2)) >>> latt.plot() >>> plt.show()