pythtb.WFArray.solve_model#
- WFArray.solve_model(model, use_tensorflow=False)[source]#
Diagonalizes
modelon every point of the internalMesh.The method calls
TBModel.solve_ham()passing the k-points and model parameters defined in theMeshand populates theWFArraywith the eigenstates and eigenergies of the Hamiltonian.Note
For meshes that include \(\lambda\)-axes, the axis names are interpreted as
TBModelparameter names. The names and values along each \(\lambda\)-axis are passed as keyword arguments toTBModel.solve_ham(). These parameter names must match those used in the model definition when usingTBModel.set_onsite()andTBModel.set_hop().Added in version 2.0.0: Replaces
solve_on_one_point()andsolve_on_grid().- Parameters:
- model
TBModel The tight-binding model to diagonalize on the mesh. Its
Latticeand the samespinfulconfiguration must match those of theWFArray.- use_tensorflowbool, optional
If True, uses TensorFlow for diagonalization. This can be beneficial for large systems where GPU acceleration is available. This requires TensorFlow to be installed. Default is False.
- model
Notes
The samples along each \(\lambda\)-axis are obtained from
Mesh.get_axis_range()and passed toTBModel.solve_ham()as keyword arguments, so it is essential that the mesh axis names exactly match the symbolic/callable parameter names in the model.Eigenstates stored by
solve_modelare chosen to obey a periodic gauge \(\psi_{n,{\bf k+G}}=\psi_{n {\bf k}}\), so the cell-periodic states satisfy \(u_{n,{\bf k_0+G}}=e^{-i{\bf G}\cdot{\bf r}} u_{n {\bf k_0}}\). See Formalism section 4.4 and equation 4.18 for more detail.If the mesh includes Brillouin zone boundary points along any k-axis, or a looping axis is marked as both Brillouin zone winding and closed,
solve_modelapplies the periodic-gauge phase to the states along that axis.
Examples
Say we have a parametric model function defined as follows:
>>> model = TBModel(lattice=lat, spinful=False) >>> model.set_onsite(['param_1'], mode='set')
The model will be 2D in k-space for this example. We want to vary
param_1, and store the energy eigenvalues and eigenstates on a 3D mesh: 2 dimensions in k-space and 1 dimension for the parameterparam_1. This means we will have aMeshwith 2 k-axes and 1 lambda-axis corresponding toparam_1. We can create the mesh as follows:>>> mesh = Mesh( ... dim_k=2, ... dim_lambda=1, ... axis_types=['k','k','l'], ... axis_names=['k1', 'k2', 'param_1'] ... )
Note that we must name the last axis as
param_1to follow the name we set in the model function. We build the mesh values by usingbuild_grid. We will construct a uniform 2D grid in k-space of shape(20, 20)and a uniform 1D grid forparam_1with 5 points going from 0 to \(2\pi\).>>> mesh.build_grid(shape=(20, 20, 5), lambda_start=0, lambda_end=2*np.pi)
To initialize the WFArray, we specify the same lattice as the model, and the mesh we just created. If the model were spinful, we would need to set
spinful=True.>>> wfa = WFArray(model.lattice, mesh)
Now, the parameter values are stored in the mesh, and we can diagonalize the model on the mesh using
solve_model():>>> wfa.solve(model=model)
The eigenvalues and eigenstates are stored in the
.energiesand.wfsattributes, respectively. They can be accessed as follows:>>> wfa.energies.shape (20, 20, 5, 2) >>> wfa.wfs.shape (20, 20, 5, 2, 2)