Comments (4)
Hi
you have to define the hopping names first, and pass them as a string to the hoppings that you want.
The modifier should be applied in the model.
I modified you script a bit, but the part you sent was incomplete.
import pybinding as pb
from pybinding.repository.graphene import a
import matplotlib.pyplot as plt
from numpy import sqrt, pi
phi0 = 1
a_cc = a/np.sqrt(3) # nm, carbon carbon bond length
gamma = 3.033 # eV hopping energy from full solution of tight binding nearest neighbor
t1 = gamma
t2 = gamma
t3 = gamma
lat = pb.Lattice(a1=a*np.array([1/2,np.sqrt(3)/2]), a2=a*np.array([1/2,-np.sqrt(3)/2]))
lat.add_sublattices(
('A',[0, -a_cc/2], 0),
('B', [0, a_cc/2], 0)
)
lat.register_hopping_energies({'t1':t1, 't2': t2, 't3': t3})
lat.add_hoppings(
([0,0],'A','B',"t1"),
([0,1],'A','B',"t2"),
([1,0],'B','A',"t3")
)
lat.plot()
plt.show()
plt.savefig("lat.pdf")
def vectorPotential(ab, x, y):
b1Term = -(1/sqrt(3))*np.sin((2*pi*x/ab) - (2*pi*y/(ab*sqrt(3))))
b2Term = (2/sqrt(3))*np.cos(4*pi*y/(sqrt(3)*ab))
b3Term = (1/sqrt(3))*np.cos((2*pi*x/ab)+(2*pi*y/(ab*sqrt(3))))
Ax = b1Term + b2Term + b3Term
return Ax
shiftInEnergies = []
def pilarStrain(B,ab):
@pb.hopping_energy_modifier
def strained_hopping(energy, x1, y1, z1, x2, y2, z2, hop_id):
Ax = vectorPotential(ab,x1,y1)
t1_shifted = gamma*(1-(((3*pi*a_cc*B)/(2*phi0))*Ax))
t2_shifted = gamma*(1+(((3*pi*a_cc*B)/(2*phi0))*Ax))
t3_shifted = t2_shifted
xVec = x2-x1
yVec = y2-y1
energy[hop_id == 't1'] *= 1.1
if hop_id == 't1':
energy = t1_shifted
elif hop_id == 't2':
energy = t2_shifted
elif hop_id == 't3':
energy = t3_shifted
global shiftInEnergies
shiftInEnergies = energy - gamma
return energy
return strained_hopping
model = pb.Model(
lat,
pb.primitive(10, 10),
pb.translational_symmetry(10*a,10*a),
pilarStrain(1, 1)
)
plt.figure()
bz = lat.brillouin_zone()
bands = pb.solver.lapack(model).calc_wavefunction(bz[3]*0, bz[3]/100, (bz[3]+bz[4])/200, bz[3]*0, step=0.001).bands_disentangled
plt.plot(bands.k_path.as_1d(), bands.energy)
plt.gca().set_ylim([-.5, .5])
plt.show()
plt.savefig("band.pdf")
from pybinding.
Thanks that now works and it modifies all the energies, I thought I needed to name after as the hoppings didn't exist yet. The only problem now is when running the example you added it gives an error 'Solver' object has no attribute 'calc_wavefunction'?
from pybinding.
Dean hasn't yet given me write permissions to pybinding, it's a new feature to disentangle large bands. It is also possible to do a calculation on a larger system with ARPACK and disentangling the bands to see if you have a crossing or not at an intersection of two bands.
You can install the new version with the following commands:
pip uninstall pybinding
pip install -i https://test.pypi.org/simple/ pybinding
Due to recent changes in Matplotlib, there is a possibility that you encounter an error when plotting certain things. This will be solved in a new release of Matplotlib.
from pybinding.
Ah ok then, worked fine with new version thanks for the help, disintangling bands will be a great help as I will be using some fairly large superlattices
from pybinding.
Related Issues (20)
- Bug in KPM method HOT 1
- (removed)
- The calc_conductivity in KPM takes in temperature as a number in the input variables
- Obtaining Atomic Basis Sets for Materials in Source Code HOT 2
- Small question about heatmap-plot of the eigenvalue. HOT 2
- can not install on windows HOT 5
- Addition of Hermitian conjugate HOT 1
- how to use Polygon.contains ? HOT 4
- installation with pip fails HOT 4
- pybinding returns an error for a 1D lattice defined by the book (literally) HOT 1
- Non-hermitian matrix HOT 2
- Pip installation fails on windows HOT 3
- ERROR: Failed building wheel for pybinding HOT 2
- pybinding can not run on MAC with M3 chip. HOT 4
- calculation of band structure in the presence of magnetic field HOT 2
- Translational symmetry with generator defined hoppings HOT 1
- Is it possible to write the Hamiltonian into wannier90 format? HOT 3
- Difficulty installing locally (windows 11 & wsl) HOT 3
- What does `translational_symmetry` actually perform? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pybinding.