Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
K
kwant
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Joseph Weston
kwant
Commits
1d8db7bb
Commit
1d8db7bb
authored
5 years ago
by
Joseph Weston
Browse files
Options
Downloads
Patches
Plain Diff
add whatsnew entry for vectorized systems
parent
cd2750c1
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#24113
passed with warnings
5 years ago
Stage: build-env
Stage: build
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
doc/source/pre/whatsnew/1.5.rst
+34
-0
34 additions, 0 deletions
doc/source/pre/whatsnew/1.5.rst
with
34 additions
and
0 deletions
doc/source/pre/whatsnew/1.5.rst
+
34
−
0
View file @
1d8db7bb
...
...
@@ -3,6 +3,40 @@ What's new in Kwant 1.5
This article explains the user-visible changes in Kwant 1.5.0.
Value functions may now be vectorized
-------------------------------------
It is now possible to define value functions that act on whole
arrays of sites at a time.
::
def onsite(sites):
r = sites.positions()
return np.exp(-np.linalg.norm(r, axis=1)**2)
def hopping(to_sites, from_sites):
dr = to_sites.positions() - from_sites.positions()
return 1 / np.linalg.norm(dr, axis=1)**2
lat = kwant.lattice.square(norbs=1)
syst = kwant.Builder(vectorize=True)
syst[(lat(i, j) for i in range(4) for j in range(10)] = onsite
syst[lat.neighbors()] = hopping
syst = syst.finalized()
syst.hamiltonian_submatrix()
Notice that when creating the Builder we provide the ``vectorize=True`` flag,
and that the value functions now take `~kwant.system.SiteArray` objects
(which have a ``positions`` method, rather than a ``pos`` property as for
`~kwant.system.Site`). We can now operate on the array of site positions
using ``numpy``. Using vectorized value functions in this way can produce an
order of magnitude speedup when evaluating system Hamiltonians (though this
speedup may be masked by other parts of your computation e.g. calculating
the scattering matrix).
Deprecation of leaving 'norbs' unset for site families
------------------------------------------------------
When constructing site families (e.g. lattices) it is now deprecated to
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment