Browse code

add whatsnew entry

Joseph Weston authored on 26/11/2019 11:10:10
Showing 1 changed files
... ...
@@ -4,8 +4,8 @@ What's new in Kwant 1.5
4 4
 This article explains the user-visible changes in Kwant 1.5.0.
5 5
 
6 6
 
7
-Value functions may now be vectorized
7
+Kwant supports vectorized value functions
8
+-----------------------------------------
8 9
 It is now possible to define value functions that act on whole
9 10
 arrays of sites at a time.
10 11
 ::
... ...
@@ -36,6 +36,19 @@ order of magnitude speedup when evaluating system Hamiltonians (though this
36 36
 speedup may be masked by other parts of your computation e.g. calculating
37 37
 the scattering matrix).
38 38
 
39
+Similarly, the ``onsite`` passed to an operator may now be vectorized in the same
40
+way, as long as the system passed to the operator is also vectorized:
41
+::
42
+
43
+    def x_onsite(sites):
44
+        x, _ = sites.positions().transpose()
45
+        return x
46
+
47
+    x_position = kwant.operator.Density(syst, x_onsite)
48
+
49
+    psi = kwant.wave_function(syst, energy=0.1)(0)[0]
50
+    x_position(psi)
51
+
39 52
 
40 53
 Deprecation of leaving 'norbs' unset for site families
41 54
 ------------------------------------------------------