Comments (2)
Hi @empyriumz,
It's possible. Like with any function-dependent onsite or hopping energy in pybinding, you just need a modifier function:
import pybinding as pb
import numpy as np
def chain_lattice(d):
lat = pb.Lattice(a1=[d])
lat.add_sublattices(("A", [0]))
lat.add_hoppings(([1], "A", "A", 1.0))
return lat
def random_hopping(mu):
@pb.hopping_energy_modifier
def func(energy):
return np.random.normal(mu, 1, size=energy.size) # size is required
return func
model = pb.Model(
chain_lattice(d=0.1),
pb.primitive(a1=6),
random_hopping(mu=0)
)
The model creation process in pybinding is a bit different than kwant. In pybinding, the initial unit cell is created as a constant (usually this represents the pristine material). Any functions which need to be applied to multiple unit cells are introduced using modifiers (which act on the pristine material).
Note that the size
argument was given to np.random.normal
so that it returns an array of random numbers instead of just a single one. This is because the modifier functions in pybinding are applied to all sites/hoppings at the same time (as numpy array operations), as opposed to kwant which applies one site/hopping at a time.
See this tutorial page for more information about modifier functions: http://docs.pybinding.site/en/stable/tutorial/fields.html
from pybinding.
Hi @dean0x7d,
Great it works! Thx a lot.
from pybinding.
Related Issues (20)
- Problem with attaching leads to bilayer graphene HOT 3
- Fermi surface plotting HOT 2
- Divacancy in random HOT 2
- Random Disorder in multiorbital model HOT 1
- update PyBind11-version
- 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
- Modifying specific hoppings 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.